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
14 #pragma implementation
19 #include "FormTabular.h"
20 #include "forms/form_tabular.h"
21 #include "frontends/LyXView.h"
23 #include "xforms_helpers.h"
24 #include "lyxrc.h" // to set the default length values
25 #include "helper_funcs.h"
26 #include "input_validators.h"
28 #include "insets/insettabular.h"
30 #include "support/lstrings.h"
32 #include <boost/bind.hpp>
35 #include FORMS_H_LOCATION
43 FormTabular::FormTabular(LyXView & lv, Dialogs & d)
44 : FormInset(lv, d, _("Tabular Layout")),
45 inset_(0), actCell_(-1), closing_(false)
50 void FormTabular::redraw()
52 if (form() && form()->visible)
53 fl_redraw_form(form());
57 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabfolder);
58 if (outer_form && outer_form->visible)
59 fl_redraw_form(outer_form);
63 FL_FORM * FormTabular::form() const
71 void FormTabular::disconnect()
74 FormInset::disconnect();
78 void FormTabular::showInset(InsetTabular * inset)
80 if (inset == 0) return;
82 // If connected to another inset, disconnect from it.
83 if (inset_ != inset) {
85 ih_ = inset->hideDialog.connect(boost::bind(&FormTabular::hide, this));
93 void FormTabular::updateInset(InsetTabular * inset)
95 if (inset == 0 || inset_ == 0) return;
97 // If connected to another inset, disconnect from it.
98 if (inset_ != inset) {
100 ih_ = inset->hideDialog.connect(boost::bind(&FormTabular::hide, this));
108 void FormTabular::build()
110 dialog_.reset(build_tabular(this));
112 // Allow the base class to control messages
113 setMessageWidget(dialog_->text_warning);
115 setPrehandler(dialog_->input_tabular_column);
116 setPrehandler(dialog_->input_tabular_row);
118 tabular_options_.reset(build_tabular_options(this));
119 column_options_.reset(build_tabular_column(this));
120 cell_options_.reset(build_tabular_cell(this));
121 longtable_options_.reset(build_tabular_longtable(this));
123 fl_set_input_return(column_options_->input_column_width,
125 fl_set_input_return(column_options_->input_special_alignment,
128 setPrehandler(column_options_->input_column_width);
129 setPrehandler(column_options_->input_special_alignment);
131 fl_set_input_return(cell_options_->input_mcolumn_width,
133 fl_set_input_return(cell_options_->input_special_multialign,
136 setPrehandler(cell_options_->input_mcolumn_width);
137 setPrehandler(cell_options_->input_special_multialign);
139 fl_addto_tabfolder(dialog_->tabfolder, _("Tabular"),
140 tabular_options_->form);
141 fl_addto_tabfolder(dialog_->tabfolder, _("Column/Row"),
142 column_options_->form);
143 fl_addto_tabfolder(dialog_->tabfolder, _("Cell"),
144 cell_options_->form);
145 fl_addto_tabfolder(dialog_->tabfolder, _("LongTable"),
146 longtable_options_->form);
148 // work-around xforms bug re update of folder->x, folder->y coords.
149 setPrehandler(dialog_->tabfolder);
151 // Create the contents of the unit choices
152 // Don't include the "%" terms...
153 vector<string> units_vec = getLatexUnits();
154 vector<string>::iterator ret =
155 remove_if(units_vec.begin(), units_vec.end(),
156 bind2nd(contains_functor(), "%"));
157 units_vec.erase(ret, units_vec.end());
159 string units = getStringFromVector(units_vec, "|");
161 fl_addto_choice(column_options_->choice_value_column_width,
163 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
168 void FormTabular::update()
173 if (!inset_ || !inset_->tabular.get())
176 LyXTabular * tabular = inset_->tabular.get();
182 int cell = inset_->getActCell();
184 int column = tabular->column_of_cell(cell) + 1;
186 fl_activate_object(column_options_->input_special_alignment);
187 fl_activate_object(cell_options_->input_special_multialign);
188 fl_activate_object(column_options_->input_column_width);
189 fl_activate_object(column_options_->choice_value_column_width);
190 sprintf(buf, "%d", column);
191 fl_set_input(dialog_->input_tabular_column, buf);
192 fl_deactivate_object(dialog_->input_tabular_column);
193 int row = tabular->row_of_cell(cell);
194 sprintf(buf, "%d", row + 1);
195 fl_set_input(dialog_->input_tabular_row, buf);
196 fl_deactivate_object(dialog_->input_tabular_row);
197 if (tabular->IsMultiColumn(cell)) {
198 fl_set_button(cell_options_->check_multicolumn, 1);
199 fl_set_button(cell_options_->check_border_top,
200 tabular->TopLine(cell)?1:0);
201 setEnabled(cell_options_->check_border_top, true);
202 fl_set_button(cell_options_->check_border_bottom,
203 tabular->BottomLine(cell)?1:0);
204 setEnabled(cell_options_->check_border_bottom, true);
205 // pay attention to left/right lines they are only allowed
206 // to set if we are in first/last cell of row or if the left/right
207 // cell is also a multicolumn.
208 if (tabular->IsFirstCellInRow(cell) ||
209 tabular->IsMultiColumn(cell-1)) {
210 fl_set_button(cell_options_->check_border_left,
211 tabular->LeftLine(cell)?1:0);
212 setEnabled(cell_options_->check_border_left, true);
214 fl_set_button(cell_options_->check_border_left, 0);
215 setEnabled(cell_options_->check_border_left, false);
217 if (tabular->IsLastCellInRow(cell) ||
218 tabular->IsMultiColumn(cell+1)) {
219 fl_set_button(cell_options_->check_border_right,
220 tabular->RightLine(cell)?1:0);
221 setEnabled(cell_options_->check_border_right, true);
223 fl_set_button(cell_options_->check_border_right, 0);
224 setEnabled(cell_options_->check_border_right, false);
226 pwidth = tabular->GetMColumnPWidth(cell);
227 align = tabular->GetAlignment(cell);
228 if (align == LYX_ALIGN_LEFT)
229 fl_set_button(cell_options_->radio_align_left, 1);
230 else if (align == LYX_ALIGN_RIGHT)
231 fl_set_button(cell_options_->radio_align_right, 1);
233 fl_set_button(cell_options_->radio_align_center, 1);
235 align = tabular->GetVAlignment(cell);
236 fl_set_button(cell_options_->radio_valign_top, 0);
237 fl_set_button(cell_options_->radio_valign_bottom, 0);
238 fl_set_button(cell_options_->radio_valign_center, 0);
239 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
240 fl_set_button(cell_options_->radio_valign_center, 1);
241 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
242 fl_set_button(cell_options_->radio_valign_bottom, 1);
244 fl_set_button(cell_options_->radio_valign_top, 1);
246 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
247 fl_set_input(cell_options_->input_special_multialign, special.c_str());
248 bool const metric = lyxrc.default_papersize > 3;
249 string const default_unit = metric ? "cm" : "in";
250 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
251 cell_options_->choice_value_mcolumn_width,
252 pwidth, default_unit);
254 if (!lv_.buffer()->isReadonly()) {
255 setEnabled(cell_options_->input_special_multialign, true);
256 setEnabled(cell_options_->input_mcolumn_width, true);
257 setEnabled(cell_options_->choice_value_mcolumn_width, true);
260 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
261 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
262 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
264 setEnabled(cell_options_->radio_align_left, true);
265 setEnabled(cell_options_->radio_align_right, true);
266 setEnabled(cell_options_->radio_align_center, true);
268 fl_set_button(cell_options_->check_multicolumn, 0);
270 fl_set_button(cell_options_->check_border_top, 0);
271 setEnabled(cell_options_->check_border_top, false);
273 fl_set_button(cell_options_->check_border_bottom, 0);
274 setEnabled(cell_options_->check_border_bottom, false);
276 fl_set_button(cell_options_->check_border_left, 0);
277 setEnabled(cell_options_->check_border_left, false);
279 fl_set_button(cell_options_->check_border_right, 0);
280 setEnabled(cell_options_->check_border_right, false);
282 fl_set_button(cell_options_->radio_align_left, 0);
283 setEnabled(cell_options_->radio_align_left, false);
285 fl_set_button(cell_options_->radio_align_right, 0);
286 setEnabled(cell_options_->radio_align_right, false);
288 fl_set_button(cell_options_->radio_align_center, 0);
289 setEnabled(cell_options_->radio_align_center, false);
291 fl_set_button(cell_options_->radio_valign_top, 0);
292 setEnabled(cell_options_->radio_valign_top, false);
294 fl_set_button(cell_options_->radio_valign_bottom, 0);
295 setEnabled(cell_options_->radio_valign_bottom, false);
297 fl_set_button(cell_options_->radio_valign_center, 0);
298 setEnabled(cell_options_->radio_valign_center, false);
300 fl_set_input(cell_options_->input_special_multialign, "");
301 setEnabled(cell_options_->input_special_multialign, false);
303 fl_set_input(cell_options_->input_mcolumn_width, "");
304 setEnabled(cell_options_->input_mcolumn_width, false);
305 setEnabled(cell_options_->choice_value_mcolumn_width, false);
307 if (tabular->GetRotateCell(cell))
308 fl_set_button(cell_options_->check_rotate_cell, 1);
310 fl_set_button(cell_options_->check_rotate_cell, 0);
311 if (tabular->TopLine(cell, true))
312 fl_set_button(column_options_->check_border_top, 1);
314 fl_set_button(column_options_->check_border_top, 0);
315 if (tabular->BottomLine(cell, true))
316 fl_set_button(column_options_->check_border_bottom, 1);
318 fl_set_button(column_options_->check_border_bottom, 0);
319 if (tabular->LeftLine(cell, true))
320 fl_set_button(column_options_->check_border_left, 1);
322 fl_set_button(column_options_->check_border_left, 0);
323 if (tabular->RightLine(cell, true))
324 fl_set_button(column_options_->check_border_right, 1);
326 fl_set_button(column_options_->check_border_right, 0);
327 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
328 fl_set_input(column_options_->input_special_alignment, special.c_str());
330 bool const isReadonly = lv_.buffer()->isReadonly();
331 setEnabled(column_options_->input_special_alignment, !isReadonly);
333 pwidth = tabular->GetColumnPWidth(cell);
334 bool const metric = lyxrc.default_papersize > 3;
335 string const default_unit = metric ? "cm" : "in";
336 updateWidgetsFromLength(column_options_->input_column_width,
337 column_options_->choice_value_column_width,
338 pwidth, default_unit);
339 setEnabled(column_options_->input_column_width, !isReadonly);
340 setEnabled(column_options_->choice_value_column_width, !isReadonly);
342 setEnabled(cell_options_->check_useminipage, !pwidth.zero());
343 if (!pwidth.zero()) {
344 if (tabular->GetUsebox(cell) == 2)
345 fl_set_button(cell_options_->check_useminipage, 1);
347 fl_set_button(cell_options_->check_useminipage, 0);
349 fl_set_button(cell_options_->check_useminipage, 0);
351 align = tabular->GetAlignment(cell, true);
352 fl_set_button(column_options_->radio_align_left, 0);
353 fl_set_button(column_options_->radio_align_right, 0);
354 fl_set_button(column_options_->radio_align_center, 0);
355 if (align == LYX_ALIGN_LEFT)
356 fl_set_button(column_options_->radio_align_left, 1);
357 else if (align == LYX_ALIGN_RIGHT)
358 fl_set_button(column_options_->radio_align_right, 1);
360 fl_set_button(column_options_->radio_align_center, 1);
361 align = tabular->GetVAlignment(cell, true);
362 fl_set_button(column_options_->radio_valign_top, 0);
363 fl_set_button(column_options_->radio_valign_bottom, 0);
364 fl_set_button(column_options_->radio_valign_center, 0);
365 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
366 fl_set_button(column_options_->radio_valign_center, 1);
367 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
368 fl_set_button(column_options_->radio_valign_bottom, 1);
370 fl_set_button(column_options_->radio_valign_top, 1);
372 setEnabled(column_options_->radio_align_left, true);
373 setEnabled(column_options_->radio_align_right, true);
374 setEnabled(column_options_->radio_align_center, true);
375 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
376 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
377 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
379 fl_set_button(tabular_options_->check_longtable,
380 tabular->IsLongTabular());
382 bool const enable = tabular->IsLongTabular();
384 setEnabled(longtable_options_->check_lt_firsthead, enable);
385 setEnabled(longtable_options_->check_1head_2border_above, enable);
386 setEnabled(longtable_options_->check_1head_2border_below, enable);
387 setEnabled(longtable_options_->check_1head_empty, enable);
388 setEnabled(longtable_options_->check_lt_head, enable);
389 setEnabled(longtable_options_->check_head_2border_above, enable);
390 setEnabled(longtable_options_->check_head_2border_below, enable);
391 setEnabled(longtable_options_->check_lt_foot, enable);
392 setEnabled(longtable_options_->check_foot_2border_above, enable);
393 setEnabled(longtable_options_->check_foot_2border_below, enable);
394 setEnabled(longtable_options_->check_lt_lastfoot, enable);
395 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
396 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
397 setEnabled(longtable_options_->check_lastfoot_empty, enable);
398 setEnabled(longtable_options_->check_lt_newpage, enable);
401 LyXTabular::ltType ltt;
403 bool row_set = tabular->GetRowOfLTHead(row, ltt);
404 fl_set_button(longtable_options_->check_lt_head, row_set);
406 fl_set_button(longtable_options_->check_head_2border_above,
408 fl_set_button(longtable_options_->check_head_2border_above,
412 setEnabled(longtable_options_->check_head_2border_above, 0);
413 setEnabled(longtable_options_->check_head_2border_below, 0);
414 fl_set_button(longtable_options_->check_head_2border_above,0);
415 fl_set_button(longtable_options_->check_head_2border_above,0);
416 fl_set_button(longtable_options_->check_1head_empty,0);
417 setEnabled(longtable_options_->check_1head_empty, 0);
421 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
422 fl_set_button(longtable_options_->check_lt_firsthead, row_set);
423 if (ltt.set && (!ltt.empty || !use_empty)) {
424 fl_set_button(longtable_options_->check_1head_2border_above,
426 fl_set_button(longtable_options_->check_1head_2border_above,
429 setEnabled(longtable_options_->check_1head_2border_above, 0);
430 setEnabled(longtable_options_->check_1head_2border_below, 0);
431 fl_set_button(longtable_options_->check_1head_2border_above,0);
432 fl_set_button(longtable_options_->check_1head_2border_above,0);
434 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
436 setEnabled(longtable_options_->check_lt_firsthead, 0);
440 row_set = tabular->GetRowOfLTFoot(row, ltt);
441 fl_set_button(longtable_options_->check_lt_foot, row_set);
443 fl_set_button(longtable_options_->check_foot_2border_above,
445 fl_set_button(longtable_options_->check_foot_2border_above,
449 setEnabled(longtable_options_->check_foot_2border_above, 0);
450 setEnabled(longtable_options_->check_foot_2border_below, 0);
451 fl_set_button(longtable_options_->check_foot_2border_above,0);
452 fl_set_button(longtable_options_->check_foot_2border_above,0);
453 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
454 setEnabled(longtable_options_->check_lastfoot_empty, 0);
458 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
459 fl_set_button(longtable_options_->check_lt_lastfoot, row_set);
460 if (ltt.set && (!ltt.empty || !use_empty)) {
461 fl_set_button(longtable_options_->check_lastfoot_2border_above,
463 fl_set_button(longtable_options_->check_lastfoot_2border_above,
466 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
467 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
468 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
469 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
471 fl_set_button(longtable_options_->check_lastfoot_empty,
474 setEnabled(longtable_options_->check_lt_lastfoot, 0);
477 fl_set_button(longtable_options_->check_lt_newpage,
478 tabular->GetLTNewPage(row));
480 fl_set_button(longtable_options_->check_lt_firsthead, 0);
481 fl_set_button(longtable_options_->check_1head_2border_above, 0);
482 fl_set_button(longtable_options_->check_1head_2border_above, 0);
483 fl_set_button(longtable_options_->check_1head_empty, 0);
484 fl_set_button(longtable_options_->check_lt_head, 0);
485 fl_set_button(longtable_options_->check_head_2border_above, 0);
486 fl_set_button(longtable_options_->check_head_2border_above, 0);
487 fl_set_button(longtable_options_->check_lt_foot, 0);
488 fl_set_button(longtable_options_->check_foot_2border_above, 0);
489 fl_set_button(longtable_options_->check_foot_2border_above, 0);
490 fl_set_button(longtable_options_->check_lt_lastfoot, 0);
491 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
492 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
493 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
494 fl_set_button(longtable_options_->check_lt_newpage, 0);
496 fl_set_button(tabular_options_->check_rotate_tabular,
497 tabular->GetRotateTabular());
501 bool FormTabular::input(FL_OBJECT * ob, long)
507 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
510 int cell = inset_->getActCell();
512 // ugly hack to auto-apply the stuff that hasn't been
513 // yet. don't let this continue to exist ...
514 if (ob == dialog_->button_close) {
516 LyXTabular * tabular = inset_->tabular.get();
518 getLengthFromWidgets(column_options_->input_column_width,
519 column_options_->choice_value_column_width);
521 LyXLength llen = tabular->GetColumnPWidth(cell);
523 str2 = llen.asString();
525 input(column_options_->input_column_width, 0);
526 str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
527 cell_options_->choice_value_mcolumn_width);
528 llen = tabular->GetMColumnPWidth(cell);
532 str2 = llen.asString();
534 input(cell_options_->input_mcolumn_width, 0);
535 str1 = fl_get_input(column_options_->input_special_alignment);
536 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
538 input(column_options_->input_special_alignment, 0);
539 str1 = fl_get_input(cell_options_->input_special_multialign);
540 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
542 input(cell_options_->input_special_multialign, 0);
548 if (actCell_ != cell) {
550 postWarning(_("Wrong Cursor position, updated window"));
553 // No point in processing directives that you can't do anything with
554 // anyhow, so exit now if the buffer is read-only.
555 if (lv_.buffer()->isReadonly()) {
559 if ((ob == column_options_->input_column_width) ||
560 (ob == column_options_->choice_value_column_width)) {
562 getLengthFromWidgets(column_options_->input_column_width,
563 column_options_->choice_value_column_width);
564 inset_->tabularFeatures(lv_.view().get(), LyXTabular::SET_PWIDTH, str);
566 //check if the input is valid
568 fl_get_input(column_options_->input_column_width);
569 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
570 postWarning(_("Invalid Length (valid example: 10mm)"));
574 update(); // update for alignment
578 if ((ob == cell_options_->input_mcolumn_width) ||
579 (ob == cell_options_->choice_value_mcolumn_width)) {
581 getLengthFromWidgets(cell_options_->input_mcolumn_width,
582 cell_options_->choice_value_mcolumn_width);
583 inset_->tabularFeatures(lv_.view().get(), LyXTabular::SET_MPWIDTH, str);
585 //check if the input is valid
587 fl_get_input(cell_options_->input_mcolumn_width);
588 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
589 postWarning(_("Invalid Length (valid example: 10mm)"));
592 update(); // update for alignment
596 if (ob == tabular_options_->button_append_row)
597 num = LyXTabular::APPEND_ROW;
598 else if (ob == tabular_options_->button_append_column)
599 num = LyXTabular::APPEND_COLUMN;
600 else if (ob == tabular_options_->button_delete_row)
601 num = LyXTabular::DELETE_ROW;
602 else if (ob == tabular_options_->button_delete_column)
603 num = LyXTabular::DELETE_COLUMN;
604 else if (ob == tabular_options_->button_set_borders)
605 num = LyXTabular::SET_ALL_LINES;
606 else if (ob == tabular_options_->button_unset_borders)
607 num = LyXTabular::UNSET_ALL_LINES;
608 else if (ob == column_options_->check_border_top)
609 num = LyXTabular::TOGGLE_LINE_TOP;
610 else if (ob == column_options_->check_border_bottom)
611 num = LyXTabular::TOGGLE_LINE_BOTTOM;
612 else if (ob == column_options_->check_border_left)
613 num = LyXTabular::TOGGLE_LINE_LEFT;
614 else if (ob == column_options_->check_border_right)
615 num = LyXTabular::TOGGLE_LINE_RIGHT;
616 else if (ob == column_options_->radio_align_left)
617 num = LyXTabular::ALIGN_LEFT;
618 else if (ob == column_options_->radio_align_right)
619 num = LyXTabular::ALIGN_RIGHT;
620 else if (ob == column_options_->radio_align_center)
621 num = LyXTabular::ALIGN_CENTER;
622 else if (ob == column_options_->radio_valign_top)
623 num = LyXTabular::VALIGN_TOP;
624 else if (ob == column_options_->radio_valign_bottom)
625 num = LyXTabular::VALIGN_BOTTOM;
626 else if (ob == column_options_->radio_valign_center)
627 num = LyXTabular::VALIGN_CENTER;
628 else if (ob == cell_options_->check_multicolumn)
629 num = LyXTabular::MULTICOLUMN;
630 else if (ob == tabular_options_->check_longtable) {
631 if (fl_get_button(tabular_options_->check_longtable))
632 num = LyXTabular::SET_LONGTABULAR;
634 num = LyXTabular::UNSET_LONGTABULAR;
635 } else if (ob == tabular_options_->check_rotate_tabular) {
636 s = fl_get_button(tabular_options_->check_rotate_tabular);
638 num = LyXTabular::SET_ROTATE_TABULAR;
640 num = LyXTabular::UNSET_ROTATE_TABULAR;
641 } else if (ob == cell_options_->check_rotate_cell) {
642 s = fl_get_button(cell_options_->check_rotate_cell);
644 num = LyXTabular::SET_ROTATE_CELL;
646 num = LyXTabular::UNSET_ROTATE_CELL;
647 } else if (ob == cell_options_->check_useminipage) {
648 num = LyXTabular::SET_USEBOX;
650 } else if ((ob == longtable_options_->check_lt_firsthead) ||
651 (ob == longtable_options_->check_1head_2border_above) ||
652 (ob == longtable_options_->check_1head_2border_below) ||
653 (ob == longtable_options_->check_1head_empty) ||
654 (ob == longtable_options_->check_lt_head) ||
655 (ob == longtable_options_->check_head_2border_above) ||
656 (ob == longtable_options_->check_head_2border_below) ||
657 (ob == longtable_options_->check_lt_foot) ||
658 (ob == longtable_options_->check_foot_2border_above) ||
659 (ob == longtable_options_->check_foot_2border_below) ||
660 (ob == longtable_options_->check_lt_lastfoot) ||
661 (ob == longtable_options_->check_lastfoot_2border_above) ||
662 (ob == longtable_options_->check_lastfoot_2border_below) ||
663 (ob == longtable_options_->check_lastfoot_empty)) {
664 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
665 } else if (ob == longtable_options_->check_lt_newpage) {
666 num = LyXTabular::SET_LTNEWPAGE;
667 } else if (ob == column_options_->input_special_alignment) {
668 special = fl_get_input(column_options_->input_special_alignment);
669 num = LyXTabular::SET_SPECIAL_COLUMN;
670 } else if (ob == cell_options_->input_special_multialign) {
671 special = fl_get_input(cell_options_->input_special_multialign);
672 num = LyXTabular::SET_SPECIAL_MULTI;
673 } else if (ob == cell_options_->check_border_top)
674 num = LyXTabular::M_TOGGLE_LINE_TOP;
675 else if (ob == cell_options_->check_border_bottom)
676 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
677 else if (ob == cell_options_->check_border_left)
678 num = LyXTabular::M_TOGGLE_LINE_LEFT;
679 else if (ob == cell_options_->check_border_right)
680 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
681 else if (ob == cell_options_->radio_align_left)
682 num = LyXTabular::M_ALIGN_LEFT;
683 else if (ob == cell_options_->radio_align_right)
684 num = LyXTabular::M_ALIGN_RIGHT;
685 else if (ob == cell_options_->radio_align_center)
686 num = LyXTabular::M_ALIGN_CENTER;
687 else if (ob == cell_options_->radio_valign_top)
688 num = LyXTabular::M_VALIGN_TOP;
689 else if (ob == cell_options_->radio_valign_bottom)
690 num = LyXTabular::M_VALIGN_BOTTOM;
691 else if (ob == cell_options_->radio_valign_center)
692 num = LyXTabular::M_VALIGN_CENTER;
696 inset_->tabularFeatures(lv_.view().get(), num, special);
702 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
704 bool flag = fl_get_button(ob);
705 if ((ob == longtable_options_->check_1head_2border_above) ||
706 (ob == longtable_options_->check_head_2border_above) ||
707 (ob == longtable_options_->check_foot_2border_above) ||
708 (ob == longtable_options_->check_lastfoot_2border_above)) {
709 special = "dl_above";
710 } else if ((ob == longtable_options_->check_1head_2border_below) ||
711 (ob == longtable_options_->check_head_2border_below) ||
712 (ob == longtable_options_->check_foot_2border_below) ||
713 (ob == longtable_options_->check_lastfoot_2border_below)) {
714 special = "dl_below";
715 } else if ((ob == longtable_options_->check_1head_empty) ||
716 (ob == longtable_options_->check_lastfoot_empty)) {
721 if ((ob == longtable_options_->check_lt_firsthead) ||
722 (ob == longtable_options_->check_1head_2border_above) ||
723 (ob == longtable_options_->check_1head_2border_below) ||
724 (ob == longtable_options_->check_1head_empty)) {
725 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
726 LyXTabular::UNSET_LTFIRSTHEAD);
727 } else if ((ob == longtable_options_->check_lt_head) ||
728 (ob == longtable_options_->check_head_2border_above) ||
729 (ob == longtable_options_->check_head_2border_below)) {
730 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
731 } else if ((ob == longtable_options_->check_lt_foot) ||
732 (ob == longtable_options_->check_foot_2border_above) ||
733 (ob == longtable_options_->check_foot_2border_below)) {
734 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
735 } else if ((ob == longtable_options_->check_lt_lastfoot) ||
736 (ob == longtable_options_->check_lastfoot_2border_above) ||
737 (ob == longtable_options_->check_lastfoot_2border_below) ||
738 (ob == longtable_options_->check_lastfoot_empty)) {
739 return (flag ? LyXTabular::SET_LTLASTFOOT :
740 LyXTabular::UNSET_LTLASTFOOT);
743 return LyXTabular::LAST_ACTION;