2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright (C) 1995, 1996 Matthias Ettrich
9 * ====================================================== */
22 /* The features the text class offers for tables */
27 // Are the values of these enums important? (Lgb)
34 TOGGLE_LINE_BOTTOM = 5,
36 TOGGLE_LINE_RIGHT = 7,
37 ALIGN_LEFT = 8, // what are these alignment enums used for?
48 SET_ROTATE_TABLE = 19,
49 UNSET_ROTATE_TABLE = 20,
51 UNSET_ROTATE_CELL = 22,
58 SET_SPECIAL_COLUMN = 29,
59 SET_SPECIAL_MULTI = 30
64 CELL_BEGIN_OF_MULTICOLUMN = 1,
65 CELL_PART_OF_MULTICOLUMN = 2
69 LyXTable(int columns_arg, int rows_arg);
71 LyXTable(LyXLex &lex);
77 /// Returns true if there is a topline, returns false if not
78 bool TopLine(int cell);
79 /// Returns true if there is a topline, returns false if not
80 bool BottomLine(int cell);
81 /// Returns true if there is a topline, returns false if not
82 bool LeftLine(int cell);
83 /// Returns true if there is a topline, returns false if not
84 bool RightLine(int cell);
87 bool TopAlreadyDrawed(int cell);
89 bool VeryLastRow(int cell);
92 int AdditionalHeight(int cell);
94 int AdditionalWidth(int cell);
96 /* returns the maximum over all rows */
98 int WidthOfColumn(int cell);
102 /// Returns true if a complete update is necessary, otherwise false
103 bool SetWidthOfCell(int cell, int new_width);
104 /// Returns true if a complete update is necessary, otherwise false
105 bool SetAllLines(int cell, bool line);
106 /// Returns true if a complete update is necessary, otherwise false
107 bool SetTopLine(int cell, bool line);
108 /// Returns true if a complete update is necessary, otherwise false
109 bool SetBottomLine(int cell, bool line);
110 /// Returns true if a complete update is necessary, otherwise false
111 bool SetLeftLine(int cell, bool line);
112 /// Returns true if a complete update is necessary, otherwise false
113 bool SetRightLine(int cell, bool line);
114 /// Returns true if a complete update is necessary, otherwise false
115 bool SetAlignment(int cell, char align);
117 bool SetPWidth(int cell, string width);
119 bool SetAlignSpecial(int cell, string special, int what);
121 char GetAlignment(int cell); // add approp. signedness
123 string GetPWidth(int cell);
125 string GetAlignSpecial(int cell, int what);
128 int GetWidthOfCell(int cell);
130 int GetBeginningOfTextInCell(int cell);
133 void AppendRow(int cell);
135 void DeleteRow(int cell);
138 void AppendColumn(int cell);
140 void DeleteColumn(int cell);
143 bool IsFirstCell(int cell);
145 bool IsLastCell(int cell);
148 int GetNumberOfCells();
150 int AppendCellAfterCell(int append_cell, int question_cell);
152 int DeleteCellIfColumnIsDeleted(int cell, int delete_column_cell);
154 int NumberOfCellsInRow(int cell);
159 void Init(int columns_arg, int rows_arg);
162 void Write(FILE* file);
164 void Read(FILE* file);
166 // cell <0 will tex the preamble
167 // returns the number of printed newlines
169 int TexEndOfCell(string & file, int cell);
171 int RoffEndOfCell(FILE* file, int cell);
173 char const *getDocBookAlign(int cell, bool isColumn= false);
175 int DocBookEndOfCell(string &file, int cell, int &depth);
178 bool IsMultiColumn(int cell);
180 void SetMultiColumn(int cell, int number);
182 int UnsetMultiColumn(int cell); // returns number of new cells
184 int row_of_cell(int cell);
186 int column_of_cell(int cell);
192 void SetLongTable(int what);
196 void SetRotateTable(int what);
200 void SetRotateCell(int cell, int what);
202 bool RotateCell(int cell);
206 void AppendContRow(int cell);
208 bool IsContRow(int cell);
209 /// returns the number of the cell which continues
210 /// or -1 if no ContRow
211 int CellHasContRow(int cell);
213 bool RowHasContRow(int cell);
215 int FirstVirtualCell(int cell);
217 int NextVirtualCell(int cell);
219 bool ShouldBeVeryLastCell(int cell);
221 bool ShouldBeVeryLastRow(int cell);
223 int GetCellAbove(int cell);
225 int GetCellNumber(int column, int row);
227 void SetLinebreaks(int cell, bool what);
229 bool Linebreaks(int cell);
231 /// Long Table Options
233 void SetLTHead(int cell, bool first);
235 bool RowOfLTHead(int cell);
237 bool RowOfLTFirstHead(int cell);
239 void SetLTFoot(int cell, bool last);
241 bool RowOfLTFoot(int cell);
243 bool RowOfLTLastFoot(int cell);
245 void SetLTNewPage(int cell, bool what);
247 bool LTNewPage(int cell);
256 char multicolumn; // add approp. signedness
258 char alignment; // add approp. signedness
270 string align_special;
272 string p_width; // this is only set for multicolumn!!!
279 /// This are for longtables only
283 struct columnstruct {
284 char alignment; // add approp. signedness
289 string align_special;
298 void set_row_column_number_info();
303 columnstruct *column_info;
305 cellstruct** cell_info;
311 int endhead; // row of endhead
312 int endfirsthead; // row of endfirsthead
313 int endfoot; // row of endfoot
314 int endlastfoot; // row of endlastfoot
316 /// Returns true if a complete update is necessary, otherwise false
317 bool SetWidthOfMulticolCell(int cell, int new_width);
318 void recalculateMulticolCells(int cell, int new_width);
319 /// Returns true if change
320 bool calculate_width_of_column(int column);
321 bool calculate_width_of_column_NMC(int column); // no multi cells
323 void calculate_width_of_table();
326 int right_column_of_cell(int cell);
329 cellstruct* cellinfo_of_cell(int cell);
332 void delete_column(int column);
335 int cells_in_multicolumn(int cell);