sw/source/core/layout/paintfrm.cxx |    9 +++++++++
 sw/source/core/layout/tabfrm.cxx   |   13 ++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit 7238912cc94fa2e4812a06b05f84a663d42eb0cf
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Aug 22 11:20:27 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu Aug 22 16:40:13 2024 +0200

    sw: layout: allow table in hidden section to move back
    
    The problem is that a SwTabFrame in a hidden section will never MoveBwd
    because its height is always set to 1 erroneously in
    SwTabFrame::Format() due to some border or so, and thus it doesn't fit.
    
    So prevent Format() from being called by disabling invalidations.
    
    (regression from commit ff7f1b59e22092d8548459e75fe912db852f056f)
    
    Change-Id: I25232b31b22b98c852c2f28eefff34f51e088eda
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172251
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit 20b8f3922a374378cef7b87ee30cde2ae1d6264e)

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 214932b173f2..cc1a6c7634ba 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2105,7 +2105,8 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
         }
     }
 
-    if (IsHiddenNow())
+    bool const isHiddenNow(IsHiddenNow());
+    if (isHiddenNow)
         MakeValidZeroHeight();
 
     int nUnSplitted = 5; // Just another loop control :-(
@@ -2141,7 +2142,10 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
                         pLayout->GetBrowseWidthByTabFrame( *this ) );
                 }
 
-                setFramePrintAreaValid(false);
+                if (!isHiddenNow)
+                {
+                    setFramePrintAreaValid(false);
+                }
                 aNotify.SetLowersComplete( false );
             }
             SwFrame *pPre;
@@ -2242,7 +2246,10 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
                                 pHTMLLayout->GetBrowseWidthByTabFrame( *this ) 
);
                         }
 
-                        setFramePrintAreaValid(false);
+                        if (!isHiddenNow)
+                        {
+                            setFramePrintAreaValid(false);
+                        }
 
                         if (!pAccess)
                         {
commit a8516b3ea16fb810f8796bd4c277f3aed8bd6a31
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Aug 22 12:45:22 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu Aug 22 16:40:13 2024 +0200

    sw: do not paint hidden frames
    
    Table frames in hidden sections may still paint their border lines.
    
    Check that the height (or width, if vertical) is not 0 before painting.
    
    (regression from commit ff7f1b59e22092d8548459e75fe912db852f056f)
    
    Change-Id: I6ace6d6608d5e23ff2f3c5a61d37e3f6da958977
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172250
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 13495926390ba54fbcd45ec00fbe613b1f2b734b)

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 60b25866d073..ff0fb7db6e79 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3329,6 +3329,11 @@ SwShortCut::SwShortCut( const SwFrame& rFrame, const 
SwRect& rRect )
 
 void SwLayoutFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, SwPrintData const*const) const
 {
+    if (!getFramePrintArea().HasArea())
+    {
+        return; // do not paint hidden frame
+    }
+
     // #i16816# tagged pdf support
     Frame_Info aFrameInfo( *this );
     SwTaggedPDFHelper aTaggedPDFHelper( nullptr, &aFrameInfo, nullptr, 
rRenderContext );
@@ -4142,6 +4147,10 @@ void SwFlyFrame::PaintDecorators() const
 
 void SwTabFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, SwPrintData const*const) const
 {
+    if (!getFramePrintArea().HasArea())
+    {
+        return; // do not paint hidden frame
+    }
     const SwViewOption* pViewOption = gProp.pSGlobalShell->GetViewOptions();
     if (pViewOption->IsTable())
     {

Reply via email to