3 #include "math_amsarrayinset.h"
4 #include "math_mathmlstream.h"
5 #include "metricsinfo.h"
6 #include "math_support.h"
7 #include "math_streamstr.h"
8 #include "math_support.h"
12 MathAMSArrayInset::MathAMSArrayInset(string const & name, int m, int n)
13 : MathGridInset(m, n), name_(name)
17 MathAMSArrayInset::MathAMSArrayInset(string const & name)
18 : MathGridInset(1, 1), name_(name)
22 MathInset * MathAMSArrayInset::clone() const
24 return new MathAMSArrayInset(*this);
28 char const * MathAMSArrayInset::name_left() const
30 if (name_ == "bmatrix")
32 if (name_ == "Bmatrix")
34 if (name_ == "vmatrix")
36 if (name_ == "Vmatrix")
38 if (name_ == "pmatrix")
44 char const * MathAMSArrayInset::name_right() const
46 if (name_ == "bmatrix")
48 if (name_ == "Bmatrix")
50 if (name_ == "vmatrix")
52 if (name_ == "Vmatrix")
54 if (name_ == "pmatrix")
60 void MathAMSArrayInset::metrics(MetricsInfo & mi) const
63 if (m.base.style == LM_ST_DISPLAY)
64 m.base.style = LM_ST_TEXT;
65 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 - ascent();
74 mathed_draw_deco(pi, x + 1, yy, 5, height(), name_left());
75 mathed_draw_deco(pi, x + width() - 6, yy, 5, 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);