[Libreoffice-commits] core.git: sw/qa writerfilter/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 25 04:55:56 UTC 2019
sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak.docx |binary
sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx |binary
sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak3.docx |binary
sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak4.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 37 ++++++++++
sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 2
writerfilter/source/dmapper/DomainMapper.cxx | 7 +
7 files changed, 46 insertions(+)
New commits:
commit 89e44da1ab450f6e2f4106103efd169227683f20
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Tue Apr 16 14:14:03 2019 +0300
Commit: Justin Luth <justin_luth at sil.org>
CommitDate: Thu Apr 25 06:55:18 2019 +0200
related tdf#123636 writerfilter: split newline also if PAGE_BREAK
...but only with old MSWord compat flag SplitPgBreakAndParaMark.
All of the other cases (COLUMN_BREAK and non-empty runs) split
the paragraph, so why not here? This document shows it is needed,
but only for SplitPgBreakAndParaMark documents.
Note: Word 2003 doesn't display "modern" docx well in this regard.
It adds extra paragraphs where it shouldn't. There are already
example unit tests that ensure that extra paragraphs aren't written
for SplitPgBreakAndParaMark == false.
The actual bug's document is not related to the compatibility flag.
That will be handled in separate commit.
Change-Id: I27399780c909663f9a2b21974a5b385bea67f9ec
Reviewed-on: https://gerrit.libreoffice.org/70835
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak.docx
new file mode 100644
index 000000000000..6f7b4b144547
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak.docx differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx
new file mode 100644
index 000000000000..30698c4675cf
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak3.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak3.docx
new file mode 100644
index 000000000000..1bcc335fdc59
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak3.docx differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak4.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak4.docx
new file mode 100644
index 000000000000..3a9d86ee21e2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak4.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 86b7e69c331d..41c04f56c687 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -75,6 +75,43 @@ DECLARE_OOXMLEXPORT_TEST(testTdf124637_sectionMargin, "tdf124637_sectionMargin.d
CPPUNIT_ASSERT_EQUAL_MESSAGE("Section Left Margin", sal_Int32(0), getProperty<sal_Int32>(xSect, "SectionLeftMargin"));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak, "tdf123636_newlinePageBreak.docx")
+{
+ //MS Compatibility flag: SplitPgBreakAndParaMark
+ //special case: split first empty paragraph in a section.
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 2, getParagraphs() );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() );
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak2, "tdf123636_newlinePageBreak2.docx")
+{
+ //WITHOUT SplitPgBreakAndParaMark: a following anchored shape should force a page break
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 2, getParagraphs() );
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() );
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak3, "tdf123636_newlinePageBreak3.docx")
+{
+ //MS Compatibility flag: SplitPgBreakAndParaMark
+ //proof case: split any non-empty paragraphs, not just the first paragraph of a section.
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 5, getParagraphs() );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() );
+
+ xmlDocPtr pDump = parseLayoutDump();
+ assertXPath(pDump, "/root/page[1]/body/txt[3]", "Last line on page 1");
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak4, "tdf123636_newlinePageBreak4.docx")
+{
+ //MS Compatibility flag: SplitPgBreakAndParaMark
+ //special case: an empty paragraph doesn't split (except if first paragraph).
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 3, getParagraphs() );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() );
+
+ xmlDocPtr pDump = parseLayoutDump();
+ assertXPath(pDump, "/root/page[2]/body/txt[1]", "");
+}
+
DECLARE_OOXMLEXPORT_TEST(tdf123912_protectedForm, "tdf123912_protectedForm.odt")
{
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index 3a546a80d6c4..2a2a82df7b74 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -937,6 +937,8 @@ DECLARE_OOXMLEXPORT_TEST(testExtentValue, "fdo74605.docx")
sal_Int32 nX = getXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent", "cx").toInt32();
// This was negative.
CPPUNIT_ASSERT(nX >= 0);
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() );
}
// part of tdf#93676, word gives the frame in the exported .docx a huge height,
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 41cc8afdd6a7..1a9be316b85d 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3294,6 +3294,13 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
{
if (m_pImpl->GetSettingsTable()->GetSplitPgBreakAndParaMark())
{
+ if ( m_pImpl->GetIsFirstParagraphInSection() || !m_pImpl->IsFirstRun() )
+ {
+ m_pImpl->m_bIsSplitPara = true;
+ m_pImpl->finishParagraph( m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) );
+ lcl_startParagraphGroup();
+ }
+
pContext->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE));
m_pImpl->clearDeferredBreaks();
}
More information about the Libreoffice-commits
mailing list