summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-09-06 17:54:46 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-09-19 10:08:55 +0200
commitd0a9f2aef8512ed922b2c41b1de0aa92ff581019 (patch)
treeb435b4d5eaecddca81d5a815b6ff8494f703cdfc
parentbe7cb6820e67771683d9627049316156549b935b (diff)
sw_redlinehide_2: tweak CheckParaRedlineMerge() next-node flag update
If there's a table or section affected by the editing operation, then it has to be ensured that the table node / section node has its flag reset on Undo; also the next text node following the table, as CheckParaRedlineMerge() isn't called for table nodes. Change-Id: Ic1b085619adbeba69fa641a3a7492b71966fee6e
-rw-r--r--sw/source/core/text/redlnitr.cxx40
1 files changed, 36 insertions, 4 deletions
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index b32ac32ac5f4..ccfc4ac803db 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -139,11 +139,43 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode,
rTextNode.SetRedlineMergeFlag(SwNode::Merge::None);
}
}
- {
- SwNode *const pNextNode(pNode->GetNodes()[pNode->GetIndex() + 1]);
- if (!pNextNode->IsCreateFrameWhenHidingRedlines())
+ // Reset flag of the following text node since we know it's not merged;
+ // also any table/sections in between.
+ // * the following SwTextNode is in same nodes section as pNode (nLevel=0)
+ // * the start nodes that don't have a SwTextNode before them
+ // on their level, and their corresponding end nodes
+ // * the first SwTextNode inside each start node of the previous point
+ // Other (non-first) SwTextNodes in nested sections shouldn't be reset!
+ int nLevel(0);
+ for (sal_uLong j = pNode->GetIndex() + 1; j < pNode->GetNodes().Count(); ++j)
+ {
+ SwNode *const pTmp(pNode->GetNodes()[j]);
+ if (!pTmp->IsCreateFrameWhenHidingRedlines())
{ // clear stale flag caused by editing with redlines shown
- pNextNode->SetRedlineMergeFlag(SwNode::Merge::None);
+ pTmp->SetRedlineMergeFlag(SwNode::Merge::None);
+ }
+ if (pTmp->IsStartNode())
+ {
+ ++nLevel;
+ }
+ else if (pTmp->IsEndNode())
+ {
+ if (nLevel == 0)
+ {
+ break; // there is no following text node; avoid leaving section
+ }
+ --nLevel;
+ }
+ else if (pTmp->IsTextNode())
+ {
+ if (nLevel == 0)
+ {
+ break; // done
+ }
+ else
+ { // skip everything other than 1st text node in section!
+ j = pTmp->EndOfSectionIndex() - 1; // will be incremented again
+ }
}
}
if (!bHaveRedlines)