tdf#171025 docx export: don't lose pageAfter break in ParaProps
DOCX PrepareNewSectionBreak passes the CurrentSectionInfo
to SectionBreak, so it always followed the pSectionInfo path.
However, the options in that path do not work
when StartParagraphProperties is the context.
So, if there is a PageAfter break as one of the paragraph properties,
and since StartParagraphProperties happens just before EndParagraph
(i.e. all the pargraph runs have already been written)
then the request to SvxBreak::PageAfter can be written
as the last run in the paragraph - right before </w:p>.
That is accomplished with m_bPageBreakAfter.
make CppunitTest_sw_ooxmlexport25 \
CPPUNIT_TEST_NAME=testTdf171025_pageAfter
The only unit test this patch matched was
make CppunitTest_sw_ooxmlexport15 \
CPPUNIT_TEST_NAME=testTdf136952_pgBreak3B
and it simply adds an explicit page break
just connected before the sectPr - common enough in DOCX.
Change-Id: I718bf6d3cf240fd4ab1140c02194ea11d3767b74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200539
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
This commit is contained in:
Binary file not shown.
@@ -41,6 +41,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148057_columnBreak, "tdf148057_columnBreak.docx"
|
||||
CPPUNIT_ASSERT_EQUAL(2, getPages());
|
||||
}
|
||||
|
||||
DECLARE_OOXMLEXPORT_TEST(testTdf171025_pageAfter, "tdf171025_pageAfter.docx")
|
||||
{
|
||||
// given a document with a LO specialty pageAfter break
|
||||
// coupled with IsPlausableSingleWordSection
|
||||
CPPUNIT_ASSERT_EQUAL(2, getPages());
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, testTdf171038_pageAfter)
|
||||
{
|
||||
// given a document with a LO-specialty PageAfter break
|
||||
|
||||
@@ -7218,7 +7218,7 @@ void DocxAttributeOutput::SectionBreak( sal_uInt8 nC, bool bBreakAfter, const WW
|
||||
m_nColBreakStatus = COLBRK_POSTPONE;
|
||||
break;
|
||||
case msword::PageBreak:
|
||||
if ( pSectionInfo )
|
||||
if (pSectionInfo && !m_bOpenedParaPr)
|
||||
{
|
||||
// Detect when the current node is the last node in the
|
||||
// document: the last section is written explicitly in
|
||||
@@ -7280,7 +7280,7 @@ void DocxAttributeOutput::SectionBreak( sal_uInt8 nC, bool bBreakAfter, const WW
|
||||
}
|
||||
else if ( m_bParagraphOpened )
|
||||
{
|
||||
if (bBreakAfter)
|
||||
if (bBreakAfter || m_bOpenedParaPr)
|
||||
// tdf#128889
|
||||
m_bPageBreakAfter = true;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user