3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
17 #include "ControlTabular.h"
19 #include "ButtonController.h"
20 #include "insets/insettabular.h"
22 #include "FormTabular.h"
23 #include "forms/form_tabular.h"
25 #include "xforms_helpers.h"
28 #include "helper_funcs.h"
29 #include "input_validators.h"
30 #include "support/lstrings.h"
32 #include "lyx_forms.h"
40 #if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
41 bool const scalableTabfolders = false;
43 bool const scalableTabfolders = true;
49 typedef FormController<ControlTabular, FormView<FD_tabular> > base_class;
51 FormTabular::FormTabular(Dialog & parent)
52 : base_class(parent, _("Table Settings"), scalableTabfolders),
53 closing_(false), actCell_(-1)
58 void FormTabular::redraw()
60 if (form() && form()->visible)
61 fl_redraw_form(form());
65 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabfolder);
66 if (outer_form && outer_form->visible)
67 fl_redraw_form(outer_form);
71 void FormTabular::build()
73 dialog_.reset(build_tabular(this));
75 // Allow the base class to control messages
76 setMessageWidget(dialog_->text_warning);
78 // trigger an input event for cut&paste with middle mouse button.
79 setPrehandler(dialog_->input_tabular_column);
80 setPrehandler(dialog_->input_tabular_row);
82 // Create the contents of the unit choices; don't include the "%" terms.
83 vector<string> units_vec = getLatexUnits();
84 vector<string>::iterator ret =
85 remove_if(units_vec.begin(), units_vec.end(),
86 bind2nd(contains_functor(), "%"));
87 units_vec.erase(ret, units_vec.end());
88 string const units = getStringFromVector(units_vec, "|");
90 // tabular options form
91 tabular_options_.reset(build_tabular_options(this));
93 // column options form
94 column_options_.reset(build_tabular_column(this));
96 fl_set_input_return(column_options_->input_column_width,
98 fl_set_input_return(column_options_->input_special_alignment,
101 // trigger an input event for cut&paste with middle mouse button.
102 setPrehandler(column_options_->input_column_width);
103 setPrehandler(column_options_->input_special_alignment);
105 fl_addto_choice(column_options_->choice_value_column_width,
109 cell_options_.reset(build_tabular_cell(this));
111 fl_set_input_return(cell_options_->input_mcolumn_width,
113 fl_set_input_return(cell_options_->input_special_multialign,
116 // trigger an input event for cut&paste with middle mouse button.
117 setPrehandler(cell_options_->input_mcolumn_width);
118 setPrehandler(cell_options_->input_special_multialign);
120 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
123 longtable_options_.reset(build_tabular_longtable(this));
125 // Enable the tabfolder to be rescaled correctly.
126 if (scalableTabfolders)
127 fl_set_tabfolder_autofit(dialog_->tabfolder, FL_FIT);
130 fl_addto_tabfolder(dialog_->tabfolder, _("Table"),
131 tabular_options_->form);
132 fl_addto_tabfolder(dialog_->tabfolder, _("Column/Row"),
133 column_options_->form);
134 fl_addto_tabfolder(dialog_->tabfolder, _("Cell"),
135 cell_options_->form);
136 fl_addto_tabfolder(dialog_->tabfolder, _("LongTable"),
137 longtable_options_->form);
139 // FIXME: addReadOnly everything
143 void FormTabular::update()
148 LyXTabular const & tabular = controller().tabular();
155 int const cell = controller().getActiveCell();
157 int column = tabular.column_of_cell(cell) + 1;
159 fl_activate_object(column_options_->input_special_alignment);
160 fl_activate_object(cell_options_->input_special_multialign);
161 fl_activate_object(column_options_->input_column_width);
162 fl_activate_object(column_options_->choice_value_column_width);
163 sprintf(buf, "%d", column);
164 fl_set_input(dialog_->input_tabular_column, buf);
165 fl_deactivate_object(dialog_->input_tabular_column);
166 int row = tabular.row_of_cell(cell);
167 sprintf(buf, "%d", row + 1);
168 fl_set_input(dialog_->input_tabular_row, buf);
169 fl_deactivate_object(dialog_->input_tabular_row);
170 if (tabular.IsMultiColumn(cell)) {
171 fl_set_button(cell_options_->check_multicolumn, 1);
172 fl_set_button(cell_options_->check_border_top,
173 tabular.TopLine(cell)?1:0);
174 setEnabled(cell_options_->check_border_top, true);
175 fl_set_button(cell_options_->check_border_bottom,
176 tabular.BottomLine(cell)?1:0);
177 setEnabled(cell_options_->check_border_bottom, true);
178 // pay attention to left/right lines they are only allowed
179 // to set if we are in first/last cell of row or if the left/right
180 // cell is also a multicolumn.
181 if (tabular.IsFirstCellInRow(cell) ||
182 tabular.IsMultiColumn(cell-1)) {
183 fl_set_button(cell_options_->check_border_left,
184 tabular.LeftLine(cell)?1:0);
185 setEnabled(cell_options_->check_border_left, true);
187 fl_set_button(cell_options_->check_border_left, 0);
188 setEnabled(cell_options_->check_border_left, false);
190 if (tabular.IsLastCellInRow(cell) ||
191 tabular.IsMultiColumn(cell+1)) {
192 fl_set_button(cell_options_->check_border_right,
193 tabular.RightLine(cell)?1:0);
194 setEnabled(cell_options_->check_border_right, true);
196 fl_set_button(cell_options_->check_border_right, 0);
197 setEnabled(cell_options_->check_border_right, false);
199 pwidth = tabular.GetMColumnPWidth(cell);
200 align = tabular.GetAlignment(cell);
201 // set the horiz. alignment, default is left here
202 fl_set_button(cell_options_->radio_align_left, 0);
203 fl_set_button(cell_options_->radio_align_right, 0);
204 fl_set_button(cell_options_->radio_align_center, 0);
205 if (align == LYX_ALIGN_RIGHT)
206 fl_set_button(cell_options_->radio_align_right, 1);
207 else if (align == LYX_ALIGN_CENTER)
208 fl_set_button(cell_options_->radio_align_center, 1);
210 fl_set_button(cell_options_->radio_align_left, 1);
212 align = tabular.GetVAlignment(cell);
213 fl_set_button(cell_options_->radio_valign_top, 0);
214 fl_set_button(cell_options_->radio_valign_bottom, 0);
215 fl_set_button(cell_options_->radio_valign_center, 0);
216 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
217 fl_set_button(cell_options_->radio_valign_center, 1);
218 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
219 fl_set_button(cell_options_->radio_valign_bottom, 1);
221 fl_set_button(cell_options_->radio_valign_top, 1);
223 special = tabular.GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
224 fl_set_input(cell_options_->input_special_multialign, special.c_str());
225 bool const metric(controller().useMetricUnits());
226 string const default_unit = metric ? "cm" : "in";
227 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
228 cell_options_->choice_value_mcolumn_width,
229 pwidth, default_unit);
231 if (!bc().bp().isReadOnly()) {
232 setEnabled(cell_options_->input_special_multialign, true);
233 setEnabled(cell_options_->input_mcolumn_width, true);
234 setEnabled(cell_options_->choice_value_mcolumn_width, true);
237 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
238 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
239 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
241 setEnabled(cell_options_->radio_align_left, true);
242 setEnabled(cell_options_->radio_align_right, true);
243 setEnabled(cell_options_->radio_align_center, true);
245 fl_set_button(cell_options_->check_multicolumn, 0);
247 fl_set_button(cell_options_->check_border_top, 0);
248 setEnabled(cell_options_->check_border_top, false);
250 fl_set_button(cell_options_->check_border_bottom, 0);
251 setEnabled(cell_options_->check_border_bottom, false);
253 fl_set_button(cell_options_->check_border_left, 0);
254 setEnabled(cell_options_->check_border_left, false);
256 fl_set_button(cell_options_->check_border_right, 0);
257 setEnabled(cell_options_->check_border_right, false);
259 fl_set_button(cell_options_->radio_align_left, 0);
260 setEnabled(cell_options_->radio_align_left, false);
262 fl_set_button(cell_options_->radio_align_right, 0);
263 setEnabled(cell_options_->radio_align_right, false);
265 fl_set_button(cell_options_->radio_align_center, 0);
266 setEnabled(cell_options_->radio_align_center, false);
268 fl_set_button(cell_options_->radio_valign_top, 0);
269 setEnabled(cell_options_->radio_valign_top, false);
271 fl_set_button(cell_options_->radio_valign_bottom, 0);
272 setEnabled(cell_options_->radio_valign_bottom, false);
274 fl_set_button(cell_options_->radio_valign_center, 0);
275 setEnabled(cell_options_->radio_valign_center, false);
277 fl_set_input(cell_options_->input_special_multialign, "");
278 setEnabled(cell_options_->input_special_multialign, false);
280 fl_set_input(cell_options_->input_mcolumn_width, "");
281 setEnabled(cell_options_->input_mcolumn_width, false);
282 setEnabled(cell_options_->choice_value_mcolumn_width, false);
284 if (tabular.GetRotateCell(cell))
285 fl_set_button(cell_options_->check_rotate_cell, 1);
287 fl_set_button(cell_options_->check_rotate_cell, 0);
288 if (tabular.TopLine(cell, true))
289 fl_set_button(column_options_->check_border_top, 1);
291 fl_set_button(column_options_->check_border_top, 0);
292 if (tabular.BottomLine(cell, true))
293 fl_set_button(column_options_->check_border_bottom, 1);
295 fl_set_button(column_options_->check_border_bottom, 0);
296 if (tabular.LeftLine(cell, true))
297 fl_set_button(column_options_->check_border_left, 1);
299 fl_set_button(column_options_->check_border_left, 0);
300 if (tabular.RightLine(cell, true))
301 fl_set_button(column_options_->check_border_right, 1);
303 fl_set_button(column_options_->check_border_right, 0);
304 special = tabular.GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
305 fl_set_input(column_options_->input_special_alignment, special.c_str());
307 bool const isReadonly = bc().bp().isReadOnly();
308 setEnabled(column_options_->input_special_alignment, !isReadonly);
310 pwidth = tabular.GetColumnPWidth(cell);
311 bool const metric = controller().useMetricUnits();
312 string const default_unit = metric ? "cm" : "in";
313 updateWidgetsFromLength(column_options_->input_column_width,
314 column_options_->choice_value_column_width,
315 pwidth, default_unit);
316 setEnabled(column_options_->input_column_width, !isReadonly);
317 setEnabled(column_options_->choice_value_column_width, !isReadonly);
319 setEnabled(cell_options_->check_useminipage, !pwidth.zero());
320 if (!pwidth.zero()) {
321 if (tabular.GetUsebox(cell) == 2)
322 fl_set_button(cell_options_->check_useminipage, 1);
324 fl_set_button(cell_options_->check_useminipage, 0);
326 fl_set_button(cell_options_->check_useminipage, 0);
328 align = tabular.GetAlignment(cell, true);
329 fl_set_button(column_options_->radio_align_left, 0);
330 fl_set_button(column_options_->radio_align_right, 0);
331 fl_set_button(column_options_->radio_align_center, 0);
332 fl_set_button(column_options_->radio_align_block, 0);
333 if (align == LYX_ALIGN_LEFT)
334 fl_set_button(column_options_->radio_align_left, 1);
335 else if (align == LYX_ALIGN_RIGHT)
336 fl_set_button(column_options_->radio_align_right, 1);
337 else if (align == LYX_ALIGN_CENTER)
338 fl_set_button(column_options_->radio_align_center, 1);
340 fl_set_button(column_options_->radio_align_block, 1);
341 align = tabular.GetVAlignment(cell, true);
342 fl_set_button(column_options_->radio_valign_top, 0);
343 fl_set_button(column_options_->radio_valign_bottom, 0);
344 fl_set_button(column_options_->radio_valign_center, 0);
345 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
346 fl_set_button(column_options_->radio_valign_center, 1);
347 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
348 fl_set_button(column_options_->radio_valign_bottom, 1);
350 fl_set_button(column_options_->radio_valign_top, 1);
352 setEnabled(column_options_->radio_align_left, true);
353 setEnabled(column_options_->radio_align_right, true);
354 setEnabled(column_options_->radio_align_center, true);
355 setEnabled(column_options_->radio_align_block, !pwidth.zero());
356 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
357 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
358 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
360 fl_set_button(tabular_options_->check_longtable,
361 tabular.IsLongTabular());
363 bool const enable = tabular.IsLongTabular();
365 setEnabled(longtable_options_->check_lt_firsthead, enable);
366 setEnabled(longtable_options_->check_1head_2border_above, enable);
367 setEnabled(longtable_options_->check_1head_2border_below, enable);
368 setEnabled(longtable_options_->check_1head_empty, enable);
369 setEnabled(longtable_options_->check_lt_head, enable);
370 setEnabled(longtable_options_->check_head_2border_above, enable);
371 setEnabled(longtable_options_->check_head_2border_below, enable);
372 setEnabled(longtable_options_->check_lt_foot, enable);
373 setEnabled(longtable_options_->check_foot_2border_above, enable);
374 setEnabled(longtable_options_->check_foot_2border_below, enable);
375 setEnabled(longtable_options_->check_lt_lastfoot, enable);
376 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
377 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
378 setEnabled(longtable_options_->check_lastfoot_empty, enable);
379 setEnabled(longtable_options_->check_lt_newpage, enable);
382 LyXTabular::ltType ltt;
384 bool row_set = tabular.GetRowOfLTHead(row, ltt);
385 fl_set_button(longtable_options_->check_lt_head, row_set);
387 fl_set_button(longtable_options_->check_head_2border_above,
389 fl_set_button(longtable_options_->check_head_2border_below,
393 setEnabled(longtable_options_->check_head_2border_above, 0);
394 setEnabled(longtable_options_->check_head_2border_below, 0);
395 fl_set_button(longtable_options_->check_head_2border_above,0);
396 fl_set_button(longtable_options_->check_head_2border_below,0);
397 fl_set_button(longtable_options_->check_1head_empty,0);
398 setEnabled(longtable_options_->check_1head_empty, 0);
402 row_set = tabular.GetRowOfLTFirstHead(row, ltt);
403 fl_set_button(longtable_options_->check_lt_firsthead, row_set);
404 if (ltt.set && (!ltt.empty || !use_empty)) {
405 fl_set_button(longtable_options_->check_1head_2border_above,
407 fl_set_button(longtable_options_->check_1head_2border_below,
410 setEnabled(longtable_options_->check_1head_2border_above, 0);
411 setEnabled(longtable_options_->check_1head_2border_below, 0);
412 fl_set_button(longtable_options_->check_1head_2border_above,0);
413 fl_set_button(longtable_options_->check_1head_2border_below,0);
415 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
417 setEnabled(longtable_options_->check_lt_firsthead, 0);
421 row_set = tabular.GetRowOfLTFoot(row, ltt);
422 fl_set_button(longtable_options_->check_lt_foot, row_set);
424 fl_set_button(longtable_options_->check_foot_2border_above,
426 fl_set_button(longtable_options_->check_foot_2border_below,
430 setEnabled(longtable_options_->check_foot_2border_above, 0);
431 setEnabled(longtable_options_->check_foot_2border_below, 0);
432 fl_set_button(longtable_options_->check_foot_2border_above,0);
433 fl_set_button(longtable_options_->check_foot_2border_below,0);
434 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
435 setEnabled(longtable_options_->check_lastfoot_empty, 0);
439 row_set = tabular.GetRowOfLTLastFoot(row, ltt);
440 fl_set_button(longtable_options_->check_lt_lastfoot, row_set);
441 if (ltt.set && (!ltt.empty || !use_empty)) {
442 fl_set_button(longtable_options_->check_lastfoot_2border_above,
444 fl_set_button(longtable_options_->check_lastfoot_2border_below,
447 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
448 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
449 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
450 fl_set_button(longtable_options_->check_lastfoot_2border_below, 0);
452 fl_set_button(longtable_options_->check_lastfoot_empty,
455 setEnabled(longtable_options_->check_lt_lastfoot, 0);
458 fl_set_button(longtable_options_->check_lt_newpage,
459 tabular.GetLTNewPage(row));
461 fl_set_button(longtable_options_->check_lt_firsthead, 0);
462 fl_set_button(longtable_options_->check_1head_2border_above, 0);
463 fl_set_button(longtable_options_->check_1head_2border_below, 0);
464 fl_set_button(longtable_options_->check_1head_empty, 0);
465 fl_set_button(longtable_options_->check_lt_head, 0);
466 fl_set_button(longtable_options_->check_head_2border_above, 0);
467 fl_set_button(longtable_options_->check_head_2border_below, 0);
468 fl_set_button(longtable_options_->check_lt_foot, 0);
469 fl_set_button(longtable_options_->check_foot_2border_above, 0);
470 fl_set_button(longtable_options_->check_foot_2border_below, 0);
471 fl_set_button(longtable_options_->check_lt_lastfoot, 0);
472 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
473 fl_set_button(longtable_options_->check_lastfoot_2border_below, 0);
474 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
475 fl_set_button(longtable_options_->check_lt_newpage, 0);
477 fl_set_button(tabular_options_->check_rotate_tabular,
478 tabular.GetRotateTabular());
482 ButtonPolicy::SMInput FormTabular::input(FL_OBJECT * ob, long)
485 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
488 LyXTabular const & tabular = controller().tabular();
490 int const cell = controller().getActiveCell();
492 // ugly hack to auto-apply the stuff that hasn't been
493 // yet. don't let this continue to exist ...
494 if (ob == dialog_->button_close) {
497 getLengthFromWidgets(column_options_->input_column_width,
498 column_options_->choice_value_column_width);
500 LyXLength llen = tabular.GetColumnPWidth(cell);
502 str2 = llen.asString();
504 input(column_options_->input_column_width, 0);
505 str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
506 cell_options_->choice_value_mcolumn_width);
507 llen = tabular.GetMColumnPWidth(cell);
511 str2 = llen.asString();
513 input(cell_options_->input_mcolumn_width, 0);
514 str1 = getString(column_options_->input_special_alignment);
515 str2 = tabular.GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
517 input(column_options_->input_special_alignment, 0);
518 str1 = getString(cell_options_->input_special_multialign);
519 str2 = tabular.GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
521 input(cell_options_->input_special_multialign, 0);
525 return ButtonPolicy::SMI_VALID;
528 if (actCell_ != cell) {
530 postWarning(_("Wrong Cursor position, updated window"));
531 return ButtonPolicy::SMI_VALID;
534 // No point in processing directives that you can't do anything with
535 // anyhow, so exit now if the buffer is read-only.
536 if (bc().bp().isReadOnly()) {
538 return ButtonPolicy::SMI_VALID;
541 if ((ob == column_options_->input_column_width) ||
542 (ob == column_options_->choice_value_column_width)) {
544 getLengthFromWidgets(column_options_->input_column_width,
545 column_options_->choice_value_column_width);
546 controller().set(LyXTabular::SET_PWIDTH, str);
548 //check if the input is valid
549 string const input = getString(column_options_->input_column_width);
550 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
551 postWarning(_("Invalid Length (valid example: 10mm)"));
552 return ButtonPolicy::SMI_INVALID;
555 update(); // update for alignment
556 return ButtonPolicy::SMI_VALID;
559 if ((ob == cell_options_->input_mcolumn_width) ||
560 (ob == cell_options_->choice_value_mcolumn_width)) {
562 getLengthFromWidgets(cell_options_->input_mcolumn_width,
563 cell_options_->choice_value_mcolumn_width);
564 controller().set(LyXTabular::SET_MPWIDTH, str);
566 //check if the input is valid
567 string const input = getString(cell_options_->input_mcolumn_width);
568 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
569 postWarning(_("Invalid Length (valid example: 10mm)"));
570 return ButtonPolicy::SMI_INVALID;
572 update(); // update for alignment
573 return ButtonPolicy::SMI_VALID;
576 if (ob == tabular_options_->button_append_row)
577 num = LyXTabular::APPEND_ROW;
578 else if (ob == tabular_options_->button_append_column)
579 num = LyXTabular::APPEND_COLUMN;
580 else if (ob == tabular_options_->button_delete_row)
581 num = LyXTabular::DELETE_ROW;
582 else if (ob == tabular_options_->button_delete_column)
583 num = LyXTabular::DELETE_COLUMN;
584 else if (ob == tabular_options_->button_set_borders)
585 num = LyXTabular::SET_ALL_LINES;
586 else if (ob == tabular_options_->button_unset_borders)
587 num = LyXTabular::UNSET_ALL_LINES;
588 else if (ob == column_options_->check_border_top)
589 num = LyXTabular::TOGGLE_LINE_TOP;
590 else if (ob == column_options_->check_border_bottom)
591 num = LyXTabular::TOGGLE_LINE_BOTTOM;
592 else if (ob == column_options_->check_border_left)
593 num = LyXTabular::TOGGLE_LINE_LEFT;
594 else if (ob == column_options_->check_border_right)
595 num = LyXTabular::TOGGLE_LINE_RIGHT;
596 else if (ob == column_options_->radio_align_left)
597 num = LyXTabular::ALIGN_LEFT;
598 else if (ob == column_options_->radio_align_right)
599 num = LyXTabular::ALIGN_RIGHT;
600 else if (ob == column_options_->radio_align_center)
601 num = LyXTabular::ALIGN_CENTER;
602 else if (ob == column_options_->radio_align_block)
603 num = LyXTabular::ALIGN_BLOCK;
604 else if (ob == column_options_->radio_valign_top)
605 num = LyXTabular::VALIGN_TOP;
606 else if (ob == column_options_->radio_valign_bottom)
607 num = LyXTabular::VALIGN_BOTTOM;
608 else if (ob == column_options_->radio_valign_center)
609 num = LyXTabular::VALIGN_CENTER;
610 else if (ob == cell_options_->check_multicolumn)
611 num = LyXTabular::MULTICOLUMN;
612 else if (ob == tabular_options_->check_longtable) {
613 if (fl_get_button(tabular_options_->check_longtable))
614 num = LyXTabular::SET_LONGTABULAR;
616 num = LyXTabular::UNSET_LONGTABULAR;
617 } else if (ob == tabular_options_->check_rotate_tabular) {
618 s = fl_get_button(tabular_options_->check_rotate_tabular);
620 num = LyXTabular::SET_ROTATE_TABULAR;
622 num = LyXTabular::UNSET_ROTATE_TABULAR;
623 } else if (ob == cell_options_->check_rotate_cell) {
624 s = fl_get_button(cell_options_->check_rotate_cell);
626 num = LyXTabular::SET_ROTATE_CELL;
628 num = LyXTabular::UNSET_ROTATE_CELL;
629 } else if (ob == cell_options_->check_useminipage) {
630 num = LyXTabular::SET_USEBOX;
632 } else if ((ob == longtable_options_->check_lt_firsthead) ||
633 (ob == longtable_options_->check_1head_2border_above) ||
634 (ob == longtable_options_->check_1head_2border_below) ||
635 (ob == longtable_options_->check_1head_empty) ||
636 (ob == longtable_options_->check_lt_head) ||
637 (ob == longtable_options_->check_head_2border_above) ||
638 (ob == longtable_options_->check_head_2border_below) ||
639 (ob == longtable_options_->check_lt_foot) ||
640 (ob == longtable_options_->check_foot_2border_above) ||
641 (ob == longtable_options_->check_foot_2border_below) ||
642 (ob == longtable_options_->check_lt_lastfoot) ||
643 (ob == longtable_options_->check_lastfoot_2border_above) ||
644 (ob == longtable_options_->check_lastfoot_2border_below) ||
645 (ob == longtable_options_->check_lastfoot_empty)) {
646 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
647 } else if (ob == longtable_options_->check_lt_newpage) {
648 num = LyXTabular::SET_LTNEWPAGE;
649 } else if (ob == column_options_->input_special_alignment) {
650 special = getString(column_options_->input_special_alignment);
651 num = LyXTabular::SET_SPECIAL_COLUMN;
652 } else if (ob == cell_options_->input_special_multialign) {
653 special = getString(cell_options_->input_special_multialign);
654 num = LyXTabular::SET_SPECIAL_MULTI;
655 } else if (ob == cell_options_->check_border_top)
656 num = LyXTabular::M_TOGGLE_LINE_TOP;
657 else if (ob == cell_options_->check_border_bottom)
658 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
659 else if (ob == cell_options_->check_border_left)
660 num = LyXTabular::M_TOGGLE_LINE_LEFT;
661 else if (ob == cell_options_->check_border_right)
662 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
663 else if (ob == cell_options_->radio_align_left)
664 num = LyXTabular::M_ALIGN_LEFT;
665 else if (ob == cell_options_->radio_align_right)
666 num = LyXTabular::M_ALIGN_RIGHT;
667 else if (ob == cell_options_->radio_align_center)
668 num = LyXTabular::M_ALIGN_CENTER;
669 else if (ob == cell_options_->radio_valign_top)
670 num = LyXTabular::M_VALIGN_TOP;
671 else if (ob == cell_options_->radio_valign_bottom)
672 num = LyXTabular::M_VALIGN_BOTTOM;
673 else if (ob == cell_options_->radio_valign_center)
674 num = LyXTabular::M_VALIGN_CENTER;
676 return ButtonPolicy::SMI_VALID;
678 controller().set(num, special);
681 return ButtonPolicy::SMI_VALID;
685 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
687 bool flag = fl_get_button(ob);
688 if ((ob == longtable_options_->check_1head_2border_above) ||
689 (ob == longtable_options_->check_head_2border_above) ||
690 (ob == longtable_options_->check_foot_2border_above) ||
691 (ob == longtable_options_->check_lastfoot_2border_above)) {
692 special = "dl_above";
693 } else if ((ob == longtable_options_->check_1head_2border_below) ||
694 (ob == longtable_options_->check_head_2border_below) ||
695 (ob == longtable_options_->check_foot_2border_below) ||
696 (ob == longtable_options_->check_lastfoot_2border_below)) {
697 special = "dl_below";
698 } else if ((ob == longtable_options_->check_1head_empty) ||
699 (ob == longtable_options_->check_lastfoot_empty)) {
704 if ((ob == longtable_options_->check_lt_firsthead) ||
705 (ob == longtable_options_->check_1head_2border_above) ||
706 (ob == longtable_options_->check_1head_2border_below) ||
707 (ob == longtable_options_->check_1head_empty)) {
708 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
709 LyXTabular::UNSET_LTFIRSTHEAD);
710 } else if ((ob == longtable_options_->check_lt_head) ||
711 (ob == longtable_options_->check_head_2border_above) ||
712 (ob == longtable_options_->check_head_2border_below)) {
713 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
714 } else if ((ob == longtable_options_->check_lt_foot) ||
715 (ob == longtable_options_->check_foot_2border_above) ||
716 (ob == longtable_options_->check_foot_2border_below)) {
717 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
718 } else if ((ob == longtable_options_->check_lt_lastfoot) ||
719 (ob == longtable_options_->check_lastfoot_2border_above) ||
720 (ob == longtable_options_->check_lastfoot_2border_below) ||
721 (ob == longtable_options_->check_lastfoot_empty)) {
722 return (flag ? LyXTabular::SET_LTLASTFOOT :
723 LyXTabular::UNSET_LTLASTFOOT);
726 return LyXTabular::LAST_ACTION;