diff options
author | Justin Luth <justin.luth@collabora.com> | 2020-08-01 12:08:51 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-08-07 10:11:52 +0200 |
commit | 75b45d43b53abd457c98f47078ca7ff3c492ce2c (patch) | |
tree | 4761c134f9d0307d8c510f83eef489bd3dd73028 /sw | |
parent | e73ca98ebeeddac05dcf224e517970ede582eb9f (diff) |
tdf#135343 writerfilter: compat15 treats section nextCol as nextPage
... and also handle a document that starts with a nextColumn break
... and also handle a nextColumn with a different number of columns.
Starting in Word 2013's compatibilityMode=15, it appears
(based on testing, but no documentation found to prove it)
that the hard-to-create column-section-break is always
handled the same way as a page break.
It already was like this if it occurred when the previous
section did not have columns. Only when the previous section
had the same # of columns did it act as a regular column break.
In any case, LO never handled any of it well.
P.S. I never liked "lastContext" since it isn't clear
whether it means the very last something or something earlier.
So I changed it to PrevSection which is much nicer.
still to do: figure out how to just do a regular column
break in the previous section.
Change-Id: I3cef4a1ab185d25dfde90b85338706e8909b72dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99936
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c12v3.docx | bin | 0 -> 11087 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c14.docx | bin | 0 -> 11891 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c14v2.docx | bin | 0 -> 11298 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c15.docx | bin | 0 -> 11890 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 46 |
5 files changed, 46 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c12v3.docx b/sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c12v3.docx Binary files differnew file mode 100644 index 000000000000..b51e53124b2e --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c12v3.docx diff --git a/sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c14.docx b/sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c14.docx Binary files differnew file mode 100644 index 000000000000..25505bdddaea --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c14.docx diff --git a/sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c14v2.docx b/sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c14v2.docx Binary files differnew file mode 100644 index 000000000000..064e62f70719 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c14v2.docx diff --git a/sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c15.docx b/sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c15.docx Binary files differnew file mode 100644 index 000000000000..f4bd1ff12e35 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf135343_columnSectionBreak_c15.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 009867c72f11..cd9656c94ef7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -13,6 +13,7 @@ #include <com/sun/star/text/RelOrientation.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/XPageCursor.hpp> +#include <com/sun/star/text/XTextColumns.hpp> #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/text/XTextTablesSupplier.hpp> @@ -115,6 +116,51 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133370_columnBreak, "tdf133370_columnBreak.odt") CPPUNIT_ASSERT_EQUAL(1, getPages()); } +DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c14, "tdf135343_columnSectionBreak_c14.docx") +{ + uno::Reference<beans::XPropertySet> xTextSection = getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(1), "TextSection"); + uno::Reference<text::XTextColumns> xTextColumns = getProperty<uno::Reference<text::XTextColumns>>(xTextSection, "TextColumns"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Section one's columns", sal_Int16(2), xTextColumns->getColumnCount()); + + // Old Word 2010 version - nextColumn breaks inside column sections are just treated as regular column breaks. + //xTextSection = getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(12, "RTL 2"), "TextSection"); + //xTextColumns = getProperty<uno::Reference<text::XTextColumns>>(xTextSection, "TextColumns"); + //CPPUNIT_ASSERT_EQUAL_MESSAGE("Section four's columns", sal_Int16(3), xTextColumns->getColumnCount()); + //CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c14v2, "tdf135343_columnSectionBreak_c14v2.docx") +{ + // In this Word 2010 v2, section three was changed to start with a nextColumn break instead of a continuous break. + // The previous section has no columns, so this time start the columns on a new page. + uno::Reference<beans::XPropertySet> xTextSection = getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(10, ""), "TextSection"); + uno::Reference<text::XTextColumns> xTextColumns = getProperty<uno::Reference<text::XTextColumns>>(xTextSection, "TextColumns"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Section three's columns", sal_Int16(3), xTextColumns->getColumnCount()); + //CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c12v3, "tdf135343_columnSectionBreak_c12v3.docx") +{ + // In this Word 20-3 v3, section one and two have different number of columns. It acts like a page break. + uno::Reference<beans::XPropertySet> xTextSection = getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(1, "Four columns,"), "TextSection"); + uno::Reference<text::XTextColumns> xTextColumns = getProperty<uno::Reference<text::XTextColumns>>(xTextSection, "TextColumns"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Section one's columns", sal_Int16(4), xTextColumns->getColumnCount()); + + xTextSection = getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(6, "RTL 2"), "TextSection"); + xTextColumns = getProperty<uno::Reference<text::XTextColumns>>(xTextSection, "TextColumns"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Section two's columns", sal_Int16(2), xTextColumns->getColumnCount()); + CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c15, "tdf135343_columnSectionBreak_c15.docx") +{ + // Word 2013+ version - nextColumn breaks inside column sections are always handled like nextPage breaks. + uno::Reference<beans::XPropertySet> xTextSection = getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(12, "RTL 2"), "TextSection"); + uno::Reference<text::XTextColumns> xTextColumns = getProperty<uno::Reference<text::XTextColumns>>(xTextSection, "TextColumns"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Section four's columns", sal_Int16(3), xTextColumns->getColumnCount()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Fits on two pages", 2, getPages()); +} + DECLARE_OOXMLEXPORT_TEST(testTdf129452_excessBorder, "tdf129452_excessBorder.docx") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); |