summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-01-03 16:40:29 +0100
committerMiklos Vajna <vmiklos@suse.cz>2013-01-04 17:04:20 +0100
commitf60a7f9af31f69ebe22f2deffa6ebe4132a50e56 (patch)
treea734c6178370d872b7df90a8da1c0fecd5ebe0b2
parent10536938a1f96c985b6deb6683ff1e1b64d040e7 (diff)
n#793262 fix DOCX import of last empty header/footer para char props
At the end of the header/footer import, the last empty paragraph was removed. In case the last but one paragraph was empty, but had character properties (e.g. a custom font size), the removal changed these, and used the character properties of the last paragraph instead. Simply dispose the last paragraph, this way character properties are always kept. (cherry picked from commit e8b661dd0aed9b35104e910acbb814748a2c3af0) Conflicts: writerfilter/source/dmapper/DomainMapper_Impl.cxx Change-Id: Ic78f197fe99458becb9d86901bee6dfcb7076a13
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx17
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)
{