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

New commits:
commit ac0222fb5bfde87736b55ad22cf3c9230fe741ab
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Fri Apr 4 16:20:28 2025 -0400
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Apr 9 10:09:45 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
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183820
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 7195dd82392e..0944be7af18b 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -4964,6 +4964,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())
             {
@@ -4975,7 +4982,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;
                         }
@@ -4986,16 +4993,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