diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2016-05-21 21:32:47 +0200 |
---|---|---|
committer | jan iversen <jani@documentfoundation.org> | 2016-05-23 06:29:18 +0000 |
commit | 66a953bf3aa6cb1abd55380d846accd68981537a (patch) | |
tree | bff3609f05c59c02413b425bc0b2b404eb93a97d /starmath | |
parent | f3657368a6cab2e1931c8845035b914e49360eb3 (diff) |
tdf#99984 render inferred mrow as group {}
In case an element has no content, but has got an SmXMLRowContext,
an empty group {} is inserted. The result is, that empty table
cells are rendered without error, so that files, which use a
mtable element to arrange things, no longer break on import.
Change-Id: Iae158226e6478f2f9f397b8485044860ee8767c2
Reviewed-on: https://gerrit.libreoffice.org/25273
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/qa/extras/mmlimport-test.cxx | 2 | ||||
-rw-r--r-- | starmath/source/mathmlimport.cxx | 19 |
2 files changed, 16 insertions, 5 deletions
diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx index f9f1405b5740..846ea87681a6 100644 --- a/starmath/qa/extras/mmlimport-test.cxx +++ b/starmath/qa/extras/mmlimport-test.cxx @@ -108,7 +108,7 @@ void Test::testMaction() void Test::testtdf99556() { loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/tdf99556-1.mml")); - OUString sExpected("sqrt"); + OUString sExpected("sqrt { {} }"); CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText()); } diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 971d349c5600..5be05264945a 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -2249,14 +2249,25 @@ void SmXMLRowContext_Impl::EndElement() return; } } - else //Multiple newlines result in empty row elements + else { - aRelationArray.resize(1); + // The elements msqrt, mstyle, merror, menclose, mpadded, mphantom, mtd, and math + // treat their content as a single inferred mrow in case their content is empty. + // Here an empty group {} is used to catch those cases and transform them without error + // to StarMath. + aRelationArray.resize(2); SmToken aToken; - aToken.cMathChar = '\0'; + aToken.cMathChar = MS_LBRACE; aToken.nLevel = 5; - aToken.eType = TNEWLINE; + aToken.eType = TLGROUP; + aToken.aText = "{"; aRelationArray[0] = new SmLineNode(aToken); + + aToken.cMathChar = MS_RBRACE; + aToken.nLevel = 0; + aToken.eType = TRGROUP; + aToken.aText = "}"; + aRelationArray[1] = new SmLineNode(aToken); } SmToken aDummy; |