summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-05-04 15:45:19 +0200
committerAndras Timar <andras.timar@collabora.com>2021-05-16 23:47:20 +0200
commit41fc2984c06e5fb7953b976cd572ee7bf5185f8b (patch)
tree4242b972fd12f90b8dc7ae7314654f3c8306cf5b /sw
parentd5aa5d246e2a841458ff59d602afe2c62aefeef8 (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: https://gerrit.libreoffice.org/c/core/+/115100 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 30512746c182b52f37f9a818d4e206c98e715cb7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115080 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/anchoredobject.hxx3
-rw-r--r--sw/source/core/layout/layact.cxx5
2 files changed, 6 insertions, 2 deletions
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);