sw/source/core/layout/tabfrm.cxx |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 3b92b1b0bcbd3f490bbd1d94bf4a9e6593540cdc
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Fri Apr 4 16:20:28 2025 -0400
Commit:     Justin Luth <justin.l...@collabora.com>
CommitDate: Tue Apr 8 05:12:01 2025 +0200

    related tdf#165492 sw table layout: calc entire space before compare
    
    This is just based on a code read.
    It doesn't make sense to check if the row will fit on the page
    before fully determining the actual minimum size.
    
    [The "if (bMinRowHeightInclBorder)" code block
    was the most recent addition.]
    
    Change-Id: Iab256e4098650c838dc5ef7ca3fb06aa0fd9acd9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183738
    Reviewed-by: Justin Luth <jl...@mail.com>
    Tested-by: Jenkins

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 7b65b3b64f94..c222226a026c 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -4978,6 +4978,13 @@ static SwTwips lcl_CalcMinRowHeight( const SwRowFrame* 
_pRow,
         // this frame's minimal height, because the rest will go to follow 
frame.
         else if ( !_pRow->IsInSplit() && rSz.GetHeightSizeType() == 
SwFrameSize::Minimum )
         {
+            nHeight = rSz.GetHeight();
+            if (bMinRowHeightInclBorder) // handle MS Word 'atLeast' oddities
+            {
+                // add (only) top horizontal border
+                nHeight += lcl_GetLineWidth(*_pRow, SvxBoxItemLine::TOP);
+            }
+
             bool bSplitFly = false;
             if (_pRow->IsInFly())
             {
@@ -4989,7 +4996,7 @@ static SwTwips lcl_CalcMinRowHeight( const SwRowFrame* 
_pRow,
                     SwFrame* pAnchor = 
const_cast<SwFlyFrame*>(pFly)->FindAnchorCharFrame();
                     if (pAnchor)
                     {
-                        if 
(pAnchor->FindPageFrame()->getFramePrintArea().Height() > rSz.GetHeight())
+                        if 
(pAnchor->FindPageFrame()->getFramePrintArea().Height() > nHeight)
                         {
                             bSplitFly = true;
                         }
@@ -5000,16 +5007,10 @@ static SwTwips lcl_CalcMinRowHeight( const SwRowFrame* 
_pRow,
             if (bSplitFly)
             {
                 // Split fly: enforce minimum row height for the master and 
follows.
-                nHeight = rSz.GetHeight();
             }
             else
             {
-                nHeight = rSz.GetHeight() - 
lcl_calcHeightOfRowBeforeThisFrame(*_pRow);
-            }
-            if (bMinRowHeightInclBorder)
-            {
-                //get horizontal border(s)
-                nHeight += lcl_GetLineWidth(*_pRow, SvxBoxItemLine::TOP);
+                nHeight -= lcl_calcHeightOfRowBeforeThisFrame(*_pRow);
             }
         }
     }

Reply via email to