summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-12-13 20:35:07 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2022-12-16 16:14:06 +0100
commit7d34b5ad494acdbb056d70d16b713015be900bcd (patch)
treeb567610d12f461e4d49cd4fc526a3d6fed9fcba7 /sw
parent4ec8fbc0dafae3068fb45e2ec26405bc59b43ace (diff)
(related: tdf#149595) sw: also re-sort SwSortedObjs on SwPageFrame
... if SwTextNode content changes; for the unit test here we get: Error: elements in iterator range [first, last) are not partitioned by the predicate __comp and value __val. Also, the SwTextNode may have multiple text frames on multiple pages. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144108 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit c684301352bcca709bc8d1c99e0f08e7096e9716) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144131 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> (cherry picked from commit 2033a23379c0eb9d6de41c7b1473769fda2cc632) Change-Id: I05d4276e4b4b94fe3cd2cdfda3418ad51fa08f5f
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx20
1 files changed, 16 insertions, 4 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 5fc15dd32863..a1f17358efa5 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -64,6 +64,7 @@
#include <txtfrm.hxx>
#include <ftnfrm.hxx>
#include <ftnboss.hxx>
+#include <pagefrm.hxx>
#include <rootfrm.hxx>
#include <pagedesc.hxx>
#include <expfld.hxx>
@@ -1533,10 +1534,21 @@ void SwTextNode::Update(
//Any drawing objects anchored into this text node may be sorted by their
//anchor position which may have changed here, so resort them
- SwContentFrame* pContentFrame = getLayoutFrame(GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout());
- SwSortedObjs* pSortedObjs = pContentFrame ? pContentFrame->GetDrawObjs() : nullptr;
- if (pSortedObjs)
- pSortedObjs->UpdateAll();
+ SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> iter(*this);
+ for (SwTextFrame* pFrame = iter.First(); pFrame; pFrame = iter.Next())
+ {
+ SwSortedObjs * pSortedObjs(pFrame->GetDrawObjs());
+ if (pSortedObjs)
+ {
+ pSortedObjs->UpdateAll();
+ }
+ // also sort the objs on the page frame
+ pSortedObjs = pFrame->FindPageFrame()->GetSortedObjs();
+ if (pSortedObjs) // doesn't exist yet if called for inserting as-char fly
+ {
+ pSortedObjs->UpdateAll();
+ }
+ }
// Update the paragraph signatures.
if (SwEditShell* pEditShell = GetDoc()->GetEditShell())