diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-01-03 16:40:29 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-01-04 14:49:05 +0100 |
commit | e8b661dd0aed9b35104e910acbb814748a2c3af0 (patch) | |
tree | 636051c870556e7adbbdfd6947ddbd889d169978 | |
parent | 2f3749efd781c2095a5782eee1b070bc3dc0fcc0 (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.
-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 3b8e2d86e192..8716c0d54cc8 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -278,8 +278,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& ) { |