sw/qa/extras/ooxmlexport/data/tdf152636_lostPageBreak.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 7 +++++++ sw/source/filter/ww8/ww8atr.cxx | 5 ++++- 3 files changed, 11 insertions(+), 1 deletion(-)
New commits: commit b3ddc707c3262f0a8ecd46af9efaea8382be22df Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Thu Dec 22 16:18:24 2022 -0500 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Jan 5 10:19:26 2023 +0000 tdf#152636 writerfilter: correctly detect first para in doc This fixes LO 7.5 regression c37f62b71fa59917ef85ff98480dff18aa936e41. It could be triggered if the second paragraph or table already had a new page style assigned to it. Change-Id: I5ad78c37ad6a388f7321e021250e11d22fc6e3fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144777 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> (cherry picked from commit 3963c693895779d4fba6c94b4ab1df70f9830207) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144733 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/qa/extras/ooxmlexport/data/tdf152636_lostPageBreak.odt b/sw/qa/extras/ooxmlexport/data/tdf152636_lostPageBreak.odt new file mode 100644 index 000000000000..434c30ed31c7 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf152636_lostPageBreak.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index 5d6576a0d619..1524539eb309 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -157,6 +157,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf150966_regularInset) assertXPathAttrs(pXmlDoc, "//wps:bodyPr", { { "tIns", "179640" }, { "bIns", "360000" } }); } +CPPUNIT_TEST_FIXTURE(Test, testTdf152636_lostPageBreak) +{ + loadAndReload("tdf152636_lostPageBreak.odt"); + + CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + CPPUNIT_TEST_FIXTURE(Test, testSdtDuplicatedId) { // Given a document with 2 inline <w:sdt>, with each a <w:id>: diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 3fce91b9b436..70ce371185f8 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -530,7 +530,10 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode // A section break on the very first paragraph is ignored by LO/Word // and should NOT be turned into a page break. SwNodeIndex aDocEnd(m_rDoc.GetNodes().GetEndOfContent()); - SwNodeIndex aStart(*aDocEnd.GetNode().StartOfSectionNode(), 2); + SwNodeIndex aStart(*aDocEnd.GetNode().StartOfSectionNode()); + // Set aStart to the first content node in the section + m_rDoc.GetNodes().GoNext(&aStart); + assert(aStart <= aDocEnd && "impossible: end section must have one content node"); if (rNd.GetIndex() > aStart.GetNode().GetIndex()) AttrOutput().OutputItem(SvxFormatBreakItem(SvxBreak::PageBefore, RES_BREAK)); }