summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-06-01 20:30:50 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2022-06-21 23:39:46 +0200
commit97a8db45e6ad8fb397edf5e239384637353f0b2f (patch)
treefbbfd4b8f1b29eb1b87367898e5db2c9d5fbd52f
parentReplace "Bahnschrift Light" with "DejaVu Sans" (diff)
downloadcore-97a8db45e6ad8fb397edf5e239384637353f0b2f.tar.gz
core-97a8db45e6ad8fb397edf5e239384637353f0b2f.zip
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) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135356 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit ff525d0d70ea9d189a430bde944b56d048b03e55) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135273 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 57cd4735a7312174e63d2a1a3dd3831443169530) Revert "trac#34262 Revert "tdf#144565 sw_redlinehide: fix mailmerge when flys anchored at last node"" This reverts commit 228537cebb6ffa75e7e2270fb7bfd6e91fa6ba2c. The performance regression should be fixed with above commit. Change-Id: I05cd2a515a7f67132ab1c8c6fa0d675252ea3a15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136181 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Tested-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
-rw-r--r--sw/source/core/doc/docnew.cxx27
1 files changed, 14 insertions, 13 deletions
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 984f2335bc45..6b041fa96c51 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -1054,19 +1054,19 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
{
SwNodeIndex aBreakIdx( GetNodes().GetEndOfContent(), -1 );
SwPosition aBreakPos( aBreakIdx );
- // InsertPageBreak just works on SwTextNode nodes, so make
- // sure the last node is one!
- bool bIsTextNode = aBreakIdx.GetNode().IsTextNode();
- if ( !bIsTextNode )
- getIDocumentContentOperations().AppendTextNode( aBreakPos );
- const OUString name = pTargetPageDesc->GetName();
- pTargetShell->InsertPageBreak( &name, nStartPageNumber );
- if ( !bIsTextNode )
- {
- pTargetShell->SttEndDoc( false );
- --aBreakIdx;
- GetNodes().Delete( aBreakIdx );
- }
+ // insert new node - will be removed at the end...
+ // (don't SplitNode() as it may move flys to the wrong node)
+ getIDocumentContentOperations().AppendTextNode(aBreakPos);
+ SwFormatPageDesc pageDesc(pTargetPageDesc);
+ pageDesc.SetNumOffset(nStartPageNumber);
+ // 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
@@ -1097,6 +1097,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();