sw/qa/core/layout/flycnt.cxx | 8 ++++++++ sw/source/core/layout/tabfrm.cxx | 4 +++- sw/source/core/text/txtfly.cxx | 17 +++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-)
New commits: commit 3aa3f0a1638a8d8006955b62bb647526768be3d8 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Sep 7 08:25:18 2023 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Sep 7 09:57:40 2023 +0200 sw floattable, nesting: fix position of the inner follow table The bugdoc was no longer crashing, but the inner table's follow part on page 2 was not visible. The problem was that lcl_ArrangeLowers() didn't try to update the fly's position when the cell's position changed, now we do this for split flys. The other problem was that as SwTextFly::GetTop() is called by SwTextFly::InitAnchoredObjList(), the inner flys were ignored while collecting the intersecting fly frames for a paragraph, leading to an overlap between the inner follow fly and the inner anchor text. This is now fixed by explicitly checking for the splitfly-in-splitfly case. With this, the ODT bugdoc now renders correctly when opened. (This is related to tdf#55160.) Change-Id: I60997e7913984872319250b0fb1cb91e02512800 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156632 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/sw/qa/core/layout/flycnt.cxx b/sw/qa/core/layout/flycnt.cxx index 0839e6a34b36..797d5d8c5691 100644 --- a/sw/qa/core/layout/flycnt.cxx +++ b/sw/qa/core/layout/flycnt.cxx @@ -1060,6 +1060,14 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNested) CPPUNIT_ASSERT(pPage2Fly1); CPPUNIT_ASSERT(pPage2Fly1->GetAnchorFrameContainingAnchPos()->IsInFly()); CPPUNIT_ASSERT(pPage2Fly1->GetPrecede()); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected greater than: 6204 + // - Actual : 1725 + // i.e. the inner follow fly had a bad position, it was outside the page rectangle, it was not + // rendered and this way the inner anchor had no fly portion, either. + CPPUNIT_ASSERT_GREATER(pPage2->getFrameArea().Top(), pPage2Fly1->getFrameArea().Top()); + auto pPage2Fly2 = rPage2Objs[1]->DynCastFlyFrame()->DynCastFlyAtContentFrame(); CPPUNIT_ASSERT(pPage2Fly2); CPPUNIT_ASSERT(!pPage2Fly2->GetAnchorFrameContainingAnchPos()->IsInFly()); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 5b14113825e4..bbd7ebece6d8 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -5338,10 +5338,12 @@ static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, tools::Long lYStart, bool bI // on the object positioning. // #i52904# - no direct move of objects, // whose vertical position doesn't depend on anchor frame. + // Also move split flys directly, otherwise the follows would not be moved + // at all. const bool bDirectMove = FAR_AWAY != pFly->getFrameArea().Top() && bVertPosDepOnAnchor && - !pFly->ConsiderObjWrapInfluenceOnObjPos(); + (!pFly->ConsiderObjWrapInfluenceOnObjPos() || pFly->IsFlySplitAllowed()); if ( bDirectMove ) { { diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index e5bf03162db4..a290ac4d2010 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -679,6 +679,23 @@ bool SwTextFly::GetTop( const SwAnchoredObject* _pAnchoredObj, bool bEvade = !mpCurrAnchoredObj || Is_Lower_Of( mpCurrAnchoredObj->DynCastFlyFrame(), pNew); + auto pFly = _pAnchoredObj->DynCastFlyFrame(); + if (pFly && pFly->IsFlySplitAllowed()) + { + // Check if _pAnchoredObj is a split fly inside an other split fly. Always collect such + // flys, otherwise the inner anchor text will overlap with the inner fly. + SwFrame* pFlyAnchor = const_cast<SwAnchoredObject*>(_pAnchoredObj) + ->GetAnchorFrameContainingAnchPos(); + if (pFlyAnchor && pFlyAnchor->IsInFly()) + { + auto pOuterFly = pFlyAnchor->FindFlyFrame(); + if (pOuterFly && pOuterFly->IsFlySplitAllowed()) + { + return true; + } + } + } + if ( !bEvade ) { // We are currently inside a fly frame and pNew is not