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
45 /// currently possible: 'l', 'c', 'r'
53 /// do we need a line to the left?
55 /// do we need a line to the right?
57 /// additional amount to be skipped when drawing
63 MathGridInset(int m, int n);
65 void write(std::ostream &, bool fragile) const;
67 void metrics(MathStyles st) const;
69 void draw(Painter &, int x, int y) const;
71 void halign(string const &);
73 void halign(char c, int col);
75 char halign(int col) const;
81 void vskip(LyXLength const &, int row);
83 LyXLength vskip(int row) const;
85 void resize(short int type, int cols);
87 const RowInfo & rowinfo(int row) const;
89 RowInfo & rowinfo(int row);
91 bool isGrid() const { return true; }
94 int ncols() const { return colinfo_.size(); }
96 int nrows() const { return rowinfo_.size(); }
98 int col(int idx) const { return idx % ncols(); }
100 int row(int idx) const { return idx / ncols(); }
102 int cellXOffset(int idx) const;
104 int cellYOffset(int idx) const;
107 bool idxUp(int &, int &) const;
109 bool idxDown(int &, int &) const;
111 bool idxLeft(int &, int &) const;
113 bool idxRight(int &, int &) const;
115 bool idxFirst(int &, int &) const;
117 bool idxLast(int &, int &) const;
119 void idxDelete(int &, bool &, bool &);
121 void idxDeleteRange(int, int);
132 virtual void appendRow();
134 int index(int row, int col) const;
136 std::vector<int> idxBetween(int from, int to) const;
138 virtual int defaultColSpace(int) { return 10; }
140 virtual char defaultColAlign(int) { return 'c'; }
143 /// returns proper 'end of line' code for LaTeX
144 string eolString(int row) const;
145 /// returns proper 'end of column' code for LaTeX
146 string eocString(int col) const;
149 std::vector<RowInfo> rowinfo_;
151 std::vector<ColInfo> colinfo_;
153 char v_align_; // add approp. type