[Libreoffice-commits] core.git: Changes to 'refs/changes/29/4629/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/99/4699/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/99/4699/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/29/4629/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/20/4520/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/32/4632/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/20/4520/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/32/4632/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/54/4454/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/54/4454/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/94/4494/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/95/4595/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/94/4494/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/57/4457/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/30/4630/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/94/4494/3'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/30/4630/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/48/4748/3'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/50/4450/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/51/4751/3'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/65/4465/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/12/4712/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/65/4465/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/50/4450/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/51/4751/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/52/4752/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/51/4751/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/52/4752/3'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/52/4752/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/95/4695/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/07/4607/3'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/48/4748/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/61/4661/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/95/4695/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/07/4607/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/07/4607/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/25/4625/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/25/4625/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/31/4631/2'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/31/4631/1'

2014-09-29 Thread Frédéric Wang

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-09 Thread Frédéric Wang
 starmath/qa/cppunit/test_nodetotextvisitors.cxx |   42 
 1 file changed, 42 insertions(+)

New commits:
commit 48d696e2049e771ebc797b7a7694e02de89b6020
Author: Frédéric Wang fred.w...@free.fr
Date:   Fri Jul 5 21:28:47 2013 +0200

 Tests for fdo#55853, i#11752, fdo#66081

Change-Id: Ifb1fc23c416f47c6618e7ef22a53b1744ff0e2bc
Reviewed-on: https://gerrit.libreoffice.org/4748
Reviewed-by: Khaled Hosny khaledho...@eglug.org
Tested-by: Khaled Hosny khaledho...@eglug.org

diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx 
b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
index 6ce2e5d..4409d97 100644
--- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx
+++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
@@ -75,6 +75,7 @@ public:
 void testBinVerInUnary();
 void testBinHorInSubSup();
 void testUnaryInMixedNumberAsNumerator();
+void testMiscEquivalent();
 
 CPPUNIT_TEST_SUITE(Test);
 CPPUNIT_TEST(SimpleUnaryOp);
@@ -93,6 +94,7 @@ public:
 CPPUNIT_TEST(testBinVerInUnary);
 CPPUNIT_TEST(testBinHorInSubSup);
 CPPUNIT_TEST(testUnaryInMixedNumberAsNumerator);
+CPPUNIT_TEST(testMiscEquivalent);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -100,6 +102,7 @@ private:
 SmDocShellRef xDocShRef;
 void parseandparseagain(const char *input, const char *test_name);
 void ParseAndCheck(const char *input, const char *expected, const char 
*test_name);
+void ParseAndCompare(const char *formula1, const char *formula2, const 
char *test_name);
 };
 
 void Test::setUp()
@@ -490,6 +493,30 @@ void Test::ParseAndCheck(const char *formula, const char * 
expected, const char
 delete pNode;
 }
 
+// Parse two formula commands and verify that they give the same output
+void Test::ParseAndCompare(const char *formula1, const char *formula2, const 
char *test_name)
+{
+OUString sOutput1, sOutput2;
+SmNode *pNode1, *pNode2;
+
+// parse formula1
+OUString sInput1 = OUString::createFromAscii(formula1);
+pNode1 = SmParser().ParseExpression(sInput1);
+pNode1-Prepare(xDocShRef-GetFormat(), *xDocShRef);
+SmNodeToTextVisitor(pNode1, sOutput1);
+
+// parse formula2
+OUString sInput2 = OUString::createFromAscii(formula2);
+pNode2 = SmParser().ParseExpression(sInput2);
+pNode2-Prepare(xDocShRef-GetFormat(), *xDocShRef);
+SmNodeToTextVisitor(pNode2, sOutput2);
+
+CPPUNIT_ASSERT_EQUAL_MESSAGE(test_name, sOutput1, sOutput2);
+
+delete pNode1;
+delete pNode2;
+}
+
 void Test::testBinomInBinHor()
 {
 String sInput, sExpected;
@@ -627,6 +654,21 @@ void Test::testUnaryInMixedNumberAsNumerator()
 delete pTree;
 }
 
+void Test::testMiscEquivalent()
+{
+// fdo#55853
+ParseAndCompare(2x, 2 x, Number times variable);
+ParseAndCompare(3x^2, 3 x^2, Number times power);
+
+// i#11752 and fdo#55853
+ParseAndCompare(x_2n, x_{2 n}, Number times variable in subscript);
+ParseAndCompare(x^2n, x^{2 n}, Number times variable in supscript);
+
+// fdo#66081
+ParseAndCompare({x}, x, Variable in brace);
+ParseAndCompare({{x+{{y, x+y, Nested braces);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-09 Thread Frédéric Wang
 filter/source/xslt/odf2xhtml/export/xhtml/body.xsl |   22 ++---
 1 file changed, 19 insertions(+), 3 deletions(-)

New commits:
commit fb2edd686c8b8ba4318e957f7cf23060ffd3e2c3
Author: Frédéric Wang fred.w...@free.fr
Date:   Sat Jul 6 15:57:42 2013 +0200

  fdo#66645 XHTML export: ignore incorrect style on math objects

Change-Id: Ied09a189184380aa3eba30261c7517f6bccf6d09
Reviewed-on: https://gerrit.libreoffice.org/4751
Reviewed-by: Khaled Hosny khaledho...@eglug.org
Tested-by: Khaled Hosny khaledho...@eglug.org

diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl 
b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index e83195c..2dada31 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -1068,6 +1068,23 @@
xsl:value-of select=$elem-name/' is a draw:frame.
/xsl:comment
xsl:element name={$elem-name}
+ xsl:choose
+   xsl:when test=draw:object/math:math
+ !-- draw:frame elements contain many data that are not
+  relevant for mathematical formulas and that may
+  cause incorrect rendering. Let's ignore the
+  replacement image and keep only the id attribute.
+  See fdo#66645 --
+ xsl:apply-templates select=@draw:name/
+ xsl:text /xsl:text
+ xsl:apply-templates select=draw:object[1]/
+ !-- TODO: do not always add a space after the formula,
+  for example when it is followed by a comma, period,
+  dash etc This will probably require using regexp
+  features like xsl:analyze-string --
+ xsl:text /xsl:text
+   /xsl:when
+   xsl:otherwise
xsl:attribute name=style
xsl:call-template name=widthAndHeight/
xsl:text padding:0; /xsl:text
@@ -1090,6 +1107,8 @@
xsl:apply-templates select=node()
xsl:with-param name=globalData 
select=$globalData/
/xsl:apply-templates
+   /xsl:otherwise
+ /xsl:choose
/xsl:element
/xsl:template
 
@@ -2969,7 +2988,4 @@
xsl:apply-templates select=*[1] mode=math/
/xsl:template
 
-   !-- Ignore the replacement image --
-   xsl:template 
match=draw:frame/draw:image[preceding-sibling::*[1]/math:math]/
-
 /xsl:stylesheet
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-09 Thread Frédéric Wang
 starmath/source/mathmlexport.cxx |   34 +++---
 1 file changed, 23 insertions(+), 11 deletions(-)

New commits:
commit 89bb6fd1918f342886bd1c6f4e4824a6e87743d4
Author: Frédéric Wang fred.w...@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 khaledho...@eglug.org
Tested-by: Khaled Hosny khaledho...@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);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-04 Thread Frédéric Wang
 starmath/source/mathmlexport.cxx |9 +++--
 starmath/source/parse.cxx|2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 75032fde426c781aea0af24eb9b9f6432a6bc9bb
Author: Frédéric Wang fred.w...@free.fr
Date:   Thu Jul 4 10:57:35 2013 +0200

 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 caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 12f7f5a..2c9474e 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 5929447..e532591 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);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-04 Thread Frédéric Wang
 starmath/source/mathmlexport.cxx |4 ++--
 starmath/source/parse.cxx|6 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 5d63514c6eddcd61a319c994202c7689f60ebf0a
Author: Frédéric Wang fred.w...@free.fr
Date:   Thu Jul 4 20:21:06 2013 +0100

fdo#66575 - MathML export: fix errors with newline, binom and stack.

Change-Id: I6833140aaf3fcfc47b81f7d324af88843de00834

diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 2c9474e..b35753f 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -871,8 +871,8 @@ void SmXMLExport::ExportTable(const SmNode *pNode, int 
nLevel)
 if (nSize = 1)
 {
 const SmNode *pLine = pNode-GetSubNode(nSize-1);
-if (pLine-GetType() == NLINE  pLine-GetNumSubNodes()  0 
-pLine-GetSubNode(0)-GetToken().eType == TEND)
+if (pLine-GetType() == NLINE  pLine-GetNumSubNodes() == 1 
+pLine-GetSubNode(0)-GetToken().eType == TNEWLINE)
 --nSize;
 }
 
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index e532591..aa3a66f 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -1072,7 +1072,11 @@ 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(m_aCurToken));
+{
+SmToken aTok = SmToken();
+aTok.eType = TNEWLINE;
+ExpressionArray.push_back(new SmExpressionNode(aTok));
+}
 
 SmStructureNode *pSNode = new SmLineNode(m_aCurToken);
 pSNode-SetSubNodes(ExpressionArray);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-03 Thread Frédéric Wang
 include/xmloff/xmltoken.hxx  |1 
 starmath/source/mathmlexport.cxx |   56 ---
 xmloff/source/core/xmltoken.cxx  |1 
 3 files changed, 31 insertions(+), 27 deletions(-)

New commits:
commit c61f35275c613cf7ba6f1aa7bc8235340f9df8f7
Author: Frédéric Wang fred.w...@free.fr
Date:   Sun Jun 30 16:15:14 2013 +0200

 fdo#66282 - MathML export: improve ExportBrace

Change-Id: If15038f8942c649703659e05868162c31785c762
Reviewed-on: https://gerrit.libreoffice.org/4632
Reviewed-by: Khaled Hosny khaledho...@eglug.org
Tested-by: Khaled Hosny khaledho...@eglug.org

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 690aad0..2523ad1 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -736,6 +736,7 @@ namespace xmloff { namespace token {
 XML_FALSE,
 XML_FAMILY,
 XML_FAST,
+XML_FENCE,
 XML_FIELD_NUMBER,
 XML_FILE_NAME,
 XML_FILL,
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index a523693..1dd1634 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -1144,51 +1144,53 @@ void SmXMLExport::ExportBrace(const SmNode *pNode, int 
nLevel)
 const SmNode *pTemp;
 const SmNode *pLeft=pNode-GetSubNode(0);
 const SmNode *pRight=pNode-GetSubNode(2);
-SvXMLElementExport *pFences=0,*pRow=0;
-if ( ((pLeft)  (pLeft-GetToken().eType != TNONE)) 
-((pRight)  (pRight-GetToken().eType != TNONE)) 
-(pNode-GetScaleMode() == SCALE_HEIGHT))
-{
-sal_Unicode nArse[2];
-nArse[1] = 0;
-nArse[0] = static_cast
-const SmMathSymbolNode* (pLeft)-GetText()[0];
-OSL_ENSURE(nArse[0] != 0x,Non existent symbol);
-AddAttribute(XML_NAMESPACE_MATH, XML_OPEN,nArse);
-nArse[0] = static_cast
-const SmMathSymbolNode* (pRight)-GetText()[0];
-OSL_ENSURE(nArse[0] != 0x,Non existent symbol);
-AddAttribute(XML_NAMESPACE_MATH, XML_CLOSE,nArse);
-pFences = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, 
XML_MFENCED,
-sal_True,sal_True);
-}
-else if (pLeft  (pLeft-GetToken().eType != TNONE))
+SvXMLElementExport *pRow=0;
+
+// This used to generate mfenced or mrow+mo elements according to
+// the stretchiness of fences. The MathML recommendation defines an
+// mrow+mo construction that is equivalent to the mfenced element:
+// http://www.w3.org/TR/MathML3/chapter3.html#presm.mfenced
+// To simplify our code and avoid issues with mfenced implementations in
+// MathML rendering engines, we now always generate mrow+mo elements.
+// See #fdo 66282.
+
+// mrow
+pRow = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MROW,
+sal_True, sal_True);
+
+//   mo fence=true opening-fence /mo
+if (pLeft  (pLeft-GetToken().eType != TNONE))
 {
-pRow = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MROW,
-sal_True, sal_True);
+AddAttribute(XML_NAMESPACE_MATH, XML_FENCE, XML_TRUE);
 if (pNode-GetScaleMode() == SCALE_HEIGHT)
 AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_TRUE);
 else
 AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_FALSE);
 ExportNodes(pLeft, nLevel+1);
 }
