3 * Copyright 2000-2001 The LyX Team.
4 * See the file COPYING.
6 * \author Jürgen Vigna, jug@sad.it
12 #pragma implementation
17 #include "FormTabular.h"
18 #include "form_tabular.h"
22 #include "xforms_helpers.h"
23 #include "lyxrc.h" // to set the default length values
24 #include "helper_funcs.h"
25 #include "input_validators.h"
27 #include "insets/insettabular.h"
29 #include "support/lstrings.h"
40 FormTabular::FormTabular(LyXView * lv, Dialogs * d)
41 : FormInset(lv, d, _("Tabular Layout")),
42 inset_(0), actCell_(-1), closing_(false)
44 // let the dialog be shown
45 // This is a permanent connection so we won't bother
46 // storing a copy because we won't be disconnecting.
47 d->showTabular.connect(slot(this, &FormTabular::showInset));
48 d->updateTabular.connect(slot(this, &FormTabular::updateInset));
52 void FormTabular::redraw()
54 if (form() && form()->visible)
55 fl_redraw_form(form());
59 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabFolder);
60 if (outer_form && outer_form->visible)
61 fl_redraw_form(outer_form);
65 FL_FORM * FormTabular::form() const
73 void FormTabular::disconnect()
76 FormInset::disconnect();
80 void FormTabular::showInset(InsetTabular * inset)
82 if (inset == 0) return;
84 // If connected to another inset, disconnect from it.
85 if (inset_ != inset) {
87 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
95 void FormTabular::updateInset(InsetTabular * inset)
97 if (inset == 0 || inset_ == 0) return;
99 // If connected to another inset, disconnect from it.
100 if (inset_ != inset) {
102 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
110 void FormTabular::build()
112 dialog_.reset(build_tabular());
113 tabular_options_.reset(build_tabular_options());
114 column_options_.reset(build_column_options());
115 cell_options_.reset(build_cell_options());
116 longtable_options_.reset(build_longtable_options());
118 fl_set_input_return(column_options_->input_column_width,
120 fl_set_input_return(column_options_->input_special_alignment,
122 fl_set_input_return(cell_options_->input_mcolumn_width,
124 fl_set_input_return(cell_options_->input_special_multialign,
127 fl_addto_tabfolder(dialog_->tabFolder, _("Tabular"),
128 tabular_options_->form);
129 fl_addto_tabfolder(dialog_->tabFolder, _("Column/Row"),
130 column_options_->form);
131 fl_addto_tabfolder(dialog_->tabFolder, _("Cell"),
132 cell_options_->form);
133 fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"),
134 longtable_options_->form);
136 // Create the contents of the unit choices
137 // Don't include the "%" terms...
138 vector<string> units_vec = getLatexUnits();
140 for (vector<string>::iterator it = units_vec.begin();
141 it != units_vec.end(); ++it)
143 if (contains(*it, "%"))
144 it = units_vec.erase(it, it + 1) - 1;
147 vector<string>::iterator ret =
148 remove_if(units_vec.begin(), units_vec.end(),
149 bind2nd(contains_functor(), "%"));
150 units_vec.erase(ret, units_vec.end());
153 string units = getStringFromVector(units_vec, "|");
155 fl_addto_choice(column_options_->choice_value_column_width,
157 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
162 void FormTabular::update()
167 if (!inset_ || !inset_->tabular.get())
170 LyXTabular * tabular = inset_->tabular.get();
176 int cell = inset_->getActCell();
178 int column = tabular->column_of_cell(cell) + 1;
179 fl_set_object_label(dialog_->text_warning, "");
180 fl_activate_object(column_options_->input_special_alignment);
181 fl_activate_object(cell_options_->input_special_multialign);
182 fl_activate_object(column_options_->input_column_width);
183 fl_activate_object(column_options_->choice_value_column_width);
184 sprintf(buf, "%d", column);
185 fl_set_input(dialog_->input_tabular_column, buf);
186 fl_deactivate_object(dialog_->input_tabular_column);
187 int row = tabular->row_of_cell(cell);
188 sprintf(buf, "%d", row + 1);
189 fl_set_input(dialog_->input_tabular_row, buf);
190 fl_deactivate_object(dialog_->input_tabular_row);
191 if (tabular->IsMultiColumn(cell)) {
192 fl_set_button(cell_options_->radio_multicolumn, 1);
193 fl_set_button(cell_options_->radio_border_top,
194 tabular->TopLine(cell)?1:0);
195 setEnabled(cell_options_->radio_border_top, true);
196 fl_set_button(cell_options_->radio_border_bottom,
197 tabular->BottomLine(cell)?1:0);
198 setEnabled(cell_options_->radio_border_bottom, true);
199 fl_set_button(cell_options_->radio_border_left,
200 tabular->LeftLine(cell)?1:0);
201 setEnabled(cell_options_->radio_border_left, true);
202 fl_set_button(cell_options_->radio_border_right,
203 tabular->RightLine(cell)?1:0);
204 setEnabled(cell_options_->radio_border_right, true);
205 pwidth = tabular->GetMColumnPWidth(cell);
206 align = tabular->GetAlignment(cell);
207 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
208 fl_set_button(cell_options_->radio_align_left, 1);
209 else if (align == LYX_ALIGN_RIGHT)
210 fl_set_button(cell_options_->radio_align_right, 1);
212 fl_set_button(cell_options_->radio_align_center, 1);
214 align = tabular->GetVAlignment(cell);
215 fl_set_button(cell_options_->radio_valign_top, 0);
216 fl_set_button(cell_options_->radio_valign_bottom, 0);
217 fl_set_button(cell_options_->radio_valign_center, 0);
218 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
219 fl_set_button(cell_options_->radio_valign_center, 1);
220 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
221 fl_set_button(cell_options_->radio_valign_bottom, 1);
223 fl_set_button(cell_options_->radio_valign_top, 1);
225 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
226 fl_set_input(cell_options_->input_special_multialign, special.c_str());
227 bool const metric = lyxrc.default_papersize > 3;
228 string const default_unit = metric ? "cm" : "in";
229 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
230 cell_options_->choice_value_mcolumn_width,
231 pwidth, default_unit);
233 if (!lv_->buffer()->isReadonly()) {
234 setEnabled(cell_options_->input_special_multialign, true);
235 setEnabled(cell_options_->input_mcolumn_width, true);
236 setEnabled(cell_options_->choice_value_mcolumn_width, true);
239 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
240 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
241 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
243 setEnabled(cell_options_->radio_align_left, pwidth.zero());
244 setEnabled(cell_options_->radio_align_right, pwidth.zero());
245 setEnabled(cell_options_->radio_align_center, pwidth.zero());
247 fl_set_button(cell_options_->radio_multicolumn, 0);
249 fl_set_button(cell_options_->radio_border_top, 0);
250 setEnabled(cell_options_->radio_border_top, false);
252 fl_set_button(cell_options_->radio_border_bottom, 0);
253 setEnabled(cell_options_->radio_border_bottom, false);
255 fl_set_button(cell_options_->radio_border_left, 0);
256 setEnabled(cell_options_->radio_border_left, false);
258 fl_set_button(cell_options_->radio_border_right, 0);
259 setEnabled(cell_options_->radio_border_right, false);
261 fl_set_button(cell_options_->radio_align_left, 0);
262 setEnabled(cell_options_->radio_align_left, false);
264 fl_set_button(cell_options_->radio_align_right, 0);
265 setEnabled(cell_options_->radio_align_right, false);
267 fl_set_button(cell_options_->radio_align_center, 0);
268 setEnabled(cell_options_->radio_align_center, false);
270 fl_set_button(cell_options_->radio_valign_top, 0);
271 setEnabled(cell_options_->radio_valign_top, false);
273 fl_set_button(cell_options_->radio_valign_bottom, 0);
274 setEnabled(cell_options_->radio_valign_bottom, false);
276 fl_set_button(cell_options_->radio_valign_center, 0);
277 setEnabled(cell_options_->radio_valign_center, false);
279 fl_set_input(cell_options_->input_special_multialign, "");
280 setEnabled(cell_options_->input_special_multialign, false);
282 fl_set_input(cell_options_->input_mcolumn_width, "");
283 setEnabled(cell_options_->input_mcolumn_width, false);
284 setEnabled(cell_options_->choice_value_mcolumn_width, false);
286 if (tabular->GetRotateCell(cell))
287 fl_set_button(cell_options_->radio_rotate_cell, 1);
289 fl_set_button(cell_options_->radio_rotate_cell, 0);
290 if (tabular->TopLine(cell, true))
291 fl_set_button(column_options_->radio_border_top, 1);
293 fl_set_button(column_options_->radio_border_top, 0);
294 if (tabular->BottomLine(cell, true))
295 fl_set_button(column_options_->radio_border_bottom, 1);
297 fl_set_button(column_options_->radio_border_bottom, 0);
298 if (tabular->LeftLine(cell, true))
299 fl_set_button(column_options_->radio_border_left, 1);
301 fl_set_button(column_options_->radio_border_left, 0);
302 if (tabular->RightLine(cell, true))
303 fl_set_button(column_options_->radio_border_right, 1);
305 fl_set_button(column_options_->radio_border_right, 0);
306 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
307 fl_set_input(column_options_->input_special_alignment, special.c_str());
309 bool const isReadonly = lv_->buffer()->isReadonly();
310 setEnabled(column_options_->input_special_alignment, !isReadonly);
312 pwidth = tabular->GetColumnPWidth(cell);
313 bool const metric = lyxrc.default_papersize > 3;
314 string const default_unit = metric ? "cm" : "in";
315 updateWidgetsFromLength(column_options_->input_column_width,
316 column_options_->choice_value_column_width,
317 pwidth, default_unit);
318 setEnabled(column_options_->input_column_width, !isReadonly);
319 setEnabled(column_options_->choice_value_column_width, !isReadonly);
321 setEnabled(cell_options_->radio_useminipage, !pwidth.zero());
322 if (!pwidth.zero()) {
323 if (tabular->GetUsebox(cell) == 2)
324 fl_set_button(cell_options_->radio_useminipage, 1);
326 fl_set_button(cell_options_->radio_useminipage, 0);
328 fl_set_button(cell_options_->radio_useminipage, 0);
330 align = tabular->GetAlignment(cell, true);
331 fl_set_button(column_options_->radio_align_left, 0);
332 fl_set_button(column_options_->radio_align_right, 0);
333 fl_set_button(column_options_->radio_align_center, 0);
334 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
335 fl_set_button(column_options_->radio_align_left, 1);
336 else if (align == LYX_ALIGN_RIGHT)
337 fl_set_button(column_options_->radio_align_right, 1);
339 fl_set_button(column_options_->radio_align_center, 1);
340 align = tabular->GetVAlignment(cell, true);
341 fl_set_button(column_options_->radio_valign_top, 0);
342 fl_set_button(column_options_->radio_valign_bottom, 0);
343 fl_set_button(column_options_->radio_valign_center, 0);
344 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
345 fl_set_button(column_options_->radio_valign_center, 1);
346 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
347 fl_set_button(column_options_->radio_valign_bottom, 1);
349 fl_set_button(column_options_->radio_valign_top, 1);
351 setEnabled(column_options_->radio_align_left, pwidth.zero());
352 setEnabled(column_options_->radio_align_right, pwidth.zero());
353 setEnabled(column_options_->radio_align_center, pwidth.zero());
355 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
356 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
357 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
359 fl_set_button(tabular_options_->radio_longtable,
360 tabular->IsLongTabular());
362 bool const enable = tabular->IsLongTabular();
364 setEnabled(longtable_options_->radio_lt_firsthead, enable);
365 setEnabled(longtable_options_->check_1head_2border_above, enable);
366 setEnabled(longtable_options_->check_1head_2border_below, enable);
367 setEnabled(longtable_options_->check_1head_empty, enable);
368 setEnabled(longtable_options_->radio_lt_head, enable);
369 setEnabled(longtable_options_->check_head_2border_above, enable);
370 setEnabled(longtable_options_->check_head_2border_below, enable);
371 setEnabled(longtable_options_->radio_lt_foot, enable);
372 setEnabled(longtable_options_->check_foot_2border_above, enable);
373 setEnabled(longtable_options_->check_foot_2border_below, enable);
374 setEnabled(longtable_options_->radio_lt_lastfoot, enable);
375 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
376 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
377 setEnabled(longtable_options_->check_lastfoot_empty, enable);
378 setEnabled(longtable_options_->radio_lt_newpage, enable);
381 LyXTabular::ltType ltt;
383 bool row_set = tabular->GetRowOfLTHead(row, ltt);
384 fl_set_button(longtable_options_->radio_lt_head, row_set);
386 fl_set_button(longtable_options_->check_head_2border_above,
388 fl_set_button(longtable_options_->check_head_2border_above,
392 setEnabled(longtable_options_->check_head_2border_above, 0);
393 setEnabled(longtable_options_->check_head_2border_below, 0);
394 fl_set_button(longtable_options_->check_head_2border_above,0);
395 fl_set_button(longtable_options_->check_head_2border_above,0);
396 fl_set_button(longtable_options_->check_1head_empty,0);
397 setEnabled(longtable_options_->check_1head_empty, 0);
401 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
402 fl_set_button(longtable_options_->radio_lt_firsthead, row_set);
403 if (ltt.set && (!ltt.empty || !use_empty)) {
404 fl_set_button(longtable_options_->check_1head_2border_above,
406 fl_set_button(longtable_options_->check_1head_2border_above,
409 setEnabled(longtable_options_->check_1head_2border_above, 0);
410 setEnabled(longtable_options_->check_1head_2border_below, 0);
411 fl_set_button(longtable_options_->check_1head_2border_above,0);
412 fl_set_button(longtable_options_->check_1head_2border_above,0);
414 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
416 setEnabled(longtable_options_->radio_lt_firsthead, 0);
420 row_set = tabular->GetRowOfLTFoot(row, ltt);
421 fl_set_button(longtable_options_->radio_lt_foot, row_set);
423 fl_set_button(longtable_options_->check_foot_2border_above,
425 fl_set_button(longtable_options_->check_foot_2border_above,
429 setEnabled(longtable_options_->check_foot_2border_above, 0);
430 setEnabled(longtable_options_->check_foot_2border_below, 0);
431 fl_set_button(longtable_options_->check_foot_2border_above,0);
432 fl_set_button(longtable_options_->check_foot_2border_above,0);
433 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
434 setEnabled(longtable_options_->check_lastfoot_empty, 0);
438 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
439 fl_set_button(longtable_options_->radio_lt_lastfoot, row_set);
440 if (ltt.set && (!ltt.empty || !use_empty)) {
441 fl_set_button(longtable_options_->check_lastfoot_2border_above,
443 fl_set_button(longtable_options_->check_lastfoot_2border_above,
446 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
447 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
448 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
449 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
451 fl_set_button(longtable_options_->check_lastfoot_empty,
454 setEnabled(longtable_options_->radio_lt_lastfoot, 0);
457 fl_set_button(longtable_options_->radio_lt_newpage,
458 tabular->GetLTNewPage(row));
460 fl_set_button(longtable_options_->radio_lt_firsthead, 0);
461 fl_set_button(longtable_options_->check_1head_2border_above, 0);
462 fl_set_button(longtable_options_->check_1head_2border_above, 0);
463 fl_set_button(longtable_options_->check_1head_empty, 0);
464 fl_set_button(longtable_options_->radio_lt_head, 0);
465 fl_set_button(longtable_options_->check_head_2border_above, 0);
466 fl_set_button(longtable_options_->check_head_2border_above, 0);
467 fl_set_button(longtable_options_->radio_lt_foot, 0);
468 fl_set_button(longtable_options_->check_foot_2border_above, 0);
469 fl_set_button(longtable_options_->check_foot_2border_above, 0);
470 fl_set_button(longtable_options_->radio_lt_lastfoot, 0);
471 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
472 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
473 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
474 fl_set_button(longtable_options_->radio_lt_newpage, 0);
476 fl_set_button(tabular_options_->radio_rotate_tabular,
477 tabular->GetRotateTabular());
481 bool FormTabular::input(FL_OBJECT * ob, long)
487 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
490 int cell = inset_->getActCell();
492 // ugly hack to auto-apply the stuff that hasn't been
493 // yet. don't let this continue to exist ...
494 if (ob == dialog_->button_close) {
496 LyXTabular * tabular = inset_->tabular.get();
498 getLengthFromWidgets(column_options_->input_column_width,
499 column_options_->choice_value_column_width);
501 LyXLength llen = tabular->GetColumnPWidth(cell);
503 str2 = llen.asString();
505 input(column_options_->input_column_width, 0);
506 str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
507 cell_options_->choice_value_mcolumn_width);
508 llen = tabular->GetMColumnPWidth(cell);
512 str2 = llen.asString();
514 input(cell_options_->input_mcolumn_width, 0);
515 str1 = fl_get_input(column_options_->input_special_alignment);
516 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
518 input(column_options_->input_special_alignment, 0);
519 str1 = fl_get_input(cell_options_->input_special_multialign);
520 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
522 input(cell_options_->input_special_multialign, 0);
528 if (actCell_ != cell) {
530 fl_set_object_label(dialog_->text_warning,
531 _("Warning: Wrong Cursor position, updated window"));
532 fl_show_object(dialog_->text_warning);
535 // No point in processing directives that you can't do anything with
536 // anyhow, so exit now if the buffer is read-only.
537 if (lv_->buffer()->isReadonly()) {
541 if ((ob == column_options_->input_column_width) ||
542 (ob == column_options_->choice_value_column_width))
545 getLengthFromWidgets(column_options_->input_column_width,
546 column_options_->choice_value_column_width);
547 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
549 //check if the input is valid
551 fl_get_input(column_options_->input_column_width);
552 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
553 fl_set_object_label(dialog_->text_warning,
554 _("Warning: Invalid Length (valid example: 10mm)"));
555 fl_show_object(dialog_->text_warning);
558 update(); // update for alignment
561 if ((ob == cell_options_->input_mcolumn_width) ||
562 (ob == cell_options_->choice_value_mcolumn_width))
565 getLengthFromWidgets(cell_options_->input_mcolumn_width,
566 cell_options_->choice_value_mcolumn_width);
567 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
569 //check if the input is valid
571 fl_get_input(cell_options_->input_mcolumn_width);
572 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
573 fl_set_object_label(dialog_->text_warning,
574 _("Warning: Invalid Length (valid example: 10mm)"));
575 fl_show_object(dialog_->text_warning);
578 update(); // update for alignment
582 if (ob == tabular_options_->button_append_row)
583 num = LyXTabular::APPEND_ROW;
584 else if (ob == tabular_options_->button_append_column)
585 num = LyXTabular::APPEND_COLUMN;
586 else if (ob == tabular_options_->button_delete_row)
587 num = LyXTabular::DELETE_ROW;
588 else if (ob == tabular_options_->button_delete_column)
589 num = LyXTabular::DELETE_COLUMN;
590 else if (ob == tabular_options_->button_set_borders)
591 num = LyXTabular::SET_ALL_LINES;
592 else if (ob == tabular_options_->button_unset_borders)
593 num = LyXTabular::UNSET_ALL_LINES;
594 else if (ob == column_options_->radio_border_top)
595 num = LyXTabular::TOGGLE_LINE_TOP;
596 else if (ob == column_options_->radio_border_bottom)
597 num = LyXTabular::TOGGLE_LINE_BOTTOM;
598 else if (ob == column_options_->radio_border_left)
599 num = LyXTabular::TOGGLE_LINE_LEFT;
600 else if (ob == column_options_->radio_border_right)
601 num = LyXTabular::TOGGLE_LINE_RIGHT;
602 else if (ob == column_options_->radio_align_left)
603 num = LyXTabular::ALIGN_LEFT;
604 else if (ob == column_options_->radio_align_right)
605 num = LyXTabular::ALIGN_RIGHT;
606 else if (ob == column_options_->radio_align_center)
607 num = LyXTabular::ALIGN_CENTER;
608 else if (ob == column_options_->radio_valign_top)
609 num = LyXTabular::VALIGN_TOP;
610 else if (ob == column_options_->radio_valign_bottom)
611 num = LyXTabular::VALIGN_BOTTOM;
612 else if (ob == column_options_->radio_valign_center)
613 num = LyXTabular::VALIGN_CENTER;
614 else if (ob == cell_options_->radio_multicolumn)
615 num = LyXTabular::MULTICOLUMN;
616 else if (ob == tabular_options_->radio_longtable) {
617 if (fl_get_button(tabular_options_->radio_longtable))
618 num = LyXTabular::SET_LONGTABULAR;
620 num = LyXTabular::UNSET_LONGTABULAR;
621 } else if (ob == tabular_options_->radio_rotate_tabular) {
622 s = fl_get_button(tabular_options_->radio_rotate_tabular);
624 num = LyXTabular::SET_ROTATE_TABULAR;
626 num = LyXTabular::UNSET_ROTATE_TABULAR;
627 } else if (ob == cell_options_->radio_rotate_cell) {
628 s = fl_get_button(cell_options_->radio_rotate_cell);
630 num = LyXTabular::SET_ROTATE_CELL;
632 num = LyXTabular::UNSET_ROTATE_CELL;
633 } else if (ob == cell_options_->radio_useminipage) {
634 num = LyXTabular::SET_USEBOX;
636 } else if ((ob == longtable_options_->radio_lt_firsthead) ||
637 (ob == longtable_options_->check_1head_2border_above) ||
638 (ob == longtable_options_->check_1head_2border_below) ||
639 (ob == longtable_options_->check_1head_empty) ||
640 (ob == longtable_options_->radio_lt_head) ||
641 (ob == longtable_options_->check_head_2border_above) ||
642 (ob == longtable_options_->check_head_2border_below) ||
643 (ob == longtable_options_->radio_lt_foot) ||
644 (ob == longtable_options_->check_foot_2border_above) ||
645 (ob == longtable_options_->check_foot_2border_below) ||
646 (ob == longtable_options_->radio_lt_lastfoot) ||
647 (ob == longtable_options_->check_lastfoot_2border_above) ||
648 (ob == longtable_options_->check_lastfoot_2border_below) ||
649 (ob == longtable_options_->check_lastfoot_empty))
651 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
652 } else if (ob == longtable_options_->radio_lt_newpage) {
653 num = LyXTabular::SET_LTNEWPAGE;
654 } else if (ob == column_options_->input_special_alignment) {
655 special = fl_get_input(column_options_->input_special_alignment);
656 num = LyXTabular::SET_SPECIAL_COLUMN;
657 } else if (ob == cell_options_->input_special_multialign) {
658 special = fl_get_input(cell_options_->input_special_multialign);
659 num = LyXTabular::SET_SPECIAL_MULTI;
660 } else if (ob == cell_options_->radio_border_top)
661 num = LyXTabular::M_TOGGLE_LINE_TOP;
662 else if (ob == cell_options_->radio_border_bottom)
663 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
664 else if (ob == cell_options_->radio_border_left)
665 num = LyXTabular::M_TOGGLE_LINE_LEFT;
666 else if (ob == cell_options_->radio_border_right)
667 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
668 else if (ob == cell_options_->radio_align_left)
669 num = LyXTabular::M_ALIGN_LEFT;
670 else if (ob == cell_options_->radio_align_right)
671 num = LyXTabular::M_ALIGN_RIGHT;
672 else if (ob == cell_options_->radio_align_center)
673 num = LyXTabular::M_ALIGN_CENTER;
674 else if (ob == cell_options_->radio_valign_top)
675 num = LyXTabular::M_VALIGN_TOP;
676 else if (ob == cell_options_->radio_valign_bottom)
677 num = LyXTabular::M_VALIGN_BOTTOM;
678 else if (ob == cell_options_->radio_valign_center)
679 num = LyXTabular::M_VALIGN_CENTER;
683 inset_->tabularFeatures(lv_->view(), num, special);
689 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
691 bool flag = fl_get_button(ob);
692 if ((ob == longtable_options_->check_1head_2border_above) ||
693 (ob == longtable_options_->check_head_2border_above) ||
694 (ob == longtable_options_->check_foot_2border_above) ||
695 (ob == longtable_options_->check_lastfoot_2border_above))
697 special = "dl_above";
698 } else if ((ob == longtable_options_->check_1head_2border_below) ||
699 (ob == longtable_options_->check_head_2border_below) ||
700 (ob == longtable_options_->check_foot_2border_below) ||
701 (ob == longtable_options_->check_lastfoot_2border_below))
703 special = "dl_below";
704 } else if ((ob == longtable_options_->check_1head_empty) ||
705 (ob == longtable_options_->check_lastfoot_empty))
711 if ((ob == longtable_options_->radio_lt_firsthead) ||
712 (ob == longtable_options_->check_1head_2border_above) ||
713 (ob == longtable_options_->check_1head_2border_below) ||
714 (ob == longtable_options_->check_1head_empty))
716 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
717 LyXTabular::UNSET_LTFIRSTHEAD);
718 } else if ((ob == longtable_options_->radio_lt_head) ||
719 (ob == longtable_options_->check_head_2border_above) ||
720 (ob == longtable_options_->check_head_2border_below))
722 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
723 } else if ((ob == longtable_options_->radio_lt_foot) ||
724 (ob == longtable_options_->check_foot_2border_above) ||
725 (ob == longtable_options_->check_foot_2border_below))
727 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
728 } else if ((ob == longtable_options_->radio_lt_lastfoot) ||
729 (ob == longtable_options_->check_lastfoot_2border_above) ||
730 (ob == longtable_options_->check_lastfoot_2border_below) ||
731 (ob == longtable_options_->check_lastfoot_empty))
733 return (flag ? LyXTabular::SET_LTLASTFOOT :
734 LyXTabular::UNSET_LTLASTFOOT);
736 return LyXTabular::LAST_ACTION;