[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source

Andras Timar timar at kemper.freedesktop.org
Tue May 15 01:48:39 PDT 2012


 writerfilter/source/dmapper/PropertyMap.cxx |   25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

New commits:
commit 1a241d12017d6d6c82427c0d84309e44b7a306ad
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue May 15 08:56:38 2012 +0200

    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 at suse.com>

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 503052f..adb8675 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 ),


More information about the Libreoffice-commits mailing list