-else
-pRow = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MROW,
-sal_True, sal_True);
 
 if (NULL != (pTemp = pNode-GetSubNode(1)))
+{
+// mrow
+SvXMLElementExport aRow(*this, XML_NAMESPACE_MATH, XML_MROW,
+sal_True, sal_True);
 ExportNodes(pTemp, nLevel+1);
-if (pFences)
-delete pFences;
-else if (pRight  (pRight-GetToken().eType != TNONE))
+// /mrow
+}
+
+//   mo fence=true closing-fence /mo
+if (pRight  (pRight-GetToken().eType != TNONE))
 {
+AddAttribute(XML_NAMESPACE_MATH, XML_FENCE, XML_TRUE);
 if (pNode-GetScaleMode() == SCALE_HEIGHT)
 AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_TRUE);
 else
 AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_FALSE);
 ExportNodes(pRight, nLevel+1);
 }
+
 delete pRow;
+// /mrow
 }
 
 void SmXMLExport::ExportRoot(const SmNode *pNode, int nLevel)
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 164f03c..1de3179 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -741,6 +741,7 @@ namespace xmloff { namespace token {
 TOKEN( false,   XML_FALSE ),
 TOKEN( family,  XML_FAMILY ),
 TOKEN( fast,XML_FAST ),
+TOKEN( fence,   XML_FENCE ),
 TOKEN( field-number,XML_FIELD_NUMBER ),
 TOKEN( file-name, 

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

2013-07-03 Thread Frédéric Wang
 extras/source/truetype/symbol/OpenSymbol.sfd |   12 ++--
 extras/source/truetype/symbol/README |5 +
 extras/source/truetype/symbol/opens___.ttf   |binary
 3 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit c5887193572ea1295b9d36008af5851127fd9647
Author: Frédéric Wang fred.w...@free.fr
Date:   Wed Jul 3 11:58:37 2013 +0200

Fix glyph names in OpenSymbol and add a note in the README

Change-Id: Iddea789abf66c144aef38176bb97660adaaa3d9a
Reviewed-on: https://gerrit.libreoffice.org/4695
Tested-by: Khaled Hosny khaledho...@eglug.org
Reviewed-by: Khaled Hosny khaledho...@eglug.org

diff --git a/extras/source/truetype/symbol/OpenSymbol.sfd 
b/extras/source/truetype/symbol/OpenSymbol.sfd
index 6a7991c..463b8a1 100644
--- a/extras/source/truetype/symbol/OpenSymbol.sfd
+++ b/extras/source/truetype/symbol/OpenSymbol.sfd
@@ -4,7 +4,7 @@ FullName: OpenSymbol
 FamilyName: OpenSymbol
 Weight: Book
 Copyright: (c) 2009 Sun Microsystems Inc.\nTHERE DOES NOT EXIST (c) 2011 
Julien Nabet\nPRECEDES - DOES NOT SUCCEED (c) 2011 Olivier Hallot\nPRIME - 
TRIPLE PRIME (c) 2013 Mathias Hasselmann
-Version: 102.5
+Version: 102.6
 ItalicAngle: 0
 UnderlinePosition: -143
 UnderlineWidth: 20
@@ -773,7 +773,7 @@ ShortTable: maxp 16
   0
   0
 EndShort
-LangName: 1033   Regular OpenSymbol  Version 102.5 
+LangName: 1033   Regular OpenSymbol  Version 102.6 
 GaspTable: 1 65535 2 0
 Encoding: Custom
 UnicodeInterp: none
@@ -107692,7 +107692,7 @@ SplineSet
 EndSplineSet
 EndChar
 
-StartChar: graveaccent
+StartChar: grave
 Encoding: 993 96 1004
 Width: 681
 Flags: W
@@ -107709,7 +107709,7 @@ SplineSet
 EndSplineSet
 EndChar
 
-StartChar: acuteaccent
+StartChar: acute
 Encoding: 994 180 1005
 Width: 681
 Flags: W
@@ -107742,7 +107742,7 @@ SplineSet
 EndSplineSet
 EndChar
 
-StartChar: verticalline
+StartChar: bar
 Encoding: 996 124 1007
 Width: 813
 Flags: W
@@ -107758,7 +107758,7 @@ SplineSet
 EndSplineSet
 EndChar
 
-StartChar: doubleverticalline
+StartChar: uni2016
 Encoding: 997 8214 1008
 Width: 1183
 Flags: W
diff --git a/extras/source/truetype/symbol/README 
b/extras/source/truetype/symbol/README
index fee3cef..67efc7b 100644
--- a/extras/source/truetype/symbol/README
+++ b/extras/source/truetype/symbol/README
@@ -14,3 +14,8 @@ the .sfd where the version is mentioned, e.g.
 
 -LangName: 1033   Regular OpenSymbol  Version 102.3
 +LangName: 1033   Regular OpenSymbol  Version 102.4
+
+The glyph names in the font should follow Adobe Glyph list for new fonts
+(http://partners.adobe.com/public/developer/en/opentype/aglfn13.txt) or just 
the
+uni scheme (see http://www.adobe.com/devnet/opentype/archives/glyph.html 
for
+the rationale).
diff --git a/extras/source/truetype/symbol/opens___.ttf 
b/extras/source/truetype/symbol/opens___.ttf
index 5fc1649..51f2a4d 100644
Binary files a/extras/source/truetype/symbol/opens___.ttf and 
b/extras/source/truetype/symbol/opens___.ttf differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-03 Thread Frédéric Wang
 starmath/source/mathmlexport.cxx |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 477f5880039830885b12831ba2995e63953384aa
Author: Frédéric Wang fred.w...@free.fr
Date:   Wed Jul 3 12:17:53 2013 +0200

 fdo#66281 - followup: fix a comment for overbrace.

Change-Id: Ia88a1585a6ade94b1ecc95bf4b3d0a38881b71dd
Reviewed-on: https://gerrit.libreoffice.org/4699
Reviewed-by: Khaled Hosny khaledho...@eglug.org
Tested-by: Khaled Hosny khaledho...@eglug.org

diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 1dd1634..12f7f5a 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -1469,9 +1469,17 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int 
nLevel)
 
 void SmXMLExport::ExportVerticalBrace(const SmNode *pNode, int nLevel)
 {
-// Place the overbrace value OVER a horizontal brace and then place that
-// expression OVER the overbrace value. Similarly for the underbrace
-// construction.
+// [body] overbrace [script]
+//
+// Position body, overbrace and script vertically. First place the 
overbrace
+// OVER the body and then the script OVER this expression.
+//
+//  [script]
+//   --[overbrace]--
+// XX[body]XXX
+//
+// Similarly for the underbrace construction.
+
 XMLTokenEnum which;
 
 switch (pNode-GetToken().eType)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: Thoughts on LibreOffice Math

2013-07-03 Thread Frédéric WANG

/  problem with that is that there are actually 2 text editing components,
//  Writer and EditEngine (used by Impress/Draw/Calc)... the current
//  architecture of Math embedded objects has the advantage that it works
//  with both of these and so in all applications.
/
That is something we will have to consider, but the current way is just
counter intuitive, not only that inserting a formula is deeply hidden
behind multiple level menus, but also editing a formula switches to a
completely different UI causing much disruption IMO (and the need to
click a formula to edit it is just annoying). I don't mind keeping Math
as separate competent, but we need a more integrated math editing that
what we have now.
BTW, I'm wondering how using MathML (or more generally ODF objects) is 
related to this GSOC idea:


https://wiki.documentfoundation.org/Development/Gsoc/Ideas#ODF_Formulas_in_Writer

I'm not really sure to understand to which fields the proposal refers, 
but my idea was to use MathML everywhere in LibreOffice Writer.


--
Frédéric Wang
maths-informatique-jeux.com/blog/frederic

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2013-07-02 Thread Frédéric Wang
 extras/source/truetype/symbol/OpenSymbol.sfd |  120 +++
 extras/source/truetype/symbol/opens___.ttf   |binary
 starmath/inc/types.hxx   |   18 ++--
 starmath/source/node.cxx |   20 ++--
 starmath/source/ooxmlimport.cxx  |7 +
 5 files changed, 117 insertions(+), 48 deletions(-)

New commits:
commit fbc9c18875d1e86c9b3d7d5c13e1db13af23e3f0
Author: Frédéric Wang fred.w...@free.fr
Date:   Sun Jun 30 12:49:10 2013 +0200

 fdo#66276 - MathML export: avoid using combining characters.

Change-Id: I68cf5aaeb5b13adda76953636b0d3225fff4030c
Reviewed-on: https://gerrit.libreoffice.org/4630
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/extras/source/truetype/symbol/OpenSymbol.sfd 
b/extras/source/truetype/symbol/OpenSymbol.sfd
index 9a8efb0..3031e04 100644
--- a/extras/source/truetype/symbol/OpenSymbol.sfd
+++ b/extras/source/truetype/symbol/OpenSymbol.sfd
@@ -4,7 +4,7 @@ FullName: OpenSymbol
 FamilyName: OpenSymbol
 Weight: Book
 Copyright: (c) 2009 Sun Microsystems Inc.\nTHERE DOES NOT EXIST (c) 2011 
Julien Nabet\nPRECEDES - DOES NOT SUCCEED (c) 2011 Olivier Hallot\nPRIME - 
TRIPLE PRIME (c) 2013 Mathias Hasselmann
-Version: 102.3
+Version: 102.4
 ItalicAngle: 0
 UnderlinePosition: -143
 UnderlineWidth: 20
@@ -19,7 +19,7 @@ OS2Version: 0
 OS2_WeightWidthSlopeOnly: 0
 OS2_UseTypoMetrics: 1
 CreationTime: 1144938807
-ModificationTime: 1358186116
+ModificationTime: 1372588273
 PfmFamily: 81
 TTFWeight: 400
 TTFWidth: 5
@@ -773,18 +773,18 @@ ShortTable: maxp 16
   0
   0
 EndShort
-LangName: 1033   Regular OpenSymbol  Version 102.3 
-GaspTable: 1 65535 2
+LangName: 1033   Regular OpenSymbol  Version 102.4 
+GaspTable: 1 65535 2 0
 Encoding: Custom
 UnicodeInterp: none
 NameList: Adobe Glyph List
 DisplaySize: -24
 AntiAlias: 1
 FitToEm: 1
-WinInfo: 0 45 15
+WinInfo: 675 45 15
 BeginPrivate: 0
 EndPrivate
-BeginChars: 8834 1004
+BeginChars: 8834 1007
 
 StartChar: Alpha
 Encoding: 909 913 0
@@ -107379,7 +107379,7 @@ Validated: 1
 EndChar
 
 StartChar: uni227A
-Encoding: 8826 8826 995
+Encoding: 8826 8826 993
 Width: 1628
 GlyphClass: 2
 Flags: W
@@ -107402,7 +107402,7 @@ EndSplineSet
 EndChar
 
 StartChar: uni227B
-Encoding: 8827 8827 996
+Encoding: 8827 8827 994
 Width: 1628
 GlyphClass: 2
 Flags: W
@@ -107425,10 +107425,10 @@ EndSplineSet
 EndChar
 
 StartChar: uni227C
-Encoding: 8828 8828 997
+Encoding: 8828 8828 995
 Width: 1628
 GlyphClass: 2
-Flags: HWO
+Flags: W
 LayerCount: 2
 Fore
 SplineSet
@@ -107457,10 +107457,10 @@ EndSplineSet
 EndChar
 
 StartChar: uni227D
-Encoding: 8829 8829 998
+Encoding: 8829 8829 996
 Width: 1628
 GlyphClass: 2
-Flags: HWO
+Flags: W
 LayerCount: 2
 Fore
 SplineSet
@@ -107489,10 +107489,10 @@ EndSplineSet
 EndChar
 
 StartChar: uni227E
-Encoding: 8830 8830 999
+Encoding: 8830 8830 997
 Width: 1628
 GlyphClass: 2
-Flags: HWO
+Flags: W
 LayerCount: 2
 Fore
 SplineSet
@@ -107528,10 +107528,10 @@ EndSplineSet
 EndChar
 
 StartChar: uni227F
-Encoding: 8831 8831 1000
+Encoding: 8831 8831 998
 Width: 1628
 GlyphClass: 2
-Flags: HWO
+Flags: W
 LayerCount: 2
 Fore
 SplineSet
@@ -107567,10 +107567,10 @@ EndSplineSet
 EndChar
 
 StartChar: uni2280
-Encoding: 8832 8832 1001
+Encoding: 8832 8832 999
 Width: 1628
 GlyphClass: 2
-Flags: WO
+Flags: W
 LayerCount: 2
 Fore
 SplineSet
@@ -107599,7 +107599,7 @@ EndSplineSet
 EndChar
 
 StartChar: uni2281
-Encoding: 8833 8833 1002
+Encoding: 8833 8833 1000
 Width: 1628
 GlyphClass: 2
 Flags: W
@@ -107630,10 +107630,35 @@ SplineSet
 EndSplineSet
 EndChar
 
+StartChar: primetriple
+Encoding: 2034 8244 1001
+Width: 1233
+Flags: W
+LayerCount: 2
+Fore
+SplineSet
+565 1456 m 1,0,-1
+ 270 1110 l 1,1,-1
+ 236 1110 l 1,2,-1
+ 342 1456 l 1,3,-1
+ 565 1456 l 1,0,-1
+841 1456 m 1,4,-1
+ 546 1110 l 1,5,-1
+ 512 1110 l 1,6,-1
+ 618 1456 l 1,7,-1
+ 841 1456 l 1,4,-1
+1117 1456 m 1,8,-1
+ 822 1110 l 1,9,-1
+ 788 1110 l 1,10,-1
+ 894 1456 l 1,11,-1
+ 1117 1456 l 1,8,-1
+EndSplineSet
+EndChar
+
 StartChar: prime
-Encoding: 2032 8242 1001
+Encoding: 2032 8242 1002
 Width: 681
-Flags: WO
+Flags: W
 HStem: 1110 346
 VStem: 236 329
 LayerCount: 2
@@ -107648,7 +107673,7 @@ EndSplineSet
 EndChar
 
 StartChar: primedbl
-Encoding: 2033 8243 1002
+Encoding: 2033 8243 1003
 Width: 957
 Flags: W
 LayerCount: 2
@@ -107667,10 +107692,29 @@ SplineSet
 EndSplineSet
 EndChar
 
-StartChar: primetriple
-Encoding: 2034 8244 1003
-Width: 1233
+StartChar: graveaccent
+Encoding: 993 96 1004
+Width: 681
+Flags: W
+HStem: 1130 347
+VStem: 117 329
+LayerCount: 2
+Fore
+SplineSet
+117 1477 m 1,0,-1
+ 342 1477 l 1,1,-1
+ 446 1130 l 1,2,-1
+ 412 1130 l 1,3,-1
+ 117 1477 l 1,0,-1
+EndSplineSet
+EndChar
+
+StartChar: acuteaccent
+Encoding: 994 180 1005
+Width: 681
 Flags: W
+HStem: 1110 346
+VStem: 236 329
 LayerCount: 2
 Fore
 SplineSet
@@ -107679,16 +107723,22 @@ SplineSet
  236 1110 l 1,2,-1
  342 1456 l 

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

2013-07-02 Thread Frédéric Wang
 extras/source/truetype/symbol/OpenSymbol.sfd |   45 ---
 extras/source/truetype/symbol/opens___.ttf   |binary
 starmath/inc/types.hxx   |4 ++
 starmath/source/cursor.cxx   |   12 +++
 starmath/source/mathtype.cxx |6 ++-
 starmath/source/node.cxx |6 ++-
 starmath/source/ooxmlimport.cxx  |8 ++--
 starmath/source/parse.cxx|   18 +-
 8 files changed, 72 insertions(+), 27 deletions(-)

New commits:
commit be4837c9da190b4450a7f8a46ee5b9808e5dd941
Author: Frédéric Wang fred.w...@free.fr
Date:   Mon Jul 1 21:14:53 2013 +0200

 fdo#66416 -  Use appropriate unicode characters for math Brackets

Change-Id: I43d74c92f0de65f9456f5cd8ae150466b6a43717
Reviewed-on: https://gerrit.libreoffice.org/4661
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/extras/source/truetype/symbol/OpenSymbol.sfd 
b/extras/source/truetype/symbol/OpenSymbol.sfd
index 3031e04..6a7991c 100644
--- a/extras/source/truetype/symbol/OpenSymbol.sfd
+++ b/extras/source/truetype/symbol/OpenSymbol.sfd
@@ -4,7 +4,7 @@ FullName: OpenSymbol
 FamilyName: OpenSymbol
 Weight: Book
 Copyright: (c) 2009 Sun Microsystems Inc.\nTHERE DOES NOT EXIST (c) 2011 
Julien Nabet\nPRECEDES - DOES NOT SUCCEED (c) 2011 Olivier Hallot\nPRIME - 
TRIPLE PRIME (c) 2013 Mathias Hasselmann
-Version: 102.4
+Version: 102.5
 ItalicAngle: 0
 UnderlinePosition: -143
 UnderlineWidth: 20
@@ -19,7 +19,7 @@ OS2Version: 0
 OS2_WeightWidthSlopeOnly: 0
 OS2_UseTypoMetrics: 1
 CreationTime: 1144938807
-ModificationTime: 1372588273
+ModificationTime: 1372703526
 PfmFamily: 81
 TTFWeight: 400
 TTFWidth: 5
@@ -773,7 +773,7 @@ ShortTable: maxp 16
   0
   0
 EndShort
-LangName: 1033   Regular OpenSymbol  Version 102.4 
+LangName: 1033   Regular OpenSymbol  Version 102.5 
 GaspTable: 1 65535 2 0
 Encoding: Custom
 UnicodeInterp: none
@@ -784,7 +784,7 @@ FitToEm: 1
 WinInfo: 675 45 15
 BeginPrivate: 0
 EndPrivate
-BeginChars: 8834 1007
+BeginChars: 8834 1009
 
 StartChar: Alpha
 Encoding: 909 913 0
@@ -107741,5 +107741,42 @@ SplineSet
  102 1407 l 1,0,-1
 EndSplineSet
 EndChar
+
+StartChar: verticalline
+Encoding: 996 124 1007
+Width: 813
+Flags: W
+VStem: 358 99-440 1620
+LayerCount: 2
+Fore
+SplineSet
+358 -440 m 1,0,-1
+ 358 1620 l 1,1,-1
+ 457 1620 l 1,2,-1
+ 457 -440 l 1,3,-1
+ 358 -440 l 1,0,-1
+EndSplineSet
+EndChar
+
+StartChar: doubleverticalline
+Encoding: 997 8214 1008
+Width: 1183
+Flags: W
+VStem: 334 98-430 1620 752 98-430 1620
+LayerCount: 2
+Fore
+SplineSet
+334 -430 m 1,0,-1
+ 334 1620 l 1,1,-1
+ 432 1620 l 1,2,-1
+ 432 -430 l 1,3,-1
+ 334 -430 l 1,0,-1
+752 -430 m 1,4,-1
+ 752 1620 l 1,5,-1
+ 850 1620 l 1,6,-1
+ 850 -430 l 1,7,-1
+ 752 -430 l 1,4,-1
+EndSplineSet
+EndChar
 EndChars
 EndSplineFont
diff --git a/extras/source/truetype/symbol/opens___.ttf 
b/extras/source/truetype/symbol/opens___.ttf
index f9e18ca..5fc1649 100644
Binary files a/extras/source/truetype/symbol/opens___.ttf and 
b/extras/source/truetype/symbol/opens___.ttf differ
diff --git a/starmath/inc/types.hxx b/starmath/inc/types.hxx
index de027b6..7ef060e 100644
--- a/starmath/inc/types.hxx
+++ b/starmath/inc/types.hxx
@@ -112,7 +112,9 @@ enum MathSymbol
 MS_WP   = (sal_Unicode) 0x2118,
 
 MS_LINE = (sal_Unicode) 0x2223,
+MS_VERTLINE = (sal_Unicode) 0x007C,
 MS_DLINE= (sal_Unicode) 0x2225,
+MS_DVERTLINE= (sal_Unicode) 0x2016,
 MS_ORTHO= (sal_Unicode) 0x22A5,
 MS_DOTSLOW  = (sal_Unicode) 0x2026,
 MS_DOTSAXIS = (sal_Unicode) 0x22EF,
@@ -176,6 +178,8 @@ enum MathSymbol
 MS_RANGLE   = (sal_Unicode) 0x232A,
 MS_LDBRACKET= (sal_Unicode) 0x27E6,
 MS_RDBRACKET= (sal_Unicode) 0x27E7,
+MS_LMATHANGLE   = (sal_Unicode) 0x27E8,
+MS_RMATHANGLE   = (sal_Unicode) 0x27E9,
 
 MS_PLACE= (sal_Unicode) 0x2751,
 
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index cb63ef4..002e5fe 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -733,16 +733,16 @@ SmNode *SmCursor::CreateBracket(SmBracketType 
eBracketType, bool bIsLeft) {
 aTok = SmToken(TLDBRACKET, MS_LDBRACKET, ldbracket, 
TGLBRACES, 5);
 break;
 case LineBrackets:
-aTok = SmToken(TLLINE, MS_LINE, lline, TGLBRACES, 5);
+aTok = SmToken(TLLINE, MS_VERTLINE, lline, TGLBRACES, 5);
 break;
 case DoubleLineBrackets:
-aTok = SmToken(TLDLINE, MS_DLINE, ldline, TGLBRACES, 5);
+aTok = SmToken(TLDLINE, MS_DVERTLINE, ldline, TGLBRACES, 5);
 break;
 case CurlyBrackets:
 aTok = SmToken(TLBRACE, MS_LBRACE, lbrace, TGLBRACES, 5);
 break;
 case AngleBrackets:
-  

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

2013-07-02 Thread Frédéric Wang
 starmath/source/mathmlexport.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit e58d721709bd4e255f70cc824cd484cd1a1ec32d
Author: Frédéric Wang fred.w...@free.fr
Date:   Sun Jun 30 11:08:15 2013 +0200

 fdo#66281 - make underbrace/overbrace stretchy in MathML export

Change-Id: I63608cc4b56f6baa4101020c12c1384a828ce0d2
Reviewed-on: https://gerrit.libreoffice.org/4629
Reviewed-by: Bosdonnat Cedric cedric.bosdon...@free.fr
Tested-by: Bosdonnat Cedric cedric.bosdon...@free.fr

diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 34c6050..3fc23b7 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -1469,10 +1469,9 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int 
nLevel)
 
 void SmXMLExport::ExportVerticalBrace(const SmNode *pNode, int nLevel)
 {
-//Place the overbrace value OVER a vertical brace and then place that
-//expression OVER the overbrace value, If someone can find a
-//dedicated term in MathML to handle this overbrace/underbrace concept
-//let me know. C.
+// Place the overbrace value OVER a horizontal brace and then place that
+// expression OVER the overbrace value. Similarly for the underbrace
+// construction.
 XMLTokenEnum which;
 
 switch (pNode-GetToken().eType)
@@ -1494,6 +1493,7 @@ void SmXMLExport::ExportVerticalBrace(const SmNode 
*pNode, int nLevel)
 // also XML_ACCENT is illegal with XML_MUNDER. Thus no XML_ACCENT 
attribut here!
 SvXMLElementExport aOver2(*this, XML_NAMESPACE_MATH,which, sal_True, 
sal_True);
 ExportNodes(pNode-GetSubNode(0), nLevel);
+AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_TRUE);
 ExportNodes(pNode-GetSubNode(1), nLevel);
 }
 ExportNodes(pNode-GetSubNode(2), nLevel);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-02 Thread Frédéric Wang
 starmath/source/mathmlexport.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 9bb74686b1f857e791235381db632d1b5ac58296
Author: Frédéric Wang fred.w...@free.fr
Date:   Sun Jun 30 14:06:23 2013 +0200

 fdo#66088 - follow-up: handle NGLYPHSPECIAL and NSPECIAL too.

Change-Id: Ifc078732e28e9bdaa796c5be3c08c20f9512926e
Reviewed-on: https://gerrit.libreoffice.org/4631
Reviewed-by: Bosdonnat Cedric cedric.bosdon...@free.fr
Tested-by: Bosdonnat Cedric cedric.bosdon...@free.fr

diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 3fc23b7..a10765e 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -910,9 +910,9 @@ void SmXMLExport::ExportMath(const SmNode *pNode, int 
/*nLevel*/)
 const SmMathSymbolNode *pTemp = static_castconst SmMathSymbolNode 
*(pNode);
 SvXMLElementExport *pMath = 0;
 
-if (pNode-GetType() == NMATH)
+if (pNode-GetType() == NMATH || pNode-GetType() == NGLYPH_SPECIAL)
 {
-// Export NMATH symbols as mo elements
+// Export NMATH and NGLYPH_SPECIAL symbols as mo elements
 pMath = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MO, 
sal_True, sal_False);
 }
 else
@@ -1545,7 +1545,6 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int 
nLevel)
 case NTEXT:
 ExportText(pNode, nLevel);
 break;
-case NSPECIAL: //NSPECIAL requires some sort of Entity preservation in 
the XML engine.
 case NGLYPH_SPECIAL:
 case NMATH:
 {
@@ -1587,6 +1586,7 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int 
nLevel)
 }
 }
 break;
