summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx21
1 files changed, 11 insertions, 10 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 180196e1a076..e1d5987c5b22 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1132,17 +1132,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
@@ -1153,6 +1144,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) );