summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-12-23 12:07:40 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-12-23 17:56:18 +0100
commit40bd193475374addbd8d9e6ade7c617d263df137 (patch)
tree35f4d6981655ad093f86df2ba3f7e70608544d84
parenttdf#135061 sw_redlinehide: create frames following hidden table (diff)
downloadcore-40bd193475374addbd8d9e6ade7c617d263df137.tar.gz
core-40bd193475374addbd8d9e6ade7c617d263df137.zip
tdf#135061 sw_redlinehide: fix copy into delete redline following table
When pasting, the entire document body is covered by a delete redline. The insert position is in the last node, whose SwTextFrame has a MergedPara, and the problem is that the MergedPara::pLastNode continues to point to the last node of the document, even when the delete redline is adjusted to end in a newly inserted node by SaveRedlEndPosForRestore::Restore(). Thus afer the 2nd paste, SwDoc::SearchNumRule() goes into infinite loop from node 141 to 86 and then jump via the bad MergedPara back to 141. The reason is that in DocumentContentOperationsManager::CopyWithFlyInFly() the RecreateStartTextFrames() isn't called. This is because it only checks if the preceding node is a text node, while here it is a table node. Fix this by checking if the node at the insert position is merged to a node preceding the previous node. Change-Id: I103b60b2bec86af11006ed591cfda2feb5f575a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127273 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 70ac13eecfa620e94770a64110eeaa05f8c266e6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127317 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit f7455f031b5338b55b0c58822b3502913603e99c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127355 Tested-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx23
1 files changed, 15 insertions, 8 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 758c990e927e..45346c3f1a04 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3450,21 +3450,28 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
aRedlRest.Restore();
if (bMakeNewFrames) // tdf#130685 only after aRedlRest
{ // recreate from previous node (could be merged now)
- if (SwTextNode *const pNode = aSavePos.GetNode().GetTextNode())
+ std::unordered_set<SwTextFrame*> frames;
+ SwTextNode * pNode = aSavePos.GetNode().GetTextNode();
+ SwTextNode *const pEndNode = rInsPos.GetNode().GetTextNode();
+ if (pEndNode)
{
- std::unordered_set<SwTextFrame*> frames;
- SwTextNode *const pEndNode = rInsPos.GetNode().GetTextNode();
- if (pEndNode)
+ SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pEndNode);
+ for (SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
{
- SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pEndNode);
- for (SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
+ if (pFrame->getRootFrame()->IsHideRedlines())
{
- if (pFrame->getRootFrame()->IsHideRedlines())
+ frames.insert(pFrame);
+ // tdf#135061 check if end node is merged to a preceding node
+ if (pNode == nullptr && pFrame->GetMergedPara()
+ && pFrame->GetMergedPara()->pFirstNode->GetIndex() < aSavePos.GetIndex())
{
- frames.insert(pFrame);
+ pNode = pFrame->GetMergedPara()->pFirstNode;
}
}
}
+ }
+ if (pNode != nullptr)
+ {
sw::RecreateStartTextFrames(*pNode);
if (!frames.empty())
{ // tdf#132187 check if the end node needs new frames