diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-08-12 11:53:45 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-08-12 12:35:19 +0200 |
commit | c73b8072a1732f829d3d6ba6c1172d96d55b1c4f (patch) | |
tree | 56f07ac0c0956e4524ff5af78eec355d90dd23af /writerfilter | |
parent | ae035a32737a77be75c9d017f7f5a90a05048e06 (diff) |
fdo#63428 writerfilter: fix paste of commented text ranges
There were multiple problems here:
- xFoo->createTextCursorByRange() got a text range argument,
where the text range wasn't from the xFoo text
- it was assumed that all XText implements text::XParagraphCursor as
well, but this is not true for e.g. comment text
- commented text ranges were pasted as normal comments (once again, the
insert position wasn't passed around)
Change-Id: I9a975a08b08a7f32b1ee71e42f58736cc0dbb09d
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index eb8fd3ce749e..56c476580591 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -290,7 +290,7 @@ void DomainMapper_Impl::RemoveLastParagraph( ) uno::Reference<lang::XComponent> xParagraph(xEnumeration->nextElement(), uno::UNO_QUERY); xParagraph->dispose(); } - else + else if (xCursor.is()) { xCursor->goLeft( 1, true ); // If this is a text on a shape, possibly the text has the trailing @@ -1603,7 +1603,7 @@ void DomainMapper_Impl::PushAnnotation() uno::Reference< text::XText > xAnnotationText; m_xAnnotationField->getPropertyValue("TextRange") >>= xAnnotationText; m_aTextAppendStack.push(TextAppendContext(uno::Reference< text::XTextAppend >( xAnnotationText, uno::UNO_QUERY_THROW ), - m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xAnnotationText->getStart()))); + m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : xAnnotationText->createTextCursorByRange(xAnnotationText->getStart()))); } catch( const uno::Exception& rException) { @@ -3626,8 +3626,13 @@ void DomainMapper_Impl::AddAnnotationPosition(const bool bStart) uno::Reference<text::XTextRange> xCurrent; if (xTextAppend.is()) { - uno::Reference<text::XTextCursor> xCursor = xTextAppend->createTextCursorByRange(xTextAppend->getEnd()); - xCurrent = xCursor->getStart(); + uno::Reference<text::XTextCursor> xCursor; + if (m_bIsNewDoc) + xCursor = xTextAppend->createTextCursorByRange(xTextAppend->getEnd()); + else + xCursor = m_aTextAppendStack.top().xCursor; + if (xCursor.is()) + xCurrent = xCursor->getStart(); } // And save it, to be used by PopAnnotation() later. |