From 21cbd2cb9c1bf86728edf351f5e350d923eb15b2 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 10 Feb 2022 19:43:08 +0100 Subject: sw: fix layout loop on soffice --convert-to pdf ooo95698-1.odt For unknown reasons, this loops since commit 32902f66e7749b2d06d13f50416be5323a0c0ea9a "sw_redlinehide: make layout based Show/Hide mode the default" The problem is that when page 1 is layouted for the first time, it splits into 6 pages, and then the SwTabFrame 47 decides that it wants to move its follow flow line because it fits onto page 1. Then splitting the SwTabFrame again fails, but for this RemoveFollowFlowLine() was called a 2nd time and removed the one on page 3. The result is a layout with content on page 1, nothing on page 2, 3 and again content on page 4. This seems to reoccur every time page 1 is formatted. But the first RemoveFollowFlowLine() was wrong because CalcHeightOfFirstContentLine() returns 0 because lcl_CalcHeightOfFirstContentLine() didn't handle the case of SwSectionFrame containing SwTabFrame. This is similar to commit e024cad7c1365da6a198656c3ca0c32b28938e87 doing the same thing for text frames in section. Change-Id: I23fb4d1d56622039f461bb2d357a9c88db140605 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129800 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit b4271e028686d729189afc5e42a9c310f81144f3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129828 Reviewed-by: Xisco Fauli (cherry picked from commit 60811f97c753360393f52aa747837db15a722162) --- sw/source/core/layout/tabfrm.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index c00a7294e8c3..4f2c504cc8e5 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -5581,9 +5581,12 @@ static SwTwips lcl_CalcHeightOfFirstContentLine( const SwRowFrame& rSourceLine ) const SwRowFrame* pTmpSourceRow = static_cast(pCurrSourceCell->Lower()); nTmpHeight = lcl_CalcHeightOfFirstContentLine( *pTmpSourceRow ); } - else if ( pTmp->IsTabFrame() ) + else if (pTmp->IsTabFrame() || (pTmp->IsSctFrame() && pTmp->GetLower() && pTmp->GetLower()->IsTabFrame())) { - nTmpHeight = static_cast(pTmp)->CalcHeightOfFirstContentLine(); + SwTabFrame const*const pTabFrame(pTmp->IsTabFrame() + ? static_cast(pTmp) + : static_cast(pTmp->GetLower())); + nTmpHeight = pTabFrame->CalcHeightOfFirstContentLine(); } else if (pTmp->IsTextFrame() || (pTmp->IsSctFrame() && pTmp->GetLower() && pTmp->GetLower()->IsTextFrame())) { -- cgit