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 // trigger an input event for cut&paste with middle mouse button.
116 setPrehandler(dialog_->input_tabular_column);
117 setPrehandler(dialog_->input_tabular_row);
119 // Create the contents of the unit choices; don't include the "%" terms.
120 vector<string> units_vec = getLatexUnits();
121 vector<string>::iterator ret =
122 remove_if(units_vec.begin(), units_vec.end(),
123 bind2nd(contains_functor(), "%"));
124 units_vec.erase(ret, units_vec.end());
125 string const units = getStringFromVector(units_vec, "|");
127 // tabular options form
128 tabular_options_.reset(build_tabular_options(this));
130 // column options form
131 column_options_.reset(build_tabular_column(this));
133 fl_set_input_return(column_options_->input_column_width,
135 fl_set_input_return(column_options_->input_special_alignment,
138 // trigger an input event for cut&paste with middle mouse button.
139 setPrehandler(column_options_->input_column_width);
140 setPrehandler(column_options_->input_special_alignment);
142 fl_addto_choice(column_options_->choice_value_column_width,
146 cell_options_.reset(build_tabular_cell(this));
148 fl_set_input_return(cell_options_->input_mcolumn_width,
150 fl_set_input_return(cell_options_->input_special_multialign,
153 // trigger an input event for cut&paste with middle mouse button.
154 setPrehandler(cell_options_->input_mcolumn_width);
155 setPrehandler(cell_options_->input_special_multialign);
157 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
160 longtable_options_.reset(build_tabular_longtable(this));
162 fl_addto_tabfolder(dialog_->tabfolder, _("Tabular"),
163 tabular_options_->form);
164 fl_addto_tabfolder(dialog_->tabfolder, _("Column/Row"),
165 column_options_->form);
166 fl_addto_tabfolder(dialog_->tabfolder, _("Cell"),
167 cell_options_->form);
168 fl_addto_tabfolder(dialog_->tabfolder, _("LongTable"),
169 longtable_options_->form);
171 // work-around xforms bug re update of folder->x, folder->y coords.
172 setPrehandler(dialog_->tabfolder);
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)) {
218 fl_set_button(cell_options_->check_border_left,
219 tabular->LeftLine(cell)?1:0);
220 setEnabled(cell_options_->check_border_left, true);
222 fl_set_button(cell_options_->check_border_left, 0);
223 setEnabled(cell_options_->check_border_left, false);
225 if (tabular->IsLastCellInRow(cell) ||
226 tabular->IsMultiColumn(cell+1)) {
227 fl_set_button(cell_options_->check_border_right,
228 tabular->RightLine(cell)?1:0);
229 setEnabled(cell_options_->check_border_right, true);
231 fl_set_button(cell_options_->check_border_right, 0);
232 setEnabled(cell_options_->check_border_right, false);
234 pwidth = tabular->GetMColumnPWidth(cell);
235 align = tabular->GetAlignment(cell);
236 if (align == LYX_ALIGN_LEFT)
237 fl_set_button(cell_options_->radio_align_left, 1);
238 else if (align == LYX_ALIGN_RIGHT)
239 fl_set_button(cell_options_->radio_align_right, 1);
241 fl_set_button(cell_options_->radio_align_center, 1);
243 align = tabular->GetVAlignment(cell);
244 fl_set_button(cell_options_->radio_valign_top, 0);
245 fl_set_button(cell_options_->radio_valign_bottom, 0);
246 fl_set_button(cell_options_->radio_valign_center, 0);
247 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
248 fl_set_button(cell_options_->radio_valign_center, 1);
249 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
250 fl_set_button(cell_options_->radio_valign_bottom, 1);
252 fl_set_button(cell_options_->radio_valign_top, 1);
254 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
255 fl_set_input(cell_options_->input_special_multialign, special.c_str());
256 bool const metric = lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER;
257 string const default_unit = metric ? "cm" : "in";
258 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
259 cell_options_->choice_value_mcolumn_width,
260 pwidth, default_unit);
262 if (!lv_.buffer()->isReadonly()) {
263 setEnabled(cell_options_->input_special_multialign, true);
264 setEnabled(cell_options_->input_mcolumn_width, true);
265 setEnabled(cell_options_->choice_value_mcolumn_width, true);
268 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
269 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
270 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
272 setEnabled(cell_options_->radio_align_left, true);
273 setEnabled(cell_options_->radio_align_right, true);
274 setEnabled(cell_options_->radio_align_center, true);
276 fl_set_button(cell_options_->check_multicolumn, 0);
278 fl_set_button(cell_options_->check_border_top, 0);
279 setEnabled(cell_options_->check_border_top, false);
281 fl_set_button(cell_options_->check_border_bottom, 0);
282 setEnabled(cell_options_->check_border_bottom, false);
284 fl_set_button(cell_options_->check_border_left, 0);
285 setEnabled(cell_options_->check_border_left, false);
287 fl_set_button(cell_options_->check_border_right, 0);
288 setEnabled(cell_options_->check_border_right, false);
290 fl_set_button(cell_options_->radio_align_left, 0);
291 setEnabled(cell_options_->radio_align_left, false);
293 fl_set_button(cell_options_->radio_align_right, 0);
294 setEnabled(cell_options_->radio_align_right, false);
296 fl_set_button(cell_options_->radio_align_center, 0);
297 setEnabled(cell_options_->radio_align_center, false);
299 fl_set_button(cell_options_->radio_valign_top, 0);
300 setEnabled(cell_options_->radio_valign_top, false);
302 fl_set_button(cell_options_->radio_valign_bottom, 0);
303 setEnabled(cell_options_->radio_valign_bottom, false);
305 fl_set_button(cell_options_->radio_valign_center, 0);
306 setEnabled(cell_options_->radio_valign_center, false);
308 fl_set_input(cell_options_->input_special_multialign, "");
309 setEnabled(cell_options_->input_special_multialign, false);
311 fl_set_input(cell_options_->input_mcolumn_width, "");
312 setEnabled(cell_options_->input_mcolumn_width, false);
313 setEnabled(cell_options_->choice_value_mcolumn_width, false);
315 if (tabular->GetRotateCell(cell))
316 fl_set_button(cell_options_->check_rotate_cell, 1);
318 fl_set_button(cell_options_->check_rotate_cell, 0);
319 if (tabular->TopLine(cell, true))
320 fl_set_button(column_options_->check_border_top, 1);
322 fl_set_button(column_options_->check_border_top, 0);
323 if (tabular->BottomLine(cell, true))
324 fl_set_button(column_options_->check_border_bottom, 1);
326 fl_set_button(column_options_->check_border_bottom, 0);
327 if (tabular->LeftLine(cell, true))
328 fl_set_button(column_options_->check_border_left, 1);
330 fl_set_button(column_options_->check_border_left, 0);
331 if (tabular->RightLine(cell, true))
332 fl_set_button(column_options_->check_border_right, 1);
334 fl_set_button(column_options_->check_border_right, 0);
335 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
336 fl_set_input(column_options_->input_special_alignment, special.c_str());
338 bool const isReadonly = lv_.buffer()->isReadonly();
339 setEnabled(column_options_->input_special_alignment, !isReadonly);
341 pwidth = tabular->GetColumnPWidth(cell);
342 bool const metric = lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER;
343 string const default_unit = metric ? "cm" : "in";
344 updateWidgetsFromLength(column_options_->input_column_width,
345 column_options_->choice_value_column_width,
346 pwidth, default_unit);
347 setEnabled(column_options_->input_column_width, !isReadonly);
348 setEnabled(column_options_->choice_value_column_width, !isReadonly);
350 setEnabled(cell_options_->check_useminipage, !pwidth.zero());
351 if (!pwidth.zero()) {
352 if (tabular->GetUsebox(cell) == 2)
353 fl_set_button(cell_options_->check_useminipage, 1);
355 fl_set_button(cell_options_->check_useminipage, 0);
357 fl_set_button(cell_options_->check_useminipage, 0);
359 align = tabular->GetAlignment(cell, true);
360 fl_set_button(column_options_->radio_align_left, 0);
361 fl_set_button(column_options_->radio_align_right, 0);
362 fl_set_button(column_options_->radio_align_center, 0);
363 if (align == LYX_ALIGN_LEFT)
364 fl_set_button(column_options_->radio_align_left, 1);
365 else if (align == LYX_ALIGN_RIGHT)
366 fl_set_button(column_options_->radio_align_right, 1);
368 fl_set_button(column_options_->radio_align_center, 1);
369 align = tabular->GetVAlignment(cell, true);
370 fl_set_button(column_options_->radio_valign_top, 0);
371 fl_set_button(column_options_->radio_valign_bottom, 0);
372 fl_set_button(column_options_->radio_valign_center, 0);
373 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
374 fl_set_button(column_options_->radio_valign_center, 1);
375 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
376 fl_set_button(column_options_->radio_valign_bottom, 1);
378 fl_set_button(column_options_->radio_valign_top, 1);
380 setEnabled(column_options_->radio_align_left, true);
381 setEnabled(column_options_->radio_align_right, true);
382 setEnabled(column_options_->radio_align_center, true);
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 = getString(column_options_->input_special_alignment);
544 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
546 input(column_options_->input_special_alignment, 0);
547 str1 = getString(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().get(), LyXTabular::SET_PWIDTH, str);
574 //check if the input is valid
575 string const input = getString(column_options_->input_column_width);
576 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
577 postWarning(_("Invalid Length (valid example: 10mm)"));
581 update(); // update for alignment
585 if ((ob == cell_options_->input_mcolumn_width) ||
586 (ob == cell_options_->choice_value_mcolumn_width)) {
588 getLengthFromWidgets(cell_options_->input_mcolumn_width,
589 cell_options_->choice_value_mcolumn_width);
590 inset_->tabularFeatures(lv_.view().get(), LyXTabular::SET_MPWIDTH, str);
592 //check if the input is valid
593 string const input = getString(cell_options_->input_mcolumn_width);
594 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
595 postWarning(_("Invalid Length (valid example: 10mm)"));
598 update(); // update for alignment
602 if (ob == tabular_options_->button_append_row)
603 num = LyXTabular::APPEND_ROW;
604 else if (ob == tabular_options_->button_append_column)
605 num = LyXTabular::APPEND_COLUMN;
606 else if (ob == tabular_options_->button_delete_row)
607 num = LyXTabular::DELETE_ROW;
608 else if (ob == tabular_options_->button_delete_column)
609 num = LyXTabular::DELETE_COLUMN;
610 else if (ob == tabular_options_->button_set_borders)
611 num = LyXTabular::SET_ALL_LINES;
612 else if (ob == tabular_options_->button_unset_borders)
613 num = LyXTabular::UNSET_ALL_LINES;
614 else if (ob == column_options_->check_border_top)
615 num = LyXTabular::TOGGLE_LINE_TOP;
616 else if (ob == column_options_->check_border_bottom)
617 num = LyXTabular::TOGGLE_LINE_BOTTOM;
618 else if (ob == column_options_->check_border_left)
619 num = LyXTabular::TOGGLE_LINE_LEFT;
620 else if (ob == column_options_->check_border_right)
621 num = LyXTabular::TOGGLE_LINE_RIGHT;
622 else if (ob == column_options_->radio_align_left)
623 num = LyXTabular::ALIGN_LEFT;
624 else if (ob == column_options_->radio_align_right)
625 num = LyXTabular::ALIGN_RIGHT;
626 else if (ob == column_options_->radio_align_center)
627 num = LyXTabular::ALIGN_CENTER;
628 else if (ob == column_options_->radio_valign_top)
629 num = LyXTabular::VALIGN_TOP;
630 else if (ob == column_options_->radio_valign_bottom)
631 num = LyXTabular::VALIGN_BOTTOM;
632 else if (ob == column_options_->radio_valign_center)
633 num = LyXTabular::VALIGN_CENTER;
634 else if (ob == cell_options_->check_multicolumn)
635 num = LyXTabular::MULTICOLUMN;
636 else if (ob == tabular_options_->check_longtable) {
637 if (fl_get_button(tabular_options_->check_longtable))
638 num = LyXTabular::SET_LONGTABULAR;
640 num = LyXTabular::UNSET_LONGTABULAR;
641 } else if (ob == tabular_options_->check_rotate_tabular) {
642 s = fl_get_button(tabular_options_->check_rotate_tabular);
644 num = LyXTabular::SET_ROTATE_TABULAR;
646 num = LyXTabular::UNSET_ROTATE_TABULAR;
647 } else if (ob == cell_options_->check_rotate_cell) {
648 s = fl_get_button(cell_options_->check_rotate_cell);
650 num = LyXTabular::SET_ROTATE_CELL;
652 num = LyXTabular::UNSET_ROTATE_CELL;
653 } else if (ob == cell_options_->check_useminipage) {
654 num = LyXTabular::SET_USEBOX;
656 } else if ((ob == longtable_options_->check_lt_firsthead) ||
657 (ob == longtable_options_->check_1head_2border_above) ||
658 (ob == longtable_options_->check_1head_2border_below) ||
659 (ob == longtable_options_->check_1head_empty) ||
660 (ob == longtable_options_->check_lt_head) ||
661 (ob == longtable_options_->check_head_2border_above) ||
662 (ob == longtable_options_->check_head_2border_below) ||
663 (ob == longtable_options_->check_lt_foot) ||
664 (ob == longtable_options_->check_foot_2border_above) ||
665 (ob == longtable_options_->check_foot_2border_below) ||
666 (ob == longtable_options_->check_lt_lastfoot) ||
667 (ob == longtable_options_->check_lastfoot_2border_above) ||
668 (ob == longtable_options_->check_lastfoot_2border_below) ||
669 (ob == longtable_options_->check_lastfoot_empty)) {
670 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
671 } else if (ob == longtable_options_->check_lt_newpage) {
672 num = LyXTabular::SET_LTNEWPAGE;
673 } else if (ob == column_options_->input_special_alignment) {
674 special = getString(column_options_->input_special_alignment);
675 num = LyXTabular::SET_SPECIAL_COLUMN;
676 } else if (ob == cell_options_->input_special_multialign) {
677 special = getString(cell_options_->input_special_multialign);
678 num = LyXTabular::SET_SPECIAL_MULTI;
679 } else if (ob == cell_options_->check_border_top)
680 num = LyXTabular::M_TOGGLE_LINE_TOP;
681 else if (ob == cell_options_->check_border_bottom)
682 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
683 else if (ob == cell_options_->check_border_left)
684 num = LyXTabular::M_TOGGLE_LINE_LEFT;
685 else if (ob == cell_options_->check_border_right)
686 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
687 else if (ob == cell_options_->radio_align_left)
688 num = LyXTabular::M_ALIGN_LEFT;
689 else if (ob == cell_options_->radio_align_right)
690 num = LyXTabular::M_ALIGN_RIGHT;
691 else if (ob == cell_options_->radio_align_center)
692 num = LyXTabular::M_ALIGN_CENTER;
693 else if (ob == cell_options_->radio_valign_top)
694 num = LyXTabular::M_VALIGN_TOP;
695 else if (ob == cell_options_->radio_valign_bottom)
696 num = LyXTabular::M_VALIGN_BOTTOM;
697 else if (ob == cell_options_->radio_valign_center)
698 num = LyXTabular::M_VALIGN_CENTER;
702 inset_->tabularFeatures(lv_.view().get(), num, special);
708 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
710 bool flag = fl_get_button(ob);
711 if ((ob == longtable_options_->check_1head_2border_above) ||
712 (ob == longtable_options_->check_head_2border_above) ||
713 (ob == longtable_options_->check_foot_2border_above) ||
714 (ob == longtable_options_->check_lastfoot_2border_above)) {
715 special = "dl_above";
716 } else if ((ob == longtable_options_->check_1head_2border_below) ||
717 (ob == longtable_options_->check_head_2border_below) ||
718 (ob == longtable_options_->check_foot_2border_below) ||
719 (ob == longtable_options_->check_lastfoot_2border_below)) {
720 special = "dl_below";
721 } else if ((ob == longtable_options_->check_1head_empty) ||
722 (ob == longtable_options_->check_lastfoot_empty)) {
727 if ((ob == longtable_options_->check_lt_firsthead) ||
728 (ob == longtable_options_->check_1head_2border_above) ||
729 (ob == longtable_options_->check_1head_2border_below) ||
730 (ob == longtable_options_->check_1head_empty)) {
731 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
732 LyXTabular::UNSET_LTFIRSTHEAD);
733 } else if ((ob == longtable_options_->check_lt_head) ||
734 (ob == longtable_options_->check_head_2border_above) ||
735 (ob == longtable_options_->check_head_2border_below)) {
736 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
737 } else if ((ob == longtable_options_->check_lt_foot) ||
738 (ob == longtable_options_->check_foot_2border_above) ||
739 (ob == longtable_options_->check_foot_2border_below)) {
740 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
741 } else if ((ob == longtable_options_->check_lt_lastfoot) ||
742 (ob == longtable_options_->check_lastfoot_2border_above) ||
743 (ob == longtable_options_->check_lastfoot_2border_below) ||
744 (ob == longtable_options_->check_lastfoot_empty)) {
745 return (flag ? LyXTabular::SET_LTLASTFOOT :
746 LyXTabular::UNSET_LTLASTFOOT);
749 return LyXTabular::LAST_ACTION;