2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright (C) 1995, 1996 Matthias Ettrich
9 *======================================================*/
19 #include "definitions.h"
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(FILE* file);
165 void Read(FILE* file);
167 // cell <0 will tex the preamble
168 // returns the number of printed newlines
170 int TexEndOfCell(string& file, int cell);
172 int RoffEndOfCell(FILE* file, int cell);
174 const char *getDocBookAlign(int cell, bool isColumn=false);
176 int DocBookEndOfCell(string &file, int cell, int &depth);
179 bool IsMultiColumn(int cell);
181 void SetMultiColumn(int cell, int number);
183 int UnsetMultiColumn(int cell); // returns number of new cells
185 int row_of_cell(int cell);
187 int column_of_cell(int cell);
193 void SetLongTable(int what);
197 void SetRotateTable(int what);
201 void SetRotateCell(int cell, int what);
203 bool RotateCell(int cell);
207 void AppendContRow(int cell);
209 bool IsContRow(int cell);
210 /// returns the number of the cell which continues
211 /// or -1 if no ContRow
212 int CellHasContRow(int cell);
214 bool RowHasContRow(int cell);
216 int FirstVirtualCell(int cell);
218 int NextVirtualCell(int cell);
220 bool ShouldBeVeryLastCell(int cell);
222 bool ShouldBeVeryLastRow(int cell);
224 int GetCellAbove(int cell);
226 int GetCellNumber(int column, int row);
228 void SetLinebreaks(int cell, bool what);
230 bool Linebreaks(int cell);
232 /// Long Table Options
234 void SetLTHead(int cell, bool first);
236 bool RowOfLTHead(int cell);
238 bool RowOfLTFirstHead(int cell);
240 void SetLTFoot(int cell, bool last);
242 bool RowOfLTFoot(int cell);
244 bool RowOfLTLastFoot(int cell);
246 void SetLTNewPage(int cell, bool what);
248 bool LTNewPage(int cell);
257 char multicolumn; // add approp. signedness
259 char alignment; // add approp. signedness
271 string align_special;
273 string p_width; // this is only set for multicolumn!!!
280 /// This are for longtables only
284 struct columnstruct {
285 char alignment; // add approp. signedness
290 string align_special;
299 void set_row_column_number_info();
304 columnstruct *column_info;
306 cellstruct** cell_info;
312 int endhead; // row of endhead
313 int endfirsthead; // row of endfirsthead
314 int endfoot; // row of endfoot
315 int endlastfoot; // row of endlastfoot
317 /// Returns true if a complete update is necessary, otherwise false
318 bool SetWidthOfMulticolCell(int cell, int new_width);
319 void recalculateMulticolCells(int cell, int new_width);
320 /// Returns true if change
321 bool calculate_width_of_column(int column);
322 bool calculate_width_of_column_NMC(int column); // no multi cells
324 void calculate_width_of_table();
327 int right_column_of_cell(int cell);
330 cellstruct* cellinfo_of_cell(int cell);
333 void delete_column(int column);
336 int cells_in_multicolumn(int cell);