summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-12-05 16:26:22 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-12-18 17:55:28 +0100
commit8af496c93328e4fee3972957e27b953fdb325bac (patch)
tree7d30741b89e5ea86d398ba47e8b67ad90d70556a /sw
parent9b67b6a6d4b912f1e515d3884fa02c1be8aa6921 (diff)
sw_redlinehide_4b: fix wrong handling of IsDelLastPara() redlines
CheckParaRedlineMerge(): Fully deleted SwTextNode followed by a table, as seen in ooo81405-1.odt and ooo31961-16.sxw. Also avoid creating an extent for the node in which it starts, e.g. ooo31961-27.odt. Change-Id: I2a7d935a9cedcb66aeaa9dce418b1fab758f1784
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/itratr.cxx2
-rw-r--r--sw/source/core/text/redlnitr.cxx30
2 files changed, 27 insertions, 5 deletions
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 3bd7075cb9ed..827a29e8538f 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -740,6 +740,8 @@ TextFrameIndex SwAttrIter::GetNextAttr() const
if (redline.second.first)
{
assert(m_pMergedPara);
+ assert(redline.second.first->End()->nNode.GetIndex() <= m_pMergedPara->pLastNode->GetIndex()
+ || !redline.second.first->End()->nNode.GetNode().IsTextNode());
if (CanSkipOverRedline(*redline.second.first,
nStartIndex, nEndIndex, m_nPosition == redline.first))
{ // if current position is start of the redline, must skip!
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index e73a478ce737..0b92335a7e97 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -124,12 +124,32 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode,
}
pTmp->SetRedlineMergeFlag(SwNode::Merge::Hidden);
}
- pNode = pEnd->nNode.GetNode().GetTextNode();
- assert(pNode);
- nodes.push_back(pNode);
- pNode->SetRedlineMergeFlag(SwNode::Merge::NonFirst);
+ // note: in DelLastPara() case, the end node is not actually merged
+ // and is likely a SwTableNode!
+ if (!pEnd->nNode.GetNode().IsTextNode())
+ {
+ assert(pEnd->nNode != pStart->nNode);
+ // must set pNode too because it will mark the last node
+ pNode = nodes.back();
+ assert(pNode == pNode->GetNodes()[pEnd->nNode.GetIndex() - 1]);
+ if (pNode != &rTextNode)
+ { // something might depend on last merged one being NonFirst?
+ pNode->SetRedlineMergeFlag(SwNode::Merge::NonFirst);
+ }
+ nLastEnd = pNode->Len();
+ }
+ else
+ {
+ pNode = pEnd->nNode.GetNode().GetTextNode();
+ nodes.push_back(pNode);
+ pNode->SetRedlineMergeFlag(SwNode::Merge::NonFirst);
+ nLastEnd = pEnd->nContent.GetIndex();
+ }
+ }
+ else
+ {
+ nLastEnd = pEnd->nContent.GetIndex();
}
- nLastEnd = pEnd->nContent.GetIndex();
}
if (pNode == &rTextNode)
{