tdf#132149 ww8export: nextNode has nothing to do with pageDesc
While it can often be assumed that the next paragraph following
one that has just soft-page-breaked in the middle will be on the
same page, it isn't necessarily correct. Either the paragraph
could span multiple pages, or a page-break could push it to
the next page.
Thus, strip the code out completely, and simply prepare a
new page style based on the follow style - which by definition
is different enough to not be a plausible single word section.
A few followup commits will add enhancements, but this is
broken up into minute bits in order to aid in regression
identification.
Change-Id: I80e4e17be69a49f45a624d819c9c4158541ee065
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101424
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf132149_pgBreak.odt b/sw/qa/extras/ooxmlexport/data/tdf132149_pgBreak.odt
new file mode 100644
index 0000000..b88e660
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf132149_pgBreak.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 821a254..397b904 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -329,6 +329,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c15, "tdf135343_column
CPPUNIT_ASSERT_EQUAL_MESSAGE("Fits on two pages", 2, getPages());
}
DECLARE_OOXMLEXPORT_TEST(testTdf132149_pgBreak, "tdf132149_pgBreak.odt")
{
xmlDocUniquePtr pDump = parseLayoutDump();
// No header on pages 1,2,3 (and currently 4).
assertXPath(pDump, "//page[2]/header", 0);
//Page break is not lost. This SHOULD be on page 4, but sadly it is not.
//assertXPathContent(pDump, "//page[5]/header", "First Page Style");
//CPPUNIT_ASSERT(getXPathContent(pDump, "//page[5]/body/txt").startsWith("Lorem ipsum"));
}
DECLARE_OOXMLEXPORT_TEST(testTdf129452_excessBorder, "tdf129452_excessBorder.docx")
{
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index da882d0..a1f8965 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2717,24 +2717,9 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
// if paragraph is split, put the section break between the parts
if( bNeedParaSplit && *aBreakIt != rNode.GetText().getLength() )
{
SwNodeIndex aNextIndex( rNode, 1 );
const SwNode& pNextNode = aNextIndex.GetNode();
// if there is a next node, use its attributes to create the new
// section
if( pNextNode.IsTextNode() )
{
const SwTextNode& rNextNode = *static_cast<SwTextNode*>(
&aNextIndex.GetNode() );
OutputSectionBreaks(rNextNode.GetpSwAttrSet(), rNextNode);
}
else if (pNextNode.IsEndNode() )
{
// In this case the same paragraph holds the next page style
// too.
const SwPageDesc* pNextPageDesc = m_pCurrentPageDesc->GetFollow();
assert(pNextPageDesc);
PrepareNewPageDesc( rNode.GetpSwAttrSet(), rNode, nullptr , pNextPageDesc);
}
}
else if (!bNeedParaSplit)
{