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)
157 if (contains(*it, "%"))
158 it = units_vec.erase(it, it + 1) - 1;
161 vector<string>::iterator ret =
162 remove_if(units_vec.begin(), units_vec.end(),
163 bind2nd(contains_functor(), "%"));
164 units_vec.erase(ret, units_vec.end());
167 string units = getStringFromVector(units_vec, "|");
169 fl_addto_choice(column_options_->choice_value_column_width,
171 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
176 void FormTabular::update()
181 if (!inset_ || !inset_->tabular.get())
184 LyXTabular * tabular = inset_->tabular.get();
190 int cell = inset_->getActCell();
192 int column = tabular->column_of_cell(cell) + 1;
194 fl_activate_object(column_options_->input_special_alignment);
195 fl_activate_object(cell_options_->input_special_multialign);
196 fl_activate_object(column_options_->input_column_width);
197 fl_activate_object(column_options_->choice_value_column_width);
198 sprintf(buf, "%d", column);
199 fl_set_input(dialog_->input_tabular_column, buf);
200 fl_deactivate_object(dialog_->input_tabular_column);
201 int row = tabular->row_of_cell(cell);
202 sprintf(buf, "%d", row + 1);
203 fl_set_input(dialog_->input_tabular_row, buf);
204 fl_deactivate_object(dialog_->input_tabular_row);
205 if (tabular->IsMultiColumn(cell)) {
206 fl_set_button(cell_options_->check_multicolumn, 1);
207 fl_set_button(cell_options_->check_border_top,
208 tabular->TopLine(cell)?1:0);
209 setEnabled(cell_options_->check_border_top, true);
210 fl_set_button(cell_options_->check_border_bottom,
211 tabular->BottomLine(cell)?1:0);
212 setEnabled(cell_options_->check_border_bottom, true);
213 // pay attention to left/right lines they are only allowed
214 // to set if we are in first/last cell of row or if the left/right
215 // cell is also a multicolumn.
216 if (tabular->IsFirstCellInRow(cell) ||
217 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))
229 fl_set_button(cell_options_->check_border_right,
230 tabular->RightLine(cell)?1:0);
231 setEnabled(cell_options_->check_border_right, true);
233 fl_set_button(cell_options_->check_border_right, 0);
234 setEnabled(cell_options_->check_border_right, false);
236 pwidth = tabular->GetMColumnPWidth(cell);
237 align = tabular->GetAlignment(cell);
238 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
239 fl_set_button(cell_options_->radio_align_left, 1);
240 else if (align == LYX_ALIGN_RIGHT)
241 fl_set_button(cell_options_->radio_align_right, 1);
243 fl_set_button(cell_options_->radio_align_center, 1);
245 align = tabular->GetVAlignment(cell);
246 fl_set_button(cell_options_->radio_valign_top, 0);
247 fl_set_button(cell_options_->radio_valign_bottom, 0);
248 fl_set_button(cell_options_->radio_valign_center, 0);
249 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
250 fl_set_button(cell_options_->radio_valign_center, 1);
251 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
252 fl_set_button(cell_options_->radio_valign_bottom, 1);
254 fl_set_button(cell_options_->radio_valign_top, 1);
256 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
257 fl_set_input(cell_options_->input_special_multialign, special.c_str());
258 bool const metric = lyxrc.default_papersize > 3;
259 string const default_unit = metric ? "cm" : "in";
260 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
261 cell_options_->choice_value_mcolumn_width,
262 pwidth, default_unit);
264 if (!lv_->buffer()->isReadonly()) {
265 setEnabled(cell_options_->input_special_multialign, true);
266 setEnabled(cell_options_->input_mcolumn_width, true);
267 setEnabled(cell_options_->choice_value_mcolumn_width, true);
270 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
271 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
272 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
274 setEnabled(cell_options_->radio_align_left, pwidth.zero());
275 setEnabled(cell_options_->radio_align_right, pwidth.zero());
276 setEnabled(cell_options_->radio_align_center, pwidth.zero());
278 fl_set_button(cell_options_->check_multicolumn, 0);
280 fl_set_button(cell_options_->check_border_top, 0);
281 setEnabled(cell_options_->check_border_top, false);
283 fl_set_button(cell_options_->check_border_bottom, 0);
284 setEnabled(cell_options_->check_border_bottom, false);
286 fl_set_button(cell_options_->check_border_left, 0);
287 setEnabled(cell_options_->check_border_left, false);
289 fl_set_button(cell_options_->check_border_right, 0);
290 setEnabled(cell_options_->check_border_right, false);
292 fl_set_button(cell_options_->radio_align_left, 0);
293 setEnabled(cell_options_->radio_align_left, false);
295 fl_set_button(cell_options_->radio_align_right, 0);
296 setEnabled(cell_options_->radio_align_right, false);
298 fl_set_button(cell_options_->radio_align_center, 0);
299 setEnabled(cell_options_->radio_align_center, false);
301 fl_set_button(cell_options_->radio_valign_top, 0);
302 setEnabled(cell_options_->radio_valign_top, false);
304 fl_set_button(cell_options_->radio_valign_bottom, 0);
305 setEnabled(cell_options_->radio_valign_bottom, false);
307 fl_set_button(cell_options_->radio_valign_center, 0);
308 setEnabled(cell_options_->radio_valign_center, false);
310 fl_set_input(cell_options_->input_special_multialign, "");
311 setEnabled(cell_options_->input_special_multialign, false);
313 fl_set_input(cell_options_->input_mcolumn_width, "");
314 setEnabled(cell_options_->input_mcolumn_width, false);
315 setEnabled(cell_options_->choice_value_mcolumn_width, false);
317 if (tabular->GetRotateCell(cell))
318 fl_set_button(cell_options_->check_rotate_cell, 1);
320 fl_set_button(cell_options_->check_rotate_cell, 0);
321 if (tabular->TopLine(cell, true))
322 fl_set_button(column_options_->check_border_top, 1);
324 fl_set_button(column_options_->check_border_top, 0);
325 if (tabular->BottomLine(cell, true))
326 fl_set_button(column_options_->check_border_bottom, 1);
328 fl_set_button(column_options_->check_border_bottom, 0);
329 if (tabular->LeftLine(cell, true))
330 fl_set_button(column_options_->check_border_left, 1);
332 fl_set_button(column_options_->check_border_left, 0);
333 if (tabular->RightLine(cell, true))
334 fl_set_button(column_options_->check_border_right, 1);
336 fl_set_button(column_options_->check_border_right, 0);
337 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
338 fl_set_input(column_options_->input_special_alignment, special.c_str());
340 bool const isReadonly = lv_->buffer()->isReadonly();
341 setEnabled(column_options_->input_special_alignment, !isReadonly);
343 pwidth = tabular->GetColumnPWidth(cell);
344 bool const metric = lyxrc.default_papersize > 3;
345 string const default_unit = metric ? "cm" : "in";
346 updateWidgetsFromLength(column_options_->input_column_width,
347 column_options_->choice_value_column_width,
348 pwidth, default_unit);
349 setEnabled(column_options_->input_column_width, !isReadonly);
350 setEnabled(column_options_->choice_value_column_width, !isReadonly);
352 setEnabled(cell_options_->check_useminipage, !pwidth.zero());
353 if (!pwidth.zero()) {
354 if (tabular->GetUsebox(cell) == 2)
355 fl_set_button(cell_options_->check_useminipage, 1);
357 fl_set_button(cell_options_->check_useminipage, 0);
359 fl_set_button(cell_options_->check_useminipage, 0);
361 align = tabular->GetAlignment(cell, true);
362 fl_set_button(column_options_->radio_align_left, 0);
363 fl_set_button(column_options_->radio_align_right, 0);
364 fl_set_button(column_options_->radio_align_center, 0);
365 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
366 fl_set_button(column_options_->radio_align_left, 1);
367 else if (align == LYX_ALIGN_RIGHT)
368 fl_set_button(column_options_->radio_align_right, 1);
370 fl_set_button(column_options_->radio_align_center, 1);
371 align = tabular->GetVAlignment(cell, true);
372 fl_set_button(column_options_->radio_valign_top, 0);
373 fl_set_button(column_options_->radio_valign_bottom, 0);
374 fl_set_button(column_options_->radio_valign_center, 0);
375 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
376 fl_set_button(column_options_->radio_valign_center, 1);
377 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
378 fl_set_button(column_options_->radio_valign_bottom, 1);
380 fl_set_button(column_options_->radio_valign_top, 1);
382 setEnabled(column_options_->radio_align_left, pwidth.zero());
383 setEnabled(column_options_->radio_align_right, pwidth.zero());
384 setEnabled(column_options_->radio_align_center, pwidth.zero());
386 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
387 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
388 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
390 fl_set_button(tabular_options_->check_longtable,
391 tabular->IsLongTabular());
393 bool const enable = tabular->IsLongTabular();
395 setEnabled(longtable_options_->check_lt_firsthead, enable);
396 setEnabled(longtable_options_->check_1head_2border_above, enable);
397 setEnabled(longtable_options_->check_1head_2border_below, enable);
398 setEnabled(longtable_options_->check_1head_empty, enable);
399 setEnabled(longtable_options_->check_lt_head, enable);
400 setEnabled(longtable_options_->check_head_2border_above, enable);
401 setEnabled(longtable_options_->check_head_2border_below, enable);
402 setEnabled(longtable_options_->check_lt_foot, enable);
403 setEnabled(longtable_options_->check_foot_2border_above, enable);
404 setEnabled(longtable_options_->check_foot_2border_below, enable);
405 setEnabled(longtable_options_->check_lt_lastfoot, enable);
406 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
407 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
408 setEnabled(longtable_options_->check_lastfoot_empty, enable);
409 setEnabled(longtable_options_->check_lt_newpage, enable);
412 LyXTabular::ltType ltt;
414 bool row_set = tabular->GetRowOfLTHead(row, ltt);
415 fl_set_button(longtable_options_->check_lt_head, row_set);
417 fl_set_button(longtable_options_->check_head_2border_above,
419 fl_set_button(longtable_options_->check_head_2border_above,
423 setEnabled(longtable_options_->check_head_2border_above, 0);
424 setEnabled(longtable_options_->check_head_2border_below, 0);
425 fl_set_button(longtable_options_->check_head_2border_above,0);
426 fl_set_button(longtable_options_->check_head_2border_above,0);
427 fl_set_button(longtable_options_->check_1head_empty,0);
428 setEnabled(longtable_options_->check_1head_empty, 0);
432 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
433 fl_set_button(longtable_options_->check_lt_firsthead, row_set);
434 if (ltt.set && (!ltt.empty || !use_empty)) {
435 fl_set_button(longtable_options_->check_1head_2border_above,
437 fl_set_button(longtable_options_->check_1head_2border_above,
440 setEnabled(longtable_options_->check_1head_2border_above, 0);
441 setEnabled(longtable_options_->check_1head_2border_below, 0);
442 fl_set_button(longtable_options_->check_1head_2border_above,0);
443 fl_set_button(longtable_options_->check_1head_2border_above,0);
445 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
447 setEnabled(longtable_options_->check_lt_firsthead, 0);
451 row_set = tabular->GetRowOfLTFoot(row, ltt);
452 fl_set_button(longtable_options_->check_lt_foot, row_set);
454 fl_set_button(longtable_options_->check_foot_2border_above,
456 fl_set_button(longtable_options_->check_foot_2border_above,
460 setEnabled(longtable_options_->check_foot_2border_above, 0);
461 setEnabled(longtable_options_->check_foot_2border_below, 0);
462 fl_set_button(longtable_options_->check_foot_2border_above,0);
463 fl_set_button(longtable_options_->check_foot_2border_above,0);
464 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
465 setEnabled(longtable_options_->check_lastfoot_empty, 0);
469 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
470 fl_set_button(longtable_options_->check_lt_lastfoot, row_set);
471 if (ltt.set && (!ltt.empty || !use_empty)) {
472 fl_set_button(longtable_options_->check_lastfoot_2border_above,
474 fl_set_button(longtable_options_->check_lastfoot_2border_above,
477 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
478 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
479 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
480 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
482 fl_set_button(longtable_options_->check_lastfoot_empty,
485 setEnabled(longtable_options_->check_lt_lastfoot, 0);
488 fl_set_button(longtable_options_->check_lt_newpage,
489 tabular->GetLTNewPage(row));
491 fl_set_button(longtable_options_->check_lt_firsthead, 0);
492 fl_set_button(longtable_options_->check_1head_2border_above, 0);
493 fl_set_button(longtable_options_->check_1head_2border_above, 0);
494 fl_set_button(longtable_options_->check_1head_empty, 0);
495 fl_set_button(longtable_options_->check_lt_head, 0);
496 fl_set_button(longtable_options_->check_head_2border_above, 0);
497 fl_set_button(longtable_options_->check_head_2border_above, 0);
498 fl_set_button(longtable_options_->check_lt_foot, 0);
499 fl_set_button(longtable_options_->check_foot_2border_above, 0);
500 fl_set_button(longtable_options_->check_foot_2border_above, 0);
501 fl_set_button(longtable_options_->check_lt_lastfoot, 0);
502 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
503 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
504 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
505 fl_set_button(longtable_options_->check_lt_newpage, 0);
507 fl_set_button(tabular_options_->check_rotate_tabular,
508 tabular->GetRotateTabular());
512 bool FormTabular::input(FL_OBJECT * ob, long)
518 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
521 int cell = inset_->getActCell();
523 // ugly hack to auto-apply the stuff that hasn't been
524 // yet. don't let this continue to exist ...
525 if (ob == dialog_->button_close) {
527 LyXTabular * tabular = inset_->tabular.get();
529 getLengthFromWidgets(column_options_->input_column_width,
530 column_options_->choice_value_column_width);
532 LyXLength llen = tabular->GetColumnPWidth(cell);
534 str2 = llen.asString();
536 input(column_options_->input_column_width, 0);
537 str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
538 cell_options_->choice_value_mcolumn_width);
539 llen = tabular->GetMColumnPWidth(cell);
543 str2 = llen.asString();
545 input(cell_options_->input_mcolumn_width, 0);
546 str1 = fl_get_input(column_options_->input_special_alignment);
547 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
549 input(column_options_->input_special_alignment, 0);
550 str1 = fl_get_input(cell_options_->input_special_multialign);
551 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
553 input(cell_options_->input_special_multialign, 0);
559 if (actCell_ != cell) {
561 postWarning(_("Wrong Cursor position, updated window"));
564 // No point in processing directives that you can't do anything with
565 // anyhow, so exit now if the buffer is read-only.
566 if (lv_->buffer()->isReadonly()) {
570 if ((ob == column_options_->input_column_width) ||
571 (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))
594 getLengthFromWidgets(cell_options_->input_mcolumn_width,
595 cell_options_->choice_value_mcolumn_width);
596 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
598 //check if the input is valid
600 fl_get_input(cell_options_->input_mcolumn_width);
601 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
602 postWarning(_("Invalid Length (valid example: 10mm)"));
605 update(); // update for alignment
609 if (ob == tabular_options_->button_append_row)
610 num = LyXTabular::APPEND_ROW;
611 else if (ob == tabular_options_->button_append_column)
612 num = LyXTabular::APPEND_COLUMN;
613 else if (ob == tabular_options_->button_delete_row)
614 num = LyXTabular::DELETE_ROW;
615 else if (ob == tabular_options_->button_delete_column)
616 num = LyXTabular::DELETE_COLUMN;
617 else if (ob == tabular_options_->button_set_borders)
618 num = LyXTabular::SET_ALL_LINES;
619 else if (ob == tabular_options_->button_unset_borders)
620 num = LyXTabular::UNSET_ALL_LINES;
621 else if (ob == column_options_->check_border_top)
622 num = LyXTabular::TOGGLE_LINE_TOP;
623 else if (ob == column_options_->check_border_bottom)
624 num = LyXTabular::TOGGLE_LINE_BOTTOM;
625 else if (ob == column_options_->check_border_left)
626 num = LyXTabular::TOGGLE_LINE_LEFT;
627 else if (ob == column_options_->check_border_right)
628 num = LyXTabular::TOGGLE_LINE_RIGHT;
629 else if (ob == column_options_->radio_align_left)
630 num = LyXTabular::ALIGN_LEFT;
631 else if (ob == column_options_->radio_align_right)
632 num = LyXTabular::ALIGN_RIGHT;
633 else if (ob == column_options_->radio_align_center)
634 num = LyXTabular::ALIGN_CENTER;
635 else if (ob == column_options_->radio_valign_top)
636 num = LyXTabular::VALIGN_TOP;
637 else if (ob == column_options_->radio_valign_bottom)
638 num = LyXTabular::VALIGN_BOTTOM;
639 else if (ob == column_options_->radio_valign_center)
640 num = LyXTabular::VALIGN_CENTER;
641 else if (ob == cell_options_->check_multicolumn)
642 num = LyXTabular::MULTICOLUMN;
643 else if (ob == tabular_options_->check_longtable) {
644 if (fl_get_button(tabular_options_->check_longtable))
645 num = LyXTabular::SET_LONGTABULAR;
647 num = LyXTabular::UNSET_LONGTABULAR;
648 } else if (ob == tabular_options_->check_rotate_tabular) {
649 s = fl_get_button(tabular_options_->check_rotate_tabular);
651 num = LyXTabular::SET_ROTATE_TABULAR;
653 num = LyXTabular::UNSET_ROTATE_TABULAR;
654 } else if (ob == cell_options_->check_rotate_cell) {
655 s = fl_get_button(cell_options_->check_rotate_cell);
657 num = LyXTabular::SET_ROTATE_CELL;
659 num = LyXTabular::UNSET_ROTATE_CELL;
660 } else if (ob == cell_options_->check_useminipage) {
661 num = LyXTabular::SET_USEBOX;
663 } else if ((ob == longtable_options_->check_lt_firsthead) ||
664 (ob == longtable_options_->check_1head_2border_above) ||
665 (ob == longtable_options_->check_1head_2border_below) ||
666 (ob == longtable_options_->check_1head_empty) ||
667 (ob == longtable_options_->check_lt_head) ||
668 (ob == longtable_options_->check_head_2border_above) ||
669 (ob == longtable_options_->check_head_2border_below) ||
670 (ob == longtable_options_->check_lt_foot) ||
671 (ob == longtable_options_->check_foot_2border_above) ||
672 (ob == longtable_options_->check_foot_2border_below) ||
673 (ob == longtable_options_->check_lt_lastfoot) ||
674 (ob == longtable_options_->check_lastfoot_2border_above) ||
675 (ob == longtable_options_->check_lastfoot_2border_below) ||
676 (ob == longtable_options_->check_lastfoot_empty))
678 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
679 } else if (ob == longtable_options_->check_lt_newpage) {
680 num = LyXTabular::SET_LTNEWPAGE;
681 } else if (ob == column_options_->input_special_alignment) {
682 special = fl_get_input(column_options_->input_special_alignment);
683 num = LyXTabular::SET_SPECIAL_COLUMN;
684 } else if (ob == cell_options_->input_special_multialign) {
685 special = fl_get_input(cell_options_->input_special_multialign);
686 num = LyXTabular::SET_SPECIAL_MULTI;
687 } else if (ob == cell_options_->check_border_top)
688 num = LyXTabular::M_TOGGLE_LINE_TOP;
689 else if (ob == cell_options_->check_border_bottom)
690 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
691 else if (ob == cell_options_->check_border_left)
692 num = LyXTabular::M_TOGGLE_LINE_LEFT;
693 else if (ob == cell_options_->check_border_right)
694 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
695 else if (ob == cell_options_->radio_align_left)
696 num = LyXTabular::M_ALIGN_LEFT;
697 else if (ob == cell_options_->radio_align_right)
698 num = LyXTabular::M_ALIGN_RIGHT;
699 else if (ob == cell_options_->radio_align_center)
700 num = LyXTabular::M_ALIGN_CENTER;
701 else if (ob == cell_options_->radio_valign_top)
702 num = LyXTabular::M_VALIGN_TOP;
703 else if (ob == cell_options_->radio_valign_bottom)
704 num = LyXTabular::M_VALIGN_BOTTOM;
705 else if (ob == cell_options_->radio_valign_center)
706 num = LyXTabular::M_VALIGN_CENTER;
710 inset_->tabularFeatures(lv_->view(), num, special);
716 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
718 bool flag = fl_get_button(ob);
719 if ((ob == longtable_options_->check_1head_2border_above) ||
720 (ob == longtable_options_->check_head_2border_above) ||
721 (ob == longtable_options_->check_foot_2border_above) ||
722 (ob == longtable_options_->check_lastfoot_2border_above))
724 special = "dl_above";
725 } else if ((ob == longtable_options_->check_1head_2border_below) ||
726 (ob == longtable_options_->check_head_2border_below) ||
727 (ob == longtable_options_->check_foot_2border_below) ||
728 (ob == longtable_options_->check_lastfoot_2border_below))
730 special = "dl_below";
731 } else if ((ob == longtable_options_->check_1head_empty) ||
732 (ob == longtable_options_->check_lastfoot_empty))
738 if ((ob == longtable_options_->check_lt_firsthead) ||
739 (ob == longtable_options_->check_1head_2border_above) ||
740 (ob == longtable_options_->check_1head_2border_below) ||
741 (ob == longtable_options_->check_1head_empty))
743 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
744 LyXTabular::UNSET_LTFIRSTHEAD);
745 } else if ((ob == longtable_options_->check_lt_head) ||
746 (ob == longtable_options_->check_head_2border_above) ||
747 (ob == longtable_options_->check_head_2border_below))
749 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
750 } else if ((ob == longtable_options_->check_lt_foot) ||
751 (ob == longtable_options_->check_foot_2border_above) ||
752 (ob == longtable_options_->check_foot_2border_below))
754 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
755 } else if ((ob == longtable_options_->check_lt_lastfoot) ||
756 (ob == longtable_options_->check_lastfoot_2border_above) ||
757 (ob == longtable_options_->check_lastfoot_2border_below) ||
758 (ob == longtable_options_->check_lastfoot_empty))
760 return (flag ? LyXTabular::SET_LTLASTFOOT :
761 LyXTabular::UNSET_LTLASTFOOT);
763 return LyXTabular::LAST_ACTION;