sw/inc/anchoredobject.hxx | 3 ++- sw/source/core/layout/layact.cxx | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-)
New commits: commit 41f68b652eb1ccdd4941e2270426461da8e66417 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue May 4 15:45:19 2021 +0200 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu May 6 10:40:10 2021 +0200 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 <michael.st...@allotropia.de> (cherry picked from commit 30512746c182b52f37f9a818d4e206c98e715cb7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115080 Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx index fa789d755d53..1db20eaf494c 100644 --- a/sw/inc/anchoredobject.hxx +++ b/sw/inc/anchoredobject.hxx @@ -46,7 +46,8 @@ class SW_DLLPUBLIC SwAnchoredObject private: // drawing object representing the anchored object in the drawing layer SdrObject* mpDrawObj; - // frame the object is anchored at + /// Frame the object is anchored at. + /// For at-char/at-para anchor, this is always the master SwTextFrame. SwFrame* mpAnchorFrame; // #i28701 - page frame the object is registered at // note: no page frame for as-character anchored objects diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index bf4a6df98c4b..c613507a5142 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1638,7 +1638,9 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage) std::vector<std::pair<SwAnchoredObject*, SwPageFrame*>> moved; for (auto const pObj : *pObjs) { - SwPageFrame *const pAnchorPage(pObj->FindPageFrameOfAnchor()); + assert(!pObj->AnchorFrame()->IsTextFrame() + || !static_cast<SwTextFrame const*>(pObj->AnchorFrame())->IsFollow()); + SwPageFrame *const pAnchorPage(pObj->AnchorFrame()->FindPageFrame()); assert(pAnchorPage); if (pAnchorPage != pPage && pPage->GetPhyPageNum() < pAnchorPage->GetPhyPageNum() @@ -1650,6 +1652,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); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits