1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-2001 The LyX Team.
9 *======================================================*/
11 * FormTabular Interface Class Implementation
17 #pragma implementation
20 #include "FormTabular.h"
21 #include "form_tabular.h"
24 #include "insets/insettabular.h"
26 #include "xforms_helpers.h"
27 #include "lyxrc.h" // to set the default length values
28 #include "helper_funcs.h"
29 #include "input_validators.h"
30 #include "support/lstrings.h"
34 FormTabular::FormTabular(LyXView * lv, Dialogs * d)
35 : FormInset(lv, d, _("Tabular Layout")),
36 inset_(0), actCell_(-1), closing_(false)
38 // let the dialog be shown
39 // This is a permanent connection so we won't bother
40 // storing a copy because we won't be disconnecting.
41 d->showTabular.connect(slot(this, &FormTabular::showInset));
42 d->updateTabular.connect(slot(this, &FormTabular::updateInset));
46 void FormTabular::redraw()
48 if(form() && form()->visible)
49 fl_redraw_form(form());
53 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabFolder);
54 if (outer_form && outer_form->visible)
55 fl_redraw_form(outer_form);
59 FL_FORM * FormTabular::form() const
67 void FormTabular::disconnect()
70 FormInset::disconnect();
74 void FormTabular::showInset(InsetTabular * inset)
76 if (inset == 0) return;
78 // If connected to another inset, disconnect from it.
79 if (inset_ != inset) {
81 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
89 void FormTabular::updateInset(InsetTabular * inset)
91 if (inset == 0 || inset_ == 0) return;
93 // If connected to another inset, disconnect from it.
94 if (inset_ != inset) {
96 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
104 void FormTabular::build()
106 dialog_.reset(build_tabular());
107 tabular_options_.reset(build_tabular_options());
108 column_options_.reset(build_column_options());
109 cell_options_.reset(build_cell_options());
110 longtable_options_.reset(build_longtable_options());
112 fl_set_input_return(column_options_->input_column_width,
114 fl_set_input_return(column_options_->input_special_alignment,
116 fl_set_input_return(cell_options_->input_mcolumn_width,
118 fl_set_input_return(cell_options_->input_special_multialign,
121 fl_addto_tabfolder(dialog_->tabFolder, _("Tabular"),
122 tabular_options_->form);
123 fl_addto_tabfolder(dialog_->tabFolder, _("Column/Row"),
124 column_options_->form);
125 fl_addto_tabfolder(dialog_->tabFolder, _("Cell"),
126 cell_options_->form);
127 fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"),
128 longtable_options_->form);
130 // We should set these input filters on width fields to make them accept
131 // only unsigned numbers.
132 // But this leeds to trouble with the current apply behaviour (JSpitzm).
133 // fl_set_input_filter(column_options_->input_column_width,
134 // fl_unsigned_float_filter);
135 // fl_set_input_filter(cell_options_->input_mcolumn_width,
136 // fl_unsigned_float_filter);
138 // Create the contents of the unit choices
139 // Don't include the "%" terms...
140 std::vector<string> units_vec = getLatexUnits();
141 for (std::vector<string>::iterator it = units_vec.begin();
142 it != units_vec.end(); ++it) {
143 if (contains(*it, "%"))
144 it = units_vec.erase(it, it + 1) - 1;
146 string units = getStringFromVector(units_vec, "|");
148 fl_addto_choice(column_options_->choice_value_column_width,
150 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
155 void FormTabular::update()
160 if (!inset_ || !inset_->tabular.get())
163 LyXTabular * tabular = inset_->tabular.get();
169 int cell = inset_->getActCell();
171 int column = tabular->column_of_cell(cell) + 1;
172 fl_set_object_label(dialog_->text_warning, "");
173 fl_activate_object(column_options_->input_special_alignment);
174 fl_activate_object(cell_options_->input_special_multialign);
175 fl_activate_object(column_options_->input_column_width);
176 fl_activate_object(column_options_->choice_value_column_width);
177 sprintf(buf, "%d", column);
178 fl_set_input(dialog_->input_tabular_column, buf);
179 fl_deactivate_object(dialog_->input_tabular_column);
180 int row = tabular->row_of_cell(cell);
181 sprintf(buf, "%d", row + 1);
182 fl_set_input(dialog_->input_tabular_row, buf);
183 fl_deactivate_object(dialog_->input_tabular_row);
184 if (tabular->IsMultiColumn(cell)) {
185 fl_set_button(cell_options_->radio_multicolumn, 1);
186 fl_set_button(cell_options_->radio_border_top,
187 tabular->TopLine(cell)?1:0);
188 setEnabled(cell_options_->radio_border_top, true);
189 fl_set_button(cell_options_->radio_border_bottom,
190 tabular->BottomLine(cell)?1:0);
191 setEnabled(cell_options_->radio_border_bottom, true);
192 fl_set_button(cell_options_->radio_border_left,
193 tabular->LeftLine(cell)?1:0);
194 setEnabled(cell_options_->radio_border_left, true);
195 fl_set_button(cell_options_->radio_border_right,
196 tabular->RightLine(cell)?1:0);
197 setEnabled(cell_options_->radio_border_right, true);
198 pwidth = tabular->GetMColumnPWidth(cell);
199 align = tabular->GetAlignment(cell);
200 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
201 fl_set_button(cell_options_->radio_align_left, 1);
202 else if (align == LYX_ALIGN_RIGHT)
203 fl_set_button(cell_options_->radio_align_right, 1);
205 fl_set_button(cell_options_->radio_align_center, 1);
206 setEnabled(cell_options_->radio_align_left, true);
207 setEnabled(cell_options_->radio_align_right, true);
208 setEnabled(cell_options_->radio_align_center, true);
209 align = tabular->GetVAlignment(cell);
210 fl_set_button(cell_options_->radio_valign_top, 0);
211 fl_set_button(cell_options_->radio_valign_bottom, 0);
212 fl_set_button(cell_options_->radio_valign_center, 0);
213 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
214 fl_set_button(cell_options_->radio_valign_center, 1);
215 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
216 fl_set_button(cell_options_->radio_valign_bottom, 1);
218 fl_set_button(cell_options_->radio_valign_top, 1);
219 setEnabled(cell_options_->radio_valign_top, true);
220 setEnabled(cell_options_->radio_valign_bottom, true);
221 setEnabled(cell_options_->radio_valign_center, true);
222 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
223 fl_set_input(cell_options_->input_special_multialign, special.c_str());
224 bool const metric = lyxrc.default_papersize > 3;
225 string const default_unit = metric ? "cm" : "in";
226 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
227 cell_options_->choice_value_mcolumn_width,
228 pwidth, default_unit);
230 if (!lv_->buffer()->isReadonly()) {
231 setEnabled(cell_options_->input_special_multialign, true);
232 setEnabled(cell_options_->input_mcolumn_width, true);
233 setEnabled(cell_options_->choice_value_mcolumn_width, true);
236 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
237 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
238 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
240 setEnabled(cell_options_->radio_align_left, pwidth.zero());
241 setEnabled(cell_options_->radio_align_right, pwidth.zero());
242 setEnabled(cell_options_->radio_align_center, pwidth.zero());
244 fl_set_button(cell_options_->radio_multicolumn, 0);
246 fl_set_button(cell_options_->radio_border_top, 0);
247 setEnabled(cell_options_->radio_border_top, false);
249 fl_set_button(cell_options_->radio_border_bottom, 0);
250 setEnabled(cell_options_->radio_border_bottom, false);
252 fl_set_button(cell_options_->radio_border_left, 0);
253 setEnabled(cell_options_->radio_border_left, false);
255 fl_set_button(cell_options_->radio_border_right, 0);
256 setEnabled(cell_options_->radio_border_right, false);
258 fl_set_button(cell_options_->radio_align_left, 0);
259 setEnabled(cell_options_->radio_align_left, false);
261 fl_set_button(cell_options_->radio_align_right, 0);
262 setEnabled(cell_options_->radio_align_right, false);
264 fl_set_button(cell_options_->radio_align_center, 0);
265 setEnabled(cell_options_->radio_align_center, false);
267 fl_set_button(cell_options_->radio_valign_top, 0);
268 setEnabled(cell_options_->radio_valign_top, false);
270 fl_set_button(cell_options_->radio_valign_bottom, 0);
271 setEnabled(cell_options_->radio_valign_bottom, false);
273 fl_set_button(cell_options_->radio_valign_center, 0);
274 setEnabled(cell_options_->radio_valign_center, false);
276 fl_set_input(cell_options_->input_special_multialign, "");
277 setEnabled(cell_options_->input_special_multialign, false);
279 fl_set_input(cell_options_->input_mcolumn_width, "");
280 setEnabled(cell_options_->input_mcolumn_width, false);
281 setEnabled(cell_options_->choice_value_mcolumn_width, false);
283 if (tabular->GetRotateCell(cell))
284 fl_set_button(cell_options_->radio_rotate_cell, 1);
286 fl_set_button(cell_options_->radio_rotate_cell, 0);
287 if (tabular->TopLine(cell, true))
288 fl_set_button(column_options_->radio_border_top, 1);
290 fl_set_button(column_options_->radio_border_top, 0);
291 if (tabular->BottomLine(cell, true))
292 fl_set_button(column_options_->radio_border_bottom, 1);
294 fl_set_button(column_options_->radio_border_bottom, 0);
295 if (tabular->LeftLine(cell, true))
296 fl_set_button(column_options_->radio_border_left, 1);
298 fl_set_button(column_options_->radio_border_left, 0);
299 if (tabular->RightLine(cell, true))
300 fl_set_button(column_options_->radio_border_right, 1);
302 fl_set_button(column_options_->radio_border_right, 0);
303 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
304 fl_set_input(column_options_->input_special_alignment, special.c_str());
306 bool const isReadonly = lv_->buffer()->isReadonly();
307 setEnabled(column_options_->input_special_alignment, !isReadonly);
309 pwidth = tabular->GetColumnPWidth(cell);
310 bool const metric = lyxrc.default_papersize > 3;
311 string const default_unit = metric ? "cm" : "in";
312 updateWidgetsFromLength(column_options_->input_column_width,
313 column_options_->choice_value_column_width,
314 pwidth, default_unit);
315 setEnabled(column_options_->input_column_width, !isReadonly);
316 setEnabled(column_options_->choice_value_column_width, !isReadonly);
318 setEnabled(cell_options_->radio_useminipage, !pwidth.zero());
319 if (!pwidth.zero()) {
320 if (tabular->GetUsebox(cell) == 2)
321 fl_set_button(cell_options_->radio_useminipage, 1);
323 fl_set_button(cell_options_->radio_useminipage, 0);
325 fl_set_button(cell_options_->radio_useminipage, 0);
327 align = tabular->GetAlignment(cell, true);
328 fl_set_button(column_options_->radio_align_left, 0);
329 fl_set_button(column_options_->radio_align_right, 0);
330 fl_set_button(column_options_->radio_align_center, 0);
331 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
332 fl_set_button(column_options_->radio_align_left, 1);
333 else if (align == LYX_ALIGN_RIGHT)
334 fl_set_button(column_options_->radio_align_right, 1);
336 fl_set_button(column_options_->radio_align_center, 1);
337 align = tabular->GetVAlignment(cell, true);
338 fl_set_button(column_options_->radio_valign_top, 0);
339 fl_set_button(column_options_->radio_valign_bottom, 0);
340 fl_set_button(column_options_->radio_valign_center, 0);
341 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
342 fl_set_button(column_options_->radio_valign_center, 1);
343 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
344 fl_set_button(column_options_->radio_valign_bottom, 1);
346 fl_set_button(column_options_->radio_valign_top, 1);
348 setEnabled(column_options_->radio_align_left, pwidth.zero());
349 setEnabled(column_options_->radio_align_right, pwidth.zero());
350 setEnabled(column_options_->radio_align_center, pwidth.zero());
352 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
353 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
354 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
356 fl_set_button(tabular_options_->radio_longtable,
357 tabular->IsLongTabular());
359 bool const enable = tabular->IsLongTabular();
361 setEnabled(longtable_options_->radio_lt_firsthead, enable);
362 setEnabled(longtable_options_->check_1head_2border_above, enable);
363 setEnabled(longtable_options_->check_1head_2border_below, enable);
364 setEnabled(longtable_options_->check_1head_empty, enable);
365 setEnabled(longtable_options_->radio_lt_head, enable);
366 setEnabled(longtable_options_->check_head_2border_above, enable);
367 setEnabled(longtable_options_->check_head_2border_below, enable);
368 setEnabled(longtable_options_->radio_lt_foot, enable);
369 setEnabled(longtable_options_->check_foot_2border_above, enable);
370 setEnabled(longtable_options_->check_foot_2border_below, enable);
371 setEnabled(longtable_options_->radio_lt_lastfoot, enable);
372 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
373 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
374 setEnabled(longtable_options_->check_lastfoot_empty, enable);
375 setEnabled(longtable_options_->radio_lt_newpage, enable);
378 LyXTabular::ltType ltt;
380 bool row_set = tabular->GetRowOfLTHead(row, ltt);
381 fl_set_button(longtable_options_->radio_lt_head, row_set);
383 fl_set_button(longtable_options_->check_head_2border_above,
385 fl_set_button(longtable_options_->check_head_2border_above,
389 setEnabled(longtable_options_->check_head_2border_above, 0);
390 setEnabled(longtable_options_->check_head_2border_below, 0);
391 fl_set_button(longtable_options_->check_head_2border_above,0);
392 fl_set_button(longtable_options_->check_head_2border_above,0);
393 fl_set_button(longtable_options_->check_1head_empty,0);
394 setEnabled(longtable_options_->check_1head_empty, 0);
398 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
399 fl_set_button(longtable_options_->radio_lt_firsthead, row_set);
400 if (ltt.set && (!ltt.empty || !use_empty)) {
401 fl_set_button(longtable_options_->check_1head_2border_above,
403 fl_set_button(longtable_options_->check_1head_2border_above,
406 setEnabled(longtable_options_->check_1head_2border_above, 0);
407 setEnabled(longtable_options_->check_1head_2border_below, 0);
408 fl_set_button(longtable_options_->check_1head_2border_above,0);
409 fl_set_button(longtable_options_->check_1head_2border_above,0);
411 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
413 setEnabled(longtable_options_->radio_lt_firsthead, 0);
417 row_set = tabular->GetRowOfLTFoot(row, ltt);
418 fl_set_button(longtable_options_->radio_lt_foot, row_set);
420 fl_set_button(longtable_options_->check_foot_2border_above,
422 fl_set_button(longtable_options_->check_foot_2border_above,
426 setEnabled(longtable_options_->check_foot_2border_above, 0);
427 setEnabled(longtable_options_->check_foot_2border_below, 0);
428 fl_set_button(longtable_options_->check_foot_2border_above,0);
429 fl_set_button(longtable_options_->check_foot_2border_above,0);
430 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
431 setEnabled(longtable_options_->check_lastfoot_empty, 0);
435 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
436 fl_set_button(longtable_options_->radio_lt_lastfoot, row_set);
437 if (ltt.set && (!ltt.empty || !use_empty)) {
438 fl_set_button(longtable_options_->check_lastfoot_2border_above,
440 fl_set_button(longtable_options_->check_lastfoot_2border_above,
443 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
444 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
445 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
446 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
448 fl_set_button(longtable_options_->check_lastfoot_empty,
451 setEnabled(longtable_options_->radio_lt_lastfoot, 0);
454 fl_set_button(longtable_options_->radio_lt_newpage,
455 tabular->GetLTNewPage(row));
457 fl_set_button(longtable_options_->radio_lt_firsthead, 0);
458 fl_set_button(longtable_options_->check_1head_2border_above, 0);
459 fl_set_button(longtable_options_->check_1head_2border_above, 0);
460 fl_set_button(longtable_options_->check_1head_empty, 0);
461 fl_set_button(longtable_options_->radio_lt_head, 0);
462 fl_set_button(longtable_options_->check_head_2border_above, 0);
463 fl_set_button(longtable_options_->check_head_2border_above, 0);
464 fl_set_button(longtable_options_->radio_lt_foot, 0);
465 fl_set_button(longtable_options_->check_foot_2border_above, 0);
466 fl_set_button(longtable_options_->check_foot_2border_above, 0);
467 fl_set_button(longtable_options_->radio_lt_lastfoot, 0);
468 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
469 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
470 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
471 fl_set_button(longtable_options_->radio_lt_newpage, 0);
473 fl_set_button(tabular_options_->radio_rotate_tabular,
474 tabular->GetRotateTabular());
478 bool FormTabular::input(FL_OBJECT * ob, long)
484 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
487 int cell = inset_->getActCell();
489 // ugly hack to auto-apply the stuff that hasn't been
490 // yet. don't let this continue to exist ...
491 if (ob == dialog_->button_close) {
493 input(column_options_->input_column_width, 0);
494 input(cell_options_->input_mcolumn_width, 0);
495 input(column_options_->input_special_alignment, 0);
496 input(cell_options_->input_special_multialign, 0);
502 if (actCell_ != cell) {
504 fl_set_object_label(dialog_->text_warning,
505 _("Warning: Wrong Cursor position, updated window"));
506 fl_show_object(dialog_->text_warning);
509 // No point in processing directives that you can't do anything with
510 // anyhow, so exit now if the buffer is read-only.
511 if (lv_->buffer()->isReadonly()) {
515 if ((ob == column_options_->input_column_width) ||
516 (ob == column_options_->choice_value_column_width))
519 getLengthFromWidgets(column_options_->input_column_width,
520 column_options_->choice_value_column_width);
521 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
523 //check if the input is valid
525 fl_get_input(column_options_->input_column_width);
526 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
527 fl_set_object_label(dialog_->text_warning,
528 _("Warning: Invalid Length (valid example: 10mm)"));
529 fl_show_object(dialog_->text_warning);
532 update(); // update for alignment
535 if ((ob == cell_options_->input_mcolumn_width) ||
536 (ob == cell_options_->choice_value_mcolumn_width))
539 getLengthFromWidgets(cell_options_->input_mcolumn_width,
540 cell_options_->choice_value_mcolumn_width);
541 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
543 //check if the input is valid
545 fl_get_input(cell_options_->input_mcolumn_width);
546 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
547 fl_set_object_label(dialog_->text_warning,
548 _("Warning: Invalid Length (valid example: 10mm)"));
549 fl_show_object(dialog_->text_warning);
552 update(); // update for alignment
556 if (ob == tabular_options_->button_append_row)
557 num = LyXTabular::APPEND_ROW;
558 else if (ob == tabular_options_->button_append_column)
559 num = LyXTabular::APPEND_COLUMN;
560 else if (ob == tabular_options_->button_delete_row)
561 num = LyXTabular::DELETE_ROW;
562 else if (ob == tabular_options_->button_delete_column)
563 num = LyXTabular::DELETE_COLUMN;
564 else if (ob == tabular_options_->button_set_borders)
565 num = LyXTabular::SET_ALL_LINES;
566 else if (ob == tabular_options_->button_unset_borders)
567 num = LyXTabular::UNSET_ALL_LINES;
568 else if (ob == column_options_->radio_border_top)
569 num = LyXTabular::TOGGLE_LINE_TOP;
570 else if (ob == column_options_->radio_border_bottom)
571 num = LyXTabular::TOGGLE_LINE_BOTTOM;
572 else if (ob == column_options_->radio_border_left)
573 num = LyXTabular::TOGGLE_LINE_LEFT;
574 else if (ob == column_options_->radio_border_right)
575 num = LyXTabular::TOGGLE_LINE_RIGHT;
576 else if (ob == column_options_->radio_align_left)
577 num = LyXTabular::ALIGN_LEFT;
578 else if (ob == column_options_->radio_align_right)
579 num = LyXTabular::ALIGN_RIGHT;
580 else if (ob == column_options_->radio_align_center)
581 num = LyXTabular::ALIGN_CENTER;
582 else if (ob == column_options_->radio_valign_top)
583 num = LyXTabular::VALIGN_TOP;
584 else if (ob == column_options_->radio_valign_bottom)
585 num = LyXTabular::VALIGN_BOTTOM;
586 else if (ob == column_options_->radio_valign_center)
587 num = LyXTabular::VALIGN_CENTER;
588 else if (ob == cell_options_->radio_multicolumn)
589 num = LyXTabular::MULTICOLUMN;
590 else if (ob == tabular_options_->radio_longtable) {
591 if (fl_get_button(tabular_options_->radio_longtable))
592 num = LyXTabular::SET_LONGTABULAR;
594 num = LyXTabular::UNSET_LONGTABULAR;
595 } else if (ob == tabular_options_->radio_rotate_tabular) {
596 s = fl_get_button(tabular_options_->radio_rotate_tabular);
598 num = LyXTabular::SET_ROTATE_TABULAR;
600 num = LyXTabular::UNSET_ROTATE_TABULAR;
601 } else if (ob == cell_options_->radio_rotate_cell) {
602 s = fl_get_button(cell_options_->radio_rotate_cell);
604 num = LyXTabular::SET_ROTATE_CELL;
606 num = LyXTabular::UNSET_ROTATE_CELL;
607 } else if (ob == cell_options_->radio_useminipage) {
608 num = LyXTabular::SET_USEBOX;
610 } else if ((ob == longtable_options_->radio_lt_firsthead) ||
611 (ob == longtable_options_->check_1head_2border_above) ||
612 (ob == longtable_options_->check_1head_2border_below) ||
613 (ob == longtable_options_->check_1head_empty) ||
614 (ob == longtable_options_->radio_lt_head) ||
615 (ob == longtable_options_->check_head_2border_above) ||
616 (ob == longtable_options_->check_head_2border_below) ||
617 (ob == longtable_options_->radio_lt_foot) ||
618 (ob == longtable_options_->check_foot_2border_above) ||
619 (ob == longtable_options_->check_foot_2border_below) ||
620 (ob == longtable_options_->radio_lt_lastfoot) ||
621 (ob == longtable_options_->check_lastfoot_2border_above) ||
622 (ob == longtable_options_->check_lastfoot_2border_below) ||
623 (ob == longtable_options_->check_lastfoot_empty))
625 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
626 } else if (ob == longtable_options_->radio_lt_newpage) {
627 num = LyXTabular::SET_LTNEWPAGE;
628 } else if (ob == column_options_->input_special_alignment) {
629 special = fl_get_input(column_options_->input_special_alignment);
630 num = LyXTabular::SET_SPECIAL_COLUMN;
631 } else if (ob == cell_options_->input_special_multialign) {
632 special = fl_get_input(cell_options_->input_special_multialign);
633 num = LyXTabular::SET_SPECIAL_MULTI;
634 } else if (ob == cell_options_->radio_border_top)
635 num = LyXTabular::M_TOGGLE_LINE_TOP;
636 else if (ob == cell_options_->radio_border_bottom)
637 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
638 else if (ob == cell_options_->radio_border_left)
639 num = LyXTabular::M_TOGGLE_LINE_LEFT;
640 else if (ob == cell_options_->radio_border_right)
641 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
642 else if (ob == cell_options_->radio_align_left)
643 num = LyXTabular::M_ALIGN_LEFT;
644 else if (ob == cell_options_->radio_align_right)
645 num = LyXTabular::M_ALIGN_RIGHT;
646 else if (ob == cell_options_->radio_align_center)
647 num = LyXTabular::M_ALIGN_CENTER;
648 else if (ob == cell_options_->radio_valign_top)
649 num = LyXTabular::M_VALIGN_TOP;
650 else if (ob == cell_options_->radio_valign_bottom)
651 num = LyXTabular::M_VALIGN_BOTTOM;
652 else if (ob == cell_options_->radio_valign_center)
653 num = LyXTabular::M_VALIGN_CENTER;
657 inset_->tabularFeatures(lv_->view(), num, special);
663 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
665 bool flag = fl_get_button(ob);
666 if ((ob == longtable_options_->check_1head_2border_above) ||
667 (ob == longtable_options_->check_head_2border_above) ||
668 (ob == longtable_options_->check_foot_2border_above) ||
669 (ob == longtable_options_->check_lastfoot_2border_above))
671 special = "dl_above";
672 } else if ((ob == longtable_options_->check_1head_2border_below) ||
673 (ob == longtable_options_->check_head_2border_below) ||
674 (ob == longtable_options_->check_foot_2border_below) ||
675 (ob == longtable_options_->check_lastfoot_2border_below))
677 special = "dl_below";
678 } else if ((ob == longtable_options_->check_1head_empty) ||
679 (ob == longtable_options_->check_lastfoot_empty))
685 if ((ob == longtable_options_->radio_lt_firsthead) ||
686 (ob == longtable_options_->check_1head_2border_above) ||
687 (ob == longtable_options_->check_1head_2border_below) ||
688 (ob == longtable_options_->check_1head_empty))
690 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
691 LyXTabular::UNSET_LTFIRSTHEAD);
692 } else if ((ob == longtable_options_->radio_lt_head) ||
693 (ob == longtable_options_->check_head_2border_above) ||
694 (ob == longtable_options_->check_head_2border_below))
696 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
697 } else if ((ob == longtable_options_->radio_lt_foot) ||
698 (ob == longtable_options_->check_foot_2border_above) ||
699 (ob == longtable_options_->check_foot_2border_below))
701 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
702 } else if ((ob == longtable_options_->radio_lt_lastfoot) ||
703 (ob == longtable_options_->check_lastfoot_2border_above) ||
704 (ob == longtable_options_->check_lastfoot_2border_below) ||
705 (ob == longtable_options_->check_lastfoot_empty))
707 return (flag ? LyXTabular::SET_LTLASTFOOT :
708 LyXTabular::UNSET_LTLASTFOOT);
710 return LyXTabular::LAST_ACTION;