starmath/qa/extras/mmlexport-test.cxx | 12 ++++++++++++ starmath/source/mathmlexport.cxx | 16 ++++++++++++++++ starmath/source/mathmlexport.hxx | 1 + 3 files changed, 29 insertions(+)
New commits: commit 3a8035bcb6cf081572d86813021bbccab265a935 Author: Takeshi Abe <t...@fixedpoint.jp> Date: Mon Sep 19 09:26:41 2016 +0900 tdf#97049 Export "intd" to MathML Change-Id: Ie1fc33e18958e73d4876b2b5daceec127011c3cc Reviewed-on: https://gerrit.libreoffice.org/29003 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Takeshi Abe <t...@fixedpoint.jp> diff --git a/starmath/qa/extras/mmlexport-test.cxx b/starmath/qa/extras/mmlexport-test.cxx index f13ee9d..3a2d222 100644 --- a/starmath/qa/extras/mmlexport-test.cxx +++ b/starmath/qa/extras/mmlexport-test.cxx @@ -35,9 +35,11 @@ public: virtual void setUp() override; virtual void tearDown() override; + void testTdf97049(); void testTdf101022(); CPPUNIT_TEST_SUITE(MathMLExportTest); + CPPUNIT_TEST(testTdf97049); CPPUNIT_TEST(testTdf101022); CPPUNIT_TEST_SUITE_END(); @@ -85,6 +87,16 @@ xmlDocPtr MathMLExportTest::exportAndParse() return pDoc; } +void MathMLExportTest::testTdf97049() +{ + mxDocShell->SetText("intd {{1 over x} dx}"); + xmlDocPtr pDoc = exportAndParse(); + assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mo[1]", "stretchy", "true"); + auto aContent = getXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:mo[1]"); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aContent.getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Unicode(0x222B), aContent[0]); +} + void MathMLExportTest::testTdf101022() { #define CHECK_MATHVARIANT(capital, small) do \ diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index 0567181..2aab226 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -811,6 +811,11 @@ void SmXMLExport::ExportMath(const SmNode *pNode, int /*nLevel*/) AddAttribute(XML_NAMESPACE_MATH, XML_MATHVARIANT, XML_NORMAL); pMath = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MI, true, false); } + else if (pNode->GetType() == NDYNINTSYMBOL) + { + AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_TRUE); + pMath = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MO, true, false); + } else { // Export NMATHIDENT and NPLACE symbols as <mi> elements: @@ -1456,6 +1461,13 @@ void SmXMLExport::ExportMatrix(const SmNode *pNode, int nLevel) } } +void SmXMLExport::ExportDynIntegral(const SmDynIntegralNode *pNode, int nLevel) +{ + SvXMLElementExport aRow(*this, XML_NAMESPACE_MATH, XML_MROW, true, true); + ExportNodes(pNode->Symbol(), nLevel+1); + ExportNodes(pNode->Body(), nLevel+1); +} + void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel) { if (!pNode) @@ -1520,6 +1532,7 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel) case NSPECIAL: //NSPECIAL requires some sort of Entity preservation in the XML engine. case NMATHIDENT : case NPLACE: + case NDYNINTSYMBOL: ExportMath(pNode, nLevel); break; case NBINHOR: @@ -1561,6 +1574,9 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel) case NBLANK: ExportBlank(pNode, nLevel); break; + case NDYNINT: + ExportDynIntegral(static_cast<const SmDynIntegralNode *>(pNode), nLevel); + break; default: SAL_WARN("starmath", "Warning: failed to export a node?"); break; diff --git a/starmath/source/mathmlexport.hxx b/starmath/source/mathmlexport.hxx index 4581db8..19a29cb 100644 --- a/starmath/source/mathmlexport.hxx +++ b/starmath/source/mathmlexport.hxx @@ -92,6 +92,7 @@ protected: void ExportVerticalBrace(const SmVerticalBraceNode *pNode, int nLevel); void ExportMatrix(const SmNode *pNode, int nLevel); void ExportBlank(const SmNode *pNode, int nLevel); + void ExportDynIntegral(const SmDynIntegralNode *pNode, int nLevel); public: SmXMLExport( _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits