5 #include "math_nestinset.h"
13 /** Gridded math inset base class.
14 This is the base to all grid-like editable math objects
15 like array and eqnarray.
16 \author André Pönitz 2001
19 class MathGridInset : public MathNestInset {
21 /// additional per-row information
26 int skipPixels() const;
33 /// hline abow this row?
35 /// hline below this row?
41 // additional per-row information
61 MathGridInset(int m, int n);
63 void write(std::ostream &, bool fragile) const;
65 void metrics(MathStyles st) const;
67 void draw(Painter &, int x, int y) const;
69 void halign(string const &);
71 void halign(char c, int col);
73 char halign(int col) const;
79 void vskip(LyXLength const &, int row);
81 LyXLength vskip(int row) const;
83 void resize(short int type, int cols);
85 const RowInfo & rowinfo(int row) const;
87 RowInfo & rowinfo(int row);
89 bool isGrid() const { return true; }
92 int ncols() const { return colinfo_.size(); }
94 int nrows() const { return rowinfo_.size(); }
96 int col(int idx) const { return idx % ncols(); }
98 int row(int idx) const { return idx / ncols(); }
100 int cellXOffset(int idx) const;
102 int cellYOffset(int idx) const;
105 bool idxUp(int &, int &) const;
107 bool idxDown(int &, int &) const;
109 bool idxLeft(int &, int &) const;
111 bool idxRight(int &, int &) const;
113 bool idxFirst(int &, int &) const;
115 bool idxLast(int &, int &) const;
117 void idxDelete(int &, bool &, bool &);
119 void idxDeleteRange(int, int);
130 virtual void appendRow();
132 int index(int row, int col) const;
134 std::vector<int> idxBetween(int from, int to) const;
137 /// returns proper 'end of line' code for LaTeX
138 string eolString(int row) const;
139 /// returns proper 'end of column' code for LaTeX
140 string eocString(int col) const;
143 std::vector<RowInfo> rowinfo_;
145 std::vector<ColInfo> colinfo_;
147 char v_align_; // add approp. type