sw/source/core/doc/docnew.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit ff525d0d70ea9d189a430bde944b56d048b03e55
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Jun 3 13:33:54 2022 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Jun 3 15:08:39 2022 +0200

    tdf#148309 sw_redlinehide: fix mail merge performance regression
    
    The problem is that in the call to pTargetShell->EndAllAction(), the
    cursor is on the node before the newly appended one that has the page
    break, and only this node is formatted (via GetFormatted()), so no new
    page frames are inserted in the layout, which then creates massive
    performance problems later, particularly since the bugdoc contains
    multiple at-page anchored flys.
    
    (regression from commit 42448f48bb48a13d6618a181b12840db6d85c574)
    
    Change-Id: I05cd2a515a7f67132ab1c8c6fa0d675252ea3a15
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135356
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 72798b019e15..1a9f7e868980 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -1099,6 +1099,11 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, 
sal_uInt16 const nStartPageNu
             // set break on the last paragraph
             getIDocumentContentOperations().InsertPoolItem(SwPaM(aBreakPos),
                     pageDesc, SetAttrMode::DEFAULT, pTargetShell->GetLayout());
+            // tdf#148309 move to the last node - so that the "flush page 
break"
+            // code below will format the frame of the node with the page 
break,
+            // which is required for new page frames to be created!  Else 
layout
+            // performance will be terrible.
+            pTargetShell->SttEndDoc(false);
 
             // There is now a new empty text node on the new page. If it has
             // any marks, those are from the previous page: move them back
@@ -1129,6 +1134,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, 
sal_uInt16 const nStartPageNu
             if ( !bDeletePrevious )
             {
                 SAL_INFO( "sw.pageframe", "(Flush pagebreak AKA EndAllAction" 
);
+                
assert(pTargetShell->GetCursor()->GetPoint()->nNode.GetNode().GetTextNode()->GetSwAttrSet().HasItem(RES_PAGEDESC));
                 pTargetShell->EndAllAction();
                 SAL_INFO( "sw.pageframe",  "Flush changes AKA EndAllAction)" );
                 pTargetShell->StartAllAction();

Reply via email to