summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-12-17 14:10:50 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-12-17 22:38:20 +0100
commite700b5c25f094f11bdb92b3fdb67a27420e805a9 (patch)
treeff5daf8cca0dbd8859c637b6da29ef484abac9a3 /sw/source
parentc247023dfd10bef22b9ff5a85cc44febfc90e951 (diff)
tdf#137318 sw_redlinehide: fix JoinNext() if deleted node contains redlines
The GetRedlineMergeFlag() of the deleted node is None also if there are deletions contained completely inside the node, but in this case the merged node does need a MergedPara, so check if the deleted node had a frame that has a MergedPara in addition to the flag (which remains as an "optimization"). (regression from d258fc29560baa5ecae03ebc2740e11420643e27) Change-Id: I44456f230374ec1de159106678e80fb4670c9f33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127011 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 31f51598fd08c2b76583a1baad0c0d6d4b336664) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126978 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx20
1 files changed, 17 insertions, 3 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 2fefd8b42f50..581c7f344a74 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1016,6 +1016,22 @@ SwContentNode *SwTextNode::JoinNext()
rDoc.CorrAbs( aIdx, SwPosition( *this ), nOldLen, true );
}
SwNode::Merge const eOldMergeFlag(pTextNode->GetRedlineMergeFlag());
+ auto eRecreateMerged(eOldMergeFlag == SwNode::Merge::First
+ ? sw::Recreate::ThisNode
+ : sw::Recreate::No);
+ if (eRecreateMerged == sw::Recreate::No)
+ {
+ // tdf#137318 if a delete is inside one node, flag is still None!
+ SwIterator<SwTextFrame, SwTextNode, sw::IteratorMode::UnwrapMulti> aIter(*pTextNode);
+ for (SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
+ {
+ if (pFrame->GetMergedPara())
+ {
+ eRecreateMerged = sw::Recreate::ThisNode;
+ break;
+ }
+ }
+ }
bool bOldHasNumberingWhichNeedsLayoutUpdate = HasNumberingWhichNeedsLayoutUpdate(*pTextNode);
rNds.Delete(aIdx);
@@ -1030,9 +1046,7 @@ SwContentNode *SwTextNode::JoinNext()
InvalidateNumRule();
}
- CheckResetRedlineMergeFlag(*this, eOldMergeFlag == SwNode::Merge::First
- ? sw::Recreate::ThisNode
- : sw::Recreate::No);
+ CheckResetRedlineMergeFlag(*this, eRecreateMerged);
}
else {
OSL_FAIL( "No TextNode." );