diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2021-04-20 12:45:36 +0200 |
---|---|---|
committer | Gabor Kelemen <kelemeng@ubuntu.com> | 2021-12-10 16:03:58 +0100 |
commit | b324e5a9956ec039f7d111025d95afd7a6fcd038 (patch) | |
tree | 4e9dc3266f98e9108f16a4193130c8405a720e05 | |
parent | 38b997ebdd80e5a652bba3e24760e704d0f0e3ea (diff) |
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)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114332
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit e656cf2a71e738c282abcd0d610e724b955f274a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114520
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
(cherry picked from commit c79b92edfb5e650fff76688998cf4f0bbd08d2a4)
Change-Id: If1b421daa0d71718d89d9772f5c0d9e367e76845
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115764
Tested-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r-- | sw/source/core/inc/flyfrms.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/layout/pagechg.cxx | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx index 4c6940c28edc..8e167b9490f5 100644 --- a/sw/source/core/inc/flyfrms.hxx +++ b/sw/source/core/inc/flyfrms.hxx @@ -227,6 +227,7 @@ public: //see layact.cxx void AddRefOfst( long nOfst ) { aRef.AdjustY( nOfst ); } + void AddRefOfst(Point const& rOfst) { aRef += rOfst; } // #i26791# virtual void MakeObjPos() override; diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 612b0bb53ee3..118dc4c04212 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -2005,6 +2005,11 @@ static void lcl_MoveAllLowerObjs( SwFrame* pFrame, const Point& rOffset ) { SwFlyFrame* pFlyFrame( static_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(); |