diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-05-15 08:56:38 +0200 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-05-15 10:47:25 +0200 |
commit | 1a241d12017d6d6c82427c0d84309e44b7a306ad (patch) | |
tree | ec31c5d0bfb6f416711db03e58e9b40a7dba6fe9 | |
parent | bc5e702c54bcee479af6e0a81b72e87eaad185a3 (diff) |
fdo#49940 dmapper: handle m_bTitlePage when m_nBreakType is zero
We used to ignore m_bTitlePage in this case, resulting in wrong
'Default' page style for the first page, instead of 'First Page'.
Change-Id: I1899354fb39db4f0eb663fd5233395f2d4a5e72a
Signed-off-by: Andras Timar <atimar@suse.com>
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 503052fb2c96..adb8675c14b1 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -802,6 +802,19 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage ) operator[]( PropertyDefinition( PROP_BOTTOM_MARGIN, false )) = uno::makeAny( m_nBottomMargin + nFooterHeight ); } +uno::Reference<beans::XPropertySet> lcl_GetRangeProperties(bool bIsFirstSection, DomainMapper_Impl& rDM_Impl, uno::Reference<text::XTextRange> xStartingRange) +{ + uno::Reference< beans::XPropertySet > xRangeProperties; + if (bIsFirstSection) + { + uno::Reference<container::XEnumerationAccess> xEnumAccess(rDM_Impl.GetBodyText(), uno::UNO_QUERY_THROW); + uno::Reference<container::XEnumeration> xEnum = xEnumAccess->createEnumeration(); + xRangeProperties = uno::Reference<beans::XPropertySet>(xEnum->nextElement(), uno::UNO_QUERY_THROW); + } + else + xRangeProperties = uno::Reference<beans::XPropertySet>(xStartingRange, uno::UNO_QUERY_THROW); + return xRangeProperties; +} void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) { @@ -842,6 +855,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) rDM_Impl.appendTextSectionAfter( m_xStartingRange ); if( m_nColumnCount > 0 && xSection.is()) ApplyColumnProperties( xSection ); + uno::Reference<beans::XPropertySet> xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange)); + xRangeProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_PAGE_DESC_NAME), uno::makeAny(m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName)); } else { @@ -971,15 +986,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) { { //now apply this break at the first paragraph of this section - uno::Reference< beans::XPropertySet > xRangeProperties; - if( m_bIsFirstSection ) - { - uno::Reference< container::XEnumerationAccess > xEnumAccess( rDM_Impl.GetBodyText( ), uno::UNO_QUERY_THROW ); - uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration( ); - xRangeProperties = uno::Reference< beans::XPropertySet >( xEnum->nextElement( ), uno::UNO_QUERY_THROW ); - } - else - xRangeProperties = uno::Reference< beans::XPropertySet >( m_xStartingRange, uno::UNO_QUERY_THROW ); + uno::Reference<beans::XPropertySet> xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange)); /* break type 0 - No break 1 - New Colunn 2 - New page 3 - Even page 4 - odd page */ xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ), |