[Libreoffice-commits] core.git: sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 20 13:20:30 UTC 2021


 sw/source/core/inc/flyfrms.hxx    |    1 +
 sw/source/core/layout/pagechg.cxx |    5 +++++
 2 files changed, 6 insertions(+)

New commits:
commit e656cf2a71e738c282abcd0d610e724b955f274a
Author:     Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Tue Apr 20 12:45:36 2021 +0200
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Tue Apr 20 15:19:45 2021 +0200

    tdf#138785 sw: fix mis-positioned as-char flys when deleting empty page
    
    When SwFrame::CheckPageDescs() deletes an empty page in the middle of
    the document, which happens during SetRedlineFlags() here, the
    SwFlyInContentFrame::maFrameArea is moved in lcl_MoveAllLowers(), but
    the SwFlyInContentFrame::m_aRefPoint stays unchanged.
    
    Because the formatting occurs only after the redline mode is reset, the
    position of the SwFlyInContentFrame when it is formatted is exactly the
    same as its (stale) m_aRefPoint, so the setting of (updated) maFrameArea
    is skipped in SwAsCharAnchoredObjectPosition::CalcPosition(), so the
    fly ends up a page above where it should be.
    
    So keep m_aRefPoint consistent with maFrameArea in lcl_MoveAllLowers().
    
    (regression from b9ef71476fd70bc13f50ebe80390e0730d1b7afb)
    
    Change-Id: If1b421daa0d71718d89d9772f5c0d9e367e76845
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114332
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx
index 5eabe01d009f..1f346a9d90e4 100644
--- a/sw/source/core/inc/flyfrms.hxx
+++ b/sw/source/core/inc/flyfrms.hxx
@@ -223,6 +223,7 @@ public:
 
     //see layact.cxx
     void AddRefOfst( tools::Long nOfst ) { m_aRef.AdjustY( nOfst ); }
+    void AddRefOfst(Point const& rOfst) { m_aRef += rOfst; }
 
     // #i26791#
     virtual void MakeObjPos() override;
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 1c304008aeca..5d1d5ec8462d 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -2008,6 +2008,11 @@ static void lcl_MoveAllLowerObjs( SwFrame* pFrame, const Point& rOffset )
         if ( auto pFlyFrame = dynamic_cast<SwFlyFrame *>( pAnchoredObj ) )
         {
             lcl_MoveAllLowers( pFlyFrame, rOffset );
+            // tdf#138785 update position specific to as-char flys
+            if (pFlyFrame->IsFlyInContentFrame())
+            {
+                static_cast<SwFlyInContentFrame*>(pFlyFrame)->AddRefOfst(rOffset);
+            }
             pFlyFrame->NotifyDrawObj();
             // --> let the active embedded object be moved
             SwFrame* pLower = pFlyFrame->Lower();


More information about the Libreoffice-commits mailing list