[Libreoffice-commits] core.git: starmath/qa starmath/source
Regina Henschel
rb.henschel at t-online.de
Mon May 23 06:29:42 UTC 2016
starmath/qa/extras/mmlimport-test.cxx | 2 +-
starmath/source/mathmlimport.cxx | 19 +++++++++++++++----
2 files changed, 16 insertions(+), 5 deletions(-)
New commits:
commit 66a953bf3aa6cb1abd55380d846accd68981537a
Author: Regina Henschel <rb.henschel at t-online.de>
Date: Sat May 21 21:32:47 2016 +0200
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 at libreoffice.org>
Reviewed-by: jan iversen <jani at documentfoundation.org>
diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx
index f9f1405..846ea87 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 971d349..5be0526 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;
More information about the Libreoffice-commits
mailing list