From 8af98ac8bf0ac8795999ecbf061d3c094f7c3be4 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 13 Feb 2019 14:01:57 +0100 Subject: 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 Tested-by: Jenkins --- sw/qa/extras/odfexport/data/btlr-cell.odt | Bin 0 -> 9174 bytes sw/qa/extras/odfexport/odfexport.cxx | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 sw/qa/extras/odfexport/data/btlr-cell.odt (limited to 'sw/qa/extras') diff --git a/sw/qa/extras/odfexport/data/btlr-cell.odt b/sw/qa/extras/odfexport/data/btlr-cell.odt new file mode 100644 index 000000000000..c010fa9f51b6 Binary files /dev/null and b/sw/qa/extras/odfexport/data/btlr-cell.odt differ 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 #include #include +#include #include #include #include @@ -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 xSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xTables = xSupplier->getTextTables(); + uno::Reference xTable(xTables->getByName("Table1"), uno::UNO_QUERY); + uno::Reference xA1(xTable->getCellByName("A1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, getProperty(xA1, "WritingMode")); + + uno::Reference xB1(xTable->getCellByName("B1"), uno::UNO_QUERY); + auto nActual = getProperty(xB1, "WritingMode"); + CPPUNIT_ASSERT(nActual == text::WritingMode2::LR_TB || nActual == text::WritingMode2::CONTEXT); + + uno::Reference xC1(xTable->getCellByName("C1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, getProperty(xC1, "WritingMode")); +} + DECLARE_ODFEXPORT_TEST(testFdo86963, "fdo86963.odt") { // Export of this document failed with beans::UnknownPropertyException. -- cgit v1.2.3