5 #include "math_nestinset.h"
6 #include "math_mathmlstream.h"
10 MathNestInset::MathNestInset(idx_type nargs)
11 : MathDimInset(), cells_(nargs)
15 MathInset::idx_type MathNestInset::nargs() const
21 MathXArray & MathNestInset::xcell(idx_type i)
27 MathXArray const & MathNestInset::xcell(idx_type i) const
33 MathArray & MathNestInset::cell(idx_type i)
35 return cells_[i].data_;
39 MathArray const & MathNestInset::cell(idx_type i) const
41 return cells_[i].data_;
45 void MathNestInset::substitute(MathMacro const & m)
47 for (idx_type i = 0; i < nargs(); ++i)
48 cell(i).substitute(m);
52 void MathNestInset::metrics(MathMetricsInfo const & mi) const
54 for (idx_type i = 0; i < nargs(); ++i)
59 void MathNestInset::draw(Painter & pain, int x, int y) const
61 for (idx_type i = 0; i < nargs(); ++i)
62 xcell(i).draw(pain, x + xcell(i).xo(), y + xcell(i).yo());
66 bool MathNestInset::idxNext(idx_type & idx, pos_type & pos) const
68 if (idx + 1 >= nargs())
76 bool MathNestInset::idxRight(idx_type & idx, pos_type & pos) const
78 return idxNext(idx, pos);
82 bool MathNestInset::idxPrev(idx_type & idx, pos_type & pos) const
87 pos = cell(idx).size();
92 bool MathNestInset::idxLeft(idx_type & idx, pos_type & pos) const
94 return idxPrev(idx, pos);
98 bool MathNestInset::idxFirst(idx_type & i, pos_type & pos) const
108 bool MathNestInset::idxLast(idx_type & i, pos_type & pos) const
113 pos = cell(i).size();
118 bool MathNestInset::idxHome(idx_type & /* idx */, pos_type & pos) const
127 bool MathNestInset::idxEnd(idx_type & idx, pos_type & pos) const
129 pos_type n = cell(idx).size();
137 void MathNestInset::dump() const
139 WriteStream os(lyxerr);
140 os << "---------------------------------------------\n";
143 for (idx_type i = 0; i < nargs(); ++i)
144 os << cell(i) << "\n";
145 os << "---------------------------------------------\n";
149 void MathNestInset::validate(LaTeXFeatures & features) const
151 for (idx_type i = 0; i < nargs(); ++i)
152 cell(i).validate(features);
156 bool MathNestInset::match(MathInset * p) const
158 if (nargs() != p->nargs())
160 for (idx_type i = 0; i < nargs(); ++i)
161 if (!cell(i).match(p->cell(i)))
167 void MathNestInset::replace(ReplaceData & rep)
169 for (idx_type i = 0; i < nargs(); ++i)
170 cell(i).replace(rep);