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)
42 TOGGLE_LINE_BOTTOM = 5,
46 TOGGLE_LINE_RIGHT = 7,
48 ALIGN_LEFT = 8, // what are these alignment enums used for?
70 SET_ROTATE_TABLE = 19,
72 UNSET_ROTATE_TABLE = 20,
76 UNSET_ROTATE_CELL = 22,
90 SET_SPECIAL_COLUMN = 29,
92 SET_SPECIAL_MULTI = 30
99 CELL_BEGIN_OF_MULTICOLUMN = 1,
101 CELL_PART_OF_MULTICOLUMN = 2
105 LyXTable(int columns_arg, int rows_arg);
107 LyXTable(LyXTable const &);
110 LyXTable(LyXLex & lex);
114 LyXTable & operator=(LyXTable const &);
118 /// Returns true if there is a topline, returns false if not
119 bool TopLine(int cell);
120 /// Returns true if there is a topline, returns false if not
121 bool BottomLine(int cell);
122 /// Returns true if there is a topline, returns false if not
123 bool LeftLine(int cell);
124 /// Returns true if there is a topline, returns false if not
125 bool RightLine(int cell);
128 bool TopAlreadyDrawed(int cell);
130 bool VeryLastRow(int cell);
133 int AdditionalHeight(int cell);
135 int AdditionalWidth(int cell);
137 /* returns the maximum over all rows */
139 int WidthOfColumn(int cell);
143 int AscentOfRow(int row);
145 int DescentOfRow(int row);
149 void SetAscentOfRow(int row, int height);
151 void SetDescentOfRow(int row, int height);
152 /// Returns true if a complete update is necessary, otherwise false
153 bool SetWidthOfCell(int cell, int new_width);
154 /// Returns true if a complete update is necessary, otherwise false
155 bool SetAllLines(int cell, bool line);
156 /// Returns true if a complete update is necessary, otherwise false
157 bool SetTopLine(int cell, bool line);
158 /// Returns true if a complete update is necessary, otherwise false
159 bool SetBottomLine(int cell, bool line);
160 /// Returns true if a complete update is necessary, otherwise false
161 bool SetLeftLine(int cell, bool line);
162 /// Returns true if a complete update is necessary, otherwise false
163 bool SetRightLine(int cell, bool line);
164 /// Returns true if a complete update is necessary, otherwise false
165 bool SetAlignment(int cell, char align);
167 bool SetPWidth(int cell, string width);
169 bool SetAlignSpecial(int cell, string special, int what);
171 char GetAlignment(int cell); // add approp. signedness
173 string GetPWidth(int cell);
175 string GetAlignSpecial(int cell, int what);
178 int GetWidthOfCell(int cell);
180 int GetBeginningOfTextInCell(int cell);
183 void AppendRow(int cell);
185 void DeleteRow(int cell);
188 void AppendColumn(int cell);
190 void DeleteColumn(int cell);
193 bool IsFirstCell(int cell);
195 bool IsLastCell(int cell);
198 int GetNumberOfCells();
200 int AppendCellAfterCell(int append_cell, int question_cell);
202 int DeleteCellIfColumnIsDeleted(int cell, int delete_column_cell);
204 int NumberOfCellsInRow(int cell);
209 void Init(int columns_arg, int rows_arg);
212 void Write(std::ostream &, bool old_format=true);
214 void Read(std::istream &);
216 int Latex(std::ostream &);
219 @param cell < 0 will tex the preamble
220 @return the number of printed newlines
222 int TexEndOfCell(std::ostream &, int cell);
224 int DocBookEndOfCell(std::ostream &, int cell, int & depth);
228 int RoffEndOfCell(std::ostream &, int cell);
232 char const * getDocBookAlign(int cell, bool isColumn = false);
235 bool IsMultiColumn(int cell);
237 void SetMultiColumn(int cell, int number);
239 int UnsetMultiColumn(int cell); // returns number of new cells
241 bool IsPartOfMultiColumn(int row, int column);
243 int row_of_cell(int cell) const;
245 int column_of_cell(int cell) const;
251 void SetLongTable(int what);
255 void SetRotateTable(int what);
259 void SetRotateCell(int cell, int what);
261 bool RotateCell(int cell);
265 void AppendContRow(int cell);
267 bool IsContRow(int cell);
269 @return number of the cell which coninues or -1 if no ContRow
271 int CellHasContRow(int cell);
273 bool RowHasContRow(int cell);
275 int FirstVirtualCell(int cell);
277 int NextVirtualCell(int cell);
279 bool ShouldBeVeryLastCell(int cell);
281 bool ShouldBeVeryLastRow(int cell);
283 int GetCellAbove(int cell);
285 int GetCellNumber(int column, int row);
287 void SetLinebreaks(int cell, bool what);
289 bool Linebreaks(int cell);
291 // Long Table Options
293 void SetLTHead(int cell, bool first);
295 bool RowOfLTHead(int cell);
297 bool RowOfLTFirstHead(int cell);
299 void SetLTFoot(int cell, bool last);
301 bool RowOfLTFoot(int cell);
303 bool RowOfLTLastFoot(int cell);
305 void SetLTNewPage(int cell, bool what);
307 bool LTNewPage(int cell);
316 cellstruct & operator=(cellstruct const &);
322 int multicolumn; // add approp. signedness
324 int alignment; // add approp. signedness
336 string align_special;
338 string p_width; // this is only set for multicolumn!!!
347 rowstruct & operator=(rowstruct const &);
358 /// This are for longtables only
362 struct columnstruct {
368 columnstruct & operator=(columnstruct const &);
370 int alignment; // add approp. signedness
380 string align_special;
389 rowstruct * row_info;
391 columnstruct * column_info;
393 cellstruct ** cell_info;
400 /// row of endfirst head
404 /// row of endlastfoot
407 void set_row_column_number_info();
408 /// Returns true if a complete update is necessary, otherwise false
409 bool SetWidthOfMulticolCell(int cell, int new_width);
411 void recalculateMulticolCells(int cell, int new_width);
412 /// Returns true if change
413 bool calculate_width_of_column(int column);
415 bool calculate_width_of_column_NMC(int column); // no multi cells
417 void calculate_width_of_table();
420 int right_column_of_cell(int cell);
423 cellstruct * cellinfo_of_cell(int cell);
426 void delete_column(int column);
429 int cells_in_multicolumn(int cell);