diff options
-rw-r--r-- | starmath/source/mathmlexport.cxx | 19 | ||||
-rw-r--r-- | starmath/source/mathmlimport.cxx | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index f9e658998df3..e18a69ec78cf 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -882,15 +882,28 @@ void SmXMLExport::ExportText(const SmNode *pNode, int /*nLevel*/) delete pText; } -void SmXMLExport::ExportBlank(const SmNode * /*pNode*/, int /*nLevel*/) +void SmXMLExport::ExportBlank(const SmNode *pNode, int /*nLevel*/) { - //!! exports an empty <mi> tag since for example "~_~" is allowed in + const SmBlankNode *pTemp = static_cast<const SmBlankNode *>(pNode); + //!! exports an <mspace> element. Note that for example "~_~" is allowed in //!! Math (so it has no sense at all) but must not result in an empty //!! <msub> tag in MathML !! + if (pTemp->GetBlankNum() != 0) + { + // Attach a width attribute. We choose the (somewhat arbitrary) values + // ".5em" for a small gap '`' and "2em" for a large gap '~'. + // (see SmBlankNode::IncreaseBy for how pTemp->nNum is set). + OUStringBuffer sStrBuf; + ::sax::Converter::convertDouble(sStrBuf, pTemp->GetBlankNum() * .5); + sStrBuf.append(OUString("em")); + AddAttribute(XML_NAMESPACE_MATH, XML_WIDTH, sStrBuf.getStr()); + } + SvXMLElementExport *pText; - pText = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MI, sal_True, sal_False); + pText = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MSPACE, + sal_True, sal_False); GetDocHandler()->characters( OUString() ); delete pText; diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 608ab7ac92ad..beaaf3d59548 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -1418,6 +1418,8 @@ public: void SmXMLSpaceContext_Impl::StartElement( const uno::Reference<xml::sax::XAttributeList > & /*xAttrList*/ ) { + // There is not any syntax in Math to specify blank nodes of arbitrary + // size. Hence we always interpret an <mspace> as a large gap "~". SmToken aToken; aToken.cMathChar = '\0'; aToken.eType = TBLANK; |