]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathTabular.cpp
* src/mathed/InsetMathHull.cpp:
[lyx.git] / src / mathed / InsetMathTabular.cpp
index 2e17fb401238fe2604cbb70da412b44be3b3fe43..099089169908b92a318d66a24fb2375f9c7c5725 100644 (file)
 #include <config.h>
 
 #include "InsetMathTabular.h"
+
 #include "MathData.h"
 #include "MathStream.h"
 #include "MathStream.h"
 
 #include "support/lstrings.h"
-#include "support/std_ostream.h"
-
-#include <iterator>
 
+#include <ostream>
 
 namespace lyx {
 
@@ -34,11 +33,6 @@ InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n,
 {}
 
 
-InsetMathTabular::InsetMathTabular(docstring const & name, char valign,
-               docstring const & halign)
-       : InsetMathGrid(valign, halign), name_(name)
-{}
-
 
 Inset * InsetMathTabular::clone() const
 {
@@ -46,15 +40,19 @@ Inset * InsetMathTabular::clone() const
 }
 
 
-bool InsetMathTabular::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathTabular::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        FontSetChanger dummy(mi.base, "textnormal");
        InsetMathGrid::metrics(mi, dim);
        dim.wid += 6;
-       if (dim_ == dim)
-               return false;
-       dim_ = dim;
-       return true;
+}
+
+
+Dimension const InsetMathTabular::dimension(BufferView const & bv) const
+{
+       Dimension dim = InsetMathGrid::dimension(bv);
+       dim.wid += 6;
+       return dim;
 }
 
 
@@ -67,13 +65,16 @@ void InsetMathTabular::draw(PainterInfo & pi, int x, int y) const
 
 void InsetMathTabular::write(WriteStream & os) const
 {
+       ModeSpecifier specifier(os, TEXT_MODE);
+
        if (os.fragile())
                os << "\\protect";
        os << "\\begin{" << name_ << '}';
 
-       if (v_align_ == 't' || v_align_ == 'b')
-               os << '[' << char(v_align_) << ']';
-       os << '{' << halign() << "}\n";
+       char const v = verticalAlignment();
+       if (v == 't' || v == 'b')
+               os << '[' << v << ']';
+       os << '{' << horizontalAlignments() << "}\n";
 
        InsetMathGrid::write(os);