diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-02-07 16:02:51 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-02-08 12:01:06 +0100 |
commit | 9f5f7287d910eec56420f536a7658d5fd55c7653 (patch) | |
tree | ad5cc332dbacb7daa7bca0e48e86a77a5745a7a5 /writerfilter/source | |
parent | ad5f3db93d258f8ab08e74e40b1476437ed596d5 (diff) |
RTF paste: fix cursor creation on shapes
This went wrong in commit 232ad2f2588beff50cb5c1f3b689c581ba317583 (API
CHANGE: add a "position" parameter to XParagraph/TextPortionAppend
methods, 2012-11-28), the problem is that the text range is part of the
shape text's node range, so we have to call createTextCursorByRange() on
the shape's XText, not on the body text.
Change-Id: Ifa97213659130b8c279022a6a03f920dca6061bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129603
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
(cherry picked from commit ce8b6f3426e55b6d09a52eb4a7d17614fc1a6c15)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129612
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'writerfilter/source')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 65546cb297f8..35b9964ef73d 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3553,10 +3553,17 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape } else { - uno::Reference< text::XTextRange > xShapeText( xShape, uno::UNO_QUERY_THROW); + uno::Reference<text::XTextRange> xShapeTextRange(xShape, uno::UNO_QUERY_THROW); // Add the shape to the text append stack - m_aTextAppendStack.push( TextAppendContext(uno::Reference< text::XTextAppend >( xShape, uno::UNO_QUERY_THROW ), - m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xShapeText->getStart() ))); + uno::Reference<text::XTextAppend> xShapeTextAppend(xShape, uno::UNO_QUERY_THROW); + uno::Reference<text::XTextCursor> xTextCursor; + if (!m_bIsNewDoc) + { + xTextCursor = xShapeTextRange->getText()->createTextCursorByRange( + xShapeTextRange->getStart()); + } + TextAppendContext aContext(xShapeTextAppend, xTextCursor); + m_aTextAppendStack.push(aContext); // Add the shape to the anchored objects stack uno::Reference< text::XTextContent > xTxtContent( xShape, uno::UNO_QUERY_THROW ); |