sw/source/core/txtnode/ndtxt.cxx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
New commits: commit c684301352bcca709bc8d1c99e0f08e7096e9716 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Dec 13 20:35:07 2022 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Dec 14 14:24:24 2022 +0000 (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. Change-Id: I05d4276e4b4b94fe3cd2cdfda3418ad51fa08f5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144108 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index d78aacc898d2..a334baf87634 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -57,6 +57,7 @@ #include <paratr.hxx> #include <txtfrm.hxx> #include <ftnfrm.hxx> +#include <pagefrm.hxx> #include <rootfrm.hxx> #include <expfld.hxx> #include <section.hxx> @@ -1593,10 +1594,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())