summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorFrédéric Wang <fred.wang@free.fr>2013-06-30 17:34:40 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2013-07-02 23:25:49 +0000
commit6f86d931b4266d00fec75c0124ac9fc3026a4f1b (patch)
tree1af711091235861b387ccb85595dd3fb6b6aedd4 /starmath
parentd2a71b952850cdf1a7efc5c0f86df9864201a950 (diff)
fdo#66283 - MathML export: remove useless mrow/mstyle with font commands
Change-Id: I57870a22ef915950fe177dcb75ab31a25f2520c8 Reviewed-on: https://gerrit.libreoffice.org/4634 Reviewed-by: Khaled Hosny <khaledhosny@eglug.org> Tested-by: Khaled Hosny <khaledhosny@eglug.org>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/mathmlexport.cxx26
-rw-r--r--starmath/source/mathmlexport.hxx3
2 files changed, 14 insertions, 15 deletions
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index a10765e7d398..a523693f7b30 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -780,13 +780,15 @@ void SmXMLExport::ExportUnaryHorizontal(const SmNode *pNode, int nLevel)
ExportExpression(pNode, nLevel);
}
-void SmXMLExport::ExportExpression(const SmNode *pNode, int nLevel)
+void SmXMLExport::ExportExpression(const SmNode *pNode, int nLevel,
+ bool bNoMrowContainer /*=false*/)
{
SvXMLElementExport *pRow=0;
sal_uLong nSize = pNode->GetNumSubNodes();
// #i115443: nodes of type expression always need to be grouped with mrow statement
- if (nSize > 1 || (pNode && pNode->GetType() == NEXPRESSION))
+ if (!bNoMrowContainer &&
+ (nSize > 1 || (pNode && pNode->GetType() == NEXPRESSION)))
pRow = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MROW, sal_True, sal_True);
for (sal_uInt16 i = 0; i < nSize; i++)
@@ -1290,8 +1292,6 @@ static bool lcl_HasEffectOnMathvariant( const SmTokenType eType )
void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel)
{
- SvXMLElementExport *pElement = 0;
-
//
// gather the mathvariant attribut relevant data from all
// successively following SmFontNodes...
@@ -1328,10 +1328,8 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel)
switch (pNode->GetToken().eType)
{
- //wrap a phantom element around everything*/
case TPHANTOM:
- pElement = new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
- XML_MPHANTOM, sal_True,sal_True);
+ // No attribute needed. An <mphantom> element will be used below.
break;
case TBLACK:
AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_BLACK);
@@ -1455,15 +1453,15 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel)
break;
}
- //for now we will just always export with a style and not worry about
- //anyone else for the moment.
{
- //wrap a style around it
- SvXMLElementExport aStyle(*this, XML_NAMESPACE_MATH, XML_MSTYLE, sal_True,sal_True);
- ExportExpression(pNode, nLevel);
+ // Wrap everything in an <mphantom> or <mstyle> element. These elements
+ // are mrow-like, so ExportExpression doesn't need to add an explicit
+ // <mrow> element. See #fdo 66283.
+ SvXMLElementExport aElement(*this, XML_NAMESPACE_MATH,
+ pNode->GetToken().eType == TPHANTOM ? XML_MPHANTOM : XML_MSTYLE,
+ sal_True, sal_True);
+ ExportExpression(pNode, nLevel, true);
}
-
- delete pElement;
}
diff --git a/starmath/source/mathmlexport.hxx b/starmath/source/mathmlexport.hxx
index 3cbaaae7c400..d7ca75a7f534 100644
--- a/starmath/source/mathmlexport.hxx
+++ b/starmath/source/mathmlexport.hxx
@@ -84,7 +84,8 @@ protected:
void ExportNodes(const SmNode *pNode, int nLevel);
void ExportTable(const SmNode *pNode, int nLevel);
void ExportLine(const SmNode *pNode, int nLevel);
- void ExportExpression(const SmNode *pNode, int nLevel);
+ void ExportExpression(const SmNode *pNode, int nLevel,
+ bool bNoMrowContainer = false);
void ExportText(const SmNode *pNode, int nLevel);
void ExportMath(const SmNode *pNode, int nLevel);
void ExportPolygon(const SmNode *pNode, int nLevel);