From 01575244271cc7e0156e766b91750c4c147a0f8e Mon Sep 17 00:00:00 2001 From: PriyankaGaikwad Date: Wed, 27 May 2015 12:22:10 +0530 Subject: tdf#58122 FILESAVE: XLSX - Cell RTL direction state not saved Current behavior: The direction of the sheet is set to default from left to right Expected behavior: The action of changing the direction from left to right to become from right to left Solution: Added export for text writting direction. Now export properly Change-Id: I0a49ba0e458cbd6a7feae8e205ae583b7da30d0b --- sc/qa/unit/data/xlsx/writingMode.xlsx | Bin 0 -> 9485 bytes sc/qa/unit/subsequent_export-test.cxx | 15 ++++++++++++++- sc/source/filter/excel/xestyle.cxx | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 sc/qa/unit/data/xlsx/writingMode.xlsx diff --git a/sc/qa/unit/data/xlsx/writingMode.xlsx b/sc/qa/unit/data/xlsx/writingMode.xlsx new file mode 100644 index 000000000000..3cf95125785d Binary files /dev/null and b/sc/qa/unit/data/xlsx/writingMode.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 41c54edd0e27..8aa8ca918508 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -155,6 +155,7 @@ public: void testMoveCellAnchoredShapes(); void testMatrixMultiplication(); void testPreserveTextWhitespaceXLSX(); + void testTextDirection(); void testRefStringXLSX(); void testRefStringConfigXLSX(); @@ -221,6 +222,7 @@ public: CPPUNIT_TEST(testHyperlinkXLSX); CPPUNIT_TEST(testMoveCellAnchoredShapes); CPPUNIT_TEST(testMatrixMultiplication); + CPPUNIT_TEST(testTextDirection); CPPUNIT_TEST(testRefStringXLSX); CPPUNIT_TEST(testRefStringConfigXLSX); @@ -2988,7 +2990,6 @@ void ScExportTest::testMatrixMultiplication() xDocSh->DoClose(); } - void ScExportTest::testRefStringXLSX() { ScDocShellRef xDocSh = loadDoc("ref_string.", FORMAT_XLSX); @@ -3088,6 +3089,18 @@ void ScExportTest::testHeaderImage() CPPUNIT_ASSERT(aURL.startsWith("vnd.sun.star.GraphicObject:")); } +void ScExportTest::testTextDirection() +{ + ScDocShellRef xDocSh = loadDoc("writingMode.", FORMAT_XLSX); + CPPUNIT_ASSERT(xDocSh.Is()); + + xmlDocPtr pDoc = XPathHelper::parseExport(&(*xDocSh), m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + CPPUNIT_ASSERT(pDoc); + + assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "readingOrder", "1");//LTR + assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", "readingOrder", "2");//RTL +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 3f826554411e..9ea54b935d7a 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -1621,7 +1621,7 @@ void XclExpCellAlign::SaveXml( XclExpXmlStream& rStrm ) const // OOXTODO: XML_relativeIndent, mnIndent? // OOXTODO: XML_justifyLastLine, XML_shrinkToFit, XclXmlUtils::ToPsz( mbShrink ), - // OOXTODO: XML_readingOrder, + XML_readingOrder, mnTextDir == EXC_XF_TEXTDIR_CONTEXT ? NULL : OString::number( mnTextDir ).getStr(), FSEND ); } -- cgit