summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2020-05-07 14:43:17 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-05-20 09:31:50 +0200
commitc71ebc0a9f0e8a35d7c315df68cc42159f909d41 (patch)
tree6bc3189952fc1fd6e10719935ae4c98a8e155c31 /sw/source
parent96baf8c69330d50af7d31ab9838bcd0ec7c8c50b (diff)
NFC sw layout: optimize assignment of bAllowSplitOfRow
1.) Remove unnecessary test for !bDontSplit, since by definition, bTableRowKeep requires !bDontSplit const bool bDontSplit const bool bTableRowKeep = !bDontSplit && ... const bool bAllowSplitOfRow = bTableRowKeep && ... 2.) Put the trivial !bPrevInd test first and so potentially avoid the non-trivial lookup of AreAllRowsKeepWithNext(pFirstNonHeadlineRow) 3.) bAllowSplitOfRow by definition contains the two requirements of !bDontSplit and !pIndPrev, so pull out and test earlier - potentially avoiding further tests. This also emphasizes its similarity to bEmulateTableKeep. Change-Id: I41cb72aa03371eacfdb68d63dc3df21f85e755bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93635 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/layout/tabfrm.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 300232cefe17..b0376110a433 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2380,18 +2380,15 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
const SwRowFrame* pFirstNonHeadlineRow = GetFirstNonHeadlineRow();
// #i120016# if this row wants to keep, allow split in case that all rows want to keep with next,
// the table can not move forward as it is the first one and a split is in general allowed.
- const bool bAllowSplitOfRow = ( bTableRowKeep &&
- AreAllRowsKeepWithNext( pFirstNonHeadlineRow ) ) &&
- !pIndPrev &&
- !bDontSplit;
+ const bool bAllowSplitOfRow = bTableRowKeep && !pIndPrev && AreAllRowsKeepWithNext(pFirstNonHeadlineRow);
// tdf91083 MSCompat: this extends bAllowSplitOfRow (and perhaps should just replace it).
// If the kept-together items cannot move to a new page, a table split is in general allowed.
const bool bEmulateTableKeepSplitAllowed = bEmulateTableKeep && !IsKeepFwdMoveAllowed(/*IgnoreMyOwnKeepValue=*/true);
if ( pFirstNonHeadlineRow && nUnSplitted > 0 &&
- ( bEmulateTableKeepSplitAllowed ||
+ ( bEmulateTableKeepSplitAllowed || bAllowSplitOfRow ||
( ( !bTableRowKeep || pFirstNonHeadlineRow->GetNext() ||
- !pFirstNonHeadlineRow->ShouldRowKeepWithNext() || bAllowSplitOfRow
+ !pFirstNonHeadlineRow->ShouldRowKeepWithNext()
) && ( !bDontSplit || !pIndPrev )
) ) )
{