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 "forms/form_tabular.h"
19 #include "frontends/LyXView.h"
21 #include "xforms_helpers.h"
22 #include "lyxrc.h" // to set the default length values
23 #include "helper_funcs.h"
24 #include "input_validators.h"
26 #include "insets/insettabular.h"
28 #include "support/lstrings.h"
30 #include <boost/bind.hpp>
33 #include FORMS_H_LOCATION
41 FormTabular::FormTabular(LyXView & lv, Dialogs & d)
42 : FormInset(lv, d, _("Tabular Layout")),
43 inset_(0), actCell_(-1), closing_(false)
48 void FormTabular::redraw()
50 if (form() && form()->visible)
51 fl_redraw_form(form());
55 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabfolder);
56 if (outer_form && outer_form->visible)
57 fl_redraw_form(outer_form);
61 FL_FORM * FormTabular::form() const
69 void FormTabular::disconnect()
72 FormInset::disconnect();
76 void FormTabular::showInset(InsetTabular * inset)
78 if (inset == 0) return;
80 // If connected to another inset, disconnect from it.
81 if (inset_ != inset) {
83 ih_ = inset->hideDialog.connect(boost::bind(&FormTabular::hide, this));
91 void FormTabular::updateInset(InsetTabular * inset)
93 if (inset == 0 || inset_ == 0) return;
95 // If connected to another inset, disconnect from it.
96 if (inset_ != inset) {
98 ih_ = inset->hideDialog.connect(boost::bind(&FormTabular::hide, this));
106 void FormTabular::build()
108 dialog_.reset(build_tabular(this));
110 // Allow the base class to control messages
111 setMessageWidget(dialog_->text_warning);
113 setPrehandler(dialog_->input_tabular_column);
114 setPrehandler(dialog_->input_tabular_row);
116 tabular_options_.reset(build_tabular_options(this));
117 column_options_.reset(build_tabular_column(this));
118 cell_options_.reset(build_tabular_cell(this));
119 longtable_options_.reset(build_tabular_longtable(this));
121 fl_set_input_return(column_options_->input_column_width,
123 fl_set_input_return(column_options_->input_special_alignment,
126 setPrehandler(column_options_->input_column_width);
127 setPrehandler(column_options_->input_special_alignment);
129 fl_set_input_return(cell_options_->input_mcolumn_width,
131 fl_set_input_return(cell_options_->input_special_multialign,
134 setPrehandler(cell_options_->input_mcolumn_width);
135 setPrehandler(cell_options_->input_special_multialign);
137 fl_addto_tabfolder(dialog_->tabfolder, _("Tabular"),
138 tabular_options_->form);
139 fl_addto_tabfolder(dialog_->tabfolder, _("Column/Row"),
140 column_options_->form);
141 fl_addto_tabfolder(dialog_->tabfolder, _("Cell"),
142 cell_options_->form);
143 fl_addto_tabfolder(dialog_->tabfolder, _("LongTable"),
144 longtable_options_->form);
146 // Create the contents of the unit choices
147 // Don't include the "%" terms...
148 vector<string> units_vec = getLatexUnits();
149 vector<string>::iterator ret =
150 remove_if(units_vec.begin(), units_vec.end(),
151 bind2nd(contains_functor(), "%"));
152 units_vec.erase(ret, units_vec.end());
154 string units = getStringFromVector(units_vec, "|");
156 fl_addto_choice(column_options_->choice_value_column_width,
158 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
163 void FormTabular::update()
168 if (!inset_ || !inset_->tabular.get())
171 LyXTabular * tabular = inset_->tabular.get();
177 int cell = inset_->getActCell();
179 int column = tabular->column_of_cell(cell) + 1;
181 fl_activate_object(column_options_->input_special_alignment);
182 fl_activate_object(cell_options_->input_special_multialign);
183 fl_activate_object(column_options_->input_column_width);
184 fl_activate_object(column_options_->choice_value_column_width);
185 sprintf(buf, "%d", column);
186 fl_set_input(dialog_->input_tabular_column, buf);
187 fl_deactivate_object(dialog_->input_tabular_column);
188 int row = tabular->row_of_cell(cell);
189 sprintf(buf, "%d", row + 1);
190 fl_set_input(dialog_->input_tabular_row, buf);
191 fl_deactivate_object(dialog_->input_tabular_row);
192 if (tabular->IsMultiColumn(cell)) {
193 fl_set_button(cell_options_->check_multicolumn, 1);
194 fl_set_button(cell_options_->check_border_top,
195 tabular->TopLine(cell)?1:0);
196 setEnabled(cell_options_->check_border_top, true);
197 fl_set_button(cell_options_->check_border_bottom,
198 tabular->BottomLine(cell)?1:0);
199 setEnabled(cell_options_->check_border_bottom, true);
200 // pay attention to left/right lines they are only allowed
201 // to set if we are in first/last cell of row or if the left/right
202 // cell is also a multicolumn.
203 if (tabular->IsFirstCellInRow(cell) ||
204 tabular->IsMultiColumn(cell-1)) {
205 fl_set_button(cell_options_->check_border_left,
206 tabular->LeftLine(cell)?1:0);
207 setEnabled(cell_options_->check_border_left, true);
209 fl_set_button(cell_options_->check_border_left, 0);
210 setEnabled(cell_options_->check_border_left, false);
212 if (tabular->IsLastCellInRow(cell) ||
213 tabular->IsMultiColumn(cell+1)) {
214 fl_set_button(cell_options_->check_border_right,
215 tabular->RightLine(cell)?1:0);
216 setEnabled(cell_options_->check_border_right, true);
218 fl_set_button(cell_options_->check_border_right, 0);
219 setEnabled(cell_options_->check_border_right, false);
221 pwidth = tabular->GetMColumnPWidth(cell);
222 align = tabular->GetAlignment(cell);
223 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
224 fl_set_button(cell_options_->radio_align_left, 1);
225 else if (align == LYX_ALIGN_RIGHT)
226 fl_set_button(cell_options_->radio_align_right, 1);
228 fl_set_button(cell_options_->radio_align_center, 1);
230 align = tabular->GetVAlignment(cell);
231 fl_set_button(cell_options_->radio_valign_top, 0);
232 fl_set_button(cell_options_->radio_valign_bottom, 0);
233 fl_set_button(cell_options_->radio_valign_center, 0);
234 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
235 fl_set_button(cell_options_->radio_valign_center, 1);
236 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
237 fl_set_button(cell_options_->radio_valign_bottom, 1);
239 fl_set_button(cell_options_->radio_valign_top, 1);
241 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
242 fl_set_input(cell_options_->input_special_multialign, special.c_str());
243 bool const metric = lyxrc.default_papersize > 3;
244 string const default_unit = metric ? "cm" : "in";
245 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
246 cell_options_->choice_value_mcolumn_width,
247 pwidth, default_unit);
249 if (!lv_.buffer()->isReadonly()) {
250 setEnabled(cell_options_->input_special_multialign, true);
251 setEnabled(cell_options_->input_mcolumn_width, true);
252 setEnabled(cell_options_->choice_value_mcolumn_width, true);
255 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
256 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
257 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
259 setEnabled(cell_options_->radio_align_left, pwidth.zero());
260 setEnabled(cell_options_->radio_align_right, pwidth.zero());
261 setEnabled(cell_options_->radio_align_center, pwidth.zero());
263 fl_set_button(cell_options_->check_multicolumn, 0);
265 fl_set_button(cell_options_->check_border_top, 0);
266 setEnabled(cell_options_->check_border_top, false);
268 fl_set_button(cell_options_->check_border_bottom, 0);
269 setEnabled(cell_options_->check_border_bottom, false);
271 fl_set_button(cell_options_->check_border_left, 0);
272 setEnabled(cell_options_->check_border_left, false);
274 fl_set_button(cell_options_->check_border_right, 0);
275 setEnabled(cell_options_->check_border_right, false);
277 fl_set_button(cell_options_->radio_align_left, 0);
278 setEnabled(cell_options_->radio_align_left, false);
280 fl_set_button(cell_options_->radio_align_right, 0);
281 setEnabled(cell_options_->radio_align_right, false);
283 fl_set_button(cell_options_->radio_align_center, 0);
284 setEnabled(cell_options_->radio_align_center, false);
286 fl_set_button(cell_options_->radio_valign_top, 0);
287 setEnabled(cell_options_->radio_valign_top, false);
289 fl_set_button(cell_options_->radio_valign_bottom, 0);
290 setEnabled(cell_options_->radio_valign_bottom, false);
292 fl_set_button(cell_options_->radio_valign_center, 0);
293 setEnabled(cell_options_->radio_valign_center, false);
295 fl_set_input(cell_options_->input_special_multialign, "");
296 setEnabled(cell_options_->input_special_multialign, false);
298 fl_set_input(cell_options_->input_mcolumn_width, "");
299 setEnabled(cell_options_->input_mcolumn_width, false);
300 setEnabled(cell_options_->choice_value_mcolumn_width, false);
302 if (tabular->GetRotateCell(cell))
303 fl_set_button(cell_options_->check_rotate_cell, 1);
305 fl_set_button(cell_options_->check_rotate_cell, 0);
306 if (tabular->TopLine(cell, true))
307 fl_set_button(column_options_->check_border_top, 1);
309 fl_set_button(column_options_->check_border_top, 0);
310 if (tabular->BottomLine(cell, true))
311 fl_set_button(column_options_->check_border_bottom, 1);
313 fl_set_button(column_options_->check_border_bottom, 0);
314 if (tabular->LeftLine(cell, true))
315 fl_set_button(column_options_->check_border_left, 1);
317 fl_set_button(column_options_->check_border_left, 0);
318 if (tabular->RightLine(cell, true))
319 fl_set_button(column_options_->check_border_right, 1);
321 fl_set_button(column_options_->check_border_right, 0);
322 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
323 fl_set_input(column_options_->input_special_alignment, special.c_str());
325 bool const isReadonly = lv_.buffer()->isReadonly();
326 setEnabled(column_options_->input_special_alignment, !isReadonly);
328 pwidth = tabular->GetColumnPWidth(cell);
329 bool const metric = lyxrc.default_papersize > 3;
330 string const default_unit = metric ? "cm" : "in";
331 updateWidgetsFromLength(column_options_->input_column_width,
332 column_options_->choice_value_column_width,
333 pwidth, default_unit);
334 setEnabled(column_options_->input_column_width, !isReadonly);
335 setEnabled(column_options_->choice_value_column_width, !isReadonly);
337 setEnabled(cell_options_->check_useminipage, !pwidth.zero());
338 if (!pwidth.zero()) {
339 if (tabular->GetUsebox(cell) == 2)
340 fl_set_button(cell_options_->check_useminipage, 1);
342 fl_set_button(cell_options_->check_useminipage, 0);
344 fl_set_button(cell_options_->check_useminipage, 0);
346 align = tabular->GetAlignment(cell, true);
347 fl_set_button(column_options_->radio_align_left, 0);
348 fl_set_button(column_options_->radio_align_right, 0);
349 fl_set_button(column_options_->radio_align_center, 0);
350 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
351 fl_set_button(column_options_->radio_align_left, 1);
352 else if (align == LYX_ALIGN_RIGHT)
353 fl_set_button(column_options_->radio_align_right, 1);
355 fl_set_button(column_options_->radio_align_center, 1);
356 align = tabular->GetVAlignment(cell, true);
357 fl_set_button(column_options_->radio_valign_top, 0);
358 fl_set_button(column_options_->radio_valign_bottom, 0);
359 fl_set_button(column_options_->radio_valign_center, 0);
360 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
361 fl_set_button(column_options_->radio_valign_center, 1);
362 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
363 fl_set_button(column_options_->radio_valign_bottom, 1);
365 fl_set_button(column_options_->radio_valign_top, 1);
367 setEnabled(column_options_->radio_align_left, pwidth.zero());
368 setEnabled(column_options_->radio_align_right, pwidth.zero());
369 setEnabled(column_options_->radio_align_center, pwidth.zero());
371 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
372 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
373 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
375 fl_set_button(tabular_options_->check_longtable,
376 tabular->IsLongTabular());
378 bool const enable = tabular->IsLongTabular();
380 setEnabled(longtable_options_->check_lt_firsthead, enable);
381 setEnabled(longtable_options_->check_1head_2border_above, enable);
382 setEnabled(longtable_options_->check_1head_2border_below, enable);
383 setEnabled(longtable_options_->check_1head_empty, enable);
384 setEnabled(longtable_options_->check_lt_head, enable);
385 setEnabled(longtable_options_->check_head_2border_above, enable);
386 setEnabled(longtable_options_->check_head_2border_below, enable);
387 setEnabled(longtable_options_->check_lt_foot, enable);
388 setEnabled(longtable_options_->check_foot_2border_above, enable);
389 setEnabled(longtable_options_->check_foot_2border_below, enable);
390 setEnabled(longtable_options_->check_lt_lastfoot, enable);
391 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
392 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
393 setEnabled(longtable_options_->check_lastfoot_empty, enable);
394 setEnabled(longtable_options_->check_lt_newpage, enable);
397 LyXTabular::ltType ltt;
399 bool row_set = tabular->GetRowOfLTHead(row, ltt);
400 fl_set_button(longtable_options_->check_lt_head, row_set);
402 fl_set_button(longtable_options_->check_head_2border_above,
404 fl_set_button(longtable_options_->check_head_2border_above,
408 setEnabled(longtable_options_->check_head_2border_above, 0);
409 setEnabled(longtable_options_->check_head_2border_below, 0);
410 fl_set_button(longtable_options_->check_head_2border_above,0);
411 fl_set_button(longtable_options_->check_head_2border_above,0);
412 fl_set_button(longtable_options_->check_1head_empty,0);
413 setEnabled(longtable_options_->check_1head_empty, 0);
417 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
418 fl_set_button(longtable_options_->check_lt_firsthead, row_set);
419 if (ltt.set && (!ltt.empty || !use_empty)) {
420 fl_set_button(longtable_options_->check_1head_2border_above,
422 fl_set_button(longtable_options_->check_1head_2border_above,
425 setEnabled(longtable_options_->check_1head_2border_above, 0);
426 setEnabled(longtable_options_->check_1head_2border_below, 0);
427 fl_set_button(longtable_options_->check_1head_2border_above,0);
428 fl_set_button(longtable_options_->check_1head_2border_above,0);
430 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
432 setEnabled(longtable_options_->check_lt_firsthead, 0);
436 row_set = tabular->GetRowOfLTFoot(row, ltt);
437 fl_set_button(longtable_options_->check_lt_foot, row_set);
439 fl_set_button(longtable_options_->check_foot_2border_above,
441 fl_set_button(longtable_options_->check_foot_2border_above,
445 setEnabled(longtable_options_->check_foot_2border_above, 0);
446 setEnabled(longtable_options_->check_foot_2border_below, 0);
447 fl_set_button(longtable_options_->check_foot_2border_above,0);
448 fl_set_button(longtable_options_->check_foot_2border_above,0);
449 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
450 setEnabled(longtable_options_->check_lastfoot_empty, 0);
454 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
455 fl_set_button(longtable_options_->check_lt_lastfoot, row_set);
456 if (ltt.set && (!ltt.empty || !use_empty)) {
457 fl_set_button(longtable_options_->check_lastfoot_2border_above,
459 fl_set_button(longtable_options_->check_lastfoot_2border_above,
462 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
463 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
464 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
465 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
467 fl_set_button(longtable_options_->check_lastfoot_empty,
470 setEnabled(longtable_options_->check_lt_lastfoot, 0);
473 fl_set_button(longtable_options_->check_lt_newpage,
474 tabular->GetLTNewPage(row));
476 fl_set_button(longtable_options_->check_lt_firsthead, 0);
477 fl_set_button(longtable_options_->check_1head_2border_above, 0);
478 fl_set_button(longtable_options_->check_1head_2border_above, 0);
479 fl_set_button(longtable_options_->check_1head_empty, 0);
480 fl_set_button(longtable_options_->check_lt_head, 0);
481 fl_set_button(longtable_options_->check_head_2border_above, 0);
482 fl_set_button(longtable_options_->check_head_2border_above, 0);
483 fl_set_button(longtable_options_->check_lt_foot, 0);
484 fl_set_button(longtable_options_->check_foot_2border_above, 0);
485 fl_set_button(longtable_options_->check_foot_2border_above, 0);
486 fl_set_button(longtable_options_->check_lt_lastfoot, 0);
487 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
488 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
489 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
490 fl_set_button(longtable_options_->check_lt_newpage, 0);
492 fl_set_button(tabular_options_->check_rotate_tabular,
493 tabular->GetRotateTabular());
497 bool FormTabular::input(FL_OBJECT * ob, long)
503 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
506 int cell = inset_->getActCell();
508 // ugly hack to auto-apply the stuff that hasn't been
509 // yet. don't let this continue to exist ...
510 if (ob == dialog_->button_close) {
512 LyXTabular * tabular = inset_->tabular.get();
514 getLengthFromWidgets(column_options_->input_column_width,
515 column_options_->choice_value_column_width);
517 LyXLength llen = tabular->GetColumnPWidth(cell);
519 str2 = llen.asString();
521 input(column_options_->input_column_width, 0);
522 str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
523 cell_options_->choice_value_mcolumn_width);
524 llen = tabular->GetMColumnPWidth(cell);
528 str2 = llen.asString();
530 input(cell_options_->input_mcolumn_width, 0);
531 str1 = fl_get_input(column_options_->input_special_alignment);
532 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
534 input(column_options_->input_special_alignment, 0);
535 str1 = fl_get_input(cell_options_->input_special_multialign);
536 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
538 input(cell_options_->input_special_multialign, 0);
544 if (actCell_ != cell) {
546 postWarning(_("Wrong Cursor position, updated window"));
549 // No point in processing directives that you can't do anything with
550 // anyhow, so exit now if the buffer is read-only.
551 if (lv_.buffer()->isReadonly()) {
555 if ((ob == column_options_->input_column_width) ||
556 (ob == column_options_->choice_value_column_width)) {
558 getLengthFromWidgets(column_options_->input_column_width,
559 column_options_->choice_value_column_width);
560 inset_->tabularFeatures(lv_.view().get(), LyXTabular::SET_PWIDTH, str);
562 //check if the input is valid
564 fl_get_input(column_options_->input_column_width);
565 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
566 postWarning(_("Invalid Length (valid example: 10mm)"));
570 update(); // update for alignment
574 if ((ob == cell_options_->input_mcolumn_width) ||
575 (ob == cell_options_->choice_value_mcolumn_width)) {
577 getLengthFromWidgets(cell_options_->input_mcolumn_width,
578 cell_options_->choice_value_mcolumn_width);
579 inset_->tabularFeatures(lv_.view().get(), LyXTabular::SET_MPWIDTH, str);
581 //check if the input is valid
583 fl_get_input(cell_options_->input_mcolumn_width);
584 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
585 postWarning(_("Invalid Length (valid example: 10mm)"));
588 update(); // update for alignment
592 if (ob == tabular_options_->button_append_row)
593 num = LyXTabular::APPEND_ROW;
594 else if (ob == tabular_options_->button_append_column)
595 num = LyXTabular::APPEND_COLUMN;
596 else if (ob == tabular_options_->button_delete_row)
597 num = LyXTabular::DELETE_ROW;
598 else if (ob == tabular_options_->button_delete_column)
599 num = LyXTabular::DELETE_COLUMN;
600 else if (ob == tabular_options_->button_set_borders)
601 num = LyXTabular::SET_ALL_LINES;
602 else if (ob == tabular_options_->button_unset_borders)
603 num = LyXTabular::UNSET_ALL_LINES;
604 else if (ob == column_options_->check_border_top)
605 num = LyXTabular::TOGGLE_LINE_TOP;
606 else if (ob == column_options_->check_border_bottom)
607 num = LyXTabular::TOGGLE_LINE_BOTTOM;
608 else if (ob == column_options_->check_border_left)
609 num = LyXTabular::TOGGLE_LINE_LEFT;
610 else if (ob == column_options_->check_border_right)
611 num = LyXTabular::TOGGLE_LINE_RIGHT;
612 else if (ob == column_options_->radio_align_left)
613 num = LyXTabular::ALIGN_LEFT;
614 else if (ob == column_options_->radio_align_right)
615 num = LyXTabular::ALIGN_RIGHT;
616 else if (ob == column_options_->radio_align_center)
617 num = LyXTabular::ALIGN_CENTER;
618 else if (ob == column_options_->radio_valign_top)
619 num = LyXTabular::VALIGN_TOP;
620 else if (ob == column_options_->radio_valign_bottom)
621 num = LyXTabular::VALIGN_BOTTOM;
622 else if (ob == column_options_->radio_valign_center)
623 num = LyXTabular::VALIGN_CENTER;
624 else if (ob == cell_options_->check_multicolumn)
625 num = LyXTabular::MULTICOLUMN;
626 else if (ob == tabular_options_->check_longtable) {
627 if (fl_get_button(tabular_options_->check_longtable))
628 num = LyXTabular::SET_LONGTABULAR;
630 num = LyXTabular::UNSET_LONGTABULAR;
631 } else if (ob == tabular_options_->check_rotate_tabular) {
632 s = fl_get_button(tabular_options_->check_rotate_tabular);
634 num = LyXTabular::SET_ROTATE_TABULAR;
636 num = LyXTabular::UNSET_ROTATE_TABULAR;
637 } else if (ob == cell_options_->check_rotate_cell) {
638 s = fl_get_button(cell_options_->check_rotate_cell);
640 num = LyXTabular::SET_ROTATE_CELL;
642 num = LyXTabular::UNSET_ROTATE_CELL;
643 } else if (ob == cell_options_->check_useminipage) {
644 num = LyXTabular::SET_USEBOX;
646 } else if ((ob == longtable_options_->check_lt_firsthead) ||
647 (ob == longtable_options_->check_1head_2border_above) ||
648 (ob == longtable_options_->check_1head_2border_below) ||
649 (ob == longtable_options_->check_1head_empty) ||
650 (ob == longtable_options_->check_lt_head) ||
651 (ob == longtable_options_->check_head_2border_above) ||
652 (ob == longtable_options_->check_head_2border_below) ||
653 (ob == longtable_options_->check_lt_foot) ||
654 (ob == longtable_options_->check_foot_2border_above) ||
655 (ob == longtable_options_->check_foot_2border_below) ||
656 (ob == longtable_options_->check_lt_lastfoot) ||
657 (ob == longtable_options_->check_lastfoot_2border_above) ||
658 (ob == longtable_options_->check_lastfoot_2border_below) ||
659 (ob == longtable_options_->check_lastfoot_empty)) {
660 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
661 } else if (ob == longtable_options_->check_lt_newpage) {
662 num = LyXTabular::SET_LTNEWPAGE;
663 } else if (ob == column_options_->input_special_alignment) {
664 special = fl_get_input(column_options_->input_special_alignment);
665 num = LyXTabular::SET_SPECIAL_COLUMN;
666 } else if (ob == cell_options_->input_special_multialign) {
667 special = fl_get_input(cell_options_->input_special_multialign);
668 num = LyXTabular::SET_SPECIAL_MULTI;
669 } else if (ob == cell_options_->check_border_top)
670 num = LyXTabular::M_TOGGLE_LINE_TOP;
671 else if (ob == cell_options_->check_border_bottom)
672 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
673 else if (ob == cell_options_->check_border_left)
674 num = LyXTabular::M_TOGGLE_LINE_LEFT;
675 else if (ob == cell_options_->check_border_right)
676 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
677 else if (ob == cell_options_->radio_align_left)
678 num = LyXTabular::M_ALIGN_LEFT;
679 else if (ob == cell_options_->radio_align_right)
680 num = LyXTabular::M_ALIGN_RIGHT;
681 else if (ob == cell_options_->radio_align_center)
682 num = LyXTabular::M_ALIGN_CENTER;
683 else if (ob == cell_options_->radio_valign_top)
684 num = LyXTabular::M_VALIGN_TOP;
685 else if (ob == cell_options_->radio_valign_bottom)
686 num = LyXTabular::M_VALIGN_BOTTOM;
687 else if (ob == cell_options_->radio_valign_center)
688 num = LyXTabular::M_VALIGN_CENTER;
692 inset_->tabularFeatures(lv_.view().get(), num, special);
698 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
700 bool flag = fl_get_button(ob);
701 if ((ob == longtable_options_->check_1head_2border_above) ||
702 (ob == longtable_options_->check_head_2border_above) ||
703 (ob == longtable_options_->check_foot_2border_above) ||
704 (ob == longtable_options_->check_lastfoot_2border_above)) {
705 special = "dl_above";
706 } else if ((ob == longtable_options_->check_1head_2border_below) ||
707 (ob == longtable_options_->check_head_2border_below) ||
708 (ob == longtable_options_->check_foot_2border_below) ||
709 (ob == longtable_options_->check_lastfoot_2border_below)) {
710 special = "dl_below";
711 } else if ((ob == longtable_options_->check_1head_empty) ||
712 (ob == longtable_options_->check_lastfoot_empty)) {
717 if ((ob == longtable_options_->check_lt_firsthead) ||
718 (ob == longtable_options_->check_1head_2border_above) ||
719 (ob == longtable_options_->check_1head_2border_below) ||
720 (ob == longtable_options_->check_1head_empty)) {
721 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
722 LyXTabular::UNSET_LTFIRSTHEAD);
723 } else if ((ob == longtable_options_->check_lt_head) ||
724 (ob == longtable_options_->check_head_2border_above) ||
725 (ob == longtable_options_->check_head_2border_below)) {
726 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
727 } else if ((ob == longtable_options_->check_lt_foot) ||
728 (ob == longtable_options_->check_foot_2border_above) ||
729 (ob == longtable_options_->check_foot_2border_below)) {
730 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
731 } else if ((ob == longtable_options_->check_lt_lastfoot) ||
732 (ob == longtable_options_->check_lastfoot_2border_above) ||
733 (ob == longtable_options_->check_lastfoot_2border_below) ||
734 (ob == longtable_options_->check_lastfoot_empty)) {
735 return (flag ? LyXTabular::SET_LTLASTFOOT :
736 LyXTabular::UNSET_LTLASTFOOT);
739 return LyXTabular::LAST_ACTION;