sw/qa/extras/ooxmlexport/ooxmlexport15.cxx  |    4 ++++
 writerfilter/source/dmapper/PropertyMap.cxx |   10 +++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit c6e46a2fdef325a94ef2d43f5eb4a0ff47b28a14
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Thu Dec 10 16:48:06 2020 +0300
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Dec 16 10:30:58 2020 +0100

    tdf#118711 writerfilter: don't hardcode default page description
    
    well, at least not at the beginning of the document.
    
    The problem with specifying is that it becomes a property
    of the paragraph - and so if the paragraph is copied or moved,
    the page break comes along with it and the user has to remove
    the unnecessary page break wherever it lands.
    
    Since the default will be applied anyway,
    there is no value in specifying it.
    
    I'm not sure how, but at least one test document started
    with a Converted1 style, so I had to explicitly confirm
    that the stylename really did match the default
    for a first section.
    
    A unit test also indicated that
    it needs to be specified if an explict page number is assigned
    because RES_PAGEDESC contains MID_PAGEDESC_PAGEDESCNAME
    as well as MID_PAGEDESC_PAGENUMOFFSET.
    
    Change-Id: I0d0f6b70767f7daaf300e09c0d31ac4b17b91ed1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107555
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_l...@sil.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    (cherry picked from commit 8787a45f9cbb5dce61b20817ef0e549b5a227a95)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107709
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 20f9c75a311c..7dd4feae324a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -469,6 +469,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 b7457fa418b7..f3fa51ab8c55 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1827,12 +1827,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)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to