]> git.lyx.org Git - features.git/blobdiff - src/mathed/InsetMathXYMatrix.cpp
Revert part of 503c7c16: InsetMathNest:edit resets anchor.
[features.git] / src / mathed / InsetMathXYMatrix.cpp
index ac6cafaa43d5b52d4e093b798cb30d42b9ae3e54..d8f54602b9d3b20b106e9b91f687d0e070f6a5bf 100644 (file)
 
 #include "InsetMathXYMatrix.h"
 
-#include "LaTeXFeatures.h"
 #include "MathStream.h"
 
+#include "LaTeXFeatures.h"
+#include "MetricsInfo.h"
+
 #include <ostream>
 
 namespace lyx {
@@ -47,16 +49,27 @@ int InsetMathXYMatrix::rowsep() const
 
 void InsetMathXYMatrix::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       if (mi.base.style == LM_ST_DISPLAY)
-               mi.base.style = LM_ST_TEXT;
+       Changer dummy2 = mi.base.changeEnsureMath();
+       Changer dummy = mi.base.changeArray();
        InsetMathGrid::metrics(mi, dim);
 }
 
 
-void InsetMathXYMatrix::write(WriteStream & os) const
+void InsetMathXYMatrix::draw(PainterInfo & pi, int x, int y) const
+{
+       Changer dummy2 = pi.base.changeEnsureMath();
+       Changer dummy = pi.base.changeArray();
+       InsetMathGrid::draw(pi, x, y);
+}
+
+
+void InsetMathXYMatrix::write(TeXMathStream & os) const
 {
        MathEnsurer ensurer(os);
+       if (os.fragile())
+               os << "\\protect";
        os << "\\xymatrix";
+       bool open = os.startOuterRow();
        if (equal_spacing_) {
                os << "@!";
                switch (spacing_code_) {
@@ -83,7 +96,10 @@ void InsetMathXYMatrix::write(WriteStream & os) const
        }
        os << '{';
        InsetMathGrid::write(os);
-       os << "}\n";
+       os << "}";
+       if (open)
+               os.startOuterRow();
+       os << "\n";
 }
 
 
@@ -140,4 +156,16 @@ void InsetMathXYMatrix::validate(LaTeXFeatures & features) const
 }
 
 
+void InsetMathXYMatrix::mathmlize(MathMLStream &) const
+{
+       throw MathExportException();
+}
+
+
+void InsetMathXYMatrix::htmlize(HtmlStream &) const
+{
+       throw MathExportException();
+}
+
+
 } // namespace lyx