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());
114 // Allow the base class to control messages
115 setMessageWidget(dialog_->text_warning);
117 setPrehandler(dialog_->input_tabular_column);
118 setPrehandler(dialog_->input_tabular_row);
120 tabular_options_.reset(build_tabular_options());
121 column_options_.reset(build_column_options());
122 cell_options_.reset(build_cell_options());
123 longtable_options_.reset(build_longtable_options());
125 fl_set_input_return(column_options_->input_column_width,
127 fl_set_input_return(column_options_->input_special_alignment,
130 setPrehandler(column_options_->input_column_width);
131 setPrehandler(column_options_->input_special_alignment);
133 fl_set_input_return(cell_options_->input_mcolumn_width,
135 fl_set_input_return(cell_options_->input_special_multialign,
138 setPrehandler(cell_options_->input_mcolumn_width);
139 setPrehandler(cell_options_->input_special_multialign);
141 fl_addto_tabfolder(dialog_->tabfolder, _("Tabular"),
142 tabular_options_->form);
143 fl_addto_tabfolder(dialog_->tabfolder, _("Column/Row"),
144 column_options_->form);
145 fl_addto_tabfolder(dialog_->tabfolder, _("Cell"),
146 cell_options_->form);
147 fl_addto_tabfolder(dialog_->tabfolder, _("LongTable"),
148 longtable_options_->form);
150 // Create the contents of the unit choices
151 // Don't include the "%" terms...
152 vector<string> units_vec = getLatexUnits();
154 for (vector<string>::iterator it = units_vec.begin();
155 it != units_vec.end(); ++it) {
156 if (contains(*it, "%"))
157 it = units_vec.erase(it, it + 1) - 1;
160 vector<string>::iterator ret =
161 remove_if(units_vec.begin(), units_vec.end(),
162 bind2nd(contains_functor(), "%"));
163 units_vec.erase(ret, units_vec.end());
166 string units = getStringFromVector(units_vec, "|");
168 fl_addto_choice(column_options_->choice_value_column_width,
170 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
175 void FormTabular::update()
180 if (!inset_ || !inset_->tabular.get())
183 LyXTabular * tabular = inset_->tabular.get();
189 int cell = inset_->getActCell();
191 int column = tabular->column_of_cell(cell) + 1;
193 fl_activate_object(column_options_->input_special_alignment);
194 fl_activate_object(cell_options_->input_special_multialign);
195 fl_activate_object(column_options_->input_column_width);
196 fl_activate_object(column_options_->choice_value_column_width);
197 sprintf(buf, "%d", column);
198 fl_set_input(dialog_->input_tabular_column, buf);
199 fl_deactivate_object(dialog_->input_tabular_column);
200 int row = tabular->row_of_cell(cell);
201 sprintf(buf, "%d", row + 1);
202 fl_set_input(dialog_->input_tabular_row, buf);
203 fl_deactivate_object(dialog_->input_tabular_row);
204 if (tabular->IsMultiColumn(cell)) {
205 fl_set_button(cell_options_->check_multicolumn, 1);
206 fl_set_button(cell_options_->check_border_top,
207 tabular->TopLine(cell)?1:0);
208 setEnabled(cell_options_->check_border_top, true);
209 fl_set_button(cell_options_->check_border_bottom,
210 tabular->BottomLine(cell)?1:0);
211 setEnabled(cell_options_->check_border_bottom, true);
212 // pay attention to left/right lines they are only allowed
213 // to set if we are in first/last cell of row or if the left/right
214 // cell is also a multicolumn.
215 if (tabular->IsFirstCellInRow(cell) ||
216 tabular->IsMultiColumn(cell-1)) {
217 fl_set_button(cell_options_->check_border_left,
218 tabular->LeftLine(cell)?1:0);
219 setEnabled(cell_options_->check_border_left, true);
221 fl_set_button(cell_options_->check_border_left, 0);
222 setEnabled(cell_options_->check_border_left, false);
224 if (tabular->IsLastCellInRow(cell) ||
225 tabular->IsMultiColumn(cell+1)) {
226 fl_set_button(cell_options_->check_border_right,
227 tabular->RightLine(cell)?1:0);
228 setEnabled(cell_options_->check_border_right, true);
230 fl_set_button(cell_options_->check_border_right, 0);
231 setEnabled(cell_options_->check_border_right, false);
233 pwidth = tabular->GetMColumnPWidth(cell);
234 align = tabular->GetAlignment(cell);
235 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
236 fl_set_button(cell_options_->radio_align_left, 1);
237 else if (align == LYX_ALIGN_RIGHT)
238 fl_set_button(cell_options_->radio_align_right, 1);
240 fl_set_button(cell_options_->radio_align_center, 1);
242 align = tabular->GetVAlignment(cell);
243 fl_set_button(cell_options_->radio_valign_top, 0);
244 fl_set_button(cell_options_->radio_valign_bottom, 0);
245 fl_set_button(cell_options_->radio_valign_center, 0);
246 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
247 fl_set_button(cell_options_->radio_valign_center, 1);
248 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
249 fl_set_button(cell_options_->radio_valign_bottom, 1);
251 fl_set_button(cell_options_->radio_valign_top, 1);
253 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
254 fl_set_input(cell_options_->input_special_multialign, special.c_str());
255 bool const metric = lyxrc.default_papersize > 3;
256 string const default_unit = metric ? "cm" : "in";
257 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
258 cell_options_->choice_value_mcolumn_width,
259 pwidth, default_unit);
261 if (!lv_->buffer()->isReadonly()) {
262 setEnabled(cell_options_->input_special_multialign, true);
263 setEnabled(cell_options_->input_mcolumn_width, true);
264 setEnabled(cell_options_->choice_value_mcolumn_width, true);
267 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
268 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
269 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
271 setEnabled(cell_options_->radio_align_left, pwidth.zero());
272 setEnabled(cell_options_->radio_align_right, pwidth.zero());
273 setEnabled(cell_options_->radio_align_center, pwidth.zero());
275 fl_set_button(cell_options_->check_multicolumn, 0);
277 fl_set_button(cell_options_->check_border_top, 0);
278 setEnabled(cell_options_->check_border_top, false);
280 fl_set_button(cell_options_->check_border_bottom, 0);
281 setEnabled(cell_options_->check_border_bottom, false);
283 fl_set_button(cell_options_->check_border_left, 0);
284 setEnabled(cell_options_->check_border_left, false);
286 fl_set_button(cell_options_->check_border_right, 0);
287 setEnabled(cell_options_->check_border_right, false);
289 fl_set_button(cell_options_->radio_align_left, 0);
290 setEnabled(cell_options_->radio_align_left, false);
292 fl_set_button(cell_options_->radio_align_right, 0);
293 setEnabled(cell_options_->radio_align_right, false);
295 fl_set_button(cell_options_->radio_align_center, 0);
296 setEnabled(cell_options_->radio_align_center, false);
298 fl_set_button(cell_options_->radio_valign_top, 0);
299 setEnabled(cell_options_->radio_valign_top, false);
301 fl_set_button(cell_options_->radio_valign_bottom, 0);
302 setEnabled(cell_options_->radio_valign_bottom, false);
304 fl_set_button(cell_options_->radio_valign_center, 0);
305 setEnabled(cell_options_->radio_valign_center, false);
307 fl_set_input(cell_options_->input_special_multialign, "");
308 setEnabled(cell_options_->input_special_multialign, false);
310 fl_set_input(cell_options_->input_mcolumn_width, "");
311 setEnabled(cell_options_->input_mcolumn_width, false);
312 setEnabled(cell_options_->choice_value_mcolumn_width, false);
314 if (tabular->GetRotateCell(cell))
315 fl_set_button(cell_options_->check_rotate_cell, 1);
317 fl_set_button(cell_options_->check_rotate_cell, 0);
318 if (tabular->TopLine(cell, true))
319 fl_set_button(column_options_->check_border_top, 1);
321 fl_set_button(column_options_->check_border_top, 0);
322 if (tabular->BottomLine(cell, true))
323 fl_set_button(column_options_->check_border_bottom, 1);
325 fl_set_button(column_options_->check_border_bottom, 0);
326 if (tabular->LeftLine(cell, true))
327 fl_set_button(column_options_->check_border_left, 1);
329 fl_set_button(column_options_->check_border_left, 0);
330 if (tabular->RightLine(cell, true))
331 fl_set_button(column_options_->check_border_right, 1);
333 fl_set_button(column_options_->check_border_right, 0);
334 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
335 fl_set_input(column_options_->input_special_alignment, special.c_str());
337 bool const isReadonly = lv_->buffer()->isReadonly();
338 setEnabled(column_options_->input_special_alignment, !isReadonly);
340 pwidth = tabular->GetColumnPWidth(cell);
341 bool const metric = lyxrc.default_papersize > 3;
342 string const default_unit = metric ? "cm" : "in";
343 updateWidgetsFromLength(column_options_->input_column_width,
344 column_options_->choice_value_column_width,
345 pwidth, default_unit);
346 setEnabled(column_options_->input_column_width, !isReadonly);
347 setEnabled(column_options_->choice_value_column_width, !isReadonly);
349 setEnabled(cell_options_->check_useminipage, !pwidth.zero());
350 if (!pwidth.zero()) {
351 if (tabular->GetUsebox(cell) == 2)
352 fl_set_button(cell_options_->check_useminipage, 1);
354 fl_set_button(cell_options_->check_useminipage, 0);
356 fl_set_button(cell_options_->check_useminipage, 0);
358 align = tabular->GetAlignment(cell, true);
359 fl_set_button(column_options_->radio_align_left, 0);
360 fl_set_button(column_options_->radio_align_right, 0);
361 fl_set_button(column_options_->radio_align_center, 0);
362 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
363 fl_set_button(column_options_->radio_align_left, 1);
364 else if (align == LYX_ALIGN_RIGHT)
365 fl_set_button(column_options_->radio_align_right, 1);
367 fl_set_button(column_options_->radio_align_center, 1);
368 align = tabular->GetVAlignment(cell, true);
369 fl_set_button(column_options_->radio_valign_top, 0);
370 fl_set_button(column_options_->radio_valign_bottom, 0);
371 fl_set_button(column_options_->radio_valign_center, 0);
372 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
373 fl_set_button(column_options_->radio_valign_center, 1);
374 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
375 fl_set_button(column_options_->radio_valign_bottom, 1);
377 fl_set_button(column_options_->radio_valign_top, 1);
379 setEnabled(column_options_->radio_align_left, pwidth.zero());
380 setEnabled(column_options_->radio_align_right, pwidth.zero());
381 setEnabled(column_options_->radio_align_center, pwidth.zero());
383 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
384 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
385 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
387 fl_set_button(tabular_options_->check_longtable,
388 tabular->IsLongTabular());
390 bool const enable = tabular->IsLongTabular();
392 setEnabled(longtable_options_->check_lt_firsthead, enable);
393 setEnabled(longtable_options_->check_1head_2border_above, enable);
394 setEnabled(longtable_options_->check_1head_2border_below, enable);
395 setEnabled(longtable_options_->check_1head_empty, enable);
396 setEnabled(longtable_options_->check_lt_head, enable);
397 setEnabled(longtable_options_->check_head_2border_above, enable);
398 setEnabled(longtable_options_->check_head_2border_below, enable);
399 setEnabled(longtable_options_->check_lt_foot, enable);
400 setEnabled(longtable_options_->check_foot_2border_above, enable);
401 setEnabled(longtable_options_->check_foot_2border_below, enable);
402 setEnabled(longtable_options_->check_lt_lastfoot, enable);
403 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
404 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
405 setEnabled(longtable_options_->check_lastfoot_empty, enable);
406 setEnabled(longtable_options_->check_lt_newpage, enable);
409 LyXTabular::ltType ltt;
411 bool row_set = tabular->GetRowOfLTHead(row, ltt);
412 fl_set_button(longtable_options_->check_lt_head, row_set);
414 fl_set_button(longtable_options_->check_head_2border_above,
416 fl_set_button(longtable_options_->check_head_2border_above,
420 setEnabled(longtable_options_->check_head_2border_above, 0);
421 setEnabled(longtable_options_->check_head_2border_below, 0);
422 fl_set_button(longtable_options_->check_head_2border_above,0);
423 fl_set_button(longtable_options_->check_head_2border_above,0);
424 fl_set_button(longtable_options_->check_1head_empty,0);
425 setEnabled(longtable_options_->check_1head_empty, 0);
429 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
430 fl_set_button(longtable_options_->check_lt_firsthead, row_set);
431 if (ltt.set && (!ltt.empty || !use_empty)) {
432 fl_set_button(longtable_options_->check_1head_2border_above,
434 fl_set_button(longtable_options_->check_1head_2border_above,
437 setEnabled(longtable_options_->check_1head_2border_above, 0);
438 setEnabled(longtable_options_->check_1head_2border_below, 0);
439 fl_set_button(longtable_options_->check_1head_2border_above,0);
440 fl_set_button(longtable_options_->check_1head_2border_above,0);
442 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
444 setEnabled(longtable_options_->check_lt_firsthead, 0);
448 row_set = tabular->GetRowOfLTFoot(row, ltt);
449 fl_set_button(longtable_options_->check_lt_foot, row_set);
451 fl_set_button(longtable_options_->check_foot_2border_above,
453 fl_set_button(longtable_options_->check_foot_2border_above,
457 setEnabled(longtable_options_->check_foot_2border_above, 0);
458 setEnabled(longtable_options_->check_foot_2border_below, 0);
459 fl_set_button(longtable_options_->check_foot_2border_above,0);
460 fl_set_button(longtable_options_->check_foot_2border_above,0);
461 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
462 setEnabled(longtable_options_->check_lastfoot_empty, 0);
466 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
467 fl_set_button(longtable_options_->check_lt_lastfoot, row_set);
468 if (ltt.set && (!ltt.empty || !use_empty)) {
469 fl_set_button(longtable_options_->check_lastfoot_2border_above,
471 fl_set_button(longtable_options_->check_lastfoot_2border_above,
474 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
475 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
476 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
477 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
479 fl_set_button(longtable_options_->check_lastfoot_empty,
482 setEnabled(longtable_options_->check_lt_lastfoot, 0);
485 fl_set_button(longtable_options_->check_lt_newpage,
486 tabular->GetLTNewPage(row));
488 fl_set_button(longtable_options_->check_lt_firsthead, 0);
489 fl_set_button(longtable_options_->check_1head_2border_above, 0);
490 fl_set_button(longtable_options_->check_1head_2border_above, 0);
491 fl_set_button(longtable_options_->check_1head_empty, 0);
492 fl_set_button(longtable_options_->check_lt_head, 0);
493 fl_set_button(longtable_options_->check_head_2border_above, 0);
494 fl_set_button(longtable_options_->check_head_2border_above, 0);
495 fl_set_button(longtable_options_->check_lt_foot, 0);
496 fl_set_button(longtable_options_->check_foot_2border_above, 0);
497 fl_set_button(longtable_options_->check_foot_2border_above, 0);
498 fl_set_button(longtable_options_->check_lt_lastfoot, 0);
499 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
500 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
501 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
502 fl_set_button(longtable_options_->check_lt_newpage, 0);
504 fl_set_button(tabular_options_->check_rotate_tabular,
505 tabular->GetRotateTabular());
509 bool FormTabular::input(FL_OBJECT * ob, long)
515 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
518 int cell = inset_->getActCell();
520 // ugly hack to auto-apply the stuff that hasn't been
521 // yet. don't let this continue to exist ...
522 if (ob == dialog_->button_close) {
524 LyXTabular * tabular = inset_->tabular.get();
526 getLengthFromWidgets(column_options_->input_column_width,
527 column_options_->choice_value_column_width);
529 LyXLength llen = tabular->GetColumnPWidth(cell);
531 str2 = llen.asString();
533 input(column_options_->input_column_width, 0);
534 str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
535 cell_options_->choice_value_mcolumn_width);
536 llen = tabular->GetMColumnPWidth(cell);
540 str2 = llen.asString();
542 input(cell_options_->input_mcolumn_width, 0);
543 str1 = fl_get_input(column_options_->input_special_alignment);
544 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
546 input(column_options_->input_special_alignment, 0);
547 str1 = fl_get_input(cell_options_->input_special_multialign);
548 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
550 input(cell_options_->input_special_multialign, 0);
556 if (actCell_ != cell) {
558 postWarning(_("Wrong Cursor position, updated window"));
561 // No point in processing directives that you can't do anything with
562 // anyhow, so exit now if the buffer is read-only.
563 if (lv_->buffer()->isReadonly()) {
567 if ((ob == column_options_->input_column_width) ||
568 (ob == column_options_->choice_value_column_width)) {
570 getLengthFromWidgets(column_options_->input_column_width,
571 column_options_->choice_value_column_width);
572 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
574 //check if the input is valid
576 fl_get_input(column_options_->input_column_width);
577 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
578 postWarning(_("Invalid Length (valid example: 10mm)"));
582 update(); // update for alignment
586 if ((ob == cell_options_->input_mcolumn_width) ||
587 (ob == cell_options_->choice_value_mcolumn_width)) {
589 getLengthFromWidgets(cell_options_->input_mcolumn_width,
590 cell_options_->choice_value_mcolumn_width);
591 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
593 //check if the input is valid
595 fl_get_input(cell_options_->input_mcolumn_width);
596 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
597 postWarning(_("Invalid Length (valid example: 10mm)"));
600 update(); // update for alignment
604 if (ob == tabular_options_->button_append_row)
605 num = LyXTabular::APPEND_ROW;
606 else if (ob == tabular_options_->button_append_column)
607 num = LyXTabular::APPEND_COLUMN;
608 else if (ob == tabular_options_->button_delete_row)
609 num = LyXTabular::DELETE_ROW;
610 else if (ob == tabular_options_->button_delete_column)
611 num = LyXTabular::DELETE_COLUMN;
612 else if (ob == tabular_options_->button_set_borders)
613 num = LyXTabular::SET_ALL_LINES;
614 else if (ob == tabular_options_->button_unset_borders)
615 num = LyXTabular::UNSET_ALL_LINES;
616 else if (ob == column_options_->check_border_top)
617 num = LyXTabular::TOGGLE_LINE_TOP;
618 else if (ob == column_options_->check_border_bottom)
619 num = LyXTabular::TOGGLE_LINE_BOTTOM;
620 else if (ob == column_options_->check_border_left)
621 num = LyXTabular::TOGGLE_LINE_LEFT;
622 else if (ob == column_options_->check_border_right)
623 num = LyXTabular::TOGGLE_LINE_RIGHT;
624 else if (ob == column_options_->radio_align_left)
625 num = LyXTabular::ALIGN_LEFT;
626 else if (ob == column_options_->radio_align_right)
627 num = LyXTabular::ALIGN_RIGHT;
628 else if (ob == column_options_->radio_align_center)
629 num = LyXTabular::ALIGN_CENTER;
630 else if (ob == column_options_->radio_valign_top)
631 num = LyXTabular::VALIGN_TOP;
632 else if (ob == column_options_->radio_valign_bottom)
633 num = LyXTabular::VALIGN_BOTTOM;
634 else if (ob == column_options_->radio_valign_center)
635 num = LyXTabular::VALIGN_CENTER;
636 else if (ob == cell_options_->check_multicolumn)
637 num = LyXTabular::MULTICOLUMN;
638 else if (ob == tabular_options_->check_longtable) {
639 if (fl_get_button(tabular_options_->check_longtable))
640 num = LyXTabular::SET_LONGTABULAR;
642 num = LyXTabular::UNSET_LONGTABULAR;
643 } else if (ob == tabular_options_->check_rotate_tabular) {
644 s = fl_get_button(tabular_options_->check_rotate_tabular);
646 num = LyXTabular::SET_ROTATE_TABULAR;
648 num = LyXTabular::UNSET_ROTATE_TABULAR;
649 } else if (ob == cell_options_->check_rotate_cell) {
650 s = fl_get_button(cell_options_->check_rotate_cell);
652 num = LyXTabular::SET_ROTATE_CELL;
654 num = LyXTabular::UNSET_ROTATE_CELL;
655 } else if (ob == cell_options_->check_useminipage) {
656 num = LyXTabular::SET_USEBOX;
658 } else if ((ob == longtable_options_->check_lt_firsthead) ||
659 (ob == longtable_options_->check_1head_2border_above) ||
660 (ob == longtable_options_->check_1head_2border_below) ||
661 (ob == longtable_options_->check_1head_empty) ||
662 (ob == longtable_options_->check_lt_head) ||
663 (ob == longtable_options_->check_head_2border_above) ||
664 (ob == longtable_options_->check_head_2border_below) ||
665 (ob == longtable_options_->check_lt_foot) ||
666 (ob == longtable_options_->check_foot_2border_above) ||
667 (ob == longtable_options_->check_foot_2border_below) ||
668 (ob == longtable_options_->check_lt_lastfoot) ||
669 (ob == longtable_options_->check_lastfoot_2border_above) ||
670 (ob == longtable_options_->check_lastfoot_2border_below) ||
671 (ob == longtable_options_->check_lastfoot_empty)) {
672 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
673 } else if (ob == longtable_options_->check_lt_newpage) {
674 num = LyXTabular::SET_LTNEWPAGE;
675 } else if (ob == column_options_->input_special_alignment) {
676 special = fl_get_input(column_options_->input_special_alignment);
677 num = LyXTabular::SET_SPECIAL_COLUMN;
678 } else if (ob == cell_options_->input_special_multialign) {
679 special = fl_get_input(cell_options_->input_special_multialign);
680 num = LyXTabular::SET_SPECIAL_MULTI;
681 } else if (ob == cell_options_->check_border_top)
682 num = LyXTabular::M_TOGGLE_LINE_TOP;
683 else if (ob == cell_options_->check_border_bottom)
684 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
685 else if (ob == cell_options_->check_border_left)
686 num = LyXTabular::M_TOGGLE_LINE_LEFT;
687 else if (ob == cell_options_->check_border_right)
688 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
689 else if (ob == cell_options_->radio_align_left)
690 num = LyXTabular::M_ALIGN_LEFT;
691 else if (ob == cell_options_->radio_align_right)
692 num = LyXTabular::M_ALIGN_RIGHT;
693 else if (ob == cell_options_->radio_align_center)
694 num = LyXTabular::M_ALIGN_CENTER;
695 else if (ob == cell_options_->radio_valign_top)
696 num = LyXTabular::M_VALIGN_TOP;
697 else if (ob == cell_options_->radio_valign_bottom)
698 num = LyXTabular::M_VALIGN_BOTTOM;
699 else if (ob == cell_options_->radio_valign_center)
700 num = LyXTabular::M_VALIGN_CENTER;
704 inset_->tabularFeatures(lv_->view(), num, special);
710 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
712 bool flag = fl_get_button(ob);
713 if ((ob == longtable_options_->check_1head_2border_above) ||
714 (ob == longtable_options_->check_head_2border_above) ||
715 (ob == longtable_options_->check_foot_2border_above) ||
716 (ob == longtable_options_->check_lastfoot_2border_above)) {
717 special = "dl_above";
718 } else if ((ob == longtable_options_->check_1head_2border_below) ||
719 (ob == longtable_options_->check_head_2border_below) ||
720 (ob == longtable_options_->check_foot_2border_below) ||
721 (ob == longtable_options_->check_lastfoot_2border_below)) {
722 special = "dl_below";
723 } else if ((ob == longtable_options_->check_1head_empty) ||
724 (ob == longtable_options_->check_lastfoot_empty)) {
729 if ((ob == longtable_options_->check_lt_firsthead) ||
730 (ob == longtable_options_->check_1head_2border_above) ||
731 (ob == longtable_options_->check_1head_2border_below) ||
732 (ob == longtable_options_->check_1head_empty)) {
733 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
734 LyXTabular::UNSET_LTFIRSTHEAD);
735 } else if ((ob == longtable_options_->check_lt_head) ||
736 (ob == longtable_options_->check_head_2border_above) ||
737 (ob == longtable_options_->check_head_2border_below)) {
738 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
739 } else if ((ob == longtable_options_->check_lt_foot) ||
740 (ob == longtable_options_->check_foot_2border_above) ||
741 (ob == longtable_options_->check_foot_2border_below)) {
742 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
743 } else if ((ob == longtable_options_->check_lt_lastfoot) ||
744 (ob == longtable_options_->check_lastfoot_2border_above) ||
745 (ob == longtable_options_->check_lastfoot_2border_below) ||
746 (ob == longtable_options_->check_lastfoot_empty)) {
747 return (flag ? LyXTabular::SET_LTLASTFOOT :
748 LyXTabular::UNSET_LTLASTFOOT);
751 return LyXTabular::LAST_ACTION;