+case NSPECIAL: //NSPECIAL requires some sort of Entity preservation in 
the XML engine.
 case NMATHIDENT :
 case NPLACE:
 ExportMath(pNode, nLevel);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-02 Thread Frédéric Wang
 starmath/source/mathmlexport.cxx |   26 --
 starmath/source/mathmlexport.hxx |3 ++-
 2 files changed, 14 insertions(+), 15 deletions(-)

New commits:
commit 6f86d931b4266d00fec75c0124ac9fc3026a4f1b
Author: Frédéric Wang fred.w...@free.fr
Date:   Sun Jun 30 17:34:40 2013 +0200

 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 khaledho...@eglug.org
Tested-by: Khaled Hosny khaledho...@eglug.org

diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index a10765e..a523693 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 3cbaaae..d7ca75a 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);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-01 Thread Frédéric Wang
 filter/source/xslt/odf2xhtml/export/xhtml/body.xsl |   12 +++---
 starmath/source/mathmlexport.cxx   |   24 ++---
 2 files changed, 24 insertions(+), 12 deletions(-)

New commits:
commit 1ef63d0842dab4154c5ca2fc42e416950bd7459a
Author: Frédéric Wang fred.w...@free.fr
Date:   Fri Jun 28 17:07:11 2013 +0200

 fdo#66278 - MathML export: distinguish inline/display equations.

Change-Id: Ia764c2fd64ab772342ce86f67ee290ab38dc4a83
Reviewed-on: https://gerrit.libreoffice.org/4607
Reviewed-by: Bosdonnat Cedric cedric.bosdon...@free.fr
Tested-by: Bosdonnat Cedric cedric.bosdon...@free.fr

diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl 
b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index d9de0e9..e83195c 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -2949,9 +2949,7 @@
 --
!-- MathML --
xsl:template match=draw:object[math:math]
-   math xmlns=http://www.w3.org/1998/Math/MathML;
-   xsl:apply-templates 
select=math:math/math:semantics/* mode=math/
-   /math
+   xsl:apply-templates select=math:math mode=math/
/xsl:template
 
xsl:template match=* mode=math
@@ -2966,6 +2964,12 @@
/xsl:attribute
/xsl:template
 
-   xsl:template match=math:annotation mode=math/
+   !-- Ignore semantic annotations --
+   xsl:template match=math:semantics mode=math
+   xsl:apply-templates select=*[1] mode=math/
+   /xsl:template
+
+   !-- Ignore the replacement image --
+   xsl:template 
match=draw:frame/draw:image[preceding-sibling::*[1]/math:math]/
 
 /xsl:stylesheet
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index fb1e6c3..fbc1e97 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -599,6 +599,22 @@ sal_uInt32 SmXMLExport::exportDoc(enum XMLTokenEnum eClass)
 
 void SmXMLExport::_ExportContent()
 {
+uno::Reference frame::XModel xModel = GetModel();
+uno::Reference lang::XUnoTunnel xTunnel;
+xTunnel = uno::Reference lang::XUnoTunnel (xModel,uno::UNO_QUERY);
+SmModel *pModel = reinterpret_castSmModel *
+(xTunnel-getSomething(SmModel::getUnoTunnelId()));
+SmDocShell *pDocShell = pModel ?
+static_castSmDocShell*(pModel-GetObjectShell()) : 0;
+OSL_ENSURE( pDocShell, doc shell missing );
+
+if (pDocShell  !pDocShell-GetFormat().IsTextmode())
+{
+// If the Math equation is not in text mode, we attach a 
display=block
+// attribute on the math root. We don't do anything if it is in
+// text mode, the default display=inline value will be used.
+AddAttribute(XML_NAMESPACE_MATH, XML_DISPLAY, XML_BLOCK);
+}
 SvXMLElementExport aEquation(*this, XML_NAMESPACE_MATH, XML_MATH, 
sal_True, sal_True);
 SvXMLElementExport *pSemantics=0;
 
@@ -613,14 +629,6 @@ void SmXMLExport::_ExportContent()
 if (aText.Len())
 {
 // Convert symbol names
-uno::Reference frame::XModel xModel = GetModel();
-uno::Reference lang::XUnoTunnel xTunnel;
-xTunnel = uno::Reference lang::XUnoTunnel (xModel,uno::UNO_QUERY);
-SmModel *pModel = reinterpret_castSmModel *
-(xTunnel-getSomething(SmModel::getUnoTunnelId()));
-SmDocShell *pDocShell = pModel ?
-static_castSmDocShell*(pModel-GetObjectShell()) : 0;
-OSL_ENSURE( pDocShell, doc shell missing );
 if (pDocShell)
 {
 SmParser rParser = pDocShell-GetParser();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-01 Thread Frédéric Wang
 include/xmloff/xmltoken.hxx  |3 ++
 starmath/source/mathmlexport.cxx |   42 +--
 xmloff/source/core/xmltoken.cxx  |3 ++
 3 files changed, 46 insertions(+), 2 deletions(-)

New commits:
commit bc51be7e7f2fc55456e1ce7dcdc70e6a15c53c0e
Author: Frédéric Wang fred.w...@free.fr
Date:   Sat Jun 29 22:51:58 2013 +0200

 #fdo66277 - Add support for alignment in MathML export.

Change-Id: I78352ff93da5b4e912040c4019fcea924f7b0c20
Reviewed-on: https://gerrit.libreoffice.org/4625
Reviewed-by: Bosdonnat Cedric cedric.bosdon...@free.fr
Tested-by: Bosdonnat Cedric cedric.bosdon...@free.fr

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 5993b74..690aad0 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -430,6 +430,7 @@ namespace xmloff { namespace token {
 XML_COLUMN_NAME,
 XML_COLUMN_SEP,
 XML_COLUMN_WIDTH,
+XML_COLUMNALIGN,
 XML_COLUMNS,
 XML_COLUMNSPLIT_AUTO,
 XML_COLUMNSPLIT_AVOID,
@@ -590,6 +591,7 @@ namespace xmloff { namespace token {
 XML_DELAY,
 XML_DELETION,
 XML_DELETIONS,
+XML_DENOMALIGN,
 XML_DENOMINATOR_VALUE,
 XML_DEPENDENCE,
 XML_DEPENDENCES,
@@ -1276,6 +1278,7 @@ namespace xmloff { namespace token {
 XML_NUM_LETTER_SYNC,
 XML_NUM_PREFIX,
 XML_NUM_SUFFIX,
+XML_NUMALIGN,
 XML_NUMBER,
 XML_NUMBER_AND_NAME,
 XML_NUMBER_COLUMNS_REPEATED,
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index fbc1e97..34c6050 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -799,9 +799,25 @@ void SmXMLExport::ExportExpression(const SmNode *pNode, 
int nLevel)
 void SmXMLExport::ExportBinaryVertical(const SmNode *pNode, int nLevel)
 {
 OSL_ENSURE(pNode-GetNumSubNodes()==3,Bad Fraction);
+const SmNode *pNum = pNode-GetSubNode(0);
+const SmNode *pDenom = pNode-GetSubNode(2);
+if (pNum-GetType() == NALIGN  pNum-GetToken().eType != TALIGNC)
+{
+// A left or right alignment is specified on the numerator:
+// attach the corresponding numalign attribute.
+AddAttribute(XML_NAMESPACE_MATH, XML_NUMALIGN,
+pNum-GetToken().eType == TALIGNL ? XML_LEFT : XML_RIGHT);
+}
+if (pDenom-GetType() == NALIGN  pDenom-GetToken().eType != TALIGNC)
+{
+// A left or right alignment is specified on the denominator:
+// attach the corresponding denomalign attribute.
+AddAttribute(XML_NAMESPACE_MATH, XML_DENOMALIGN,
+pDenom-GetToken().eType == TALIGNL ? XML_LEFT : XML_RIGHT);
+}
 SvXMLElementExport aFraction(*this, XML_NAMESPACE_MATH, XML_MFRAC, 
sal_True, sal_True);
-ExportNodes(pNode-GetSubNode(0), nLevel);
-ExportNodes(pNode-GetSubNode(2), nLevel);
+ExportNodes(pNum, nLevel);
+ExportNodes(pDenom, nLevel);
 }
 
 void SmXMLExport::ExportBinaryDiagonal(const SmNode *pNode, int nLevel)
@@ -866,6 +882,19 @@ 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)
+{
+  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);
+  }
+}
 pCell = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, 
XML_MTD, sal_True, sal_True);
 }
 ExportNodes(pTemp, nLevel+1);
@@ -1481,6 +1510,15 @@ void SmXMLExport::ExportMatrix(const SmNode *pNode, int 
nLevel)
 for (sal_uLong x = 0; x  pMatrix-GetNumCols(); x++)
 if (const SmNode *pTemp = pNode-GetSubNode(i++))
 {
+if (pTemp-GetType() == NALIGN 
+pTemp-GetToken().eType != TALIGNC)
+{
+// A left or right alignment is specified on this cell,
+// attach the corresponding columnalign attribute.
+AddAttribute(XML_NAMESPACE_MATH, XML_COLUMNALIGN,
+pTemp-GetToken().eType == TALIGNL ?
+XML_LEFT : XML_RIGHT);
+}
 SvXMLElementExport aCell(*this, XML_NAMESPACE_MATH, XML_MTD, 
sal_True, sal_True);
 ExportNodes(pTemp, nLevel+1);
 }

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

2013-06-28 Thread Frédéric Wang
 starmath/inc/types.hxx   |6 --
 starmath/source/mathmlexport.cxx |9 +
 starmath/source/node.cxx |6 --
 starmath/source/ooxmlimport.cxx  |2 ++
 4 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 6231979ce1b89ce36e0a68139c96c5c1c1e704bb
Author: Frédéric Wang fred.w...@free.fr
Date:   Sat Jun 22 20:03:59 2013 +0200

fdo#66024 - Formula Editor: make wide accents stretchy when exported to 
MathML

Change-Id: Ifd0adc51d79e0673661b5646d27f657768ea5b20
Reviewed-on: https://gerrit.libreoffice.org/4450
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/starmath/inc/types.hxx b/starmath/inc/types.hxx
index ca2bea9..530736b 100644
--- a/starmath/inc/types.hxx
+++ b/starmath/inc/types.hxx
@@ -139,8 +139,10 @@ enum MathSymbol
 
 MS_GRAVE= (sal_Unicode) 0x0300,
 MS_ACUTE= (sal_Unicode) 0x0301,
-MS_HAT  = (sal_Unicode) 0x0302,
-MS_TILDE= (sal_Unicode) 0x0303,
+MS_HAT  = (sal_Unicode) 0x005E,
+MS_COMBHAT  = (sal_Unicode) 0x0302,
+MS_TILDE= (sal_Unicode) 0x007E,
+MS_COMBTILDE= (sal_Unicode) 0x0303,
 MS_BAR  = (sal_Unicode) 0x0304,
 MS_BREVE= (sal_Unicode) 0x0306,
 MS_CIRCLE   = (sal_Unicode) 0x030A,
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index b2a9b38..8df9d28 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -1121,6 +1121,15 @@ void SmXMLExport::ExportAttributes(const SmNode *pNode, 
int nLevel)
 break;
 case TOVERSTRIKE:
 break;
+case TWIDETILDE:
+case TWIDEHAT:
+case TWIDEVEC:
+{
+// make these wide accents stretchy
+AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_TRUE);
+ExportNodes(pNode-GetSubNode(0), nLevel+1);
+}
+break;
 default:
 ExportNodes(pNode-GetSubNode(0), nLevel+1);
 break;
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index e0c7282..d3ae705 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -2820,10 +2820,12 @@ void SmAttributNode::CreateTextFromNode(String rText)
 case MS_VEC: // COMBINING RIGHT ARROW ABOVE
 rText += vec ;
 break;
-case MS_TILDE: // COMBINING TILDE
+case MS_TILDE: // TILDE
+case MS_COMBTILDE: // COMBINING TILDE
 rText += tilde ;
 break;
-case MS_HAT: // COMBINING CIRCUMFLEX ACCENT
+case MS_HAT: // CIRCUMFLEX ACCENT
+case MS_COMBHAT: // COMBINING CIRCUMFLEX ACCENT
 rText += hat ;
 break;
 case MS_BAR: // COMBINING MACRON
diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx
index a844195..cb355b7 100644
--- a/starmath/source/ooxmlimport.cxx
+++ b/starmath/source/ooxmlimport.cxx
@@ -192,9 +192,11 @@ OUString SmOoxmlImport::handleAcc()
 acc = widevec;
 break;
 case MS_TILDE:
+case MS_COMBTILDE:
 acc = widetilde;
 break;
 case MS_HAT:
+case MS_COMBHAT:
 acc = widehat;
 break;
 case MS_DOT:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-06-28 Thread Frédéric Wang
 include/xmloff/xmltoken.hxx  |4 +++
 starmath/source/mathmlexport.cxx |   48 ++-
 starmath/source/mathmlexport.hxx |1 
 starmath/source/mathmlimport.cxx |   38 ++
 starmath/source/mathmlimport.hxx |5 
 xmloff/source/core/xmltoken.cxx  |4 +++
 6 files changed, 99 insertions(+), 1 deletion(-)

New commits:
commit 3b3ec32358aebd81ef5385f48dbf3ee4c93649e8
Author: Frédéric Wang fred.w...@free.fr
Date:   Sun Jun 23 21:32:37 2013 +0200

fdo#66086 - MathML export: wideslash, widebslash and overstrike

Change-Id: I1e8da340ffdacab133b0cff6d6344fe56da34bf8
Reviewed-on: https://gerrit.libreoffice.org/4465
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index a40da2c..5993b74 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -295,6 +295,7 @@ namespace xmloff { namespace token {
 XML_BELOW,
 XML_BETWEEN_DATE_TIMES,
 XML_BEVEL,
+XML_BEVELLED,
 XML_BIBILIOGRAPHIC_TYPE,
 XML_BIBLIOGRAPHY,
 XML_BIBLIOGRAPHY_CONFIGURATION,
@@ -941,6 +942,7 @@ namespace xmloff { namespace token {
 XML_HIGHLIGHTED_RANGE,
 XML_HINT,
 XML_HORIZONTAL,
+XML_HORIZONTALSTRIKE,
 XML_HORIZONTAL_LINES,
 // XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
 // are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD.
@@ -1166,6 +1168,7 @@ namespace xmloff { namespace token {
 XML_MEASURE_VERTICAL_ALIGN,
 XML_MEDIAN,
 XML_MEDIUM,
+XML_MENCLOSE,
 XML_MERROR,
 XML_MESSAGE_TYPE,
 XML_META,
@@ -1262,6 +1265,7 @@ namespace xmloff { namespace token {
 XML_NORMALS_KIND,
 XML_NOT,
 XML_NOT_EQUAL_DATE,
+XML_NOTATION,
 XML_NOTE,
 XML_NOTES,
 XML_NOTIN,
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 8df9d28..f9e6589 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -766,6 +766,42 @@ void SmXMLExport::ExportBinaryVertical(const SmNode 
*pNode, int nLevel)
 ExportNodes(pNode-GetSubNode(2), nLevel);
 }
 
+void SmXMLExport::ExportBinaryDiagonal(const SmNode *pNode, int nLevel)
+{
+OSL_ENSURE(pNode-GetNumSubNodes()==3, Bad Slash);
+
+if (pNode-GetToken().eType == TWIDESLASH)
+{
+// wideslash
+// export the node as mfrac bevelled=true
+AddAttribute(XML_NAMESPACE_MATH, XML_BEVELLED, XML_TRUE);
+SvXMLElementExport aFraction(*this, XML_NAMESPACE_MATH, XML_MFRAC,
+sal_True, sal_True);
+ExportNodes(pNode-GetSubNode(0), nLevel);
+ExportNodes(pNode-GetSubNode(1), nLevel);
+}
+else
+{
+// widebslash
+// We can not use mfrac to a backslash, so just use mo\/mo
+SvXMLElementExport *pRow = new SvXMLElementExport(*this,
+XML_NAMESPACE_MATH, XML_MROW, sal_True, sal_True);
+
+ExportNodes(pNode-GetSubNode(0), nLevel);
+
+{ // Scoping for mo creation
+SvXMLElementExport aMo(*this, XML_NAMESPACE_MATH, XML_MO,
+sal_True,sal_True);
+sal_Unicode nArse[2] = {MS_BACKSLASH,0x00};
+GetDocHandler()-characters(nArse);
+}
+
+ExportNodes(pNode-GetSubNode(1), nLevel);
+
+delete pRow;
+}
+}
+
 void SmXMLExport::ExportTable(const SmNode *pNode, int nLevel)
 {
 SvXMLElementExport *pTable=0;
@@ -1090,7 +1126,14 @@ void SmXMLExport::ExportAttributes(const SmNode *pNode, 
int nLevel)
 pElement = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, 
XML_MUNDER,
 sal_True,sal_True);
 }
-else if (pNode-GetToken().eType != TOVERSTRIKE)
+else if (pNode-GetToken().eType == TOVERSTRIKE)
+{
+// export as menclose notation=horizontalstrike
+AddAttribute(XML_NAMESPACE_MATH, XML_NOTATION, XML_HORIZONTALSTRIKE);
+pElement = new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
+XML_MENCLOSE, sal_True, sal_True);
+}
+else
 {
 AddAttribute(XML_NAMESPACE_MATH, XML_ACCENT,
 XML_TRUE);
@@ -1449,6 +1492,9 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int 
nLevel)
 case NBINVER:
 ExportBinaryVertical(pNode, nLevel);
 break;
+case NBINDIAGONAL:
+ExportBinaryDiagonal(pNode, nLevel);
+break;
 case NSUBSUP:
 ExportSubSupScript(pNode, nLevel);
 break;
diff --git a/starmath/source/mathmlexport.hxx b/starmath/source/mathmlexport.hxx
index 52b558e..3cbaaae 100644
--- a/starmath/source/mathmlexport.hxx
+++ b/starmath/source/mathmlexport.hxx
@@ -92,6 +92,7 @@ protected:
 void ExportUnaryHorizontal(const SmNode *pNode, int nLevel);
  

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

2013-06-28 Thread Frédéric Wang
 starmath/source/mathmlexport.cxx |   19 ---
 starmath/source/mathmlimport.cxx |2 ++
 2 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 1418694edad8720dcd4884fd3e759c05a1f4cae9
Author: Frédéric Wang fred.w...@free.fr
Date:   Sun Jun 23 13:28:36 2013 +0200

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

Change-Id: I5cc0ed9a1273b5fb59d5dbaf63a382c844820ff9
Reviewed-on: https://gerrit.libreoffice.org/4454
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index f9e6589..e18a69e 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -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_castconst 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;
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 608ab7a..beaaf3d 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -1418,6 +1418,8 @@ public:
 void SmXMLSpaceContext_Impl::StartElement(
 const uno::Referencexml::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;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-06-28 Thread Frédéric Wang
 starmath/source/parse.cxx |   52 --
 1 file changed, 23 insertions(+), 29 deletions(-)

New commits:
commit 2ca754cba469533b1ed160b2fadbbe035cf1db34
Author: Frédéric Wang fred.w...@free.fr
Date:   Sun Jun 23 13:44:35 2013 +0200

Remove unused String::Copy in Math (try to fix fdo#36634)

Change-Id: I4a5618a7ef17a74edd036c34d748715d186f6528
Reviewed-on: https://gerrit.libreoffice.org/4457
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 9ae5dff..5a0098b 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -448,8 +448,7 @@ void SmParser::NextToken()
 }
 else if (aRes.TokenType  KParseType::ONE_SINGLE_CHAR)
 {
-String aName( m_aBufferString.Copy( nRealStart, 2 ));
-if ( aName.EqualsAscii( %% ))
+if (m_aBufferString.EqualsAscii(%%, nRealStart, 2))
 {
 //SkipComment
 m_nBufferIndex = nRealStart + 2;
@@ -549,17 +548,15 @@ void SmParser::NextToken()
 else if (aRes.TokenType  KParseType::BOOLEAN)
 {
 sal_Int32   rnEndPos = aRes.EndPos;
-String  aName( m_aBufferString.Copy( nRealStart,
-sal::static_int_cast xub_StrLen (rnEndPos - 
nRealStart) ));
-if (2 = aName.Len())
+if (rnEndPos - nRealStart = 2)
 {
-sal_Unicode ch = aName.GetChar( 0 );
+sal_Unicode ch = m_aBufferString.GetChar(nRealStart);
 switch (ch)
 {
 case '':
 {
-if (m_aBufferString.Copy( nRealStart, 2 ).
-EqualsAscii(  ))
+if (m_aBufferString.
+EqualsAscii(, nRealStart, 2))
 {
 m_aCurToken.eType= TLL;
 m_aCurToken.cMathChar = MS_LL;
@@ -569,8 +566,8 @@ void SmParser::NextToken()
 
 rnEndPos = nRealStart + 2;
 }
-else if (m_aBufferString.Copy( nRealStart, 2 ).
-EqualsAscii( = ))
+else if (m_aBufferString.
+ EqualsAscii(=, nRealStart, 2))
 {
 m_aCurToken.eType= TLE;
 m_aCurToken.cMathChar = MS_LE;
@@ -580,8 +577,8 @@ void SmParser::NextToken()
 
 rnEndPos = nRealStart + 2;
 }
-else if (m_aBufferString.Copy( nRealStart, 2 ).
-EqualsAscii(  ))
+else if (m_aBufferString.
+ EqualsAscii(, nRealStart, 2))
 {
 m_aCurToken.eType= TNEQ;
 m_aCurToken.cMathChar = MS_NEQ;
@@ -591,8 +588,8 @@ void SmParser::NextToken()
 
 rnEndPos = nRealStart + 2;
 }
-else if (m_aBufferString.Copy( nRealStart, 3 ).
-EqualsAscii( ? ))
+else if (m_aBufferString.
+ EqualsAscii(?, nRealStart, 3))
 {
 m_aCurToken.eType= TPLACE;
 m_aCurToken.cMathChar = MS_PLACE;
@@ -614,8 +611,8 @@ void SmParser::NextToken()
 break;
 case '':
 {
-if (m_aBufferString.Copy( nRealStart, 2 ).
-EqualsAscii( = ))
+if (m_aBufferString.
+EqualsAscii(=, nRealStart, 2))
 {
 m_aCurToken.eType= TGE;
 m_aCurToken.cMathChar = MS_GE;
@@ -625,8 +622,8 @@ void SmParser::NextToken()
 
 rnEndPos = nRealStart + 2;
 }
-else if (m_aBufferString.Copy( nRealStart, 2 ).
-EqualsAscii(  ))
+else if (m_aBufferString.
+ EqualsAscii(, nRealStart, 2))
 {
 m_aCurToken.eType= TGG;
 m_aCurToken.cMathChar = MS_GG;
@@ -654,12 +651,9 @@ void SmParser::NextToken()
 else if (aRes.TokenType  KParseType::ONE_SINGLE_CHAR)
 {
 sal_Int32   rnEndPos = aRes.EndPos;
-String  aName( m_aBufferString.Copy( nRealStart,
-sal::static_int_cast xub_StrLen (rnEndPos - 
nRealStart) ) );
-
-

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

2013-06-28 Thread Frédéric Wang
 starmath/inc/parse.hxx|2 
 starmath/source/parse.cxx |  128 --
 2 files changed, 91 insertions(+), 39 deletions(-)

New commits:
commit 16a0d06f900027401716ddaba25e5c8998562b2d
Author: Frédéric Wang fred.w...@free.fr
Date:   Mon Jun 24 23:14:42 2013 +0200

fdo#55853 - improve parsing of concatenated numbers and identifiers.

Change-Id: Ic1cce4cec27f4ca5c3be1daf50888bef788cd6f7
Reviewed-on: https://gerrit.libreoffice.org/4494
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index a1bd731..1630099 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -228,7 +228,7 @@ protected:
 voidOpSubSup();
 voidPower();
 voidBlank();
-voidTerm();
+voidTerm(bool bGroupNumberIdent);
 voidEscape();
 voidOperator();
 voidOper();
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 5a0098b..cc35a66 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -374,12 +374,12 @@ void SmParser::Replace( sal_uInt16 nPos, sal_uInt16 nLen, 
const String rText )
 
 // First character may be any alphabetic
 const sal_Int32 coStartFlags =
-KParseTokens::ANY_LETTER_OR_NUMBER |
+KParseTokens::ANY_LETTER |
 KParseTokens::IGNORE_LEADING_WS;
 
-// Continuing characters may be any alphanumeric or dot.
+// Continuing characters may be any alphabetic
 const sal_Int32 coContFlags =
-((coStartFlags | KParseTokens::ASC_DOT)  ~KParseTokens::IGNORE_LEADING_WS)
+(coStartFlags  ~KParseTokens::IGNORE_LEADING_WS)
 | KParseTokens::TWO_DOUBLE_QUOTES_BREAK_STRING;
 
 // First character for numbers, may be any numeric or dot
@@ -389,7 +389,7 @@ const sal_Int32 coNumStartFlags =
 KParseTokens::IGNORE_LEADING_WS;
 // Continuing characters for numbers, may be any numeric or dot.
 const sal_Int32 coNumContFlags =
-(coNumStartFlags | KParseTokens::ASC_DOT)  
~KParseTokens::IGNORE_LEADING_WS;
+coNumStartFlags  ~KParseTokens::IGNORE_LEADING_WS;
 
 void SmParser::NextToken()
 {
@@ -399,7 +399,6 @@ void SmParser::NextToken()
 ParseResult aRes;
 xub_StrLen  nRealStart;
 boolbCont;
-boolbNumStart = false;
 CharClass   aCC(SM_MOD()-GetSysLocale().GetLanguageTag());
 do
 {
@@ -408,29 +407,23 @@ void SmParser::NextToken()
 aCC.getType( m_aBufferString, m_nBufferIndex ))
++m_nBufferIndex;
 
-sal_Int32 nStartFlags = coStartFlags;
-sal_Int32 nContFlags  = coContFlags;
-sal_Unicode cFirstChar = m_aBufferString.GetChar( m_nBufferIndex );
-aRes = aCC.parseAnyToken( m_aBufferString, m_nBufferIndex,
-nStartFlags, aEmptyStr,
-nContFlags, aEmptyStr );
-
-// #i45779# parse numbers correctly
-// i.e. independent from the locale setting.
-// (note that #i11752# remains fixed)
-if ((aRes.TokenType  KParseType::IDENTNAME)  
CharClass::isAsciiDigit( cFirstChar ))
+// Try to parse a number. This should be independent from the locale
+// setting, so temporarily set the language to English.
+// See https://issues.apache.org/ooo/show_bug.cgi?id=45779
+LanguageTag aOldLoc(aCC.getLanguageTag());
+aCC.setLanguageTag(LanguageTag(m_aDotLoc));
+aRes = aCC.parsePredefinedToken(KParseType::ASC_NUMBER,
+m_aBufferString, m_nBufferIndex,
+coNumStartFlags, aEmptyStr,
+coNumContFlags, aEmptyStr);
+aCC.setLanguageTag(aOldLoc);
+
+if (aRes.TokenType == 0)
 {
-ParseResult aTmpRes;
-LanguageTag aOldLoc( aCC.getLanguageTag() );
-aCC.setLanguageTag( LanguageTag( m_aDotLoc ));
-aTmpRes = aCC.parsePredefinedToken(
-KParseType::ASC_NUMBER,
-m_aBufferString, m_nBufferIndex,
-KParseTokens::ASC_DIGIT, aEmptyStr,
-KParseTokens::ASC_DIGIT | KParseTokens::ASC_DOT, 
aEmptyStr );
-aCC.setLanguageTag( aOldLoc );
-if (aTmpRes.TokenType  KParseType::ASC_NUMBER)
-aRes.TokenType = aTmpRes.TokenType;
+// Try again with the default token parsing.
+aRes = aCC.parseAnyToken(m_aBufferString, m_nBufferIndex,
+ coStartFlags, aEmptyStr,
+ coContFlags, aEmptyStr);
 }
 
 nRealStart = m_nBufferIndex + sal::static_int_cast xub_StrLen 
(aRes.LeadingWhiteSpace);
@@ -476,8 +469,7 @@ void SmParser::NextToken()
 m_aCurToken.nLevel   = 0;
 

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

2013-06-28 Thread Frédéric Wang
 starmath/source/mathmlexport.cxx |   32 +++-
 starmath/source/parse.cxx|   16 
 2 files changed, 43 insertions(+), 5 deletions(-)

New commits:
commit 4f294a90877d2f91bb88c7d6cd5b74e8e546a025
Author: Frédéric Wang fred.w...@free.fr
Date:   Tue Jun 25 22:33:13 2013 +0200

 fdo#66081 - reduce the number of nested mrow's in MathML

Change-Id: I768db4719119e53961c9cfa6a864daad7f1f7873
Reviewed-on: https://gerrit.libreoffice.org/4520
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index e18a69e..d23662c 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -734,7 +734,37 @@ void SmXMLExport::ExportLine(const SmNode *pNode, int 
nLevel)
 
 void SmXMLExport::ExportBinaryHorizontal(const SmNode *pNode, int nLevel)
 {
-ExportExpression(pNode, nLevel);
+sal_uLong nGroup = pNode-GetToken().nGroup;
+
+SvXMLElementExport* pRow = new SvXMLElementExport(*this,
+XML_NAMESPACE_MATH, XML_MROW, sal_True, sal_True);
+
+// Unfold the binary tree structure as long as the nodes are SmBinHorNode
+// with the same nGroup. This will reduce the number of nested mrow
+// elements e.g. we only need three mrow levels to export
+//
+// a*b*c*d+e*f*g*h+i*j*k*l = a*b*c*d+e*f*g*h+i*j*k*l =
+//  a*b*c*d+e*f*g*h+i*j*k*l = a*b*c*d+e*f*g*h+i*j*k*l
+//
+// See https://www.libreoffice.org/bugzilla/show_bug.cgi?id=66081
+::std::stack const SmNode*  s;
+s.push(pNode);
+while (!s.empty())
+{
+const SmNode *node = s.top();
+s.pop();
+if (node-GetType() != NBINHOR || node-GetToken().nGroup != nGroup)
+{
+ExportNodes(node, nLevel+1);
+continue;
+}
+const SmBinHorNode* binNode = static_castconst SmBinHorNode*(node);
+s.push(binNode-RightOperand());
+s.push(binNode-Symbol());
+s.push(binNode-LeftOperand());
+}
+
+delete pRow;
 }
 
 void SmXMLExport::ExportUnaryHorizontal(const SmNode *pNode, int nLevel)
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index cc35a66..cdb6865 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -1108,10 +1108,18 @@ void SmParser::Expression()
 RelationArray[n - 1] = lcl_popOrZero(m_aNodeStack);
 }
 
-SmExpressionNode *pSNode = new SmExpressionNode(m_aCurToken);
-pSNode-SetSubNodes(RelationArray);
-pSNode-SetUseExtraSpaces(bUseExtraSpaces);
-m_aNodeStack.push(pSNode);
+if (n  1)
+{
+SmExpressionNode *pSNode = new SmExpressionNode(m_aCurToken);
+pSNode-SetSubNodes(RelationArray);
+pSNode-SetUseExtraSpaces(bUseExtraSpaces);
+m_aNodeStack.push(pSNode);
+}
+else
+{
+// This expression has only one node so just push this node.
+m_aNodeStack.push(RelationArray[0]);
+}
 }
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-06-28 Thread Frédéric Wang
 starmath/inc/node.hxx  |   16 +++-
 starmath/source/mathmlexport.cxx   |   24 +++-
 starmath/source/mathtype.cxx   |1 +
 starmath/source/node.cxx   |1 +
 starmath/source/ooxmlexport.cxx|4 ++--
 starmath/source/parse.cxx  |   32 ++--
 starmath/source/rtfexport.cxx  |4 ++--
 starmath/source/visitors.cxx   |2 +-
 starmath/source/wordexportbase.cxx |1 +
 9 files changed, 64 insertions(+), 21 deletions(-)

New commits:
commit 43cf39adff66d20862956869d11fbcc184eb5702
Author: Frédéric Wang fred.w...@free.fr
Date:   Thu Jun 27 21:35:28 2013 +0200

 fdo#66088 Export some math symbols as mi elements.

Change-Id: Ib08717c3d4d41abc7bce4cd6bc2e63bda7db6086
Reviewed-on: https://gerrit.libreoffice.org/4595
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index b1640a3..2416d6e 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -73,7 +73,7 @@ enum SmNodeType
 /*10*/ NBINDIAGONAL,   NSUBSUP,NMATRIX,NPLACE, NTEXT,
 /*15*/ NSPECIAL,   NGLYPH_SPECIAL, NMATH,  NBLANK, NERROR,
 /*20*/ NLINE,  NEXPRESSION,NPOLYLINE,  NROOT,  
