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)
47 // let the dialog be shown
48 // This is a permanent connection so we won't bother
49 // storing a copy because we won't be disconnecting.
50 d->showTabular = boost::bind(&FormTabular::showInset, this, _1);
51 d->updateTabular = boost::bind(&FormTabular::updateInset, this, _1);
56 void FormTabular::redraw()
58 if (form() && form()->visible)
59 fl_redraw_form(form());
63 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabfolder);
64 if (outer_form && outer_form->visible)
65 fl_redraw_form(outer_form);
69 FL_FORM * FormTabular::form() const
77 void FormTabular::disconnect()
80 FormInset::disconnect();
84 void FormTabular::showInset(InsetTabular * inset)
86 if (inset == 0) return;
88 // If connected to another inset, disconnect from it.
89 if (inset_ != inset) {
91 ih_ = inset->hideDialog.connect(boost::bind(&FormTabular::hide, this));
99 void FormTabular::updateInset(InsetTabular * inset)
101 if (inset == 0 || inset_ == 0) return;
103 // If connected to another inset, disconnect from it.
104 if (inset_ != inset) {
106 ih_ = inset->hideDialog.connect(boost::bind(&FormTabular::hide, this));
114 void FormTabular::build()
116 dialog_.reset(build_tabular(this));
118 // Allow the base class to control messages
119 setMessageWidget(dialog_->text_warning);
121 setPrehandler(dialog_->input_tabular_column);
122 setPrehandler(dialog_->input_tabular_row);
124 tabular_options_.reset(build_tabular_options(this));
125 column_options_.reset(build_tabular_column(this));
126 cell_options_.reset(build_tabular_cell(this));
127 longtable_options_.reset(build_tabular_longtable(this));
129 fl_set_input_return(column_options_->input_column_width,
131 fl_set_input_return(column_options_->input_special_alignment,
134 setPrehandler(column_options_->input_column_width);
135 setPrehandler(column_options_->input_special_alignment);
137 fl_set_input_return(cell_options_->input_mcolumn_width,
139 fl_set_input_return(cell_options_->input_special_multialign,
142 setPrehandler(cell_options_->input_mcolumn_width);
143 setPrehandler(cell_options_->input_special_multialign);
145 fl_addto_tabfolder(dialog_->tabfolder, _("Tabular"),
146 tabular_options_->form);
147 fl_addto_tabfolder(dialog_->tabfolder, _("Column/Row"),
148 column_options_->form);
149 fl_addto_tabfolder(dialog_->tabfolder, _("Cell"),
150 cell_options_->form);
151 fl_addto_tabfolder(dialog_->tabfolder, _("LongTable"),
152 longtable_options_->form);
154 // Create the contents of the unit choices
155 // Don't include the "%" terms...
156 vector<string> units_vec = getLatexUnits();
158 for (vector<string>::iterator it = units_vec.begin();
159 it != units_vec.end(); ++it) {
160 if (contains(*it, "%"))
161 it = units_vec.erase(it, it + 1) - 1;
164 vector<string>::iterator ret =
165 remove_if(units_vec.begin(), units_vec.end(),
166 bind2nd(contains_functor(), "%"));
167 units_vec.erase(ret, units_vec.end());
170 string units = getStringFromVector(units_vec, "|");
172 fl_addto_choice(column_options_->choice_value_column_width,
174 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
179 void FormTabular::update()
184 if (!inset_ || !inset_->tabular.get())
187 LyXTabular * tabular = inset_->tabular.get();
193 int cell = inset_->getActCell();
195 int column = tabular->column_of_cell(cell) + 1;
197 fl_activate_object(column_options_->input_special_alignment);
198 fl_activate_object(cell_options_->input_special_multialign);
199 fl_activate_object(column_options_->input_column_width);
200 fl_activate_object(column_options_->choice_value_column_width);
201 sprintf(buf, "%d", column);
202 fl_set_input(dialog_->input_tabular_column, buf);
203 fl_deactivate_object(dialog_->input_tabular_column);
204 int row = tabular->row_of_cell(cell);
205 sprintf(buf, "%d", row + 1);
206 fl_set_input(dialog_->input_tabular_row, buf);
207 fl_deactivate_object(dialog_->input_tabular_row);
208 if (tabular->IsMultiColumn(cell)) {
209 fl_set_button(cell_options_->check_multicolumn, 1);
210 fl_set_button(cell_options_->check_border_top,
211 tabular->TopLine(cell)?1:0);
212 setEnabled(cell_options_->check_border_top, true);
213 fl_set_button(cell_options_->check_border_bottom,
214 tabular->BottomLine(cell)?1:0);
215 setEnabled(cell_options_->check_border_bottom, true);
216 // pay attention to left/right lines they are only allowed
217 // to set if we are in first/last cell of row or if the left/right
218 // cell is also a multicolumn.
219 if (tabular->IsFirstCellInRow(cell) ||
220 tabular->IsMultiColumn(cell-1)) {
221 fl_set_button(cell_options_->check_border_left,
222 tabular->LeftLine(cell)?1:0);
223 setEnabled(cell_options_->check_border_left, true);
225 fl_set_button(cell_options_->check_border_left, 0);
226 setEnabled(cell_options_->check_border_left, false);
228 if (tabular->IsLastCellInRow(cell) ||
229 tabular->IsMultiColumn(cell+1)) {
230 fl_set_button(cell_options_->check_border_right,
231 tabular->RightLine(cell)?1:0);
232 setEnabled(cell_options_->check_border_right, true);
234 fl_set_button(cell_options_->check_border_right, 0);
235 setEnabled(cell_options_->check_border_right, false);
237 pwidth = tabular->GetMColumnPWidth(cell);
238 align = tabular->GetAlignment(cell);
239 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
240 fl_set_button(cell_options_->radio_align_left, 1);
241 else if (align == LYX_ALIGN_RIGHT)
242 fl_set_button(cell_options_->radio_align_right, 1);
244 fl_set_button(cell_options_->radio_align_center, 1);
246 align = tabular->GetVAlignment(cell);
247 fl_set_button(cell_options_->radio_valign_top, 0);
248 fl_set_button(cell_options_->radio_valign_bottom, 0);
249 fl_set_button(cell_options_->radio_valign_center, 0);
250 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
251 fl_set_button(cell_options_->radio_valign_center, 1);
252 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
253 fl_set_button(cell_options_->radio_valign_bottom, 1);
255 fl_set_button(cell_options_->radio_valign_top, 1);
257 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
258 fl_set_input(cell_options_->input_special_multialign, special.c_str());
259 bool const metric = lyxrc.default_papersize > 3;
260 string const default_unit = metric ? "cm" : "in";
261 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
262 cell_options_->choice_value_mcolumn_width,
263 pwidth, default_unit);
265 if (!lv_->buffer()->isReadonly()) {
266 setEnabled(cell_options_->input_special_multialign, true);
267 setEnabled(cell_options_->input_mcolumn_width, true);
268 setEnabled(cell_options_->choice_value_mcolumn_width, true);
271 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
272 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
273 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
275 setEnabled(cell_options_->radio_align_left, pwidth.zero());
276 setEnabled(cell_options_->radio_align_right, pwidth.zero());
277 setEnabled(cell_options_->radio_align_center, pwidth.zero());
279 fl_set_button(cell_options_->check_multicolumn, 0);
281 fl_set_button(cell_options_->check_border_top, 0);
282 setEnabled(cell_options_->check_border_top, false);
284 fl_set_button(cell_options_->check_border_bottom, 0);
285 setEnabled(cell_options_->check_border_bottom, false);
287 fl_set_button(cell_options_->check_border_left, 0);
288 setEnabled(cell_options_->check_border_left, false);
290 fl_set_button(cell_options_->check_border_right, 0);
291 setEnabled(cell_options_->check_border_right, false);
293 fl_set_button(cell_options_->radio_align_left, 0);
294 setEnabled(cell_options_->radio_align_left, false);
296 fl_set_button(cell_options_->radio_align_right, 0);
297 setEnabled(cell_options_->radio_align_right, false);
299 fl_set_button(cell_options_->radio_align_center, 0);
300 setEnabled(cell_options_->radio_align_center, false);
302 fl_set_button(cell_options_->radio_valign_top, 0);
303 setEnabled(cell_options_->radio_valign_top, false);
305 fl_set_button(cell_options_->radio_valign_bottom, 0);
306 setEnabled(cell_options_->radio_valign_bottom, false);
308 fl_set_button(cell_options_->radio_valign_center, 0);
309 setEnabled(cell_options_->radio_valign_center, false);
311 fl_set_input(cell_options_->input_special_multialign, "");
312 setEnabled(cell_options_->input_special_multialign, false);
314 fl_set_input(cell_options_->input_mcolumn_width, "");
315 setEnabled(cell_options_->input_mcolumn_width, false);
316 setEnabled(cell_options_->choice_value_mcolumn_width, false);
318 if (tabular->GetRotateCell(cell))
319 fl_set_button(cell_options_->check_rotate_cell, 1);
321 fl_set_button(cell_options_->check_rotate_cell, 0);
322 if (tabular->TopLine(cell, true))
323 fl_set_button(column_options_->check_border_top, 1);
325 fl_set_button(column_options_->check_border_top, 0);
326 if (tabular->BottomLine(cell, true))
327 fl_set_button(column_options_->check_border_bottom, 1);
329 fl_set_button(column_options_->check_border_bottom, 0);
330 if (tabular->LeftLine(cell, true))
331 fl_set_button(column_options_->check_border_left, 1);
333 fl_set_button(column_options_->check_border_left, 0);
334 if (tabular->RightLine(cell, true))
335 fl_set_button(column_options_->check_border_right, 1);
337 fl_set_button(column_options_->check_border_right, 0);
338 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
339 fl_set_input(column_options_->input_special_alignment, special.c_str());
341 bool const isReadonly = lv_->buffer()->isReadonly();
342 setEnabled(column_options_->input_special_alignment, !isReadonly);
344 pwidth = tabular->GetColumnPWidth(cell);
345 bool const metric = lyxrc.default_papersize > 3;
346 string const default_unit = metric ? "cm" : "in";
347 updateWidgetsFromLength(column_options_->input_column_width,
348 column_options_->choice_value_column_width,
349 pwidth, default_unit);
350 setEnabled(column_options_->input_column_width, !isReadonly);
351 setEnabled(column_options_->choice_value_column_width, !isReadonly);
353 setEnabled(cell_options_->check_useminipage, !pwidth.zero());
354 if (!pwidth.zero()) {
355 if (tabular->GetUsebox(cell) == 2)
356 fl_set_button(cell_options_->check_useminipage, 1);
358 fl_set_button(cell_options_->check_useminipage, 0);
360 fl_set_button(cell_options_->check_useminipage, 0);
362 align = tabular->GetAlignment(cell, true);
363 fl_set_button(column_options_->radio_align_left, 0);
364 fl_set_button(column_options_->radio_align_right, 0);
365 fl_set_button(column_options_->radio_align_center, 0);
366 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
367 fl_set_button(column_options_->radio_align_left, 1);
368 else if (align == LYX_ALIGN_RIGHT)
369 fl_set_button(column_options_->radio_align_right, 1);
371 fl_set_button(column_options_->radio_align_center, 1);
372 align = tabular->GetVAlignment(cell, true);
373 fl_set_button(column_options_->radio_valign_top, 0);
374 fl_set_button(column_options_->radio_valign_bottom, 0);
375 fl_set_button(column_options_->radio_valign_center, 0);
376 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
377 fl_set_button(column_options_->radio_valign_center, 1);
378 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
379 fl_set_button(column_options_->radio_valign_bottom, 1);
381 fl_set_button(column_options_->radio_valign_top, 1);
383 setEnabled(column_options_->radio_align_left, pwidth.zero());
384 setEnabled(column_options_->radio_align_right, pwidth.zero());
385 setEnabled(column_options_->radio_align_center, pwidth.zero());
387 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
388 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
389 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
391 fl_set_button(tabular_options_->check_longtable,
392 tabular->IsLongTabular());
394 bool const enable = tabular->IsLongTabular();
396 setEnabled(longtable_options_->check_lt_firsthead, enable);
397 setEnabled(longtable_options_->check_1head_2border_above, enable);
398 setEnabled(longtable_options_->check_1head_2border_below, enable);
399 setEnabled(longtable_options_->check_1head_empty, enable);
400 setEnabled(longtable_options_->check_lt_head, enable);
401 setEnabled(longtable_options_->check_head_2border_above, enable);
402 setEnabled(longtable_options_->check_head_2border_below, enable);
403 setEnabled(longtable_options_->check_lt_foot, enable);
404 setEnabled(longtable_options_->check_foot_2border_above, enable);
405 setEnabled(longtable_options_->check_foot_2border_below, enable);
406 setEnabled(longtable_options_->check_lt_lastfoot, enable);
407 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
408 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
409 setEnabled(longtable_options_->check_lastfoot_empty, enable);
410 setEnabled(longtable_options_->check_lt_newpage, enable);
413 LyXTabular::ltType ltt;
415 bool row_set = tabular->GetRowOfLTHead(row, ltt);
416 fl_set_button(longtable_options_->check_lt_head, row_set);
418 fl_set_button(longtable_options_->check_head_2border_above,
420 fl_set_button(longtable_options_->check_head_2border_above,
424 setEnabled(longtable_options_->check_head_2border_above, 0);
425 setEnabled(longtable_options_->check_head_2border_below, 0);
426 fl_set_button(longtable_options_->check_head_2border_above,0);
427 fl_set_button(longtable_options_->check_head_2border_above,0);
428 fl_set_button(longtable_options_->check_1head_empty,0);
429 setEnabled(longtable_options_->check_1head_empty, 0);
433 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
434 fl_set_button(longtable_options_->check_lt_firsthead, row_set);
435 if (ltt.set && (!ltt.empty || !use_empty)) {
436 fl_set_button(longtable_options_->check_1head_2border_above,
438 fl_set_button(longtable_options_->check_1head_2border_above,
441 setEnabled(longtable_options_->check_1head_2border_above, 0);
442 setEnabled(longtable_options_->check_1head_2border_below, 0);
443 fl_set_button(longtable_options_->check_1head_2border_above,0);
444 fl_set_button(longtable_options_->check_1head_2border_above,0);
446 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
448 setEnabled(longtable_options_->check_lt_firsthead, 0);
452 row_set = tabular->GetRowOfLTFoot(row, ltt);
453 fl_set_button(longtable_options_->check_lt_foot, row_set);
455 fl_set_button(longtable_options_->check_foot_2border_above,
457 fl_set_button(longtable_options_->check_foot_2border_above,
461 setEnabled(longtable_options_->check_foot_2border_above, 0);
462 setEnabled(longtable_options_->check_foot_2border_below, 0);
463 fl_set_button(longtable_options_->check_foot_2border_above,0);
464 fl_set_button(longtable_options_->check_foot_2border_above,0);
465 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
466 setEnabled(longtable_options_->check_lastfoot_empty, 0);
470 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
471 fl_set_button(longtable_options_->check_lt_lastfoot, row_set);
472 if (ltt.set && (!ltt.empty || !use_empty)) {
473 fl_set_button(longtable_options_->check_lastfoot_2border_above,
475 fl_set_button(longtable_options_->check_lastfoot_2border_above,
478 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
479 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
480 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
481 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
483 fl_set_button(longtable_options_->check_lastfoot_empty,
486 setEnabled(longtable_options_->check_lt_lastfoot, 0);
489 fl_set_button(longtable_options_->check_lt_newpage,
490 tabular->GetLTNewPage(row));
492 fl_set_button(longtable_options_->check_lt_firsthead, 0);
493 fl_set_button(longtable_options_->check_1head_2border_above, 0);
494 fl_set_button(longtable_options_->check_1head_2border_above, 0);
495 fl_set_button(longtable_options_->check_1head_empty, 0);
496 fl_set_button(longtable_options_->check_lt_head, 0);
497 fl_set_button(longtable_options_->check_head_2border_above, 0);
498 fl_set_button(longtable_options_->check_head_2border_above, 0);
499 fl_set_button(longtable_options_->check_lt_foot, 0);
500 fl_set_button(longtable_options_->check_foot_2border_above, 0);
501 fl_set_button(longtable_options_->check_foot_2border_above, 0);
502 fl_set_button(longtable_options_->check_lt_lastfoot, 0);
503 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
504 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
505 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
506 fl_set_button(longtable_options_->check_lt_newpage, 0);
508 fl_set_button(tabular_options_->check_rotate_tabular,
509 tabular->GetRotateTabular());
513 bool FormTabular::input(FL_OBJECT * ob, long)
519 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
522 int cell = inset_->getActCell();
524 // ugly hack to auto-apply the stuff that hasn't been
525 // yet. don't let this continue to exist ...
526 if (ob == dialog_->button_close) {
528 LyXTabular * tabular = inset_->tabular.get();
530 getLengthFromWidgets(column_options_->input_column_width,
531 column_options_->choice_value_column_width);
533 LyXLength llen = tabular->GetColumnPWidth(cell);
535 str2 = llen.asString();
537 input(column_options_->input_column_width, 0);
538 str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
539 cell_options_->choice_value_mcolumn_width);
540 llen = tabular->GetMColumnPWidth(cell);
544 str2 = llen.asString();
546 input(cell_options_->input_mcolumn_width, 0);
547 str1 = fl_get_input(column_options_->input_special_alignment);
548 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
550 input(column_options_->input_special_alignment, 0);
551 str1 = fl_get_input(cell_options_->input_special_multialign);
552 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
554 input(cell_options_->input_special_multialign, 0);
560 if (actCell_ != cell) {
562 postWarning(_("Wrong Cursor position, updated window"));
565 // No point in processing directives that you can't do anything with
566 // anyhow, so exit now if the buffer is read-only.
567 if (lv_->buffer()->isReadonly()) {
571 if ((ob == column_options_->input_column_width) ||
572 (ob == column_options_->choice_value_column_width)) {
574 getLengthFromWidgets(column_options_->input_column_width,
575 column_options_->choice_value_column_width);
576 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
578 //check if the input is valid
580 fl_get_input(column_options_->input_column_width);
581 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
582 postWarning(_("Invalid Length (valid example: 10mm)"));
586 update(); // update for alignment
590 if ((ob == cell_options_->input_mcolumn_width) ||
591 (ob == cell_options_->choice_value_mcolumn_width)) {
593 getLengthFromWidgets(cell_options_->input_mcolumn_width,
594 cell_options_->choice_value_mcolumn_width);
595 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
597 //check if the input is valid
599 fl_get_input(cell_options_->input_mcolumn_width);
600 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
601 postWarning(_("Invalid Length (valid example: 10mm)"));
604 update(); // update for alignment
608 if (ob == tabular_options_->button_append_row)
609 num = LyXTabular::APPEND_ROW;
610 else if (ob == tabular_options_->button_append_column)
611 num = LyXTabular::APPEND_COLUMN;
612 else if (ob == tabular_options_->button_delete_row)
613 num = LyXTabular::DELETE_ROW;
614 else if (ob == tabular_options_->button_delete_column)
615 num = LyXTabular::DELETE_COLUMN;
616 else if (ob == tabular_options_->button_set_borders)
617 num = LyXTabular::SET_ALL_LINES;
618 else if (ob == tabular_options_->button_unset_borders)
619 num = LyXTabular::UNSET_ALL_LINES;
620 else if (ob == column_options_->check_border_top)
621 num = LyXTabular::TOGGLE_LINE_TOP;
622 else if (ob == column_options_->check_border_bottom)
623 num = LyXTabular::TOGGLE_LINE_BOTTOM;
624 else if (ob == column_options_->check_border_left)
625 num = LyXTabular::TOGGLE_LINE_LEFT;
626 else if (ob == column_options_->check_border_right)
627 num = LyXTabular::TOGGLE_LINE_RIGHT;
628 else if (ob == column_options_->radio_align_left)
629 num = LyXTabular::ALIGN_LEFT;
630 else if (ob == column_options_->radio_align_right)
631 num = LyXTabular::ALIGN_RIGHT;
632 else if (ob == column_options_->radio_align_center)
633 num = LyXTabular::ALIGN_CENTER;
634 else if (ob == column_options_->radio_valign_top)
635 num = LyXTabular::VALIGN_TOP;
636 else if (ob == column_options_->radio_valign_bottom)
637 num = LyXTabular::VALIGN_BOTTOM;
638 else if (ob == column_options_->radio_valign_center)
639 num = LyXTabular::VALIGN_CENTER;
640 else if (ob == cell_options_->check_multicolumn)
641 num = LyXTabular::MULTICOLUMN;
642 else if (ob == tabular_options_->check_longtable) {
643 if (fl_get_button(tabular_options_->check_longtable))
644 num = LyXTabular::SET_LONGTABULAR;
646 num = LyXTabular::UNSET_LONGTABULAR;
647 } else if (ob == tabular_options_->check_rotate_tabular) {
648 s = fl_get_button(tabular_options_->check_rotate_tabular);
650 num = LyXTabular::SET_ROTATE_TABULAR;
652 num = LyXTabular::UNSET_ROTATE_TABULAR;
653 } else if (ob == cell_options_->check_rotate_cell) {
654 s = fl_get_button(cell_options_->check_rotate_cell);
656 num = LyXTabular::SET_ROTATE_CELL;
658 num = LyXTabular::UNSET_ROTATE_CELL;
659 } else if (ob == cell_options_->check_useminipage) {
660 num = LyXTabular::SET_USEBOX;
662 } else if ((ob == longtable_options_->check_lt_firsthead) ||
663 (ob == longtable_options_->check_1head_2border_above) ||
664 (ob == longtable_options_->check_1head_2border_below) ||
665 (ob == longtable_options_->check_1head_empty) ||
666 (ob == longtable_options_->check_lt_head) ||
667 (ob == longtable_options_->check_head_2border_above) ||
668 (ob == longtable_options_->check_head_2border_below) ||
669 (ob == longtable_options_->check_lt_foot) ||
670 (ob == longtable_options_->check_foot_2border_above) ||
671 (ob == longtable_options_->check_foot_2border_below) ||
672 (ob == longtable_options_->check_lt_lastfoot) ||
673 (ob == longtable_options_->check_lastfoot_2border_above) ||
674 (ob == longtable_options_->check_lastfoot_2border_below) ||
675 (ob == longtable_options_->check_lastfoot_empty)) {
676 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
677 } else if (ob == longtable_options_->check_lt_newpage) {
678 num = LyXTabular::SET_LTNEWPAGE;
679 } else if (ob == column_options_->input_special_alignment) {
680 special = fl_get_input(column_options_->input_special_alignment);
681 num = LyXTabular::SET_SPECIAL_COLUMN;
682 } else if (ob == cell_options_->input_special_multialign) {
683 special = fl_get_input(cell_options_->input_special_multialign);
684 num = LyXTabular::SET_SPECIAL_MULTI;
685 } else if (ob == cell_options_->check_border_top)
686 num = LyXTabular::M_TOGGLE_LINE_TOP;
687 else if (ob == cell_options_->check_border_bottom)
688 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
689 else if (ob == cell_options_->check_border_left)
690 num = LyXTabular::M_TOGGLE_LINE_LEFT;
691 else if (ob == cell_options_->check_border_right)
692 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
693 else if (ob == cell_options_->radio_align_left)
694 num = LyXTabular::M_ALIGN_LEFT;
695 else if (ob == cell_options_->radio_align_right)
696 num = LyXTabular::M_ALIGN_RIGHT;
697 else if (ob == cell_options_->radio_align_center)
698 num = LyXTabular::M_ALIGN_CENTER;
699 else if (ob == cell_options_->radio_valign_top)
700 num = LyXTabular::M_VALIGN_TOP;
701 else if (ob == cell_options_->radio_valign_bottom)
702 num = LyXTabular::M_VALIGN_BOTTOM;
703 else if (ob == cell_options_->radio_valign_center)
704 num = LyXTabular::M_VALIGN_CENTER;
708 inset_->tabularFeatures(lv_->view(), num, special);
714 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
716 bool flag = fl_get_button(ob);
717 if ((ob == longtable_options_->check_1head_2border_above) ||
718 (ob == longtable_options_->check_head_2border_above) ||
719 (ob == longtable_options_->check_foot_2border_above) ||
720 (ob == longtable_options_->check_lastfoot_2border_above)) {
721 special = "dl_above";
722 } else if ((ob == longtable_options_->check_1head_2border_below) ||
723 (ob == longtable_options_->check_head_2border_below) ||
724 (ob == longtable_options_->check_foot_2border_below) ||
725 (ob == longtable_options_->check_lastfoot_2border_below)) {
726 special = "dl_below";
727 } else if ((ob == longtable_options_->check_1head_empty) ||
728 (ob == longtable_options_->check_lastfoot_empty)) {
733 if ((ob == longtable_options_->check_lt_firsthead) ||
734 (ob == longtable_options_->check_1head_2border_above) ||
735 (ob == longtable_options_->check_1head_2border_below) ||
736 (ob == longtable_options_->check_1head_empty)) {
737 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
738 LyXTabular::UNSET_LTFIRSTHEAD);
739 } else if ((ob == longtable_options_->check_lt_head) ||
740 (ob == longtable_options_->check_head_2border_above) ||
741 (ob == longtable_options_->check_head_2border_below)) {
742 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
743 } else if ((ob == longtable_options_->check_lt_foot) ||
744 (ob == longtable_options_->check_foot_2border_above) ||
745 (ob == longtable_options_->check_foot_2border_below)) {
746 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
747 } else if ((ob == longtable_options_->check_lt_lastfoot) ||
748 (ob == longtable_options_->check_lastfoot_2border_above) ||
749 (ob == longtable_options_->check_lastfoot_2border_below) ||
750 (ob == longtable_options_->check_lastfoot_empty)) {
751 return (flag ? LyXTabular::SET_LTLASTFOOT :
752 LyXTabular::UNSET_LTLASTFOOT);
755 return LyXTabular::LAST_ACTION;