2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright (C) 1995, 1996 Matthias Ettrich
9 * ====================================================== */
19 #include "support/LOstream.h"
21 #define USE_OSTREAM_ONLY 1
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);
72 LyXTable(LyXLex & lex);
78 /// Returns true if there is a topline, returns false if not
79 bool TopLine(int cell);
80 /// Returns true if there is a topline, returns false if not
81 bool BottomLine(int cell);
82 /// Returns true if there is a topline, returns false if not
83 bool LeftLine(int cell);
84 /// Returns true if there is a topline, returns false if not
85 bool RightLine(int cell);
88 bool TopAlreadyDrawed(int cell);
90 bool VeryLastRow(int cell);
93 int AdditionalHeight(int cell);
95 int AdditionalWidth(int cell);
97 /* returns the maximum over all rows */
99 int WidthOfColumn(int cell);
103 /// Returns true if a complete update is necessary, otherwise false
104 bool SetWidthOfCell(int cell, int new_width);
105 /// Returns true if a complete update is necessary, otherwise false
106 bool SetAllLines(int cell, bool line);
107 /// Returns true if a complete update is necessary, otherwise false
108 bool SetTopLine(int cell, bool line);
109 /// Returns true if a complete update is necessary, otherwise false
110 bool SetBottomLine(int cell, bool line);
111 /// Returns true if a complete update is necessary, otherwise false
112 bool SetLeftLine(int cell, bool line);
113 /// Returns true if a complete update is necessary, otherwise false
114 bool SetRightLine(int cell, bool line);
115 /// Returns true if a complete update is necessary, otherwise false
116 bool SetAlignment(int cell, char align);
118 bool SetPWidth(int cell, string width);
120 bool SetAlignSpecial(int cell, string special, int what);
122 char GetAlignment(int cell); // add approp. signedness
124 string GetPWidth(int cell);
126 string GetAlignSpecial(int cell, int what);
129 int GetWidthOfCell(int cell);
131 int GetBeginningOfTextInCell(int cell);
134 void AppendRow(int cell);
136 void DeleteRow(int cell);
139 void AppendColumn(int cell);
141 void DeleteColumn(int cell);
144 bool IsFirstCell(int cell);
146 bool IsLastCell(int cell);
149 int GetNumberOfCells();
151 int AppendCellAfterCell(int append_cell, int question_cell);
153 int DeleteCellIfColumnIsDeleted(int cell, int delete_column_cell);
155 int NumberOfCellsInRow(int cell);
160 void Init(int columns_arg, int rows_arg);
163 void Write(ostream &);
165 void Read(istream &);
167 // cell <0 will tex the preamble
168 // returns the number of printed newlines
169 #ifdef USE_OSTREAM_ONLY
171 int TexEndOfCell(ostream &, int cell);
173 int DocBookEndOfCell(ostream &, int cell, int & depth);
176 int TexEndOfCell(string & file, int cell);
178 int DocBookEndOfCell(string & file, int cell, int & depth);
182 int RoffEndOfCell(ostream &, int cell);
185 char const * getDocBookAlign(int cell, bool isColumn = false);
188 bool IsMultiColumn(int cell);
190 void SetMultiColumn(int cell, int number);
192 int UnsetMultiColumn(int cell); // returns number of new cells
194 int row_of_cell(int cell);
196 int column_of_cell(int cell);
202 void SetLongTable(int what);
206 void SetRotateTable(int what);
210 void SetRotateCell(int cell, int what);
212 bool RotateCell(int cell);
216 void AppendContRow(int cell);
218 bool IsContRow(int cell);
219 /// returns the number of the cell which continues
220 /// or -1 if no ContRow
221 int CellHasContRow(int cell);
223 bool RowHasContRow(int cell);
225 int FirstVirtualCell(int cell);
227 int NextVirtualCell(int cell);
229 bool ShouldBeVeryLastCell(int cell);
231 bool ShouldBeVeryLastRow(int cell);
233 int GetCellAbove(int cell);
235 int GetCellNumber(int column, int row);
237 void SetLinebreaks(int cell, bool what);
239 bool Linebreaks(int cell);
241 /// Long Table Options
243 void SetLTHead(int cell, bool first);
245 bool RowOfLTHead(int cell);
247 bool RowOfLTFirstHead(int cell);
249 void SetLTFoot(int cell, bool last);
251 bool RowOfLTFoot(int cell);
253 bool RowOfLTLastFoot(int cell);
255 void SetLTNewPage(int cell, bool what);
257 bool LTNewPage(int cell);
266 int multicolumn; // add approp. signedness
268 int alignment; // add approp. signedness
280 string align_special;
282 string p_width; // this is only set for multicolumn!!!
289 /// This are for longtables only
293 struct columnstruct {
294 int alignment; // add approp. signedness
299 string align_special;
308 void set_row_column_number_info();
311 rowstruct * row_info;
313 columnstruct * column_info;
315 cellstruct ** cell_info;
321 int endhead; // row of endhead
322 int endfirsthead; // row of endfirsthead
323 int endfoot; // row of endfoot
324 int endlastfoot; // row of endlastfoot
326 /// Returns true if a complete update is necessary, otherwise false
327 bool SetWidthOfMulticolCell(int cell, int new_width);
328 void recalculateMulticolCells(int cell, int new_width);
329 /// Returns true if change
330 bool calculate_width_of_column(int column);
331 bool calculate_width_of_column_NMC(int column); // no multi cells
333 void calculate_width_of_table();
336 int right_column_of_cell(int cell);
339 cellstruct * cellinfo_of_cell(int cell);
342 void delete_column(int column);
345 int cells_in_multicolumn(int cell);