sw/source/core/layout/flycnt.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit d9e38d5830ac278d7180b96fb6cefe3ee8ef6d76
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Mon Mar 14 19:11:21 2022 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue Mar 15 10:59:25 2022 +0100

    tdf#135220 sw: fix layout after SwUndoDelete
    
    The bugdoc is 398 pages after initial load and 397 pages after Undo.
    
    There is really only one problem, on page 6 the fly frame 7370 "Figure
    3: Hay Rake in Weeds" anchored on SwTextFrame 5896 should be on page 7
    and aligned to the top of its paragraph.
    
    First, 5986 moves forward from page 6 to 7, hitting the condition added
    in commit c799de145f7e289f31e3669646e5bd12814e6c5e
    debug:1170918:1170918: 
SwObjectFormatterTextFrame::CheckMovedFwdCondition(): 
o_rbPageHasFlysAnchoredBelowThis because next chain on same page
    
    Then 5986 moves back to page 6.  When it is formatted there, the
    ConsiderObjWrapInfluenceOnObjPos() is true, preventing a formatting of
    the anchor frame - so it does not move forward.
    
    The flag SetTmpConsiderWrapInfluence(true) was set the first time (when
    it moved forward).
    
    Setting this flag for any anchor frame that moves forward was added in
    2005 in commit 46297c0923c50a12510c7b15b725c8d2fd80f9c0 and apparently
    the only way the flag is cleared is when SwDoc's SetModified() is
    called (or the frame is in a table or column).
    
    So it is similar to the InsertMovedFwdFrame() case that was addressed by
    commit c799de145f7e289f31e3669646e5bd12814e6c5e in that the flag should
    not be set if bPageHasFlysAnchoredBelowThis is true.
    
    (reportedly regression from sw_redlinehide
     commit 6c7245e789f973cf6dad03f7008ab3f9d12d350c)
    
    Change-Id: I27b2a1becf5f7a760e74e801e23472116d0a5ced
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131560
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 2ed6bb36b67a..5e9bdfe92ef0 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -426,7 +426,10 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
                                 bAnchoredAtMaster, nToPageNum, bDummy,
                                 bPageHasFlysAnchoredBelowThis) )
             {
-                bConsiderWrapInfluenceDueToMovedFwdAnchor = true;
+                if (!bPageHasFlysAnchoredBelowThis)
+                {
+                    bConsiderWrapInfluenceDueToMovedFwdAnchor = true;
+                }
                 // mark anchor text frame
                 // directly, that it is moved forward by object positioning.
                 SwTextFrame* pAnchorTextFrame( 
static_cast<SwTextFrame*>(AnchorFrame()) );

Reply via email to