3 #include "math_amsarrayinset.h"
4 #include "math_mathmlstream.h"
5 #include "metricsinfo.h"
6 #include "math_streamstr.h"
7 #include "math_support.h"
11 MathAMSArrayInset::MathAMSArrayInset(string const & name, int m, int n)
12 : MathGridInset(m, n), name_(name)
16 MathAMSArrayInset::MathAMSArrayInset(string const & name)
17 : MathGridInset(1, 1), name_(name)
21 MathInset * MathAMSArrayInset::clone() const
23 return new MathAMSArrayInset(*this);
27 char const * MathAMSArrayInset::name_left() const
29 if (name_ == "bmatrix")
31 if (name_ == "Bmatrix")
33 if (name_ == "vmatrix")
35 if (name_ == "Vmatrix")
37 if (name_ == "pmatrix")
43 char const * MathAMSArrayInset::name_right() const
45 if (name_ == "bmatrix")
47 if (name_ == "Bmatrix")
49 if (name_ == "vmatrix")
51 if (name_ == "Vmatrix")
53 if (name_ == "pmatrix")
59 void MathAMSArrayInset::metrics(MetricsInfo & mi, Dimension & dim) const
62 if (m.base.style == LM_ST_DISPLAY)
63 m.base.style = LM_ST_TEXT;
64 MathGridInset::metrics(m);
70 void MathAMSArrayInset::draw(PainterInfo & pi, int x, int y) const
72 MathGridInset::draw(pi, x + 6, y);
73 int const yy = y - dim_.ascent();
74 mathed_draw_deco(pi, x + 1, yy, 5, dim_.height(), name_left());
75 mathed_draw_deco(pi, x + dim_.width() - 6, yy, 5, dim_.height(), name_right());
79 void MathAMSArrayInset::write(WriteStream & os) const
81 os << "\\begin{" << name_ << '}';
82 MathGridInset::write(os);
83 os << "\\end{" << name_ << '}';
87 void MathAMSArrayInset::normalize(NormalStream & os) const
89 os << '[' << name_ << ' ';
90 MathGridInset::normalize(os);