summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-10-25 16:32:04 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-11-10 19:47:00 +0100
commit346991bc599c081efea91ad79a0a9a9936eaca86 (patch)
tree3d39e5cf8e2f8cb6486137c96238754eb244091b
parent31fb4ceefdd2f4a9bc2334ea35e2c7c789ba6c0b (diff)
sw_redlinehide_3: fix bad redlines in SwDoc::MoveParagraph()
Avoid creating a redline that ends on an EndNode (if the moved node is the last in the body), and also ensure that the redline has valid SwIndex nContent in its positions (because lcl_CheckPosition asserts that). Change-Id: I9b89d8cbc180453c24d9690ac937adb4512f0aeb
-rw-r--r--sw/source/core/doc/docnum.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index ef9a8068ad13..299d493c2250 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1992,11 +1992,12 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
SwPosition aInsPos( aIdx );
aInsPos.nContent.Assign( aIdx.GetNode().GetContentNode(), 0 );
- SwPaM aPam( pStt->nNode, aMvRg.aEnd );
+ SwPaM aPam( pStt->nNode, 0, aMvRg.aEnd, 0 );
SwPaM& rOrigPam = const_cast<SwPaM&>(rPam);
rOrigPam.DeleteMark();
rOrigPam.GetPoint()->nNode = aIdx.GetIndex() - 1;
+ rOrigPam.GetPoint()->nContent.Assign( rOrigPam.GetContentNode(), 0 );
bool bDelLastPara = !aInsPos.nNode.GetNode().IsContentNode();
@@ -2057,6 +2058,14 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
++rOrigPam.GetPoint()->nNode;
rOrigPam.GetPoint()->nContent.Assign( rOrigPam.GetContentNode(), 0 );
+ assert(*aPam.GetMark() < *aPam.GetPoint());
+ if (aPam.GetPoint()->nNode.GetNode().IsEndNode())
+ { // ensure redline ends on content node
+ --aPam.GetPoint()->nNode;
+ assert(aPam.GetPoint()->nNode.GetNode().IsTextNode());
+ SwTextNode *const pNode(aPam.GetPoint()->nNode.GetNode().GetTextNode());
+ aPam.GetPoint()->nContent.Assign(pNode, pNode->Len());
+ }
RedlineFlags eOld = getIDocumentRedlineAccess().GetRedlineFlags();
GetDocumentRedlineManager().checkRedlining(eOld);