Kaydet (Commit) 1418694e authored tarafından Frédéric Wang's avatar Frédéric Wang Kaydeden (comit) Fridrich Strba

fdo#66075 - Formula editor: export blanks as MathML <mspace> elements.

Change-Id: I5cc0ed9a1273b5fb59d5dbaf63a382c844820ff9
Reviewed-on: https://gerrit.libreoffice.org/4454Reviewed-by: 's avatarFridrich Strba <fridrich@documentfoundation.org>
Tested-by: 's avatarFridrich Strba <fridrich@documentfoundation.org>
üst 3b3ec323
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment