5 #include "math_arrayinset.h"
6 #include "math_parser.h"
7 #include "support/LOstream.h"
9 #include "math_mathmlstream.h"
14 MathArrayInset::MathArrayInset(int m, int n)
19 MathArrayInset::MathArrayInset(int m, int n, char valign, string const & halign)
20 : MathGridInset(m, n, valign, halign)
24 MathArrayInset::MathArrayInset(string const & str)
27 vector< vector<string> > dat;
28 istringstream is(str.c_str());
32 istringstream ls(line.c_str());
33 typedef std::istream_iterator<string> iter;
34 vector<string> v = vector<string>(iter(ls), iter());
39 for (row_type row = 1; row < dat.size(); ++row)
41 for (col_type col = 1; col < dat[0].size(); ++col)
43 for (row_type row = 0; row < dat.size(); ++row)
44 for (col_type col = 0; col < dat[row].size(); ++col)
45 mathed_parse_cell(cell(index(row, col)), dat[row][col]);
49 MathInset * MathArrayInset::clone() const
51 return new MathArrayInset(*this);
55 void MathArrayInset::write(MathWriteInfo & os) const
59 os << "\\begin{array}";
61 if (v_align_ == 't' || v_align_ == 'b')
62 os << '[' << char(v_align_) << ']';
65 for (col_type col = 0; col < ncols(); ++col)
66 os << colinfo_[col].align_;
69 MathGridInset::write(os);
73 os << "\\end{array}\n";
77 void MathArrayInset::writeNormal(NormalStream & os) const
80 MathGridInset::writeNormal(os);
85 void MathArrayInset::metrics(MathMetricsInfo const & st) const
87 MathMetricsInfo mi = st;
88 if (mi.style == LM_ST_DISPLAY)
89 mi.style = LM_ST_TEXT;
90 MathGridInset::metrics(mi);