summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-04-16 20:18:22 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2021-04-27 03:02:29 +0200
commiteadc7c4f0ba21d35fff09bb53e08e64194a65278 (patch)
tree3cc1f22ff6e847efba46e289a44e55a0f04b3d74 /sw/source
parentec36122b8baba9758705383559246bcb91991c98 (diff)
SW merge layout shortcut into the full layout code
The shortcut codepath just skips a large part of the full layout code. To make this more obvious, this refactors the main layout loop by merging both paths, really skipping the code in the shortcut case and getting rid of all the duplicate code. Change-Id: I015202e86e75576f03901746e1a082e9f6811549 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114118 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/layout/layact.cxx41
1 files changed, 10 insertions, 31 deletions
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index a54c20d6e7cf..422b8aee0c46 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -484,37 +484,13 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
m_pOptTab = nullptr;
// No Shortcut for Idle or CalcLayout
- if ( !IsIdle() && !IsComplete() && IsShortCut( pPage ) )
- {
- m_pRoot->DeleteEmptySct();
- if (lcl_isLayoutLooping()) return;
- if ( !IsInterrupt() &&
- (m_pRoot->IsSuperfluous() || m_pRoot->IsAssertFlyPages()) )
- {
- if ( m_pRoot->IsAssertFlyPages() )
- m_pRoot->AssertFlyPages();
- if ( m_pRoot->IsSuperfluous() )
- {
- bool bOld = IsAgain();
- m_pRoot->RemoveSuperfluous();
- m_bAgain = bOld;
- }
- if (lcl_isLayoutLooping()) return;
- pPage = static_cast<SwPageFrame*>(m_pRoot->Lower());
- while ( pPage && !pPage->IsInvalid() && !pPage->IsInvalidFly() )
- pPage = static_cast<SwPageFrame*>(pPage->GetNext());
- while ( pPage && pPage->GetNext() &&
- pPage->GetPhyPageNum() < nFirstPageNum )
- pPage = static_cast<SwPageFrame*>(pPage->GetNext());
- continue;
- }
- break;
- }
- else
- {
- m_pRoot->DeleteEmptySct();
- if (lcl_isLayoutLooping()) return;
+ const bool bTakeShortcut = !IsIdle() && !IsComplete() && IsShortCut(pPage);
+
+ m_pRoot->DeleteEmptySct();
+ if (lcl_isLayoutLooping()) return;
+ if (!bTakeShortcut)
+ {
while ( !IsInterrupt() && !IsNextCycle() &&
((pPage->GetSortedObjs() && pPage->IsInvalidFly()) || pPage->IsInvalid()) )
{
@@ -630,7 +606,8 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
}
CheckIdleEnd();
}
- if ( !pPage && !IsInterrupt() &&
+
+ if ((bTakeShortcut || !pPage) && !IsInterrupt() &&
(m_pRoot->IsSuperfluous() || m_pRoot->IsAssertFlyPages()) )
{
if ( m_pRoot->IsAssertFlyPages() )
@@ -649,6 +626,8 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
pPage->GetPhyPageNum() < nFirstPageNum )
pPage = static_cast<SwPageFrame*>(pPage->GetNext());
}
+ else if (bTakeShortcut)
+ break;
}
if ( IsInterrupt() && pPage )
{