diff options
author | Frédéric Wang <fred.wang@free.fr> | 2013-06-23 21:32:37 +0200 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-06-28 09:47:07 +0000 |
commit | 3b3ec32358aebd81ef5385f48dbf3ee4c93649e8 (patch) | |
tree | d70ad18dcb5756b55d4003e260323ce2e56d9c8e /starmath/source/mathmlexport.cxx | |
parent | 6231979ce1b89ce36e0a68139c96c5c1c1e704bb (diff) |
fdo#66086 - MathML export: wideslash, widebslash and overstrike
Change-Id: I1e8da340ffdacab133b0cff6d6344fe56da34bf8
Reviewed-on: https://gerrit.libreoffice.org/4465
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'starmath/source/mathmlexport.cxx')
-rw-r--r-- | starmath/source/mathmlexport.cxx | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index 8df9d28edb2a..f9e658998df3 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -766,6 +766,42 @@ void SmXMLExport::ExportBinaryVertical(const SmNode *pNode, int nLevel) ExportNodes(pNode->GetSubNode(2), nLevel); } +void SmXMLExport::ExportBinaryDiagonal(const SmNode *pNode, int nLevel) +{ + OSL_ENSURE(pNode->GetNumSubNodes()==3, "Bad Slash"); + + if (pNode->GetToken().eType == TWIDESLASH) + { + // wideslash + // export the node as <mfrac bevelled="true"> + AddAttribute(XML_NAMESPACE_MATH, XML_BEVELLED, XML_TRUE); + SvXMLElementExport aFraction(*this, XML_NAMESPACE_MATH, XML_MFRAC, + sal_True, sal_True); + ExportNodes(pNode->GetSubNode(0), nLevel); + ExportNodes(pNode->GetSubNode(1), nLevel); + } + else + { + // widebslash + // We can not use <mfrac> to a backslash, so just use <mo>\</mo> + SvXMLElementExport *pRow = new SvXMLElementExport(*this, + XML_NAMESPACE_MATH, XML_MROW, sal_True, sal_True); + + ExportNodes(pNode->GetSubNode(0), nLevel); + + { // Scoping for <mo> creation + SvXMLElementExport aMo(*this, XML_NAMESPACE_MATH, XML_MO, + sal_True,sal_True); + sal_Unicode nArse[2] = {MS_BACKSLASH,0x00}; + GetDocHandler()->characters(nArse); + } + + ExportNodes(pNode->GetSubNode(1), nLevel); + + delete pRow; + } +} + void SmXMLExport::ExportTable(const SmNode *pNode, int nLevel) { SvXMLElementExport *pTable=0; @@ -1090,7 +1126,14 @@ void SmXMLExport::ExportAttributes(const SmNode *pNode, int nLevel) pElement = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MUNDER, sal_True,sal_True); } - else if (pNode->GetToken().eType != TOVERSTRIKE) + else if (pNode->GetToken().eType == TOVERSTRIKE) + { + // export as <menclose notation="horizontalstrike"> + AddAttribute(XML_NAMESPACE_MATH, XML_NOTATION, XML_HORIZONTALSTRIKE); + pElement = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, + XML_MENCLOSE, sal_True, sal_True); + } + else { AddAttribute(XML_NAMESPACE_MATH, XML_ACCENT, XML_TRUE); @@ -1449,6 +1492,9 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel) case NBINVER: ExportBinaryVertical(pNode, nLevel); break; + case NBINDIAGONAL: + ExportBinaryDiagonal(pNode, nLevel); + break; case NSUBSUP: ExportSubSupScript(pNode, nLevel); break; |