MSWordExportBase::OutputSectionBreaks: avoid fake section breaks
Regression from ee9f23bb94b4c2c8c4db6466ecca272a092e9492 (docx export:
invalid sectPr added at the beginning of the doc, 2013-01-10), the
problem was that we even tried to generate section breaks at places
where the two page styles are in practice the same.
Change-Id: Iccf91ce542d9b075b93da25bcd42236db667e3d4
diff --git a/sw/qa/extras/ooxmlexport/data/unwanted-section-break.docx b/sw/qa/extras/ooxmlexport/data/unwanted-section-break.docx
new file mode 100644
index 0000000..a8565742
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/unwanted-section-break.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 1fdc15e..77d8b4c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2532,7 +2532,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo77718, "fdo77718.docx")
DECLARE_OOXMLEXPORT_TEST(testTableCurruption, "tableCurrupt.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/header4.xml");
xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
if (!pXmlDoc)
return;
CPPUNIT_ASSERT(pXmlDoc) ;
@@ -2635,7 +2635,7 @@ DECLARE_OOXMLEXPORT_TEST(testOLEObjectinHeader, "2129393649.docx")
// Problem was relationship entry for oleobject from header was
// exported into document.xml.rels file because of this rels file
// for headers were missing from document/word/rels.
xmlDocPtr pXmlDoc = parseExport("word/_rels/header3.xml.rels");
xmlDocPtr pXmlDoc = parseExport("word/_rels/header1.xml.rels");
if(!pXmlDoc)
return;
@@ -2971,12 +2971,12 @@ DECLARE_OOXMLEXPORT_TEST(testContentTypeOLE, "fdo77759.docx")
DECLARE_OOXMLEXPORT_TEST(testfdo78420, "fdo78420.docx")
{
xmlDocPtr pXmlHeader = parseExport("word/header3.xml");
xmlDocPtr pXmlHeader = parseExport("word/header2.xml");
if (!pXmlHeader)
return;
xmlDocPtr pXmlHeaderRels = parseExport("word/_rels/header3.xml.rels");
xmlDocPtr pXmlHeaderRels = parseExport("word/_rels/header2.xml.rels");
if(!pXmlHeaderRels)
return;
@@ -3409,6 +3409,13 @@ DECLARE_OOXMLEXPORT_TEST(testPlausableBorder, "plausable-border.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:br", 1);
}
DECLARE_OOXMLEXPORT_TEST(testUnwantedSectionBreak, "unwanted-section-break.docx")
{
if (xmlDocPtr pXmlDoc = parseExport())
// This was 2: an additional sectPr was added to the document.
assertXPath(pXmlDoc, "//w:sectPr", 1);
}
DECLARE_OOXMLEXPORT_TEST(testfdo80897 , "fdo80897.docx")
{
xmlDocPtr pXmlDoc = parseExport();
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 6de7aec..e831bf7 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -443,7 +443,7 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode
if ( isCellOpen && ( pAktPageDesc->GetName() != pPageDesc->GetName() ) )
pSet = NULL;
}
else
else if (!sw::util::IsPlausableSingleWordSection(pAktPageDesc->GetFirstMaster(), pPageDesc->GetMaster()))
{
bBreakSet = true;
bNewPageDesc = true;