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 /// how many hlines above this row?
35 /// parameter to the line break
37 /// extra distance between lines
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 /// how many lines to the left of this column?
59 /// additional amount to be skipped when drawing
64 /// constructor from columns description, creates one row
65 MathGridInset(char valign, string const & halign);
66 /// Note: columns first!
67 MathGridInset(col_type m, row_type n);
69 MathGridInset(col_type m, row_type n, char valign, string const & halign);
71 void metrics(MathMetricsInfo const & st) const;
73 void draw(Painter &, int x, int y) const;
75 void halign(string const &);
77 void halign(char c, col_type col);
79 char halign(col_type col) const;
81 string halign() const;
87 void vcrskip(LyXLength const &, row_type row);
89 LyXLength vcrskip(row_type row) const;
91 void resize(short int type, col_type cols);
93 const RowInfo & rowinfo(row_type row) const;
94 /// returns topmost row if passed (-1)
95 RowInfo & rowinfo(row_type row);
96 /// identifies GridInset
97 virtual MathGridInset * asGridInset() { return this; }
100 col_type ncols() const;
102 row_type nrows() const;
104 col_type col(idx_type idx) const;
106 row_type row(idx_type idx) const;
108 int cellXOffset(idx_type idx) const;
110 int cellYOffset(idx_type idx) const;
113 bool idxUp(idx_type &, pos_type &) const;
115 bool idxDown(idx_type &, pos_type &) const;
117 bool idxLeft(idx_type &, pos_type &) const;
119 bool idxRight(idx_type &, pos_type &) const;
121 bool idxFirst(idx_type &, pos_type &) const;
123 bool idxLast(idx_type &, pos_type &) const;
125 bool idxHome(idx_type &, pos_type &) const;
127 bool idxEnd(idx_type &, pos_type &) const;
129 void idxDelete(idx_type &, bool &, bool &);
131 void idxDeleteRange(idx_type, idx_type);
134 virtual void addRow(row_type);
136 virtual void delRow(row_type);
138 virtual void addCol(col_type);
140 virtual void delCol(col_type);
142 virtual void appendRow();
144 idx_type index(row_type row, col_type col) const;
146 std::vector<idx_type> idxBetween(idx_type from, idx_type to) const;
148 virtual int defaultColSpace(col_type) { return 0; }
150 virtual char defaultColAlign(col_type) { return 'c'; }
155 void write(WriteStream & os) const;
157 void normalize(NormalStream &) const;
159 //void maplize(MapleStream &) const;
161 void mathmlize(MathMLStream &) const;
163 //void octavize(OctaveStream &) const;
166 /// returns proper 'end of line' code for LaTeX
167 string eolString(row_type row) const;
168 /// returns proper 'end of column' code for LaTeX
169 string eocString(col_type col) const;
170 /// extract number of columns from alignment string
171 col_type guessColumns(string const & halign) const;
174 std::vector<RowInfo> rowinfo_;
176 std::vector<ColInfo> colinfo_;
178 char v_align_; // add approp. type