[Libreoffice-commits] .: writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Sep 26 02:35:26 PDT 2012
writerfilter/source/dmapper/PropertyMap.cxx | 29 ++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
New commits:
commit 211916f86585cb4f6258eb30e0474e4c21cd37f1
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Sep 26 11:14:04 2012 +0200
n#780843 fix docx import of cont section's header/footer on title page
Change-Id: I129e154a3fea8a96607dc6350a99f4d6ca68196e
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 682a3d7..e1258cc 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1001,6 +1001,35 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
if ((m_bTitlePage && m_bIsFirstSection) || !m_bTitlePage)
xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ),
uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName ));
+ else
+ {
+ // In this miserable situation (second or later section on a title page), make sure that the header / footer is not lost.
+ uno::Reference< container::XNameAccess > xPageStyles(rDM_Impl.GetPageStyles(), uno::UNO_QUERY);
+ if (xPageStyles->hasByName(m_sFollowPageStyleName))
+ {
+ uno::Reference<beans::XPropertySet> xCurrent(xPageStyles->getByName(rPropNameSupplier.GetName(PROP_STANDARD)), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xFollow(xPageStyles->getByName(m_sFollowPageStyleName), uno::UNO_QUERY);
+
+ if (xFollow->getPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_ON)).get<sal_Bool>())
+ {
+ xCurrent->setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_ON), uno::makeAny(sal_True));
+ uno::Reference<text::XTextRange> xCurrentRange(xCurrent->getPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_TEXT)), uno::UNO_QUERY_THROW);
+ xCurrentRange->setString("");
+ uno::Reference<text::XTextCopy> xCurrentTxt(xCurrentRange, uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextCopy> xFollowTxt(xFollow->getPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_TEXT)), uno::UNO_QUERY_THROW);
+ xCurrentTxt->copyText(xFollowTxt);
+ }
+ if (xFollow->getPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_ON)).get<sal_Bool>())
+ {
+ xCurrent->setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_ON), uno::makeAny(sal_True));
+ uno::Reference<text::XTextRange> xCurrentRange(xCurrent->getPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_TEXT)), uno::UNO_QUERY_THROW);
+ xCurrentRange->setString("");
+ uno::Reference<text::XTextCopy> xCurrentTxt(xCurrentRange, uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextCopy> xFollowTxt(xFollow->getPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_TEXT)), uno::UNO_QUERY_THROW);
+ xCurrentTxt->copyText(xFollowTxt);
+ }
+ }
+ }
// handle page breaks with odd/even page numbering
style::PageStyleLayout nPageStyleLayout(style::PageStyleLayout_ALL);
if (m_nBreakType == 3)
More information about the Libreoffice-commits
mailing list