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 * ====================================================== */
26 /* The features the text class offers for tables */
31 // Are the values of these enums important? (Lgb)
38 TOGGLE_LINE_BOTTOM = 5,
40 TOGGLE_LINE_RIGHT = 7,
41 ALIGN_LEFT = 8, // what are these alignment enums used for?
52 SET_ROTATE_TABLE = 19,
53 UNSET_ROTATE_TABLE = 20,
55 UNSET_ROTATE_CELL = 22,
62 SET_SPECIAL_COLUMN = 29,
63 SET_SPECIAL_MULTI = 30
68 CELL_BEGIN_OF_MULTICOLUMN = 1,
69 CELL_PART_OF_MULTICOLUMN = 2
73 LyXTable(int columns_arg, int rows_arg);
75 LyXTable(LyXLex & lex);
81 /// Returns true if there is a topline, returns false if not
82 bool TopLine(int cell);
83 /// Returns true if there is a topline, returns false if not
84 bool BottomLine(int cell);
85 /// Returns true if there is a topline, returns false if not
86 bool LeftLine(int cell);
87 /// Returns true if there is a topline, returns false if not
88 bool RightLine(int cell);
91 bool TopAlreadyDrawed(int cell);
93 bool VeryLastRow(int cell);
96 int AdditionalHeight(int cell);
98 int AdditionalWidth(int cell);
100 /* returns the maximum over all rows */
102 int WidthOfColumn(int cell);
106 /// Returns true if a complete update is necessary, otherwise false
107 bool SetWidthOfCell(int cell, int new_width);
108 /// Returns true if a complete update is necessary, otherwise false
109 bool SetAllLines(int cell, bool line);
110 /// Returns true if a complete update is necessary, otherwise false
111 bool SetTopLine(int cell, bool line);
112 /// Returns true if a complete update is necessary, otherwise false
113 bool SetBottomLine(int cell, bool line);
114 /// Returns true if a complete update is necessary, otherwise false
115 bool SetLeftLine(int cell, bool line);
116 /// Returns true if a complete update is necessary, otherwise false
117 bool SetRightLine(int cell, bool line);
118 /// Returns true if a complete update is necessary, otherwise false
119 bool SetAlignment(int cell, char align);
121 bool SetPWidth(int cell, string width);
123 bool SetAlignSpecial(int cell, string special, int what);
125 char GetAlignment(int cell); // add approp. signedness
127 string GetPWidth(int cell);
129 string GetAlignSpecial(int cell, int what);
132 int GetWidthOfCell(int cell);
134 int GetBeginningOfTextInCell(int cell);
137 void AppendRow(int cell);
139 void DeleteRow(int cell);
142 void AppendColumn(int cell);
144 void DeleteColumn(int cell);
147 bool IsFirstCell(int cell);
149 bool IsLastCell(int cell);
152 int GetNumberOfCells();
154 int AppendCellAfterCell(int append_cell, int question_cell);
156 int DeleteCellIfColumnIsDeleted(int cell, int delete_column_cell);
158 int NumberOfCellsInRow(int cell);
163 void Init(int columns_arg, int rows_arg);
166 void Write(ostream &);
168 void Read(istream &);
170 // cell <0 will tex the preamble
171 // returns the number of printed newlines
173 int TexEndOfCell(ostream &, int cell);
175 int DocBookEndOfCell(ostream &, int cell, int & depth);
178 int RoffEndOfCell(ostream &, int cell);
181 char const * getDocBookAlign(int cell, bool isColumn = false);
184 bool IsMultiColumn(int cell);
186 void SetMultiColumn(int cell, int number);
188 int UnsetMultiColumn(int cell); // returns number of new cells
190 int row_of_cell(int cell);
192 int column_of_cell(int cell);
198 void SetLongTable(int what);
202 void SetRotateTable(int what);
206 void SetRotateCell(int cell, int what);
208 bool RotateCell(int cell);
212 void AppendContRow(int cell);
214 bool IsContRow(int cell);
215 /// returns the number of the cell which continues
216 /// or -1 if no ContRow
217 int CellHasContRow(int cell);
219 bool RowHasContRow(int cell);
221 int FirstVirtualCell(int cell);
223 int NextVirtualCell(int cell);
225 bool ShouldBeVeryLastCell(int cell);
227 bool ShouldBeVeryLastRow(int cell);
229 int GetCellAbove(int cell);
231 int GetCellNumber(int column, int row);
233 void SetLinebreaks(int cell, bool what);
235 bool Linebreaks(int cell);
237 /// Long Table Options
239 void SetLTHead(int cell, bool first);
241 bool RowOfLTHead(int cell);
243 bool RowOfLTFirstHead(int cell);
245 void SetLTFoot(int cell, bool last);
247 bool RowOfLTFoot(int cell);
249 bool RowOfLTLastFoot(int cell);
251 void SetLTNewPage(int cell, bool what);
253 bool LTNewPage(int cell);
262 int multicolumn; // add approp. signedness
264 int alignment; // add approp. signedness
276 string align_special;
278 string p_width; // this is only set for multicolumn!!!
285 /// This are for longtables only
289 struct columnstruct {
290 int alignment; // add approp. signedness
295 string align_special;
304 void set_row_column_number_info();
307 rowstruct * row_info;
309 columnstruct * column_info;
311 cellstruct ** cell_info;
317 int endhead; // row of endhead
318 int endfirsthead; // row of endfirsthead
319 int endfoot; // row of endfoot
320 int endlastfoot; // row of endlastfoot
322 /// Returns true if a complete update is necessary, otherwise false
323 bool SetWidthOfMulticolCell(int cell, int new_width);
324 void recalculateMulticolCells(int cell, int new_width);
325 /// Returns true if change
326 bool calculate_width_of_column(int column);
327 bool calculate_width_of_column_NMC(int column); // no multi cells
329 void calculate_width_of_table();
332 int right_column_of_cell(int cell);
335 cellstruct * cellinfo_of_cell(int cell);
338 void delete_column(int column);
341 int cells_in_multicolumn(int cell);