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

New commits:
commit 148c938020f5467b78da37a5045672635e2e3afa
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Dec 20 21:04:05 2022 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Fri Dec 30 00:33:01 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)
    
    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)
    
    Change-Id: I4fcbed4daf83f9e554de5a877a40b2c2419c0f2f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144759
    Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx
index 04b505ddd548..cb94b7cbd259 100644
--- a/sw/source/core/inc/flyfrms.hxx
+++ b/sw/source/core/inc/flyfrms.hxx
@@ -151,6 +151,7 @@ public:
 
     SwFlyLayFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor );
 
+    virtual void RegisterAtPage(SwPageFrame &) override;
 protected:
     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
 };
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 4a7030ea241e..c915ee82d95a 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -723,6 +723,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::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )

Reply via email to