diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-07-27 16:47:07 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-07-27 17:28:09 +0200 |
commit | 2d422d868a717adf735ef45a6bf5e4af0efb1a0c (patch) | |
tree | 3c06698fc3300561e9b65579a134238f6b697f57 | |
parent | fix import of nested RTF_MF groups (diff) | |
download | core-2d422d868a717adf735ef45a6bf5e4af0efb1a0c.tar.gz core-2d422d868a717adf735ef45a6bf5e4af0efb1a0c.zip |
SmOoxmlImport::handleR: escape brackets in math runs
Also remove the previous escaping that took care of RTF only.
Change-Id: Ie9a019912f83a3f56ef52429855cd72cf2c8f463
-rw-r--r-- | starmath/source/ooxmlimport.cxx | 2 | ||||
-rw-r--r-- | sw/CppunitTest_sw_subsequent_ooxmlexport.mk | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/math-escape.docx | bin | 0 -> 13422 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 11 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 7 |
5 files changed, 14 insertions, 8 deletions
diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx index 0ca2d0573a77..12e20a6f2ac0 100644 --- a/starmath/source/ooxmlimport.cxx +++ b/starmath/source/ooxmlimport.cxx @@ -597,7 +597,7 @@ OUString SmOoxmlImport::handleR() } } stream.ensureClosingTag( M_TOKEN( r )); - return text; + return text.replaceAll("{", "\\{").replaceAll("}", "\\}"); } OUString SmOoxmlImport::handleRad() diff --git a/sw/CppunitTest_sw_subsequent_ooxmlexport.mk b/sw/CppunitTest_sw_subsequent_ooxmlexport.mk index 531e0b53dac2..4e63fb451757 100644 --- a/sw/CppunitTest_sw_subsequent_ooxmlexport.mk +++ b/sw/CppunitTest_sw_subsequent_ooxmlexport.mk @@ -66,6 +66,7 @@ $(eval $(call gb_CppunitTest_use_ure,sw_subsequent_ooxmlexport)) $(eval $(call gb_CppunitTest_use_components,sw_subsequent_ooxmlexport,\ comphelper/util/comphelp \ configmgr/source/configmgr \ + embeddedobj/util/embobj \ fileaccess/source/fileacc \ filter/source/config/cache/filterconfig1 \ framework/util/fwk \ @@ -79,6 +80,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_ooxmlexport,\ sw/util/swd \ sw/util/msword \ sfx2/util/sfx \ + starmath/util/sm \ svl/source/fsstor/fsstorage \ svtools/util/svt \ toolkit/util/tk \ diff --git a/sw/qa/extras/ooxmlexport/data/math-escape.docx b/sw/qa/extras/ooxmlexport/data/math-escape.docx Binary files differnew file mode 100644 index 000000000000..e935a83f570e --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/math-escape.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index c426c372c9ec..02f66a280144 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -41,12 +41,17 @@ public: void testZoom(); void defaultTabStopNotInStyles(); void testFdo38244(); + void testMathEscape(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) CPPUNIT_TEST(testZoom); CPPUNIT_TEST(defaultTabStopNotInStyles); CPPUNIT_TEST(testFdo38244); + // See rtfexport test on why this is blacklisted. +#if !(__GNUC__ == 4 && __GNUC_MINOR__ == 4) + CPPUNIT_TEST(testMathEscape); +#endif #endif CPPUNIT_TEST_SUITE_END(); @@ -159,6 +164,12 @@ void Test::testFdo38244() CPPUNIT_ASSERT_EQUAL(true, bCaught); } +void Test::testMathEscape() +{ + roundtrip("math-escape.docx"); + CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] left ( right ) \\}"), getFormula(getRun(getParagraph(1), 1))); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 2c590c0473e9..6729b8880e39 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1535,13 +1535,6 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) if (cCh > 0) { OUString aStr(OStringToOUString(OString(cCh), RTL_TEXTENCODING_MS_1252)); - if ((nKeyword == RTF_LBRACE || nKeyword == RTF_RBRACE) && m_aStates.top().nDestinationState == DESTINATION_MR) - { - if (nKeyword == RTF_LBRACE) - aStr = "\\{"; - else - aStr = "\\}"; - } text(aStr); return 0; } |