summaryrefslogtreecommitdiff
path: root/writerfilter
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 16:49:00 +0100
commita23fc47fccb907dc7a3197982ea541834f5d8fd7 (patch)
tree83dbff6524109fa567ab79f2ff09a4583db1331b /writerfilter
parent744c4a4f4eb2555d3a0c1aba9fa74209a8f1942d (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)
Diffstat (limited to 'writerfilter')
-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 9381f73d4ba3..ef16af5edc5c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -279,8 +279,21 @@ void DomainMapper_Impl::RemoveLastParagraph( )
}
else
xCursor.set(m_aTextAppendStack.top().xCursor, uno::UNO_QUERY);
- xCursor->goLeft( 1, true );
- xCursor->setString(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& )
{