NROOTSYMBOL,
-/*25*/ NRECTANGLE, NVERTICAL_BRACE
+/*25*/ NRECTANGLE, NVERTICAL_BRACE, NMATHIDENT
 };
 
 
@@ -579,6 +579,20 @@ public:
 void Accept(SmVisitor* pVisitor);
 };
 
+
+
+/** Math Identifier
+ *
+ * This behaves essentially the same as SmMathSymbolNode and is only used to
+ * represent math symbols that should be exported as mi elements rather than
+ * mo elements.
+ */
+class SmMathIdentifierNode : public SmMathSymbolNode
+{
+public:
+SmMathIdentifierNode(const SmToken rNodeToken)
+:   SmMathSymbolNode(NMATHIDENT, rNodeToken) {}
+};
 
 

 
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index d23662c..fb1e6c3 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -871,7 +871,26 @@ void SmXMLExport::ExportTable(const SmNode *pNode, int 
nLevel)
 void SmXMLExport::ExportMath(const SmNode *pNode, int /*nLevel*/)
 {
 const SmMathSymbolNode *pTemp = static_castconst SmMathSymbolNode 
*(pNode);
-SvXMLElementExport aMath(*this, XML_NAMESPACE_MATH, XML_MO, sal_True, 
sal_False);
+SvXMLElementExport *pMath = 0;
+
+if (pNode-GetType() == NMATH)
+{
+// Export NMATH symbols as mo elements
+pMath = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MO, 
sal_True, sal_False);
+}
+else
+{
+// Export NMATHIDENT and NPLACE symbols as mi elements:
+// - These math symbols should not be drawn slanted. Hence we should
+// attach a mathvariant=normal attribute to single-char mi elements
+// that are not mathematical alphanumeric symbol. For simplicity and to
+// work around browser limitations, we always attach such an attribute.
+// - The MathML specification suggests to use empty mi elements as
+// placeholders but they won't be visible in most MathML rendering
+// engines so let's use an empty square for NPLACE instead.
+AddAttribute(XML_NAMESPACE_MATH, XML_MATHVARIANT, XML_NORMAL);
+pMath = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MI, 
sal_True, sal_False);
+}
 sal_Unicode nArse[2];
 nArse[0] = pTemp-GetText()[0];
 sal_Unicode cTmp = ConvertMathToMathML( nArse[0] );
@@ -880,6 +899,8 @@ void SmXMLExport::ExportMath(const SmNode *pNode, int 
/*nLevel*/)
 OSL_ENSURE(nArse[0] != 0x,Non existent symbol);
 nArse[1] = 0;
 GetDocHandler()-characters(nArse);
+
+delete pMath;
 }
 
 void SmXMLExport::ExportText(const SmNode *pNode, int /*nLevel*/)
@@ -1520,6 +1541,7 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int 
nLevel)
 }
 }
 break;
+case NMATHIDENT :
 case NPLACE:
 ExportMath(pNode, nLevel);
 break;
diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx
index 8b958a1..3de5817 100644
--- a/starmath/source/mathtype.cxx
+++ b/starmath/source/mathtype.cxx
@@ -1997,6 +1997,7 @@ sal_uInt8 MathType::HandleNodes(SmNode *pNode,int nLevel)
 }
 break;
 case NMATH:
+case NMATHIDENT:
 HandleMath(pNode,nLevel);
 break;
 case NSUBSUP:
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index d3ae705..ccfc4b0 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -621,6 +621,7 @@ void SmNode::DumpAsDot(std::ostream out, OUString* label, 
int number,