From 30512746c182b52f37f9a818d4e206c98e715cb7 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 4 May 2021 15:45:19 +0200 Subject: tdf#141945 sw: layout: check master frame when moving fly forward The problem is that in the finished layout the fly frames are positioned on the first page but are in SwPageFrame::m_pSortedObjs of the second page. Don't use FindPageFrameOfAnchor() because that looks up the follow-frame that contains the anchor position. This was unintentional; the idea was to get flys anchored in subsequent paragraphs out of the way. This situation where it's on a follow-frame of the same paragraph is more complicated and less obvious, so don't try to solve it now. (regression from eb85de8e6b61fb3fcb6c03ae0145f7fe5478bccf) Change-Id: Ic6809a43c467955368807ccc82a7873c29fbfc2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115100 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/source/core/layout/layact.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 4a811e171ddc..10d5cf065d3a 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1606,7 +1606,9 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage) std::vector> moved; for (auto const pObj : *pObjs) { - SwPageFrame *const pAnchorPage(pObj->FindPageFrameOfAnchor()); + assert(!pObj->AnchorFrame()->IsTextFrame() + || !static_cast(pObj->AnchorFrame())->IsFollow()); + SwPageFrame *const pAnchorPage(pObj->AnchorFrame()->FindPageFrame()); assert(pAnchorPage); if (pAnchorPage != pPage && pPage->GetPhyPageNum() < pAnchorPage->GetPhyPageNum() @@ -1618,6 +1620,7 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage) } for (auto const& [pObj, pAnchorPage] : moved) { + SAL_INFO("sw.layout", "SwLayAction::FormatContent: move anchored " << pObj << " from " << pPage->GetPhyPageNum() << " to " << pAnchorPage->GetPhyPageNum()); pObj->RegisterAtPage(*pAnchorPage); ::Notify_Background(pObj->GetDrawObj(), pPage, pObj->GetObjRect(), PrepareHint::FlyFrameLeave, false); -- cgit v1.2.3