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

New commits:
commit 88a5c26334f392fcddfc5a1e62c3a482fbf72fe6
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Dec 20 21:04:05 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Feb 2 09:49:28 2023 +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/+/144658
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

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 48b95e15060e..209ca1fcfbf0 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