diff options
author | Justin Luth <justin_luth@sil.org> | 2018-12-21 21:22:51 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2019-01-15 19:52:14 +0100 |
commit | 14087d3e5fed9b56384432d9aeac608a5e8d86cf (patch) | |
tree | 04e167c6434e6806533c870f23005ee41e4405ac /sw | |
parent | 3539a1efb41a787237e4333ebc715db96ffacb5b (diff) |
tdf#121670 ooxmlimport: no columns in page styles, only sections
LIKELY TO EXPOSE SECTION EXPORT/IMPORT PROBLEMS. That is already
happening somewhat because support for forms/protected sections was
added in LO6.2. By making this change, it will help to expose
problems faster, with the hope that they can still be fixed for 6.2.
Columns in page styles are very problematic, because it doesn't
let you override the number of columns (except to put sub-columns
inside one of the existing columns). So, always
attempt to insert a column into it's own section,
and never into the page style itself.
I'm rather excited that this didn't cause any unit test failures.
I've made a lot of section fixes over the years
(and some this week which are required for the unit test to work).
This change seems very natural, and gets rid of a regression-prone
hack.
I found all of the existing unit tests with columns and tested them.
About 10 files - all look fine including complex files
tdf81345.docx and tdf104061_tableSectionColumns.docx
Change-Id: If02f1bfd91b1cf8210665244d0782ff926cc2869
Reviewed-on: https://gerrit.libreoffice.org/65557
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf121670_columnsInSectionsOnly.docx | bin | 0 -> 11270 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 17 |
2 files changed, 17 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf121670_columnsInSectionsOnly.docx b/sw/qa/extras/ooxmlexport/data/tdf121670_columnsInSectionsOnly.docx Binary files differnew file mode 100644 index 000000000000..d8ba105440d6 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf121670_columnsInSectionsOnly.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index e396ac0bea0b..f8f405f7655b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -855,6 +855,23 @@ DECLARE_OOXMLEXPORT_TEST(testUnbalancedColumns, "unbalanced-columns.docx") CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(2), "DontBalanceTextColumns")); } +DECLARE_OOXMLEXPORT_TEST(testTdf121670_columnsInSectionsOnly, "tdf121670_columnsInSectionsOnly.docx") +{ + uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL_MESSAGE("DontBalanceTextColumns?", true, getProperty<bool>(xTextSections->getByIndex(0), "DontBalanceTextColumns")); + + uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(2), "TextSection"); + CPPUNIT_ASSERT(xTextSection.is()); + uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("# of columns", sal_Int16(3), xTextColumns->getColumnCount()); + + xTextSection.set( getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(3), "TextSection") ); + CPPUNIT_ASSERT(xTextSection.is()); + xTextColumns.set( getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns") ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("# of columns", sal_Int16(0), xTextColumns->getColumnCount()); +} + DECLARE_OOXMLEXPORT_TEST(testTdf106492, "tdf106492.docx") { if (xmlDocPtr pXmlDoc = parseExport()) |