diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-02-13 14:01:57 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-02-13 15:17:34 +0100 |
commit | 8af98ac8bf0ac8795999ecbf061d3c094f7c3be4 (patch) | |
tree | dc93f5888dcdce57d780f538493668d74452a89b /sw/qa/extras | |
parent | b6de43a14a768e261d2233df57cf5fa46480d991 (diff) |
sw btlr writing mode: implement ODF filter
An easy way would be to just extend aXML_WritingDirection_Enum, but then
we would write the new attribute value to a non-extension namespace.
So special case the new attribute value during both import and export
(and only for table cells as a start).
Change-Id: I431bf99693c4a3452e91f241bd2f0fcfc72c68fd
Reviewed-on: https://gerrit.libreoffice.org/67770
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/odfexport/data/btlr-cell.odt | bin | 0 -> 9174 bytes | |||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 20 |
2 files changed, 20 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/data/btlr-cell.odt b/sw/qa/extras/odfexport/data/btlr-cell.odt Binary files differnew file mode 100644 index 000000000000..c010fa9f51b6 --- /dev/null +++ b/sw/qa/extras/odfexport/data/btlr-cell.odt diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 337c64270a04..8ac8f1c81edd 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp> #include <com/sun/star/text/XTextField.hpp> +#include <com/sun/star/text/WritingMode2.hpp> #include <comphelper/storagehelper.hxx> #include <comphelper/fileformat.h> #include <comphelper/propertysequence.hxx> @@ -1391,6 +1392,25 @@ DECLARE_ODFEXPORT_TEST(testWhitespace, "whitespace.odt") CPPUNIT_ASSERT(!xPortions->hasMoreElements()); } +DECLARE_ODFEXPORT_TEST(testBtlrCell, "btlr-cell.odt") +{ + // Without the accompanying fix in place, this test would have failed, as + // the btlr text direction in the A1 cell was lost on ODF import and + // export. + uno::Reference<text::XTextTablesSupplier> xSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xTables = xSupplier->getTextTables(); + uno::Reference<text::XTextTable> xTable(xTables->getByName("Table1"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xA1(xTable->getCellByName("A1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, getProperty<sal_Int16>(xA1, "WritingMode")); + + uno::Reference<beans::XPropertySet> xB1(xTable->getCellByName("B1"), uno::UNO_QUERY); + auto nActual = getProperty<sal_Int16>(xB1, "WritingMode"); + CPPUNIT_ASSERT(nActual == text::WritingMode2::LR_TB || nActual == text::WritingMode2::CONTEXT); + + uno::Reference<beans::XPropertySet> xC1(xTable->getCellByName("C1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, getProperty<sal_Int16>(xC1, "WritingMode")); +} + DECLARE_ODFEXPORT_TEST(testFdo86963, "fdo86963.odt") { // Export of this document failed with beans::UnknownPropertyException. |