Kaydet (Commit) 2d422d86 authored tarafından Miklos Vajna's avatar Miklos Vajna

SmOoxmlImport::handleR: escape brackets in math runs

Also remove the previous escaping that took care of RTF only.

Change-Id: Ie9a019912f83a3f56ef52429855cd72cf2c8f463
üst dba6b515
......@@ -597,7 +597,7 @@ OUString SmOoxmlImport::handleR()
}
}
stream.ensureClosingTag( M_TOKEN( r ));
return text;
return text.replaceAll("{", "\\{").replaceAll("}", "\\}");
}
OUString SmOoxmlImport::handleRad()
......
......@@ -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 \
......
......@@ -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();
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment