Kaydet (Commit) 39750e1c authored tarafından Michael Stahl's avatar Michael Stahl

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
üst a823343f
...@@ -1981,11 +1981,12 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv ) ...@@ -1981,11 +1981,12 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
SwPosition aInsPos( aIdx ); SwPosition aInsPos( aIdx );
aInsPos.nContent.Assign( aIdx.GetNode().GetContentNode(), 0 ); 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); SwPaM& rOrigPam = const_cast<SwPaM&>(rPam);
rOrigPam.DeleteMark(); rOrigPam.DeleteMark();
rOrigPam.GetPoint()->nNode = aIdx.GetIndex() - 1; rOrigPam.GetPoint()->nNode = aIdx.GetIndex() - 1;
rOrigPam.GetPoint()->nContent.Assign( rOrigPam.GetContentNode(), 0 );
bool bDelLastPara = !aInsPos.nNode.GetNode().IsContentNode(); bool bDelLastPara = !aInsPos.nNode.GetNode().IsContentNode();
...@@ -2046,6 +2047,14 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv ) ...@@ -2046,6 +2047,14 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
++rOrigPam.GetPoint()->nNode; ++rOrigPam.GetPoint()->nNode;
rOrigPam.GetPoint()->nContent.Assign( rOrigPam.GetContentNode(), 0 ); 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(); RedlineFlags eOld = getIDocumentRedlineAccess().GetRedlineFlags();
GetDocumentRedlineManager().checkRedlining(eOld); GetDocumentRedlineManager().checkRedlining(eOld);
......
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