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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 25 04:32:52 UTC 2018


 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx  |    3 +--
 writerfilter/source/dmapper/PropertyMap.cxx |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit d351d6badc97a6f63366fabb6568459b2cdb3819
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Fri Dec 14 12:20:49 2018 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Tue Dec 25 05:32:31 2018 +0100

    sw ooxmlimport: landscape <-> portrait ? not a continuous section
    
    If one section has a portrait page layout, and the next section has
    a landscape orientation, then LO cannot consider them to be
    continuous sections, but a page-break must occur.
    
    Change-Id: I4e2229f36919cce4f15ad727378c76480117d7c5
    Reviewed-on: https://gerrit.libreoffice.org/65156
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 726bc3731e36..6d7a3a2b618e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -40,8 +40,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121374_sectionHF, "tdf121374_sectionHF.odt")
     CPPUNIT_ASSERT_EQUAL( OUString("footer"), xFooterText->getString() );
 
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 6, getParagraphs() );
-    CPPUNIT_ASSERT_MESSAGE("Number of pages", getPages() > 2);
-    //CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 6, getPages() );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 6, getPages() );
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf121374_sectionHF2, "tdf121374_sectionHF2.doc")
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 7c1c29b1ebd2..9d236a7ce5c1 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1304,6 +1304,26 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
     // The default section type is nextPage.
     if ( m_nBreakType == -1 )
         m_nBreakType = NS_ooxml::LN_Value_ST_SectionMark_nextPage;
+    // if page orientation differs from previous section, it can't be treated as continuous
+    else if ( m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_continuous )
+    {
+        SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext();
+        if ( pLastContext )
+        {
+            bool bIsLandscape = false;
+            boost::optional< PropertyMap::Property > pProp = getProperty( PROP_IS_LANDSCAPE );
+            if ( pProp )
+                pProp->second >>= bIsLandscape;
+
+            bool bPrevIsLandscape = false;
+            pProp = pLastContext->getProperty( PROP_IS_LANDSCAPE );
+            if ( pProp )
+                pProp->second >>= bPrevIsLandscape;
+
+            if ( bIsLandscape != bPrevIsLandscape )
+                m_nBreakType = NS_ooxml::LN_Value_ST_SectionMark_nextPage;
+        }
+    }
 
     // Text area width is known at the end of a section: decide if tables should be converted or not.
     std::vector<FloatingTableInfo>& rPendingFloatingTables = rDM_Impl.m_aPendingFloatingTables;


More information about the Libreoffice-commits mailing list