summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-12-14 12:20:49 +0300
committerJustin Luth <justin_luth@sil.org>2018-12-25 05:32:31 +0100
commitd351d6badc97a6f63366fabb6568459b2cdb3819 (patch)
treead351f187b3a0175a5f9a961dba0683f609f4b0d
parent1a4a314132acb2d2980d1bebd4238960b747c99e (diff)
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@sil.org>
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport13.cxx3
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx20
2 files changed, 21 insertions, 2 deletions
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;