summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Wang <fred.wang@free.fr>2013-07-07 08:31:56 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2013-07-09 09:07:29 +0000
commit89bb6fd1918f342886bd1c6f4e4824a6e87743d4 (patch)
tree6c12ff25c61ddcc5e73ee05cbb79a28acb49bab9
parent06292e619370f9e54e859f051a743b6bacb2a2cd (diff)
fdo#66277 - fix alignment for binom and stack too.
Change-Id: Id4c104bb22cb7fc3c4811b3ea417229af01de02b Reviewed-on: https://gerrit.libreoffice.org/4752 Reviewed-by: Khaled Hosny <khaledhosny@eglug.org> Tested-by: Khaled Hosny <khaledhosny@eglug.org>
-rw-r--r--starmath/source/mathmlexport.cxx34
1 files changed, 23 insertions, 11 deletions
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index b35753fe4156..6c9aab2763ab 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -889,18 +889,30 @@ void SmXMLExport::ExportTable(const SmNode *pNode, int nLevel)
if (pTable)
{
pRow = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MTR, sal_True, sal_True);
- if (pTemp->GetNumSubNodes() > 0)
+ SmTokenType eAlign = TALIGNC;
+ if (pTemp->GetType() == NALIGN)
{
- const SmNode *pFirstChild = pTemp->GetSubNode(0);
- if (pFirstChild->GetType() == NALIGN &&
- pFirstChild->GetToken().eType != TALIGNC)
- {
- // If a left or right alignment is specified on this line,
- // attach the corresponding columnalign attribute.
- AddAttribute(XML_NAMESPACE_MATH, XML_COLUMNALIGN,
- pFirstChild->GetToken().eType == TALIGNL ?
- XML_LEFT : XML_RIGHT);
- }
+ // For Binom() and Stack() constructions, the NALIGN nodes
+ // are direct children.
+ // binom{alignl ...}{alignr ...} and
+ // stack{alignl ... ## alignr ... ## ...}
+ eAlign = pTemp->GetToken().eType;
+ }
+ else if (pTemp->GetType() == NLINE &&
+ pTemp->GetNumSubNodes() == 1 &&
+ pTemp->GetSubNode(0)->GetType() == NALIGN)
+ {
+ // For the Table() construction, the NALIGN node is a child
+ // of an NLINE node.
+ // alignl ... newline alignr ... newline ...
+ eAlign = pTemp->GetSubNode(0)->GetToken().eType;
+ }
+ if (eAlign != TALIGNC)
+ {
+ // If a left or right alignment is specified on this line,
+ // attach the corresponding columnalign attribute.
+ AddAttribute(XML_NAMESPACE_MATH, XML_COLUMNALIGN,
+ eAlign == TALIGNL ? XML_LEFT : XML_RIGHT);
}
pCell = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MTD, sal_True, sal_True);
}