]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathXArrow.cpp
Do not throw exceptions here either. See r22806.
[lyx.git] / src / mathed / InsetMathXArrow.cpp
index ac4cea005cdb6ed99e810d4707e0907e915c8f17..54d73563817641a4580d5d899dfe06c99bd1c17a 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -23,8 +23,8 @@ using namespace std;
 namespace lyx {
 
 
-InsetMathXArrow::InsetMathXArrow(docstring const & name)
-       : InsetMathFracBase(), name_(name)
+InsetMathXArrow::InsetMathXArrow(Buffer * buf, docstring const & name)
+       : InsetMathFracBase(buf), name_(name)
 {}
 
 
@@ -62,12 +62,11 @@ void InsetMathXArrow::draw(PainterInfo & pi, int x, int y) const
 
 void InsetMathXArrow::write(WriteStream & os) const
 {
-       bool brace = ensureMath(os);
+       MathEnsurer ensurer(os);
        os << '\\' << name_;
        if (cell(1).size())
                os << '[' << cell(1) << ']';
        os << '{' << cell(0) << '}';
-       os.pendingBrace(brace);
 }
 
 
@@ -77,6 +76,16 @@ void InsetMathXArrow::normalize(NormalStream & os) const
 }
 
 
+void InsetMathXArrow::mathmlize(MathStream & ms) const
+{
+       char const * const arrow = name_ == "xleftarrow" 
+                       ? "&larr;" : "&rarr;";
+       ms << "<munderover accent='false' accentunder='false'>"
+          << arrow << cell(1) << cell(0)
+          << "</munderover>";
+}
+
+
 void InsetMathXArrow::validate(LaTeXFeatures & features) const
 {
        features.require("amsmath");