[Libreoffice-commits] core.git: starmath/source

Frédéric Wang fred.wang at free.fr
Tue Jul 9 02:07:51 PDT 2013


 starmath/source/mathmlexport.cxx |   34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

New commits:
commit 89bb6fd1918f342886bd1c6f4e4824a6e87743d4
Author: Frédéric Wang <fred.wang at free.fr>
Date:   Sun Jul 7 08:31:56 2013 +0200

     fdo#66277 - fix alignment for binom and stack too.
    
    Change-Id: Id4c104bb22cb7fc3c4811b3ea417229af01de02b
    Reviewed-on: https://gerrit.libreoffice.org/4752
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
    Tested-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index b35753f..6c9aab2 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);
             }


More information about the Libreoffice-commits mailing list