[Libreoffice-commits] core.git: writerfilter/source

Justin Luth justin_luth at sil.org
Sat Jul 30 04:33:45 UTC 2016


 writerfilter/source/dmapper/PropertyMap.cxx |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 4a6329badc9c8679945d1a1ec225e26e15d7bfd2
Author: Justin Luth <justin_luth at sil.org>
Date:   Fri Jul 29 22:03:55 2016 +0300

    docx - inherit FollowPage before FirstPage
    
    GetPageStyle(bTitlePage == true) will check if the follow exists.
    If not, it will create a new style - which defeats the purpose
    of inheriting from the previous section if this section didn't define
    a new follow.
    
    Change-Id: I235bc9b7bc35c9875295733313a6452ba8896c4f
    Reviewed-on: https://gerrit.libreoffice.org/27700
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 094e2b4..f36c150 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1126,17 +1126,8 @@ throw ( css::beans::UnknownPropertyException,
 
     // if no new styles have been created for this section, inherit from the previous section,
     // otherwise apply this section's settings to the new style.
+    // Ensure that FollowPage is inherited first - otherwise GetPageStyle may auto-create a follow when checking FirstPage.
     SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext();
-    if( pLastContext && m_sFirstPageStyleName.isEmpty() )
-        m_sFirstPageStyleName =  pLastContext->GetPageStyleName( /*bFirst=*/true );
-    else
-    {
-        HandleMarginsHeaderFooter( /*bFirst=*/true, rDM_Impl );
-        GetPageStyle( xPageStyles, xTextFactory, /*bFirst=*/true );
-        if( rDM_Impl.IsNewDoc() && m_aFirstPageStyle.is() )
-            ApplyProperties_( m_aFirstPageStyle );
-    }
-
     if( pLastContext && m_sFollowPageStyleName.isEmpty() )
         m_sFollowPageStyleName = pLastContext->GetPageStyleName();
     else
@@ -1147,6 +1138,16 @@ throw ( css::beans::UnknownPropertyException,
             ApplyProperties_( m_aFollowPageStyle );
     }
 
+    if( pLastContext && m_sFirstPageStyleName.isEmpty() )
+        m_sFirstPageStyleName =  pLastContext->GetPageStyleName( /*bFirst=*/true );
+    else
+    {
+        HandleMarginsHeaderFooter( /*bFirst=*/true, rDM_Impl );
+        GetPageStyle( xPageStyles, xTextFactory, /*bFirst=*/true );
+        if( rDM_Impl.IsNewDoc() && m_aFirstPageStyle.is() )
+            ApplyProperties_( m_aFirstPageStyle );
+    }
+
     GetPageStyle( xPageStyles, xTextFactory, /*bFirst=*/true );
     // Chain m_aFollowPageStyle to be after m_aFirstPageStyle
     m_aFirstPageStyle->setPropertyValue( "FollowStyle", uno::makeAny(m_sFollowPageStyleName) );


More information about the Libreoffice-commits mailing list