summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-02-23 16:07:18 +0100
committerMichael Stahl <mstahl@redhat.com>2017-02-23 16:42:39 +0100
commitf1bd815f60c78495259ae19ea68eacdb8b43a9e8 (patch)
tree9eb9d34969d93068ac0d724f66717d12ec4e11a5 /sw
parent10e733908038407791f9c14af2a86417cc4a653c (diff)
sw: fix cursor backup in SwXText::insertTextPortion()
If the inserted string contains "\r", such as when importing lp556169-2.rtf before the previous fix, the given cursor has one of its positions mangled because its nNode will be on the new node, but the nContent that is restored here is on the old node. The invalid cursor causes an assert in the subsequent SetPropertyValues. Change-Id: I73a2e6ecd02ccf75f7b9ffd89d90ae1e3a93ceb2
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/unocore/unotext.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index f32836a11ff3..78cce4887deb 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1352,10 +1352,12 @@ SwXText::insertTextPortion(
if (!rText.isEmpty())
{
+ SwNodeIndex const nodeIndex(rCursor.GetPoint()->nNode, -1);
const sal_Int32 nContentPos = rCursor.GetPoint()->nContent.GetIndex();
SwUnoCursorHelper::DocInsertStringSplitCR(
*m_pImpl->m_pDoc, rCursor, rText, false);
SwUnoCursorHelper::SelectPam(rCursor, true);
+ rCursor.GetPoint()->nNode = SwNodeIndex(nodeIndex, +1);
rCursor.GetPoint()->nContent = nContentPos;
}