7 #include "math_amsarrayinset.h"
8 #include "math_mathmlstream.h"
9 #include "math_support.h"
10 #include "math_streamstr.h"
11 #include "math_support.h"
15 MathAMSArrayInset::MathAMSArrayInset(string const & name, int m, int n)
16 : MathGridInset(m, n), name_(name)
20 MathAMSArrayInset::MathAMSArrayInset(string const & name)
21 : MathGridInset(1, 1), name_(name)
25 MathInset * MathAMSArrayInset::clone() const
27 return new MathAMSArrayInset(*this);
31 char const * MathAMSArrayInset::name_left() const
33 if (name_ == "bmatrix")
35 if (name_ == "vmatrix")
37 if (name_ == "Vmatrix")
39 if (name_ == "pmatrix")
45 char const * MathAMSArrayInset::name_right() const
47 if (name_ == "bmatrix")
49 if (name_ == "vmatrix")
51 if (name_ == "Vmatrix")
53 if (name_ == "pmatrix")
59 void MathAMSArrayInset::metrics(MathMetricsInfo const & st) const
61 MathMetricsInfo mi = st;
62 if (mi.style == LM_ST_DISPLAY)
63 mi.style = LM_ST_TEXT;
64 MathGridInset::metrics(mi);
69 void MathAMSArrayInset::draw(Painter & pain, int x, int y) const
71 MathGridInset::draw(pain, x + 6, y);
73 mathed_draw_deco(pain, x + 1, yy, 5, height(), name_left());
74 mathed_draw_deco(pain, x + width_ - 6, yy, 5, height(), name_right());
78 void MathAMSArrayInset::write(WriteStream & os) const
80 os << "\\begin{" << name_ << "}";
81 MathGridInset::write(os);
82 os << "\\end{" << name_ << "}";
86 void MathAMSArrayInset::normalize(NormalStream & os) const
88 os << "[" << name_ << " ";
89 MathGridInset::normalize(os);
94 void MathAMSArrayInset::maplize(MapleStream & os) const
97 MathGridInset::maplize(os);