Kaydet (Commit) 3223f3ee authored tarafından Michael Stahl's avatar Michael Stahl

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
üst 28382b92
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment