diff options
author | Justin Luth <justin.luth@collabora.com> | 2022-12-22 16:18:24 -0500 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2022-12-23 01:17:04 +0000 |
commit | 3963c693895779d4fba6c94b4ab1df70f9830207 (patch) | |
tree | 9bc8d8d3125b9483e1f5a0839c46c8ba8bb68e24 | |
parent | 780d55199e54fafc3784691d5cf716c1bb92b0aa (diff) |
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 <jluth@mail.com>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf152636_lostPageBreak.odt | bin | 0 -> 8632 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 5 |
3 files changed, 11 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf152636_lostPageBreak.odt b/sw/qa/extras/ooxmlexport/data/tdf152636_lostPageBreak.odt Binary files differnew file mode 100644 index 000000000000..434c30ed31c7 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf152636_lostPageBreak.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index c3df45d05d68..b3a3a46dbb4e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -163,6 +163,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)); } |