sw/source/core/layout/paintfrm.cxx |    9 +++++++++
 sw/source/core/layout/tabfrm.cxx   |   13 ++++++++++---
 sw/source/core/text/itradj.cxx     |   17 +++++++++++++++++
 3 files changed, 36 insertions(+), 3 deletions(-)

New commits:
commit b5ba5e0ed89c6ce5d9382509babc2956649b1042
Author:     László Németh <[email protected]>
AuthorDate: Wed Aug 21 23:14:22 2024 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Sat Aug 24 10:49:22 2024 +0200

    tdf#162109 sw smart justify: fix overhanging last line
    
    Last line of justified paragraphs is excluded from justification
    normally, but not in the case, where it fits only with shrinking
    spaces. This line was overhanging because of the missing
    justification and space shrinking.
    
    Regression from commit 17eaebee279772b6062ae3448012133897fc71bb
    "tdf#119908 sw smart justify: fix justification by shrinking".
    
    Change-Id: I83ac8562b46999d7fd676d737bed0b9c141a89b4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172228
    Tested-by: Jenkins
    Reviewed-by: László Németh <[email protected]>
    (cherry picked from commit 6b857398a59d16308d6185d01e003e401439f060)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172195
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index 4dcaf03df1f8..d889f49a8051 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -47,6 +47,23 @@ void SwTextAdjuster::FormatBlock( )
     bool bSkip = !IsLastBlock() &&
         m_nStart + m_pCurr->GetLen() >= 
TextFrameIndex(GetInfo().GetText().getLength());
 
+    // tdf#162109 if the last line is longer, than the paragraph width,
+    // it contains shrinking spaces: don't skip block format here
+    if( bSkip )
+    {
+        // sum width of the text portions to calculate the line width without 
shrinking
+        tools::Long nBreakWidth = 0;
+        const SwLinePortion *pPos = m_pCurr->GetNextPortion();
+        while( pPos && bSkip )
+        {
+            if( !pPos->InGlueGrp() )
+                nBreakWidth += pPos->Width();
+            if( nBreakWidth > m_pCurr->Width() )
+                bSkip = false;
+            pPos = pPos->GetNextPortion();
+        }
+    }
+
     // Multi-line fields are tricky, because we need to check whether there are
     // any other text portions in the paragraph.
     if( bSkip )
commit e63cb1b0ca43bc223512c66fff531d00b5ec3316
Author:     Michael Stahl <[email protected]>
AuthorDate: Thu Aug 22 12:45:22 2024 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Sat Aug 24 10:49:22 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 <[email protected]>
    (cherry picked from commit 13495926390ba54fbcd45ec00fbe613b1f2b734b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172200
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 60edc56aafb5..d7d110de57e5 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3703,6 +3703,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, false);
     SwTaggedPDFHelper aTaggedPDFHelper( nullptr, &aFrameInfo, nullptr, 
rRenderContext );
@@ -4643,6 +4648,10 @@ void SwTextFrame::PaintOutlineContentVisibilityButton() 
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())
     {
commit d1a22ae63f9fd896b430c799dc15af145e2bec3d
Author:     Michael Stahl <[email protected]>
AuthorDate: Thu Aug 22 11:20:27 2024 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Sat Aug 24 10:49:22 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 <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit 20b8f3922a374378cef7b87ee30cde2ae1d6264e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172204
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 39d936cf7a23..c765bd35e0cc 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2262,7 +2262,8 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
         }
     }
 
-    if (IsHiddenNow())
+    bool const isHiddenNow(IsHiddenNow());
+    if (isHiddenNow)
         MakeValidZeroHeight();
 
     int nUnSplitted = 5; // Just another loop control :-(
@@ -2299,7 +2300,10 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
                         pLayout->GetBrowseWidthByTabFrame( *this ) );
                 }
 
-                setFramePrintAreaValid(false);
+                if (!isHiddenNow)
+                {
+                    setFramePrintAreaValid(false);
+                }
                 aNotify.SetLowersComplete( false );
             }
             SwFrame *pPre;
@@ -2402,7 +2406,10 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
                                 pHTMLLayout->GetBrowseWidthByTabFrame( *this ) 
);
                         }
 
-                        setFramePrintAreaValid(false);
+                        if (!isHiddenNow)
+                        {
+                            setFramePrintAreaValid(false);
+                        }
 
                         if (!oAccess)
                         {

Reply via email to