]> git.lyx.org Git - features.git/blobdiff - src/mathed/InsetMathDelim.cpp
Introduce a return value for mathmlize(). We will need this to be able
[features.git] / src / mathed / InsetMathDelim.cpp
index 403c1cf65d315fca1e2b56e3880eb72a2c1417b5..6da49562eb6347e47cc5a88849bd3ffc273f06c5 100644 (file)
@@ -4,7 +4,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Alejandro Aguilar Sierra
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -14,6 +14,7 @@
 #include "InsetMathDelim.h"
 
 #include "MathData.h"
+#include "MathExtern.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "MetricsInfo.h"
@@ -38,14 +39,15 @@ static docstring convertDelimToLatexName(docstring const & name)
 }
 
 
-InsetMathDelim::InsetMathDelim(docstring const & l, docstring const & r)
-       : InsetMathNest(1), left_(l), right_(r)
+InsetMathDelim::InsetMathDelim(Buffer * buf, docstring const & l,
+               docstring const & r)
+       : InsetMathNest(buf, 1), left_(l), right_(r)
 {}
 
 
-InsetMathDelim::InsetMathDelim
-               (docstring const & l, docstring const & r, MathData const & ar)
-       : InsetMathNest(1), left_(l), right_(r)
+InsetMathDelim::InsetMathDelim(Buffer * buf, docstring const & l, docstring const & r,
+       MathData const & ar)
+       : InsetMathNest(buf, 1), left_(l), right_(r)
 {
        cell(0) = ar;
 }
@@ -59,6 +61,7 @@ Inset * InsetMathDelim::clone() const
 
 void InsetMathDelim::write(WriteStream & os) const
 {
+       MathEnsurer ensurer(os);
        os << "\\left" << convertDelimToLatexName(left_) << cell(0)
           << "\\right" << convertDelimToLatexName(right_);
 }
@@ -159,10 +162,12 @@ void InsetMathDelim::mathematica(MathematicaStream & os) const
 }
 
 
-void InsetMathDelim::mathmlize(MathStream & os) const
+docstring InsetMathDelim::mathmlize(MathStream & os) const
 {
-       os << "<fenced open=\"" << left_ << "\" close=\""
-               << right_ << "\">" << cell(0) << "</fenced>";
+       os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true'>" << left_ << "</mo>";
+       docstring const rv = lyx::mathmlize(cell(0),os);
+       os << "<mo form='postfix' fence='true' stretchy='true' symmetric='true'>" << right_ << "</mo>";
+       return rv;
 }