summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docnum.cxx
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-15 15:10:04 +0100
commit39750e1c1f83c67d67b312cfd71372c352e0cac0 (patch)
treef94241afd7f5cbd3e357e235ae5d22c18fd3b2b0 /sw/source/core/doc/docnum.cxx
parenta823343fd36fa222f2a79d7325ce0524f0375b93 (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
Diffstat (limited to 'sw/source/core/doc/docnum.cxx')
-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 42a0fd6d3725..bc8d084f548a 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1981,11 +1981,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();
@@ -2046,6 +2047,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);