]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_arrayinset.C
use stream-like syntax for LaTeX output
[lyx.git] / src / mathed / math_arrayinset.C
index 1c5f67eb2cb7a45218bf80cd5e5656b56119d1c2..25c63eb7ce527baf7c246b83b884ad546f6cd4e5 100644 (file)
@@ -1,29 +1,30 @@
-#include <config.h>
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
 #include "math_arrayinset.h"
 #include "support/LOstream.h"
-#include "Painter.h"
-
 
 
 MathArrayInset::MathArrayInset(int m, int n)
-       : MathGridInset(m, n, "array", LM_OT_MATRIX)
+       : MathGridInset(m, n)
+{}
+
+
+MathArrayInset::MathArrayInset(int m, int n, char valign, string const & halign)
+       : MathGridInset(m, n, valign, halign)
 {}
 
 
-MathInset * MathArrayInset::Clone() const
+MathInset * MathArrayInset::clone() const
 {
        return new MathArrayInset(*this);
 }
 
 
-void MathArrayInset::Write(std::ostream & os, bool fragile) const
+void MathArrayInset::write(MathWriteInfo & os) const
 {
-       if (fragile)
+       if (os.fragile)
                os << "\\protect";
        os << "\\begin{array}";
 
@@ -31,13 +32,23 @@ void MathArrayInset::Write(std::ostream & os, bool fragile) const
                os << '[' << char(v_align_) << ']';
 
        os << '{';
-       for (int col = 0; col < ncols(); ++col)
-               os << colinfo_[col].h_align_;
+       for (col_type col = 0; col < ncols(); ++col)
+               os << colinfo_[col].align_;
        os << "}\n";
 
-       MathGridInset::Write(os, fragile);
+       MathGridInset::write(os);
 
-       if (fragile)
+       if (os.fragile)
                os << "\\protect";
        os << "\\end{array}\n";
 }
+
+
+void MathArrayInset::metrics(MathMetricsInfo const & st) const
+{
+       MathMetricsInfo m = st;
+       if (m.size == LM_ST_DISPLAY)
+               m.size = LM_ST_TEXT;
+       MathGridInset::metrics(m);
+}
+