diff options
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index e6ea2183d57c..78e0844e4f10 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -467,6 +467,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf136589_paraHadField, "tdf136589_paraHadField.doc { // The section break should not add an additional CR - which equals an empty page two. CPPUNIT_ASSERT_EQUAL(2, getPages()); + + //tdf#118711 - don't explicity specify the default page style at the beginning of the document + uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(uno::Any(), xPara->getPropertyValue("PageDescName")); } DECLARE_OOXMLEXPORT_TEST(testTdf133370_columnBreak, "tdf133370_columnBreak.odt") diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 3bb0167678b8..4cdd76e91a2c 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1832,12 +1832,16 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) { // Avoid setting page style in case of autotext: so inserting the autotext at the // end of the document does not introduce an unwanted page break. - if (!rDM_Impl.IsReadGlossaries() && !rDM_Impl.IsInFootOrEndnote()) + // Also avoid setting the page style at the very beginning if it still is the default page style. + const OUString sPageStyle = m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName; + if (!rDM_Impl.IsReadGlossaries() + && !rDM_Impl.IsInFootOrEndnote() + && !(m_bIsFirstSection && sPageStyle == getPropertyName( PROP_STANDARD ) && m_nPageNumber < 0) + ) { xRangeProperties->setPropertyValue( getPropertyName( PROP_PAGE_DESC_NAME ), - uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName - : m_sFollowPageStyleName ) ); + uno::makeAny(sPageStyle) ); } if (0 <= m_nPageNumber) |