summaryrefslogtreecommitdiff
path: root/sw/source/core/doc
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-03-07 23:12:44 +0100
committerAndras Timar <andras.timar@collabora.com>2017-03-10 16:22:41 +0100
commitb6da47459bfb909001d5cf7a97e8a15f653ce796 (patch)
tree8153247a1762acda428a75ec302a7f12ba556cc6 /sw/source/core/doc
parente05286af282812b14250c7e026825edfb2c76491 (diff)
tdf#106218 sw: compare document: tweak special handling of EndOfContent
In case the last paragraph in the document is inserted or deleted, the redline must not be positioned on the EndOfContent node (i#101009). But then rejecting the redline will have an additional paragraph as compared to the original document. Try to avoid that by tweaking the start position of the redline to the end of the previous paragraph. (regression from f4609c4c294a62023b6cd6baeb6a73d44992dec3) Change-Id: Iae75042a3124d0f3bca955fb856c94a6f478b986 (cherry picked from commit 9b3fa51e7ba4e2bfe9806295c3cbc8db347480d8) Reviewed-on: https://gerrit.libreoffice.org/34960 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit a990b46ccc788db45ff4d8f0d47b799782ecb2af)
Diffstat (limited to 'sw/source/core/doc')
-rw-r--r--sw/source/core/doc/doccomp.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 53576828d8b4..c2da0bc91261 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1683,6 +1683,17 @@ void CompareData::SetRedlinesToDoc( bool bUseDocInfo )
SwContentNode *const pContentNode( pTmp->GetContentNode() );
pTmp->GetPoint()->nContent.Assign( pContentNode,
(pContentNode) ? pContentNode->Len() : 0 );
+ // tdf#106218 try to avoid losing a paragraph break here:
+ if (pTmp->GetMark()->nContent == 0)
+ {
+ SwNodeIndex const prev(pTmp->GetMark()->nNode, -1);
+ if (prev.GetNode().IsTextNode())
+ {
+ *pTmp->GetMark() = SwPosition(
+ *prev.GetNode().GetTextNode(),
+ prev.GetNode().GetTextNode()->Len());
+ }
+ }
}
rDoc.getIDocumentRedlineAccess().DeleteRedline( *pTmp, false, USHRT_MAX );
@@ -1715,6 +1726,17 @@ void CompareData::SetRedlinesToDoc( bool bUseDocInfo )
SwContentNode *const pContentNode( pTmp->GetContentNode() );
pTmp->GetPoint()->nContent.Assign( pContentNode,
(pContentNode) ? pContentNode->Len() : 0 );
+ // tdf#106218 try to avoid losing a paragraph break here:
+ if (pTmp->GetMark()->nContent == 0)
+ {
+ SwNodeIndex const prev(pTmp->GetMark()->nNode, -1);
+ if (prev.GetNode().IsTextNode())
+ {
+ *pTmp->GetMark() = SwPosition(
+ *prev.GetNode().GetTextNode(),
+ prev.GetNode().GetTextNode()->Len());
+ }
+ }
}
} while( pInsRing != ( pTmp = pTmp->GetNext()) );
SwRedlineData aRedlnData( nsRedlineType_t::REDLINE_INSERT, nAuthor, aTimeStamp,