2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2000 The LyX Team.
10 * ====================================================== */
23 /* The features the text class offers for tables */
28 // Are the values of these enums important? (Lgb)
35 TOGGLE_LINE_BOTTOM = 5,
37 TOGGLE_LINE_RIGHT = 7,
38 ALIGN_LEFT = 8, // what are these alignment enums used for?
49 SET_ROTATE_TABLE = 19,
50 UNSET_ROTATE_TABLE = 20,
52 UNSET_ROTATE_CELL = 22,
59 SET_SPECIAL_COLUMN = 29,
60 SET_SPECIAL_MULTI = 30
65 CELL_BEGIN_OF_MULTICOLUMN = 1,
66 CELL_PART_OF_MULTICOLUMN = 2
70 LyXTable(int columns_arg, int rows_arg);
73 LyXTable(LyXLex & lex);
79 /// Returns true if there is a topline, returns false if not
80 bool TopLine(int cell);
81 /// Returns true if there is a topline, returns false if not
82 bool BottomLine(int cell);
83 /// Returns true if there is a topline, returns false if not
84 bool LeftLine(int cell);
85 /// Returns true if there is a topline, returns false if not
86 bool RightLine(int cell);
89 bool TopAlreadyDrawed(int cell);
91 bool VeryLastRow(int cell);
94 int AdditionalHeight(int cell);
96 int AdditionalWidth(int cell);
98 /* returns the maximum over all rows */
100 int WidthOfColumn(int cell);
104 /// Returns true if a complete update is necessary, otherwise false
105 bool SetWidthOfCell(int cell, int new_width);
106 /// Returns true if a complete update is necessary, otherwise false
107 bool SetAllLines(int cell, bool line);
108 /// Returns true if a complete update is necessary, otherwise false
109 bool SetTopLine(int cell, bool line);
110 /// Returns true if a complete update is necessary, otherwise false
111 bool SetBottomLine(int cell, bool line);
112 /// Returns true if a complete update is necessary, otherwise false
113 bool SetLeftLine(int cell, bool line);
114 /// Returns true if a complete update is necessary, otherwise false
115 bool SetRightLine(int cell, bool line);
116 /// Returns true if a complete update is necessary, otherwise false
117 bool SetAlignment(int cell, char align);
119 bool SetPWidth(int cell, string width);
121 bool SetAlignSpecial(int cell, string special, int what);
123 char GetAlignment(int cell); // add approp. signedness
125 string GetPWidth(int cell);
127 string GetAlignSpecial(int cell, int what);
130 int GetWidthOfCell(int cell);
132 int GetBeginningOfTextInCell(int cell);
135 void AppendRow(int cell);
137 void DeleteRow(int cell);
140 void AppendColumn(int cell);
142 void DeleteColumn(int cell);
145 bool IsFirstCell(int cell);
147 bool IsLastCell(int cell);
150 int GetNumberOfCells();
152 int AppendCellAfterCell(int append_cell, int question_cell);
154 int DeleteCellIfColumnIsDeleted(int cell, int delete_column_cell);
156 int NumberOfCellsInRow(int cell);
161 void Init(int columns_arg, int rows_arg);
164 void Write(std::ostream &);
166 void Read(std::istream &);
168 // cell <0 will tex the preamble
169 // returns the number of printed newlines
171 int TexEndOfCell(std::ostream &, int cell);
173 int DocBookEndOfCell(std::ostream &, int cell, int & depth);
176 int RoffEndOfCell(std::ostream &, int cell);
179 char const * getDocBookAlign(int cell, bool isColumn = false);
182 bool IsMultiColumn(int cell);
184 void SetMultiColumn(int cell, int number);
186 int UnsetMultiColumn(int cell); // returns number of new cells
188 int row_of_cell(int cell);
190 int column_of_cell(int cell);
196 void SetLongTable(int what);
200 void SetRotateTable(int what);
204 void SetRotateCell(int cell, int what);
206 bool RotateCell(int cell);
210 void AppendContRow(int cell);
212 bool IsContRow(int cell);
213 /// returns the number of the cell which continues
214 /// or -1 if no ContRow
215 int CellHasContRow(int cell);
217 bool RowHasContRow(int cell);
219 int FirstVirtualCell(int cell);
221 int NextVirtualCell(int cell);
223 bool ShouldBeVeryLastCell(int cell);
225 bool ShouldBeVeryLastRow(int cell);
227 int GetCellAbove(int cell);
229 int GetCellNumber(int column, int row);
231 void SetLinebreaks(int cell, bool what);
233 bool Linebreaks(int cell);
235 /// Long Table Options
237 void SetLTHead(int cell, bool first);
239 bool RowOfLTHead(int cell);
241 bool RowOfLTFirstHead(int cell);
243 void SetLTFoot(int cell, bool last);
245 bool RowOfLTFoot(int cell);
247 bool RowOfLTLastFoot(int cell);
249 void SetLTNewPage(int cell, bool what);
251 bool LTNewPage(int cell);
260 int multicolumn; // add approp. signedness
262 int alignment; // add approp. signedness
274 string align_special;
276 string p_width; // this is only set for multicolumn!!!
283 /// This are for longtables only
287 struct columnstruct {
288 int alignment; // add approp. signedness
293 string align_special;
302 void set_row_column_number_info();
305 rowstruct * row_info;
307 columnstruct * column_info;
309 cellstruct ** cell_info;
315 int endhead; // row of endhead
316 int endfirsthead; // row of endfirsthead
317 int endfoot; // row of endfoot
318 int endlastfoot; // row of endlastfoot
320 /// Returns true if a complete update is necessary, otherwise false
321 bool SetWidthOfMulticolCell(int cell, int new_width);
322 void recalculateMulticolCells(int cell, int new_width);
323 /// Returns true if change
324 bool calculate_width_of_column(int column);
325 bool calculate_width_of_column_NMC(int column); // no multi cells
327 void calculate_width_of_table();
330 int right_column_of_cell(int cell);
333 cellstruct * cellinfo_of_cell(int cell);
336 void delete_column(int column);
339 int cells_in_multicolumn(int cell);