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

New commits:
commit 34b607bb455bd30d3adf8e3f72182c7cc4d062ee
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Jul 18 16:58:34 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Jul 19 11:31:05 2023 +0200

    tdf#148729 sw: invalidate section frame for new text frame at start
    
    SwFlowFrame::CalcUpperSpace() uses the first text frame inside to
    compute the upper margin of section frames.
    
    Before commit 69d2d24b3579ad21fb1ba2746f81a02f8bbfb984 this was
    working because a temporary SwTextFrame for the new SwTextNode was
    created and then deleted again, but while it was alive the SvULSpace
    item was copied and then it invalidated the section frame:
    
    1  SwFrame::InvalidatePrt_()
    2  SwContentFrame::Modify()
        at libreoffice-6-1/sw/source/core/layout/wsfrm.cxx:2336
    3  SwTextFrame::SwClientNotify()
    ...
    7  SwTextNode::Modify()
    8  SwContentNode::SetAttr()
    9  SwTextNode::SetAttr()
    10 SwAttrSet::CopyToModify()
    11 SwTextNode::CopyText()
    12 SwTextNode::CopyText()
    13 SwTextNode::MakeCopy()
    14 SwNodes::CopyNodes()
    15 sw::DocumentContentOperationsManager::CopyWithFlyInFly()
    16 SwIntrnlSectRefLink::DataChanged()
    
    Now however nothing invalidates the section frame, so do it in
    InsertCnt_(), hopefully it works for columned sections too.
    
    (regression from commit 166b5010b402a41b192b1659093a25acf9065fd9)
    
    Change-Id: I339286ac37c9ee9a0bef730a73215bc139386514
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154594
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 9c8d6cbe85bf..666577971534 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1605,6 +1605,16 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
                 pPageMaker->CheckInsert( nIndex );
 
             pFrame->InsertBehind( pLay, pPrv );
+            if (!pPrv)
+            {
+                if (SwSectionFrame *const pSection = pLay->FindSctFrame())
+                {
+                    if (pSection && pSection->ContainsAny() == pFrame)
+                    {   // tdf#148729 section PrtArea depends on paragraph 
upper margin
+                        pSection->InvalidatePrt();
+                    }
+                }
+            }
             // #i27138#
             // notify accessibility paragraphs objects about changed
             // CONTENT_FLOWS_FROM/_TO relation.

Reply via email to