sw/source/core/inc/flyfrms.hxx   |    2 ++
 sw/source/core/layout/flylay.cxx |   13 +++++++++++++
 2 files changed, 15 insertions(+)

New commits:
commit 7bfd8f83fb93e991b644c34da7d2fa439e8f319c
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Dec 20 21:04:05 2022 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Dec 21 10:42:39 2022 +0000

    tdf#146875 sw: move also at-frame flys off SwPageFrame
    
    The bugdoc contains an at-frame anchored fly on page 77, which is
    anchored to an at-page anchored fly.
    
    While layouting page 74, the fly is moved to page 77, and the content on
    page 74 invalidated.
    
    Unexpectedly, calling RegisterAtPage on a SwFlyLayFrame does absolutely
    nothing, as it calls the base class SwFlyFrame, so the fly stays on page
    74.
    
    Thus, page 74 never actually becomes valid, and later pages are never
    layouted.
    
    (regression from commit eb85de8e6b61fb3fcb6c03ae0145f7fe5478bccf)
    
    Change-Id: I4fcbed4daf83f9e554de5a877a40b2c2419c0f2f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144631
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit abef9ea8aa99561e6f84451acf387abde4ec14ab)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144657

diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx
index 1f346a9d90e4..cf79bf2fe92b 100644
--- a/sw/source/core/inc/flyfrms.hxx
+++ b/sw/source/core/inc/flyfrms.hxx
@@ -150,6 +150,8 @@ public:
     // #i28701#
 
     SwFlyLayFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor );
+
+    virtual void RegisterAtPage(SwPageFrame &) override;
     virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 };
 
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index d7c6969a4b6b..b03c8b4f8269 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -720,6 +720,19 @@ SwFlyLayFrame::SwFlyLayFrame( SwFlyFrameFormat *pFormat, 
SwFrame* pSib, SwFrame
     m_bLayout = true;
 }
 
+void SwFlyLayFrame::RegisterAtPage(SwPageFrame & rPageFrame)
+{
+    assert(GetPageFrame() != &rPageFrame);
+    if (GetPageFrame())
+    {
+        GetPageFrame()->MoveFly( this, &rPageFrame );
+    }
+    else
+    {
+        rPageFrame.AppendFlyToPage( this );
+    }
+}
+
 // #i28701#
 
 void SwFlyLayFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)

Reply via email to