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 "forms/form_tabular.h"
19 #include "frontends/LyXView.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"
31 #include <boost/bind.hpp>
34 #include FORMS_H_LOCATION
42 FormTabular::FormTabular(LyXView * lv, Dialogs * d)
43 : FormInset(lv, d, _("Tabular Layout")),
44 inset_(0), actCell_(-1), closing_(false)
46 // let the dialog be shown
47 // This is a permanent connection so we won't bother
48 // storing a copy because we won't be disconnecting.
49 d->showTabular = boost::bind(&FormTabular::showInset, this, _1);
50 d->updateTabular = boost::bind(&FormTabular::updateInset, this, _1);
54 void FormTabular::redraw()
56 if (form() && form()->visible)
57 fl_redraw_form(form());
61 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabfolder);
62 if (outer_form && outer_form->visible)
63 fl_redraw_form(outer_form);
67 FL_FORM * FormTabular::form() const
75 void FormTabular::disconnect()
78 FormInset::disconnect();
82 void FormTabular::showInset(InsetTabular * inset)
84 if (inset == 0) return;
86 // If connected to another inset, disconnect from it.
87 if (inset_ != inset) {
89 ih_ = inset->hideDialog.connect(boost::bind(&FormTabular::hide, this));
97 void FormTabular::updateInset(InsetTabular * inset)
99 if (inset == 0 || inset_ == 0) return;
101 // If connected to another inset, disconnect from it.
102 if (inset_ != inset) {
104 ih_ = inset->hideDialog.connect(boost::bind(&FormTabular::hide, this));
112 void FormTabular::build()
114 dialog_.reset(build_tabular(this));
116 // Allow the base class to control messages
117 setMessageWidget(dialog_->text_warning);
119 setPrehandler(dialog_->input_tabular_column);
120 setPrehandler(dialog_->input_tabular_row);
122 tabular_options_.reset(build_tabular_options(this));
123 column_options_.reset(build_tabular_column(this));
124 cell_options_.reset(build_tabular_cell(this));
125 longtable_options_.reset(build_tabular_longtable(this));
127 fl_set_input_return(column_options_->input_column_width,
129 fl_set_input_return(column_options_->input_special_alignment,
132 setPrehandler(column_options_->input_column_width);
133 setPrehandler(column_options_->input_special_alignment);
135 fl_set_input_return(cell_options_->input_mcolumn_width,
137 fl_set_input_return(cell_options_->input_special_multialign,
140 setPrehandler(cell_options_->input_mcolumn_width);
141 setPrehandler(cell_options_->input_special_multialign);
143 fl_addto_tabfolder(dialog_->tabfolder, _("Tabular"),
144 tabular_options_->form);
145 fl_addto_tabfolder(dialog_->tabfolder, _("Column/Row"),
146 column_options_->form);
147 fl_addto_tabfolder(dialog_->tabfolder, _("Cell"),
148 cell_options_->form);
149 fl_addto_tabfolder(dialog_->tabfolder, _("LongTable"),
150 longtable_options_->form);
152 // Create the contents of the unit choices
153 // Don't include the "%" terms...
154 vector<string> units_vec = getLatexUnits();
156 for (vector<string>::iterator it = units_vec.begin();
157 it != units_vec.end(); ++it) {
158 if (contains(*it, "%"))
159 it = units_vec.erase(it, it + 1) - 1;
162 vector<string>::iterator ret =
163 remove_if(units_vec.begin(), units_vec.end(),
164 bind2nd(contains_functor(), "%"));
165 units_vec.erase(ret, units_vec.end());
168 string units = getStringFromVector(units_vec, "|");
170 fl_addto_choice(column_options_->choice_value_column_width,
172 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
177 void FormTabular::update()
182 if (!inset_ || !inset_->tabular.get())
185 LyXTabular * tabular = inset_->tabular.get();
191 int cell = inset_->getActCell();
193 int column = tabular->column_of_cell(cell) + 1;
195 fl_activate_object(column_options_->input_special_alignment);
196 fl_activate_object(cell_options_->input_special_multialign);
197 fl_activate_object(column_options_->input_column_width);
198 fl_activate_object(column_options_->choice_value_column_width);
199 sprintf(buf, "%d", column);
200 fl_set_input(dialog_->input_tabular_column, buf);
201 fl_deactivate_object(dialog_->input_tabular_column);
202 int row = tabular->row_of_cell(cell);
203 sprintf(buf, "%d", row + 1);
204 fl_set_input(dialog_->input_tabular_row, buf);
205 fl_deactivate_object(dialog_->input_tabular_row);
206 if (tabular->IsMultiColumn(cell)) {
207 fl_set_button(cell_options_->check_multicolumn, 1);
208 fl_set_button(cell_options_->check_border_top,
209 tabular->TopLine(cell)?1:0);
210 setEnabled(cell_options_->check_border_top, true);
211 fl_set_button(cell_options_->check_border_bottom,
212 tabular->BottomLine(cell)?1:0);
213 setEnabled(cell_options_->check_border_bottom, true);
214 // pay attention to left/right lines they are only allowed
215 // to set if we are in first/last cell of row or if the left/right
216 // cell is also a multicolumn.
217 if (tabular->IsFirstCellInRow(cell) ||
218 tabular->IsMultiColumn(cell-1)) {
219 fl_set_button(cell_options_->check_border_left,
220 tabular->LeftLine(cell)?1:0);
221 setEnabled(cell_options_->check_border_left, true);
223 fl_set_button(cell_options_->check_border_left, 0);
224 setEnabled(cell_options_->check_border_left, false);
226 if (tabular->IsLastCellInRow(cell) ||
227 tabular->IsMultiColumn(cell+1)) {
228 fl_set_button(cell_options_->check_border_right,
229 tabular->RightLine(cell)?1:0);
230 setEnabled(cell_options_->check_border_right, true);
232 fl_set_button(cell_options_->check_border_right, 0);
233 setEnabled(cell_options_->check_border_right, false);
235 pwidth = tabular->GetMColumnPWidth(cell);
236 align = tabular->GetAlignment(cell);
237 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
238 fl_set_button(cell_options_->radio_align_left, 1);
239 else if (align == LYX_ALIGN_RIGHT)
240 fl_set_button(cell_options_->radio_align_right, 1);
242 fl_set_button(cell_options_->radio_align_center, 1);
244 align = tabular->GetVAlignment(cell);
245 fl_set_button(cell_options_->radio_valign_top, 0);
246 fl_set_button(cell_options_->radio_valign_bottom, 0);
247 fl_set_button(cell_options_->radio_valign_center, 0);
248 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
249 fl_set_button(cell_options_->radio_valign_center, 1);
250 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
251 fl_set_button(cell_options_->radio_valign_bottom, 1);
253 fl_set_button(cell_options_->radio_valign_top, 1);
255 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
256 fl_set_input(cell_options_->input_special_multialign, special.c_str());
257 bool const metric = lyxrc.default_papersize > 3;
258 string const default_unit = metric ? "cm" : "in";
259 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
260 cell_options_->choice_value_mcolumn_width,
261 pwidth, default_unit);
263 if (!lv_->buffer()->isReadonly()) {
264 setEnabled(cell_options_->input_special_multialign, true);
265 setEnabled(cell_options_->input_mcolumn_width, true);
266 setEnabled(cell_options_->choice_value_mcolumn_width, true);
269 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
270 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
271 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
273 setEnabled(cell_options_->radio_align_left, pwidth.zero());
274 setEnabled(cell_options_->radio_align_right, pwidth.zero());
275 setEnabled(cell_options_->radio_align_center, pwidth.zero());
277 fl_set_button(cell_options_->check_multicolumn, 0);
279 fl_set_button(cell_options_->check_border_top, 0);
280 setEnabled(cell_options_->check_border_top, false);
282 fl_set_button(cell_options_->check_border_bottom, 0);
283 setEnabled(cell_options_->check_border_bottom, false);
285 fl_set_button(cell_options_->check_border_left, 0);
286 setEnabled(cell_options_->check_border_left, false);
288 fl_set_button(cell_options_->check_border_right, 0);
289 setEnabled(cell_options_->check_border_right, false);
291 fl_set_button(cell_options_->radio_align_left, 0);
292 setEnabled(cell_options_->radio_align_left, false);
294 fl_set_button(cell_options_->radio_align_right, 0);
295 setEnabled(cell_options_->radio_align_right, false);
297 fl_set_button(cell_options_->radio_align_center, 0);
298 setEnabled(cell_options_->radio_align_center, false);
300 fl_set_button(cell_options_->radio_valign_top, 0);
301 setEnabled(cell_options_->radio_valign_top, false);
303 fl_set_button(cell_options_->radio_valign_bottom, 0);
304 setEnabled(cell_options_->radio_valign_bottom, false);
306 fl_set_button(cell_options_->radio_valign_center, 0);
307 setEnabled(cell_options_->radio_valign_center, false);
309 fl_set_input(cell_options_->input_special_multialign, "");
310 setEnabled(cell_options_->input_special_multialign, false);
312 fl_set_input(cell_options_->input_mcolumn_width, "");
313 setEnabled(cell_options_->input_mcolumn_width, false);
314 setEnabled(cell_options_->choice_value_mcolumn_width, false);
316 if (tabular->GetRotateCell(cell))
317 fl_set_button(cell_options_->check_rotate_cell, 1);
319 fl_set_button(cell_options_->check_rotate_cell, 0);
320 if (tabular->TopLine(cell, true))
321 fl_set_button(column_options_->check_border_top, 1);
323 fl_set_button(column_options_->check_border_top, 0);
324 if (tabular->BottomLine(cell, true))
325 fl_set_button(column_options_->check_border_bottom, 1);
327 fl_set_button(column_options_->check_border_bottom, 0);
328 if (tabular->LeftLine(cell, true))
329 fl_set_button(column_options_->check_border_left, 1);
331 fl_set_button(column_options_->check_border_left, 0);
332 if (tabular->RightLine(cell, true))
333 fl_set_button(column_options_->check_border_right, 1);
335 fl_set_button(column_options_->check_border_right, 0);
336 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
337 fl_set_input(column_options_->input_special_alignment, special.c_str());
339 bool const isReadonly = lv_->buffer()->isReadonly();
340 setEnabled(column_options_->input_special_alignment, !isReadonly);
342 pwidth = tabular->GetColumnPWidth(cell);
343 bool const metric = lyxrc.default_papersize > 3;
344 string const default_unit = metric ? "cm" : "in";
345 updateWidgetsFromLength(column_options_->input_column_width,
346 column_options_->choice_value_column_width,
347 pwidth, default_unit);
348 setEnabled(column_options_->input_column_width, !isReadonly);
349 setEnabled(column_options_->choice_value_column_width, !isReadonly);
351 setEnabled(cell_options_->check_useminipage, !pwidth.zero());
352 if (!pwidth.zero()) {
353 if (tabular->GetUsebox(cell) == 2)
354 fl_set_button(cell_options_->check_useminipage, 1);
356 fl_set_button(cell_options_->check_useminipage, 0);
358 fl_set_button(cell_options_->check_useminipage, 0);
360 align = tabular->GetAlignment(cell, true);
361 fl_set_button(column_options_->radio_align_left, 0);
362 fl_set_button(column_options_->radio_align_right, 0);
363 fl_set_button(column_options_->radio_align_center, 0);
364 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
365 fl_set_button(column_options_->radio_align_left, 1);
366 else if (align == LYX_ALIGN_RIGHT)
367 fl_set_button(column_options_->radio_align_right, 1);
369 fl_set_button(column_options_->radio_align_center, 1);
370 align = tabular->GetVAlignment(cell, true);
371 fl_set_button(column_options_->radio_valign_top, 0);
372 fl_set_button(column_options_->radio_valign_bottom, 0);
373 fl_set_button(column_options_->radio_valign_center, 0);
374 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
375 fl_set_button(column_options_->radio_valign_center, 1);
376 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
377 fl_set_button(column_options_->radio_valign_bottom, 1);
379 fl_set_button(column_options_->radio_valign_top, 1);
381 setEnabled(column_options_->radio_align_left, pwidth.zero());
382 setEnabled(column_options_->radio_align_right, pwidth.zero());
383 setEnabled(column_options_->radio_align_center, pwidth.zero());
385 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
386 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
387 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
389 fl_set_button(tabular_options_->check_longtable,
390 tabular->IsLongTabular());
392 bool const enable = tabular->IsLongTabular();
394 setEnabled(longtable_options_->check_lt_firsthead, enable);
395 setEnabled(longtable_options_->check_1head_2border_above, enable);
396 setEnabled(longtable_options_->check_1head_2border_below, enable);
397 setEnabled(longtable_options_->check_1head_empty, enable);
398 setEnabled(longtable_options_->check_lt_head, enable);
399 setEnabled(longtable_options_->check_head_2border_above, enable);
400 setEnabled(longtable_options_->check_head_2border_below, enable);
401 setEnabled(longtable_options_->check_lt_foot, enable);
402 setEnabled(longtable_options_->check_foot_2border_above, enable);
403 setEnabled(longtable_options_->check_foot_2border_below, enable);
404 setEnabled(longtable_options_->check_lt_lastfoot, enable);
405 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
406 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
407 setEnabled(longtable_options_->check_lastfoot_empty, enable);
408 setEnabled(longtable_options_->check_lt_newpage, enable);
411 LyXTabular::ltType ltt;
413 bool row_set = tabular->GetRowOfLTHead(row, ltt);
414 fl_set_button(longtable_options_->check_lt_head, row_set);
416 fl_set_button(longtable_options_->check_head_2border_above,
418 fl_set_button(longtable_options_->check_head_2border_above,
422 setEnabled(longtable_options_->check_head_2border_above, 0);
423 setEnabled(longtable_options_->check_head_2border_below, 0);
424 fl_set_button(longtable_options_->check_head_2border_above,0);
425 fl_set_button(longtable_options_->check_head_2border_above,0);
426 fl_set_button(longtable_options_->check_1head_empty,0);
427 setEnabled(longtable_options_->check_1head_empty, 0);
431 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
432 fl_set_button(longtable_options_->check_lt_firsthead, row_set);
433 if (ltt.set && (!ltt.empty || !use_empty)) {
434 fl_set_button(longtable_options_->check_1head_2border_above,
436 fl_set_button(longtable_options_->check_1head_2border_above,
439 setEnabled(longtable_options_->check_1head_2border_above, 0);
440 setEnabled(longtable_options_->check_1head_2border_below, 0);
441 fl_set_button(longtable_options_->check_1head_2border_above,0);
442 fl_set_button(longtable_options_->check_1head_2border_above,0);
444 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
446 setEnabled(longtable_options_->check_lt_firsthead, 0);
450 row_set = tabular->GetRowOfLTFoot(row, ltt);
451 fl_set_button(longtable_options_->check_lt_foot, row_set);
453 fl_set_button(longtable_options_->check_foot_2border_above,
455 fl_set_button(longtable_options_->check_foot_2border_above,
459 setEnabled(longtable_options_->check_foot_2border_above, 0);
460 setEnabled(longtable_options_->check_foot_2border_below, 0);
461 fl_set_button(longtable_options_->check_foot_2border_above,0);
462 fl_set_button(longtable_options_->check_foot_2border_above,0);
463 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
464 setEnabled(longtable_options_->check_lastfoot_empty, 0);
468 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
469 fl_set_button(longtable_options_->check_lt_lastfoot, row_set);
470 if (ltt.set && (!ltt.empty || !use_empty)) {
471 fl_set_button(longtable_options_->check_lastfoot_2border_above,
473 fl_set_button(longtable_options_->check_lastfoot_2border_above,
476 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
477 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
478 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
479 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
481 fl_set_button(longtable_options_->check_lastfoot_empty,
484 setEnabled(longtable_options_->check_lt_lastfoot, 0);
487 fl_set_button(longtable_options_->check_lt_newpage,
488 tabular->GetLTNewPage(row));
490 fl_set_button(longtable_options_->check_lt_firsthead, 0);
491 fl_set_button(longtable_options_->check_1head_2border_above, 0);
492 fl_set_button(longtable_options_->check_1head_2border_above, 0);
493 fl_set_button(longtable_options_->check_1head_empty, 0);
494 fl_set_button(longtable_options_->check_lt_head, 0);
495 fl_set_button(longtable_options_->check_head_2border_above, 0);
496 fl_set_button(longtable_options_->check_head_2border_above, 0);
497 fl_set_button(longtable_options_->check_lt_foot, 0);
498 fl_set_button(longtable_options_->check_foot_2border_above, 0);
499 fl_set_button(longtable_options_->check_foot_2border_above, 0);
500 fl_set_button(longtable_options_->check_lt_lastfoot, 0);
501 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
502 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
503 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
504 fl_set_button(longtable_options_->check_lt_newpage, 0);
506 fl_set_button(tabular_options_->check_rotate_tabular,
507 tabular->GetRotateTabular());
511 bool FormTabular::input(FL_OBJECT * ob, long)
517 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
520 int cell = inset_->getActCell();
522 // ugly hack to auto-apply the stuff that hasn't been
523 // yet. don't let this continue to exist ...
524 if (ob == dialog_->button_close) {
526 LyXTabular * tabular = inset_->tabular.get();
528 getLengthFromWidgets(column_options_->input_column_width,
529 column_options_->choice_value_column_width);
531 LyXLength llen = tabular->GetColumnPWidth(cell);
533 str2 = llen.asString();
535 input(column_options_->input_column_width, 0);
536 str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
537 cell_options_->choice_value_mcolumn_width);
538 llen = tabular->GetMColumnPWidth(cell);
542 str2 = llen.asString();
544 input(cell_options_->input_mcolumn_width, 0);
545 str1 = fl_get_input(column_options_->input_special_alignment);
546 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
548 input(column_options_->input_special_alignment, 0);
549 str1 = fl_get_input(cell_options_->input_special_multialign);
550 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
552 input(cell_options_->input_special_multialign, 0);
558 if (actCell_ != cell) {
560 postWarning(_("Wrong Cursor position, updated window"));
563 // No point in processing directives that you can't do anything with
564 // anyhow, so exit now if the buffer is read-only.
565 if (lv_->buffer()->isReadonly()) {
569 if ((ob == column_options_->input_column_width) ||
570 (ob == column_options_->choice_value_column_width)) {
572 getLengthFromWidgets(column_options_->input_column_width,
573 column_options_->choice_value_column_width);
574 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
576 //check if the input is valid
578 fl_get_input(column_options_->input_column_width);
579 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
580 postWarning(_("Invalid Length (valid example: 10mm)"));
584 update(); // update for alignment
588 if ((ob == cell_options_->input_mcolumn_width) ||
589 (ob == cell_options_->choice_value_mcolumn_width)) {
591 getLengthFromWidgets(cell_options_->input_mcolumn_width,
592 cell_options_->choice_value_mcolumn_width);
593 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
595 //check if the input is valid
597 fl_get_input(cell_options_->input_mcolumn_width);
598 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
599 postWarning(_("Invalid Length (valid example: 10mm)"));
602 update(); // update for alignment
606 if (ob == tabular_options_->button_append_row)
607 num = LyXTabular::APPEND_ROW;
608 else if (ob == tabular_options_->button_append_column)
609 num = LyXTabular::APPEND_COLUMN;
610 else if (ob == tabular_options_->button_delete_row)
611 num = LyXTabular::DELETE_ROW;
612 else if (ob == tabular_options_->button_delete_column)
613 num = LyXTabular::DELETE_COLUMN;
614 else if (ob == tabular_options_->button_set_borders)
615 num = LyXTabular::SET_ALL_LINES;
616 else if (ob == tabular_options_->button_unset_borders)
617 num = LyXTabular::UNSET_ALL_LINES;
618 else if (ob == column_options_->check_border_top)
619 num = LyXTabular::TOGGLE_LINE_TOP;
620 else if (ob == column_options_->check_border_bottom)
621 num = LyXTabular::TOGGLE_LINE_BOTTOM;
622 else if (ob == column_options_->check_border_left)
623 num = LyXTabular::TOGGLE_LINE_LEFT;
624 else if (ob == column_options_->check_border_right)
625 num = LyXTabular::TOGGLE_LINE_RIGHT;
626 else if (ob == column_options_->radio_align_left)
627 num = LyXTabular::ALIGN_LEFT;
628 else if (ob == column_options_->radio_align_right)
629 num = LyXTabular::ALIGN_RIGHT;
630 else if (ob == column_options_->radio_align_center)
631 num = LyXTabular::ALIGN_CENTER;
632 else if (ob == column_options_->radio_valign_top)
633 num = LyXTabular::VALIGN_TOP;
634 else if (ob == column_options_->radio_valign_bottom)
635 num = LyXTabular::VALIGN_BOTTOM;
636 else if (ob == column_options_->radio_valign_center)
637 num = LyXTabular::VALIGN_CENTER;
638 else if (ob == cell_options_->check_multicolumn)
639 num = LyXTabular::MULTICOLUMN;
640 else if (ob == tabular_options_->check_longtable) {
641 if (fl_get_button(tabular_options_->check_longtable))
642 num = LyXTabular::SET_LONGTABULAR;
644 num = LyXTabular::UNSET_LONGTABULAR;
645 } else if (ob == tabular_options_->check_rotate_tabular) {
646 s = fl_get_button(tabular_options_->check_rotate_tabular);
648 num = LyXTabular::SET_ROTATE_TABULAR;
650 num = LyXTabular::UNSET_ROTATE_TABULAR;
651 } else if (ob == cell_options_->check_rotate_cell) {
652 s = fl_get_button(cell_options_->check_rotate_cell);
654 num = LyXTabular::SET_ROTATE_CELL;
656 num = LyXTabular::UNSET_ROTATE_CELL;
657 } else if (ob == cell_options_->check_useminipage) {
658 num = LyXTabular::SET_USEBOX;
660 } else if ((ob == longtable_options_->check_lt_firsthead) ||
661 (ob == longtable_options_->check_1head_2border_above) ||
662 (ob == longtable_options_->check_1head_2border_below) ||
663 (ob == longtable_options_->check_1head_empty) ||
664 (ob == longtable_options_->check_lt_head) ||
665 (ob == longtable_options_->check_head_2border_above) ||
666 (ob == longtable_options_->check_head_2border_below) ||
667 (ob == longtable_options_->check_lt_foot) ||
668 (ob == longtable_options_->check_foot_2border_above) ||
669 (ob == longtable_options_->check_foot_2border_below) ||
670 (ob == longtable_options_->check_lt_lastfoot) ||
671 (ob == longtable_options_->check_lastfoot_2border_above) ||
672 (ob == longtable_options_->check_lastfoot_2border_below) ||
673 (ob == longtable_options_->check_lastfoot_empty)) {
674 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
675 } else if (ob == longtable_options_->check_lt_newpage) {
676 num = LyXTabular::SET_LTNEWPAGE;
677 } else if (ob == column_options_->input_special_alignment) {
678 special = fl_get_input(column_options_->input_special_alignment);
679 num = LyXTabular::SET_SPECIAL_COLUMN;
680 } else if (ob == cell_options_->input_special_multialign) {
681 special = fl_get_input(cell_options_->input_special_multialign);
682 num = LyXTabular::SET_SPECIAL_MULTI;
683 } else if (ob == cell_options_->check_border_top)
684 num = LyXTabular::M_TOGGLE_LINE_TOP;
685 else if (ob == cell_options_->check_border_bottom)
686 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
687 else if (ob == cell_options_->check_border_left)
688 num = LyXTabular::M_TOGGLE_LINE_LEFT;
689 else if (ob == cell_options_->check_border_right)
690 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
691 else if (ob == cell_options_->radio_align_left)
692 num = LyXTabular::M_ALIGN_LEFT;
693 else if (ob == cell_options_->radio_align_right)
694 num = LyXTabular::M_ALIGN_RIGHT;
695 else if (ob == cell_options_->radio_align_center)
696 num = LyXTabular::M_ALIGN_CENTER;
697 else if (ob == cell_options_->radio_valign_top)
698 num = LyXTabular::M_VALIGN_TOP;
699 else if (ob == cell_options_->radio_valign_bottom)
700 num = LyXTabular::M_VALIGN_BOTTOM;
701 else if (ob == cell_options_->radio_valign_center)
702 num = LyXTabular::M_VALIGN_CENTER;
706 inset_->tabularFeatures(lv_->view(), num, special);
712 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
714 bool flag = fl_get_button(ob);
715 if ((ob == longtable_options_->check_1head_2border_above) ||
716 (ob == longtable_options_->check_head_2border_above) ||
717 (ob == longtable_options_->check_foot_2border_above) ||
718 (ob == longtable_options_->check_lastfoot_2border_above)) {
719 special = "dl_above";
720 } else if ((ob == longtable_options_->check_1head_2border_below) ||
721 (ob == longtable_options_->check_head_2border_below) ||
722 (ob == longtable_options_->check_foot_2border_below) ||
723 (ob == longtable_options_->check_lastfoot_2border_below)) {
724 special = "dl_below";
725 } else if ((ob == longtable_options_->check_1head_empty) ||
726 (ob == longtable_options_->check_lastfoot_empty)) {
731 if ((ob == longtable_options_->check_lt_firsthead) ||
732 (ob == longtable_options_->check_1head_2border_above) ||
733 (ob == longtable_options_->check_1head_2border_below) ||
734 (ob == longtable_options_->check_1head_empty)) {
735 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
736 LyXTabular::UNSET_LTFIRSTHEAD);
737 } else if ((ob == longtable_options_->check_lt_head) ||
738 (ob == longtable_options_->check_head_2border_above) ||
739 (ob == longtable_options_->check_head_2border_below)) {
740 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
741 } else if ((ob == longtable_options_->check_lt_foot) ||
742 (ob == longtable_options_->check_foot_2border_above) ||
743 (ob == longtable_options_->check_foot_2border_below)) {
744 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
745 } else if ((ob == longtable_options_->check_lt_lastfoot) ||
746 (ob == longtable_options_->check_lastfoot_2border_above) ||
747 (ob == longtable_options_->check_lastfoot_2border_below) ||
748 (ob == longtable_options_->check_lastfoot_empty)) {
749 return (flag ? LyXTabular::SET_LTLASTFOOT :
750 LyXTabular::UNSET_LTLASTFOOT);
753 return LyXTabular::LAST_ACTION;