diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-12-05 16:26:22 +0100 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-12-06 19:03:19 +0100 |
commit | a12d8a0a77ad3a6e99857b706e161f4d62c7cb39 (patch) | |
tree | 1042f6b0f6efc8e52ca225238665baf7f41975dd /sw/source/core | |
parent | 9075687133063fea49e8b3d739d65dfa9e69cc7f (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/source/core')
-rw-r--r-- | sw/source/core/text/itratr.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/redlnitr.cxx | 30 |
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) { |