[Libreoffice-commits] core.git: sw/inc sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 4 17:10:36 UTC 2021
sw/inc/anchoredobject.hxx | 3 ++-
sw/source/core/layout/layact.cxx | 5 ++++-
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit 30512746c182b52f37f9a818d4e206c98e715cb7
Author: Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Tue May 4 15:45:19 2021 +0200
Commit: Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Tue May 4 19:09:59 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.stahl at allotropia.de>
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 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());
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);
More information about the Libreoffice-commits
mailing list