path: root/sw/source
diff options
authorMichael Stahl <>2021-05-04 15:45:19 +0200
committerMichael Stahl <>2021-05-04 19:09:59 +0200
commit30512746c182b52f37f9a818d4e206c98e715cb7 (patch)
tree3fb1ee4d91880aa89e063995faff66c8b56eb64f /sw/source
parent4ade38b97f8c22061b612bac81f5dcd3cfb83547 (diff)
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: Tested-by: Jenkins Reviewed-by: Michael Stahl <>
Diffstat (limited to 'sw/source')
1 files changed, 4 insertions, 1 deletions
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<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());
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());
::Notify_Background(pObj->GetDrawObj(), pPage,
pObj->GetObjRect(), PrepareHint::FlyFrameLeave, false);