]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathXYMatrix.cpp
Fix bug 1527
[lyx.git] / src / mathed / InsetMathXYMatrix.cpp
index 367d522e51fd28a15aebb383610be83704eac0be..9be4e2efa6c67e3ad63bb8ec2f6976e3c6972632 100644 (file)
 #include <config.h>
 
 #include "InsetMathXYMatrix.h"
-#include "MathStream.h"
 
 #include "LaTeXFeatures.h"
-#include "support/std_ostream.h"
+#include "MathStream.h"
 
+#include <ostream>
 
 namespace lyx {
 
@@ -25,9 +25,9 @@ InsetMathXYMatrix::InsetMathXYMatrix(Length const & s, char c)
 {}
 
 
-std::auto_ptr<Inset> InsetMathXYMatrix::doClone() const
+Inset * InsetMathXYMatrix::clone() const
 {
-       return std::auto_ptr<Inset>(new InsetMathXYMatrix(*this));
+       return new InsetMathXYMatrix(*this);
 }
 
 
@@ -43,20 +43,23 @@ int InsetMathXYMatrix::rowsep() const
 }
 
 
-bool InsetMathXYMatrix::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathXYMatrix::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        if (mi.base.style == LM_ST_DISPLAY)
                mi.base.style = LM_ST_TEXT;
        InsetMathGrid::metrics(mi, dim);
-       if (dim_ == dim)
-               return false;
-       dim_ = dim;
-       return true;
 }
 
 
 void InsetMathXYMatrix::write(WriteStream & os) const
 {
+       bool brace = os.pendingBrace();
+       os.pendingBrace(false);
+       if (os.latex() && os.textMode()) {
+               os << "\\ensuremath{";
+               os.textMode(false);
+               brace = true;
+       }
        os << "\\xymatrix";
        switch (spacing_code_) {
        case 'R':
@@ -75,6 +78,7 @@ void InsetMathXYMatrix::write(WriteStream & os) const
        os << '{';
        InsetMathGrid::write(os);
        os << "}\n";
+       os.pendingBrace(brace);
 }