From c71ebc0a9f0e8a35d7c315df68cc42159f909d41 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Thu, 7 May 2020 14:43:17 +0300 Subject: 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 Reviewed-by: Miklos Vajna --- sw/source/core/layout/tabfrm.cxx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'sw/source/core/layout/tabfrm.cxx') 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 ) ) ) ) { -- cgit v1.2.3