summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriyankaGaikwad <priyanka.gaikwad@synerzip.com>2015-05-27 12:22:10 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-01-08 18:44:55 +0100
commit01575244271cc7e0156e766b91750c4c147a0f8e (patch)
treeb2f902b3d08cd44de4c7d3d5509b091f7c953b5a
parent0aa5414015813eda46dbfd7c3bcf259485ac1968 (diff)
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 <alignment readingorder="2"> export properly Change-Id: I0a49ba0e458cbd6a7feae8e205ae583b7da30d0b
-rw-r--r--sc/qa/unit/data/xlsx/writingMode.xlsxbin0 -> 9485 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx15
-rw-r--r--sc/source/filter/excel/xestyle.cxx2
3 files changed, 15 insertions, 2 deletions
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
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/writingMode.xlsx
Binary files 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 );
}