summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Wang <fred.wang@free.fr>2013-07-04 10:57:35 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-07-04 15:00:33 +0000
commit75032fde426c781aea0af24eb9b9f6432a6bc9bb (patch)
treec64fde4fa2e088060734de908c0dae1bd2c10367
parent5795edb20e642dad04f572b4fb2c0e86a7d8b6e7 (diff)
fdo#66575 - MathML export: fix errors with newline, binom and stack.
Change-Id: I6c66864381a6a5b7415e9fae682e50865b3f76db Reviewed-on: https://gerrit.libreoffice.org/4712 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--starmath/source/mathmlexport.cxx9
-rw-r--r--starmath/source/parse.cxx2
2 files changed, 8 insertions, 3 deletions
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 12f7f5af7b50..2c9474e37755 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -868,8 +868,13 @@ void SmXMLExport::ExportTable(const SmNode *pNode, int nLevel)
//no subnodes, the newline is superfulous so we just drop
//the last node, inclusion would create a bad MathML
//table
- if (nSize >= 1 && pNode->GetSubNode(nSize-1)->GetNumSubNodes() == 0)
- --nSize;
+ if (nSize >= 1)
+ {
+ const SmNode *pLine = pNode->GetSubNode(nSize-1);
+ if (pLine->GetType() == NLINE && pLine->GetNumSubNodes() > 0 &&
+ pLine->GetSubNode(0)->GetToken().eType == TEND)
+ --nSize;
+ }
// try to avoid creating a mtable element when the formula consists only
// of a single output line
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 59294475704e..e5325919f125 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -1072,7 +1072,7 @@ void SmParser::Line()
//this is to avoid a formula tree without any caret
//positions, in visual formula editor.
if(ExpressionArray.empty())
- ExpressionArray.push_back(new SmExpressionNode(SmToken()));
+ ExpressionArray.push_back(new SmExpressionNode(m_aCurToken));
SmStructureNode *pSNode = new SmLineNode(m_aCurToken);
pSNode->SetSubNodes(ExpressionArray);