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

New commits:
commit b81829dc7aa94e92818d2545cd28f1ef6c298395
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Jul 18 16:58:34 2023 +0200
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Jul 27 15:25:01 2023 +0200

    tdf#146258 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)
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154594
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 34b607bb455bd30d3adf8e3f72182c7cc4d062ee)
    [commit 34b607bb455bd30d3adf8e3f72182c7cc4d062ee used wrong issue id]
    
    Change-Id: I339286ac37c9ee9a0bef730a73215bc139386514
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154614
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index f477400aea49..a1bb7d44bf71 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1606,6 +1606,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#146258 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