sw/source/core/layout/fly.cxx |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit ee82accbd0d67eaf0f5a164a82b86abd00c3b0c9
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Aug 17 13:30:38 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Aug 18 10:57:21 2023 +0200

    tdf#156728 sw: layout: invalidate fly on header/footer size
    
    On page 30 there are at-page anchored shapes Shape22, Shape23 and
    Shape25.
    
    Shape22 and Shape23 are positioned relative to the bottom of the page
    text area, and that is working; Shape25 is positioned with an offset to
    the top of the page text area, and that doesn't work.
    
    The problem is that the shapes are positioned when the header on the
    page hasn't been formatted yet, and once the header is formatted, the
    position of the Shape25 is not invalidated, so it's a header-height too
    far up.
    
    (regression from commit 425a252c3cc5e5a79a533965026dd4af6b8df739)
    
    Change-Id: Ic907d98b1bcd4bb544fd1af9bf93ebc7b75bf362
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155762
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index c2d27eaf2f0e..a06c2a9e7f70 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2718,10 +2718,23 @@ void SwLayoutFrame::NotifyLowerObjs( const bool 
_bUnlockPosOfObjs )
         {
             assert( dynamic_cast<const SwAnchoredDrawObject*>( pObj) &&
                     "<SwLayoutFrame::NotifyFlys() - anchored object of 
unexpected type" );
+            // tdf#156728 invalidate fly positioned dependent on header/footer 
size
+            bool isPositionedByHF(false);
+            if (IsHeaderFrame() || IsFooterFrame())
+            {
+                auto const 
nO(pObj->GetFrameFormat().GetVertOrient().GetRelationOrient());
+                if (nO == text::RelOrientation::PAGE_PRINT_AREA
+                    || nO == text::RelOrientation::PAGE_PRINT_AREA_BOTTOM
+                    || nO == text::RelOrientation::PAGE_PRINT_AREA_TOP)
+                {
+                    isPositionedByHF = true;
+                }
+            }
             // #i26945# - use <pAnchorFrame> to check, if
             // fly frame is lower of layout frame resp. if fly frame is
             // at a different page registered as its anchor frame is on.
             if ( IsAnLower( pAnchorFrame ) ||
+                 isPositionedByHF ||
                  pAnchorFrame->FindPageFrame() != pPageFrame )
             {
                 // #i44016#

Reply via email to