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

New commits:
commit fc798509f9fae52c3b14e91876ae8ab17f822298
Author:     Mike Kaganski <[email protected]>
AuthorDate: Wed Sep 18 14:18:17 2024 +0500
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Tue Jun 3 16:18:27 2025 +0200

    When split is forbidden, avoid useless calculations
    
    Change-Id: Ibfc8b839d4455c21293906f7e4625a09b0d3f4f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173600
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit b9e439874477f40732b9687cae99a3d9d0770db8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186146
    Reviewed-by: Thorsten Behrens <[email protected]>
    Tested-by: allotropia jenkins <[email protected]>

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 2e0788a2589d..2584572074da 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1136,8 +1136,8 @@ bool SwTabFrame::Split(const SwTwips nCutPos, bool 
bTryToSplit,
     //                   table, or it will be set to false under certain
     //                   conditions that are not suitable for splitting
     //                   the row.
-    bool bSplitRowAllowed = true;
-    if (!pRow->IsRowSplitAllowed())
+    bool bSplitRowAllowed = bTryToSplit;
+    if (bSplitRowAllowed && !pRow->IsRowSplitAllowed())
     {
         // A row larger than the entire page ought to be allowed to split 
regardless of setting,
         // otherwise it has hidden content and that makes no sense
@@ -1157,9 +1157,9 @@ bool SwTabFrame::Split(const SwTwips nCutPos, bool 
bTryToSplit,
     // a splitting of the table row.
     // Special DoNotSplit case 1:
     // Search for sections inside pRow:
-    if ( lcl_FindSectionsInRow( *pRow ) )
+    if (bSplitRowAllowed && lcl_FindSectionsInRow(*pRow))
     {
-        bTryToSplit = false;
+        bSplitRowAllowed = false;
     }
 
     SwFlyFrame* pFly = FindFlyFrame();
@@ -1217,7 +1217,7 @@ bool SwTabFrame::Split(const SwTwips nCutPos, bool 
bTryToSplit,
         // Second case: The first non-headline row does not fit to the page.
         // If it is not allowed to be split, or it contains a sub-row that
         // is not allowed to be split, we keep the row in this table:
-        if ( bTryToSplit && bSplitRowAllowed )
+        if (bSplitRowAllowed)
         {
             // Check if there are (first) rows inside this row,
             // which are not allowed to be split.
@@ -1262,9 +1262,7 @@ bool SwTabFrame::Split(const SwTwips nCutPos, bool 
bTryToSplit,
     // - the attributes of the row are set accordingly and
     // - we are allowed to do so
     // - it should not be kept with the next row
-    bSplitRowAllowed = bSplitRowAllowed && bTryToSplit &&
-                       ( !bTableRowKeep ||
-                         !pRow->ShouldRowKeepWithNext() );
+    bSplitRowAllowed = bSplitRowAllowed && (!bTableRowKeep || 
!pRow->ShouldRowKeepWithNext());
 
     // Adjust pRow according to the keep-with-next attribute:
     if ( !bSplitRowAllowed && bTableRowKeep )

Reply via email to