diff options
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 5c760e4ce431..00f5f2f7ea1c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -298,8 +298,21 @@ void DomainMapper_Impl::RemoveLastParagraph( ) { uno::Reference< text::XTextCursor > xCursor = xTextAppend->createTextCursor(); xCursor->gotoEnd(false); - xCursor->goLeft( 1, true ); - xCursor->setString(::rtl::OUString()); + uno::Reference<container::XEnumerationAccess> xEnumerationAccess(xCursor, uno::UNO_QUERY); + // Keep the character properties of the last but one paragraph, even if + // it's empty. This works for headers/footers, and maybe in other cases + // as well, but surely not in textboxes. + if (m_bInHeaderFooterImport && xEnumerationAccess.is()) + { + uno::Reference<container::XEnumeration> xEnumeration = xEnumerationAccess->createEnumeration(); + uno::Reference<lang::XComponent> xParagraph(xEnumeration->nextElement(), uno::UNO_QUERY); + xParagraph->dispose(); + } + else + { + xCursor->goLeft( 1, true ); + xCursor->setString(OUString()); + } } catch( const uno::Exception& rEx) { |