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
22 #include "FormTabular.h"
23 #include "form_tabular.h"
27 #include "xforms_helpers.h"
28 #include "lyxrc.h" // to set the default length values
29 #include "helper_funcs.h"
30 #include "input_validators.h"
32 #include "insets/insettabular.h"
34 #include "support/lstrings.h"
45 FormTabular::FormTabular(LyXView * lv, Dialogs * d)
46 : FormInset(lv, d, _("Tabular Layout")),
47 inset_(0), actCell_(-1), closing_(false)
49 // let the dialog be shown
50 // This is a permanent connection so we won't bother
51 // storing a copy because we won't be disconnecting.
52 d->showTabular.connect(slot(this, &FormTabular::showInset));
53 d->updateTabular.connect(slot(this, &FormTabular::updateInset));
57 void FormTabular::redraw()
59 if (form() && form()->visible)
60 fl_redraw_form(form());
64 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabFolder);
65 if (outer_form && outer_form->visible)
66 fl_redraw_form(outer_form);
70 FL_FORM * FormTabular::form() const
78 void FormTabular::disconnect()
81 FormInset::disconnect();
85 void FormTabular::showInset(InsetTabular * inset)
87 if (inset == 0) return;
89 // If connected to another inset, disconnect from it.
90 if (inset_ != inset) {
92 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
100 void FormTabular::updateInset(InsetTabular * inset)
102 if (inset == 0 || inset_ == 0) return;
104 // If connected to another inset, disconnect from it.
105 if (inset_ != inset) {
107 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
115 void FormTabular::build()
117 dialog_.reset(build_tabular());
118 tabular_options_.reset(build_tabular_options());
119 column_options_.reset(build_column_options());
120 cell_options_.reset(build_cell_options());
121 longtable_options_.reset(build_longtable_options());
123 fl_set_input_return(column_options_->input_column_width,
125 fl_set_input_return(column_options_->input_special_alignment,
127 fl_set_input_return(cell_options_->input_mcolumn_width,
129 fl_set_input_return(cell_options_->input_special_multialign,
132 fl_addto_tabfolder(dialog_->tabFolder, _("Tabular"),
133 tabular_options_->form);
134 fl_addto_tabfolder(dialog_->tabFolder, _("Column/Row"),
135 column_options_->form);
136 fl_addto_tabfolder(dialog_->tabFolder, _("Cell"),
137 cell_options_->form);
138 fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"),
139 longtable_options_->form);
141 // Create the contents of the unit choices
142 // Don't include the "%" terms...
143 vector<string> units_vec = getLatexUnits();
145 for (vector<string>::iterator it = units_vec.begin();
146 it != units_vec.end(); ++it)
148 if (contains(*it, "%"))
149 it = units_vec.erase(it, it + 1) - 1;
152 vector<string>::iterator ret =
153 remove_if(units_vec.begin(), units_vec.end(),
154 bind2nd(contains_functor(), "%"));
155 units_vec.erase(ret, units_vec.end());
158 string units = getStringFromVector(units_vec, "|");
160 fl_addto_choice(column_options_->choice_value_column_width,
162 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
167 void FormTabular::update()
172 if (!inset_ || !inset_->tabular.get())
175 LyXTabular * tabular = inset_->tabular.get();
181 int cell = inset_->getActCell();
183 int column = tabular->column_of_cell(cell) + 1;
184 fl_set_object_label(dialog_->text_warning, "");
185 fl_activate_object(column_options_->input_special_alignment);
186 fl_activate_object(cell_options_->input_special_multialign);
187 fl_activate_object(column_options_->input_column_width);
188 fl_activate_object(column_options_->choice_value_column_width);
189 sprintf(buf, "%d", column);
190 fl_set_input(dialog_->input_tabular_column, buf);
191 fl_deactivate_object(dialog_->input_tabular_column);
192 int row = tabular->row_of_cell(cell);
193 sprintf(buf, "%d", row + 1);
194 fl_set_input(dialog_->input_tabular_row, buf);
195 fl_deactivate_object(dialog_->input_tabular_row);
196 if (tabular->IsMultiColumn(cell)) {
197 fl_set_button(cell_options_->radio_multicolumn, 1);
198 fl_set_button(cell_options_->radio_border_top,
199 tabular->TopLine(cell)?1:0);
200 setEnabled(cell_options_->radio_border_top, true);
201 fl_set_button(cell_options_->radio_border_bottom,
202 tabular->BottomLine(cell)?1:0);
203 setEnabled(cell_options_->radio_border_bottom, true);
204 fl_set_button(cell_options_->radio_border_left,
205 tabular->LeftLine(cell)?1:0);
206 setEnabled(cell_options_->radio_border_left, true);
207 fl_set_button(cell_options_->radio_border_right,
208 tabular->RightLine(cell)?1:0);
209 setEnabled(cell_options_->radio_border_right, true);
210 pwidth = tabular->GetMColumnPWidth(cell);
211 align = tabular->GetAlignment(cell);
212 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
213 fl_set_button(cell_options_->radio_align_left, 1);
214 else if (align == LYX_ALIGN_RIGHT)
215 fl_set_button(cell_options_->radio_align_right, 1);
217 fl_set_button(cell_options_->radio_align_center, 1);
219 align = tabular->GetVAlignment(cell);
220 fl_set_button(cell_options_->radio_valign_top, 0);
221 fl_set_button(cell_options_->radio_valign_bottom, 0);
222 fl_set_button(cell_options_->radio_valign_center, 0);
223 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
224 fl_set_button(cell_options_->radio_valign_center, 1);
225 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
226 fl_set_button(cell_options_->radio_valign_bottom, 1);
228 fl_set_button(cell_options_->radio_valign_top, 1);
230 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
231 fl_set_input(cell_options_->input_special_multialign, special.c_str());
232 bool const metric = lyxrc.default_papersize > 3;
233 string const default_unit = metric ? "cm" : "in";
234 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
235 cell_options_->choice_value_mcolumn_width,
236 pwidth, default_unit);
238 if (!lv_->buffer()->isReadonly()) {
239 setEnabled(cell_options_->input_special_multialign, true);
240 setEnabled(cell_options_->input_mcolumn_width, true);
241 setEnabled(cell_options_->choice_value_mcolumn_width, true);
244 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
245 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
246 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
248 setEnabled(cell_options_->radio_align_left, pwidth.zero());
249 setEnabled(cell_options_->radio_align_right, pwidth.zero());
250 setEnabled(cell_options_->radio_align_center, pwidth.zero());
252 fl_set_button(cell_options_->radio_multicolumn, 0);
254 fl_set_button(cell_options_->radio_border_top, 0);
255 setEnabled(cell_options_->radio_border_top, false);
257 fl_set_button(cell_options_->radio_border_bottom, 0);
258 setEnabled(cell_options_->radio_border_bottom, false);
260 fl_set_button(cell_options_->radio_border_left, 0);
261 setEnabled(cell_options_->radio_border_left, false);
263 fl_set_button(cell_options_->radio_border_right, 0);
264 setEnabled(cell_options_->radio_border_right, false);
266 fl_set_button(cell_options_->radio_align_left, 0);
267 setEnabled(cell_options_->radio_align_left, false);
269 fl_set_button(cell_options_->radio_align_right, 0);
270 setEnabled(cell_options_->radio_align_right, false);
272 fl_set_button(cell_options_->radio_align_center, 0);
273 setEnabled(cell_options_->radio_align_center, false);
275 fl_set_button(cell_options_->radio_valign_top, 0);
276 setEnabled(cell_options_->radio_valign_top, false);
278 fl_set_button(cell_options_->radio_valign_bottom, 0);
279 setEnabled(cell_options_->radio_valign_bottom, false);
281 fl_set_button(cell_options_->radio_valign_center, 0);
282 setEnabled(cell_options_->radio_valign_center, false);
284 fl_set_input(cell_options_->input_special_multialign, "");
285 setEnabled(cell_options_->input_special_multialign, false);
287 fl_set_input(cell_options_->input_mcolumn_width, "");
288 setEnabled(cell_options_->input_mcolumn_width, false);
289 setEnabled(cell_options_->choice_value_mcolumn_width, false);
291 if (tabular->GetRotateCell(cell))
292 fl_set_button(cell_options_->radio_rotate_cell, 1);
294 fl_set_button(cell_options_->radio_rotate_cell, 0);
295 if (tabular->TopLine(cell, true))
296 fl_set_button(column_options_->radio_border_top, 1);
298 fl_set_button(column_options_->radio_border_top, 0);
299 if (tabular->BottomLine(cell, true))
300 fl_set_button(column_options_->radio_border_bottom, 1);
302 fl_set_button(column_options_->radio_border_bottom, 0);
303 if (tabular->LeftLine(cell, true))
304 fl_set_button(column_options_->radio_border_left, 1);
306 fl_set_button(column_options_->radio_border_left, 0);
307 if (tabular->RightLine(cell, true))
308 fl_set_button(column_options_->radio_border_right, 1);
310 fl_set_button(column_options_->radio_border_right, 0);
311 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
312 fl_set_input(column_options_->input_special_alignment, special.c_str());
314 bool const isReadonly = lv_->buffer()->isReadonly();
315 setEnabled(column_options_->input_special_alignment, !isReadonly);
317 pwidth = tabular->GetColumnPWidth(cell);
318 bool const metric = lyxrc.default_papersize > 3;
319 string const default_unit = metric ? "cm" : "in";
320 updateWidgetsFromLength(column_options_->input_column_width,
321 column_options_->choice_value_column_width,
322 pwidth, default_unit);
323 setEnabled(column_options_->input_column_width, !isReadonly);
324 setEnabled(column_options_->choice_value_column_width, !isReadonly);
326 setEnabled(cell_options_->radio_useminipage, !pwidth.zero());
327 if (!pwidth.zero()) {
328 if (tabular->GetUsebox(cell) == 2)
329 fl_set_button(cell_options_->radio_useminipage, 1);
331 fl_set_button(cell_options_->radio_useminipage, 0);
333 fl_set_button(cell_options_->radio_useminipage, 0);
335 align = tabular->GetAlignment(cell, true);
336 fl_set_button(column_options_->radio_align_left, 0);
337 fl_set_button(column_options_->radio_align_right, 0);
338 fl_set_button(column_options_->radio_align_center, 0);
339 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
340 fl_set_button(column_options_->radio_align_left, 1);
341 else if (align == LYX_ALIGN_RIGHT)
342 fl_set_button(column_options_->radio_align_right, 1);
344 fl_set_button(column_options_->radio_align_center, 1);
345 align = tabular->GetVAlignment(cell, true);
346 fl_set_button(column_options_->radio_valign_top, 0);
347 fl_set_button(column_options_->radio_valign_bottom, 0);
348 fl_set_button(column_options_->radio_valign_center, 0);
349 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
350 fl_set_button(column_options_->radio_valign_center, 1);
351 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
352 fl_set_button(column_options_->radio_valign_bottom, 1);
354 fl_set_button(column_options_->radio_valign_top, 1);
356 setEnabled(column_options_->radio_align_left, pwidth.zero());
357 setEnabled(column_options_->radio_align_right, pwidth.zero());
358 setEnabled(column_options_->radio_align_center, pwidth.zero());
360 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
361 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
362 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
364 fl_set_button(tabular_options_->radio_longtable,
365 tabular->IsLongTabular());
367 bool const enable = tabular->IsLongTabular();
369 setEnabled(longtable_options_->radio_lt_firsthead, enable);
370 setEnabled(longtable_options_->check_1head_2border_above, enable);
371 setEnabled(longtable_options_->check_1head_2border_below, enable);
372 setEnabled(longtable_options_->check_1head_empty, enable);
373 setEnabled(longtable_options_->radio_lt_head, enable);
374 setEnabled(longtable_options_->check_head_2border_above, enable);
375 setEnabled(longtable_options_->check_head_2border_below, enable);
376 setEnabled(longtable_options_->radio_lt_foot, enable);
377 setEnabled(longtable_options_->check_foot_2border_above, enable);
378 setEnabled(longtable_options_->check_foot_2border_below, enable);
379 setEnabled(longtable_options_->radio_lt_lastfoot, enable);
380 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
381 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
382 setEnabled(longtable_options_->check_lastfoot_empty, enable);
383 setEnabled(longtable_options_->radio_lt_newpage, enable);
386 LyXTabular::ltType ltt;
388 bool row_set = tabular->GetRowOfLTHead(row, ltt);
389 fl_set_button(longtable_options_->radio_lt_head, row_set);
391 fl_set_button(longtable_options_->check_head_2border_above,
393 fl_set_button(longtable_options_->check_head_2border_above,
397 setEnabled(longtable_options_->check_head_2border_above, 0);
398 setEnabled(longtable_options_->check_head_2border_below, 0);
399 fl_set_button(longtable_options_->check_head_2border_above,0);
400 fl_set_button(longtable_options_->check_head_2border_above,0);
401 fl_set_button(longtable_options_->check_1head_empty,0);
402 setEnabled(longtable_options_->check_1head_empty, 0);
406 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
407 fl_set_button(longtable_options_->radio_lt_firsthead, row_set);
408 if (ltt.set && (!ltt.empty || !use_empty)) {
409 fl_set_button(longtable_options_->check_1head_2border_above,
411 fl_set_button(longtable_options_->check_1head_2border_above,
414 setEnabled(longtable_options_->check_1head_2border_above, 0);
415 setEnabled(longtable_options_->check_1head_2border_below, 0);
416 fl_set_button(longtable_options_->check_1head_2border_above,0);
417 fl_set_button(longtable_options_->check_1head_2border_above,0);
419 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
421 setEnabled(longtable_options_->radio_lt_firsthead, 0);
425 row_set = tabular->GetRowOfLTFoot(row, ltt);
426 fl_set_button(longtable_options_->radio_lt_foot, row_set);
428 fl_set_button(longtable_options_->check_foot_2border_above,
430 fl_set_button(longtable_options_->check_foot_2border_above,
434 setEnabled(longtable_options_->check_foot_2border_above, 0);
435 setEnabled(longtable_options_->check_foot_2border_below, 0);
436 fl_set_button(longtable_options_->check_foot_2border_above,0);
437 fl_set_button(longtable_options_->check_foot_2border_above,0);
438 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
439 setEnabled(longtable_options_->check_lastfoot_empty, 0);
443 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
444 fl_set_button(longtable_options_->radio_lt_lastfoot, row_set);
445 if (ltt.set && (!ltt.empty || !use_empty)) {
446 fl_set_button(longtable_options_->check_lastfoot_2border_above,
448 fl_set_button(longtable_options_->check_lastfoot_2border_above,
451 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
452 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
453 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
454 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
456 fl_set_button(longtable_options_->check_lastfoot_empty,
459 setEnabled(longtable_options_->radio_lt_lastfoot, 0);
462 fl_set_button(longtable_options_->radio_lt_newpage,
463 tabular->GetLTNewPage(row));
465 fl_set_button(longtable_options_->radio_lt_firsthead, 0);
466 fl_set_button(longtable_options_->check_1head_2border_above, 0);
467 fl_set_button(longtable_options_->check_1head_2border_above, 0);
468 fl_set_button(longtable_options_->check_1head_empty, 0);
469 fl_set_button(longtable_options_->radio_lt_head, 0);
470 fl_set_button(longtable_options_->check_head_2border_above, 0);
471 fl_set_button(longtable_options_->check_head_2border_above, 0);
472 fl_set_button(longtable_options_->radio_lt_foot, 0);
473 fl_set_button(longtable_options_->check_foot_2border_above, 0);
474 fl_set_button(longtable_options_->check_foot_2border_above, 0);
475 fl_set_button(longtable_options_->radio_lt_lastfoot, 0);
476 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
477 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
478 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
479 fl_set_button(longtable_options_->radio_lt_newpage, 0);
481 fl_set_button(tabular_options_->radio_rotate_tabular,
482 tabular->GetRotateTabular());
486 bool FormTabular::input(FL_OBJECT * ob, long)
492 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
495 int cell = inset_->getActCell();
497 // ugly hack to auto-apply the stuff that hasn't been
498 // yet. don't let this continue to exist ...
499 if (ob == dialog_->button_close) {
501 LyXTabular * tabular = inset_->tabular.get();
503 getLengthFromWidgets(column_options_->input_column_width,
504 column_options_->choice_value_column_width);
506 LyXLength llen = tabular->GetColumnPWidth(cell);
508 str2 = llen.asString();
510 input(column_options_->input_column_width, 0);
511 str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
512 cell_options_->choice_value_mcolumn_width);
513 llen = tabular->GetMColumnPWidth(cell);
517 str2 = llen.asString();
519 input(cell_options_->input_mcolumn_width, 0);
520 str1 = fl_get_input(column_options_->input_special_alignment);
521 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
523 input(column_options_->input_special_alignment, 0);
524 str1 = fl_get_input(cell_options_->input_special_multialign);
525 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
527 input(cell_options_->input_special_multialign, 0);
533 if (actCell_ != cell) {
535 fl_set_object_label(dialog_->text_warning,
536 _("Warning: Wrong Cursor position, updated window"));
537 fl_show_object(dialog_->text_warning);
540 // No point in processing directives that you can't do anything with
541 // anyhow, so exit now if the buffer is read-only.
542 if (lv_->buffer()->isReadonly()) {
546 if ((ob == column_options_->input_column_width) ||
547 (ob == column_options_->choice_value_column_width))
550 getLengthFromWidgets(column_options_->input_column_width,
551 column_options_->choice_value_column_width);
552 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
554 //check if the input is valid
556 fl_get_input(column_options_->input_column_width);
557 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
558 fl_set_object_label(dialog_->text_warning,
559 _("Warning: Invalid Length (valid example: 10mm)"));
560 fl_show_object(dialog_->text_warning);
563 update(); // update for alignment
566 if ((ob == cell_options_->input_mcolumn_width) ||
567 (ob == cell_options_->choice_value_mcolumn_width))
570 getLengthFromWidgets(cell_options_->input_mcolumn_width,
571 cell_options_->choice_value_mcolumn_width);
572 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
574 //check if the input is valid
576 fl_get_input(cell_options_->input_mcolumn_width);
577 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
578 fl_set_object_label(dialog_->text_warning,
579 _("Warning: Invalid Length (valid example: 10mm)"));
580 fl_show_object(dialog_->text_warning);
583 update(); // update for alignment
587 if (ob == tabular_options_->button_append_row)
588 num = LyXTabular::APPEND_ROW;
589 else if (ob == tabular_options_->button_append_column)
590 num = LyXTabular::APPEND_COLUMN;
591 else if (ob == tabular_options_->button_delete_row)
592 num = LyXTabular::DELETE_ROW;
593 else if (ob == tabular_options_->button_delete_column)
594 num = LyXTabular::DELETE_COLUMN;
595 else if (ob == tabular_options_->button_set_borders)
596 num = LyXTabular::SET_ALL_LINES;
597 else if (ob == tabular_options_->button_unset_borders)
598 num = LyXTabular::UNSET_ALL_LINES;
599 else if (ob == column_options_->radio_border_top)
600 num = LyXTabular::TOGGLE_LINE_TOP;
601 else if (ob == column_options_->radio_border_bottom)
602 num = LyXTabular::TOGGLE_LINE_BOTTOM;
603 else if (ob == column_options_->radio_border_left)
604 num = LyXTabular::TOGGLE_LINE_LEFT;
605 else if (ob == column_options_->radio_border_right)
606 num = LyXTabular::TOGGLE_LINE_RIGHT;
607 else if (ob == column_options_->radio_align_left)
608 num = LyXTabular::ALIGN_LEFT;
609 else if (ob == column_options_->radio_align_right)
610 num = LyXTabular::ALIGN_RIGHT;
611 else if (ob == column_options_->radio_align_center)
612 num = LyXTabular::ALIGN_CENTER;
613 else if (ob == column_options_->radio_valign_top)
614 num = LyXTabular::VALIGN_TOP;
615 else if (ob == column_options_->radio_valign_bottom)
616 num = LyXTabular::VALIGN_BOTTOM;
617 else if (ob == column_options_->radio_valign_center)
618 num = LyXTabular::VALIGN_CENTER;
619 else if (ob == cell_options_->radio_multicolumn)
620 num = LyXTabular::MULTICOLUMN;
621 else if (ob == tabular_options_->radio_longtable) {
622 if (fl_get_button(tabular_options_->radio_longtable))
623 num = LyXTabular::SET_LONGTABULAR;
625 num = LyXTabular::UNSET_LONGTABULAR;
626 } else if (ob == tabular_options_->radio_rotate_tabular) {
627 s = fl_get_button(tabular_options_->radio_rotate_tabular);
629 num = LyXTabular::SET_ROTATE_TABULAR;
631 num = LyXTabular::UNSET_ROTATE_TABULAR;
632 } else if (ob == cell_options_->radio_rotate_cell) {
633 s = fl_get_button(cell_options_->radio_rotate_cell);
635 num = LyXTabular::SET_ROTATE_CELL;
637 num = LyXTabular::UNSET_ROTATE_CELL;
638 } else if (ob == cell_options_->radio_useminipage) {
639 num = LyXTabular::SET_USEBOX;
641 } else if ((ob == longtable_options_->radio_lt_firsthead) ||
642 (ob == longtable_options_->check_1head_2border_above) ||
643 (ob == longtable_options_->check_1head_2border_below) ||
644 (ob == longtable_options_->check_1head_empty) ||
645 (ob == longtable_options_->radio_lt_head) ||
646 (ob == longtable_options_->check_head_2border_above) ||
647 (ob == longtable_options_->check_head_2border_below) ||
648 (ob == longtable_options_->radio_lt_foot) ||
649 (ob == longtable_options_->check_foot_2border_above) ||
650 (ob == longtable_options_->check_foot_2border_below) ||
651 (ob == longtable_options_->radio_lt_lastfoot) ||
652 (ob == longtable_options_->check_lastfoot_2border_above) ||
653 (ob == longtable_options_->check_lastfoot_2border_below) ||
654 (ob == longtable_options_->check_lastfoot_empty))
656 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
657 } else if (ob == longtable_options_->radio_lt_newpage) {
658 num = LyXTabular::SET_LTNEWPAGE;
659 } else if (ob == column_options_->input_special_alignment) {
660 special = fl_get_input(column_options_->input_special_alignment);
661 num = LyXTabular::SET_SPECIAL_COLUMN;
662 } else if (ob == cell_options_->input_special_multialign) {
663 special = fl_get_input(cell_options_->input_special_multialign);
664 num = LyXTabular::SET_SPECIAL_MULTI;
665 } else if (ob == cell_options_->radio_border_top)
666 num = LyXTabular::M_TOGGLE_LINE_TOP;
667 else if (ob == cell_options_->radio_border_bottom)
668 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
669 else if (ob == cell_options_->radio_border_left)
670 num = LyXTabular::M_TOGGLE_LINE_LEFT;
671 else if (ob == cell_options_->radio_border_right)
672 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
673 else if (ob == cell_options_->radio_align_left)
674 num = LyXTabular::M_ALIGN_LEFT;
675 else if (ob == cell_options_->radio_align_right)
676 num = LyXTabular::M_ALIGN_RIGHT;
677 else if (ob == cell_options_->radio_align_center)
678 num = LyXTabular::M_ALIGN_CENTER;
679 else if (ob == cell_options_->radio_valign_top)
680 num = LyXTabular::M_VALIGN_TOP;
681 else if (ob == cell_options_->radio_valign_bottom)
682 num = LyXTabular::M_VALIGN_BOTTOM;
683 else if (ob == cell_options_->radio_valign_center)
684 num = LyXTabular::M_VALIGN_CENTER;
688 inset_->tabularFeatures(lv_->view(), num, special);
694 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
696 bool flag = fl_get_button(ob);
697 if ((ob == longtable_options_->check_1head_2border_above) ||
698 (ob == longtable_options_->check_head_2border_above) ||
699 (ob == longtable_options_->check_foot_2border_above) ||
700 (ob == longtable_options_->check_lastfoot_2border_above))
702 special = "dl_above";
703 } else if ((ob == longtable_options_->check_1head_2border_below) ||
704 (ob == longtable_options_->check_head_2border_below) ||
705 (ob == longtable_options_->check_foot_2border_below) ||
706 (ob == longtable_options_->check_lastfoot_2border_below))
708 special = "dl_below";
709 } else if ((ob == longtable_options_->check_1head_empty) ||
710 (ob == longtable_options_->check_lastfoot_empty))
716 if ((ob == longtable_options_->radio_lt_firsthead) ||
717 (ob == longtable_options_->check_1head_2border_above) ||
718 (ob == longtable_options_->check_1head_2border_below) ||
719 (ob == longtable_options_->check_1head_empty))
721 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
722 LyXTabular::UNSET_LTFIRSTHEAD);
723 } else if ((ob == longtable_options_->radio_lt_head) ||
724 (ob == longtable_options_->check_head_2border_above) ||
725 (ob == longtable_options_->check_head_2border_below))
727 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
728 } else if ((ob == longtable_options_->radio_lt_foot) ||
729 (ob == longtable_options_->check_foot_2border_above) ||
730 (ob == longtable_options_->check_foot_2border_below))
732 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
733 } else if ((ob == longtable_options_->radio_lt_lastfoot) ||
734 (ob == longtable_options_->check_lastfoot_2border_above) ||
735 (ob == longtable_options_->check_lastfoot_2border_below) ||
736 (ob == longtable_options_->check_lastfoot_empty))
738 return (flag ? LyXTabular::SET_LTLASTFOOT :
739 LyXTabular::UNSET_LTLASTFOOT);
741 return LyXTabular::LAST_ACTION;