5 #include "math_nestinset.h"
9 MathNestInset::MathNestInset(idx_type nargs)
10 : MathDimInset(), cells_(nargs)
14 MathInset::idx_type MathNestInset::nargs() const
20 MathXArray & MathNestInset::xcell(idx_type i)
26 MathXArray const & MathNestInset::xcell(idx_type i) const
32 MathArray & MathNestInset::cell(idx_type i)
34 return cells_[i].data_;
38 MathArray const & MathNestInset::cell(idx_type i) const
40 return cells_[i].data_;
44 void MathNestInset::substitute(MathMacro const & m)
46 for (idx_type i = 0; i < nargs(); ++i)
47 cell(i).substitute(m);
51 void MathNestInset::metrics(MathStyles st) const
54 for (idx_type i = 0; i < nargs(); ++i)
59 void MathNestInset::draw(Painter & pain, int x, int y) const
63 for (idx_type i = 0; i < nargs(); ++i)
64 xcell(i).draw(pain, x + xcell(i).xo(), y + xcell(i).yo());
68 bool MathNestInset::idxNext(idx_type & idx, pos_type & pos) const
70 if (idx + 1 >= nargs())
78 bool MathNestInset::idxRight(idx_type & idx, pos_type & pos) const
80 return idxNext(idx, pos);
84 bool MathNestInset::idxPrev(idx_type & idx, pos_type & pos) const
89 pos = cell(idx).size();
94 bool MathNestInset::idxLeft(idx_type & idx, pos_type & pos) const
96 return idxPrev(idx, pos);
100 bool MathNestInset::idxFirst(idx_type & i, pos_type & pos) const
110 bool MathNestInset::idxLast(idx_type & i, pos_type & pos) const
115 pos = cell(i).size();
120 bool MathNestInset::idxHome(idx_type & /* idx */, pos_type & pos) const
129 bool MathNestInset::idxEnd(idx_type & idx, pos_type & pos) const
131 pos_type n = cell(idx).size();
140 void MathNestInset::dump() const
142 lyxerr << "---------------------------------------------\n";
143 write(lyxerr, false);
145 for (idx_type i = 0; i < nargs(); ++i)
146 lyxerr << cell(i) << "\n";
147 lyxerr << "---------------------------------------------\n";
151 void MathNestInset::push_back(MathInset * p)
154 cells_.back().data_.push_back(p);
156 lyxerr << "can't push without a cell\n";
160 void MathNestInset::validate(LaTeXFeatures & features) const
162 for (idx_type i = 0; i < nargs(); ++i)
163 cell(i).validate(features);