From e9911f12d1e124d1910ac2310c224e66ab365ed4 Mon Sep 17 00:00:00 2001 From: "Faisal M. Al-Otaibi" Date: Sat, 15 Jun 2013 12:55:14 +0200 Subject: docx: fdo#43093 fdo#44029 fix the alignment when the paragraph are RTL this will fix the alignment for RTL paragraph when import/export MS docx file. the alignment should be exchange when the paragraph are RTL. it will also fix text direction export for RTL paragraph. Change-Id: I5fe55205677d6e12142e398570cba78094705692 --- sw/qa/extras/ooxmlexport/data/fdo43093.docx | Bin 0 -> 9547 bytes sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 37 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 sw/qa/extras/ooxmlexport/data/fdo43093.docx (limited to 'sw/qa/extras') diff --git a/sw/qa/extras/ooxmlexport/data/fdo43093.docx b/sw/qa/extras/ooxmlexport/data/fdo43093.docx new file mode 100644 index 000000000000..9d5de58b5f8d Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo43093.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index d6812f07fbc0..1cfc0aec25f9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -79,6 +80,7 @@ public: void testFdo65655(); void testFDO63053(); void testWatermark(); + void testFdo43093(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -133,6 +135,7 @@ void Test::run() {"fdo65655.docx", &Test::testFdo65655}, {"fdo63053.docx" , &Test::testFDO63053}, {"watermark.docx", &Test::testWatermark}, + {"fdo43093.docx", &Test::testFdo43093}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -771,6 +774,40 @@ void Test::testWatermark() CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, getProperty(xShape, "LineStyle")); } +void Test::testFdo43093() +{ + // The problem was that the alignment are not exchange when the paragraph are RTL. + uno::Reference xParaRtlLeft(getParagraph( 1, "RTL Left")); + sal_Int32 nRtlLeft = getProperty< sal_Int32 >( xParaRtlLeft, "ParaAdjust" ); + // test the text Direction value for the pragraph + sal_Int16 nRLDir = getProperty< sal_Int32 >( xParaRtlLeft, "WritingMode" ); + + uno::Reference xParaRtlRight(getParagraph( 3, "RTL Right")); + sal_Int32 nRtlRight = getProperty< sal_Int32 >( xParaRtlRight, "ParaAdjust" ); + sal_Int16 nRRDir = getProperty< sal_Int32 >( xParaRtlRight, "WritingMode" ); + + uno::Reference xParaLtrLeft(getParagraph( 5, "LTR Left")); + sal_Int32 nLtrLeft = getProperty< sal_Int32 >( xParaLtrLeft, "ParaAdjust" ); + sal_Int16 nLLDir = getProperty< sal_Int32 >( xParaLtrLeft, "WritingMode" ); + + uno::Reference xParaLtrRight(getParagraph( 7, "LTR Right")); + sal_Int32 nLtrRight = getProperty< sal_Int32 >( xParaLtrRight, "ParaAdjust" ); + sal_Int16 nLRDir = getProperty< sal_Int32 >( xParaLtrRight, "WritingMode" ); + + // this will test the both the text direction and alignment for each paragraph + CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_LEFT), nRtlLeft); + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, nRLDir); + + CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_RIGHT), nRtlRight); + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, nRRDir); + + CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_LEFT), nLtrLeft); + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nLLDir); + + CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_RIGHT), nLtrRight); + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nLRDir); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit