3 * Copyright 2000-2001 The LyX Team.
4 * See the file COPYING.
6 * \author Jürgen Vigna, jug@sad.it
12 #pragma implementation
17 #include "FormTabular.h"
18 #include "form_tabular.h"
19 #include "frontends/LyXView.h"
22 #include "xforms_helpers.h"
23 #include "lyxrc.h" // to set the default length values
24 #include "helper_funcs.h"
25 #include "input_validators.h"
27 #include "insets/insettabular.h"
29 #include "support/lstrings.h"
31 #include <boost/bind.hpp>
41 FormTabular::FormTabular(LyXView * lv, Dialogs * d)
42 : FormInset(lv, d, _("Tabular Layout")),
43 inset_(0), actCell_(-1), closing_(false)
45 // let the dialog be shown
46 // This is a permanent connection so we won't bother
47 // storing a copy because we won't be disconnecting.
48 d->showTabular = boost::bind(&FormTabular::showInset, this, _1);
49 d->updateTabular = boost::bind(&FormTabular::updateInset, this, _1);
53 void FormTabular::redraw()
55 if (form() && form()->visible)
56 fl_redraw_form(form());
60 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabfolder);
61 if (outer_form && outer_form->visible)
62 fl_redraw_form(outer_form);
66 FL_FORM * FormTabular::form() const
74 void FormTabular::disconnect()
77 FormInset::disconnect();
81 void FormTabular::showInset(InsetTabular * inset)
83 if (inset == 0) return;
85 // If connected to another inset, disconnect from it.
86 if (inset_ != inset) {
88 ih_ = inset->hideDialog.connect(boost::bind(&FormTabular::hide, this));
96 void FormTabular::updateInset(InsetTabular * inset)
98 if (inset == 0 || inset_ == 0) return;
100 // If connected to another inset, disconnect from it.
101 if (inset_ != inset) {
103 ih_ = inset->hideDialog.connect(boost::bind(&FormTabular::hide, this));
111 void FormTabular::build()
113 dialog_.reset(build_tabular());
115 // Allow the base class to control messages
116 setMessageWidget(dialog_->text_warning);
118 setPrehandler(dialog_->input_tabular_column);
119 setPrehandler(dialog_->input_tabular_row);
121 tabular_options_.reset(build_tabular_options());
122 column_options_.reset(build_column_options());
123 cell_options_.reset(build_cell_options());
124 longtable_options_.reset(build_longtable_options());
126 fl_set_input_return(column_options_->input_column_width,
128 fl_set_input_return(column_options_->input_special_alignment,
131 setPrehandler(column_options_->input_column_width);
132 setPrehandler(column_options_->input_special_alignment);
134 fl_set_input_return(cell_options_->input_mcolumn_width,
136 fl_set_input_return(cell_options_->input_special_multialign,
139 setPrehandler(cell_options_->input_mcolumn_width);
140 setPrehandler(cell_options_->input_special_multialign);
142 fl_addto_tabfolder(dialog_->tabfolder, _("Tabular"),
143 tabular_options_->form);
144 fl_addto_tabfolder(dialog_->tabfolder, _("Column/Row"),
145 column_options_->form);
146 fl_addto_tabfolder(dialog_->tabfolder, _("Cell"),
147 cell_options_->form);
148 fl_addto_tabfolder(dialog_->tabfolder, _("LongTable"),
149 longtable_options_->form);
151 // Create the contents of the unit choices
152 // Don't include the "%" terms...
153 vector<string> units_vec = getLatexUnits();
155 for (vector<string>::iterator it = units_vec.begin();
156 it != units_vec.end(); ++it) {
157 if (contains(*it, "%"))
158 it = units_vec.erase(it, it + 1) - 1;
161 vector<string>::iterator ret =
162 remove_if(units_vec.begin(), units_vec.end(),
163 bind2nd(contains_functor(), "%"));
164 units_vec.erase(ret, units_vec.end());
167 string units = getStringFromVector(units_vec, "|");
169 fl_addto_choice(column_options_->choice_value_column_width,
171 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
176 void FormTabular::update()
181 if (!inset_ || !inset_->tabular.get())
184 LyXTabular * tabular = inset_->tabular.get();
190 int cell = inset_->getActCell();
192 int column = tabular->column_of_cell(cell) + 1;
194 fl_activate_object(column_options_->input_special_alignment);
195 fl_activate_object(cell_options_->input_special_multialign);
196 fl_activate_object(column_options_->input_column_width);
197 fl_activate_object(column_options_->choice_value_column_width);
198 sprintf(buf, "%d", column);
199 fl_set_input(dialog_->input_tabular_column, buf);
200 fl_deactivate_object(dialog_->input_tabular_column);
201 int row = tabular->row_of_cell(cell);
202 sprintf(buf, "%d", row + 1);
203 fl_set_input(dialog_->input_tabular_row, buf);
204 fl_deactivate_object(dialog_->input_tabular_row);
205 if (tabular->IsMultiColumn(cell)) {
206 fl_set_button(cell_options_->check_multicolumn, 1);
207 fl_set_button(cell_options_->check_border_top,
208 tabular->TopLine(cell)?1:0);
209 setEnabled(cell_options_->check_border_top, true);
210 fl_set_button(cell_options_->check_border_bottom,
211 tabular->BottomLine(cell)?1:0);
212 setEnabled(cell_options_->check_border_bottom, true);
213 // pay attention to left/right lines they are only allowed
214 // to set if we are in first/last cell of row or if the left/right
215 // cell is also a multicolumn.
216 if (tabular->IsFirstCellInRow(cell) ||
217 tabular->IsMultiColumn(cell-1)) {
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 (!pwidth.zero() || (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 > 3;
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, pwidth.zero());
273 setEnabled(cell_options_->radio_align_right, pwidth.zero());
274 setEnabled(cell_options_->radio_align_center, pwidth.zero());
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 > 3;
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 (!pwidth.zero() || (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, pwidth.zero());
381 setEnabled(column_options_->radio_align_right, pwidth.zero());
382 setEnabled(column_options_->radio_align_center, pwidth.zero());
384 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
385 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
386 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
388 fl_set_button(tabular_options_->check_longtable,
389 tabular->IsLongTabular());
391 bool const enable = tabular->IsLongTabular();
393 setEnabled(longtable_options_->check_lt_firsthead, enable);
394 setEnabled(longtable_options_->check_1head_2border_above, enable);
395 setEnabled(longtable_options_->check_1head_2border_below, enable);
396 setEnabled(longtable_options_->check_1head_empty, enable);
397 setEnabled(longtable_options_->check_lt_head, enable);
398 setEnabled(longtable_options_->check_head_2border_above, enable);
399 setEnabled(longtable_options_->check_head_2border_below, enable);
400 setEnabled(longtable_options_->check_lt_foot, enable);
401 setEnabled(longtable_options_->check_foot_2border_above, enable);
402 setEnabled(longtable_options_->check_foot_2border_below, enable);
403 setEnabled(longtable_options_->check_lt_lastfoot, enable);
404 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
405 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
406 setEnabled(longtable_options_->check_lastfoot_empty, enable);
407 setEnabled(longtable_options_->check_lt_newpage, enable);
410 LyXTabular::ltType ltt;
412 bool row_set = tabular->GetRowOfLTHead(row, ltt);
413 fl_set_button(longtable_options_->check_lt_head, row_set);
415 fl_set_button(longtable_options_->check_head_2border_above,
417 fl_set_button(longtable_options_->check_head_2border_above,
421 setEnabled(longtable_options_->check_head_2border_above, 0);
422 setEnabled(longtable_options_->check_head_2border_below, 0);
423 fl_set_button(longtable_options_->check_head_2border_above,0);
424 fl_set_button(longtable_options_->check_head_2border_above,0);
425 fl_set_button(longtable_options_->check_1head_empty,0);
426 setEnabled(longtable_options_->check_1head_empty, 0);
430 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
431 fl_set_button(longtable_options_->check_lt_firsthead, row_set);
432 if (ltt.set && (!ltt.empty || !use_empty)) {
433 fl_set_button(longtable_options_->check_1head_2border_above,
435 fl_set_button(longtable_options_->check_1head_2border_above,
438 setEnabled(longtable_options_->check_1head_2border_above, 0);
439 setEnabled(longtable_options_->check_1head_2border_below, 0);
440 fl_set_button(longtable_options_->check_1head_2border_above,0);
441 fl_set_button(longtable_options_->check_1head_2border_above,0);
443 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
445 setEnabled(longtable_options_->check_lt_firsthead, 0);
449 row_set = tabular->GetRowOfLTFoot(row, ltt);
450 fl_set_button(longtable_options_->check_lt_foot, row_set);
452 fl_set_button(longtable_options_->check_foot_2border_above,
454 fl_set_button(longtable_options_->check_foot_2border_above,
458 setEnabled(longtable_options_->check_foot_2border_above, 0);
459 setEnabled(longtable_options_->check_foot_2border_below, 0);
460 fl_set_button(longtable_options_->check_foot_2border_above,0);
461 fl_set_button(longtable_options_->check_foot_2border_above,0);
462 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
463 setEnabled(longtable_options_->check_lastfoot_empty, 0);
467 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
468 fl_set_button(longtable_options_->check_lt_lastfoot, row_set);
469 if (ltt.set && (!ltt.empty || !use_empty)) {
470 fl_set_button(longtable_options_->check_lastfoot_2border_above,
472 fl_set_button(longtable_options_->check_lastfoot_2border_above,
475 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
476 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
477 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
478 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
480 fl_set_button(longtable_options_->check_lastfoot_empty,
483 setEnabled(longtable_options_->check_lt_lastfoot, 0);
486 fl_set_button(longtable_options_->check_lt_newpage,
487 tabular->GetLTNewPage(row));
489 fl_set_button(longtable_options_->check_lt_firsthead, 0);
490 fl_set_button(longtable_options_->check_1head_2border_above, 0);
491 fl_set_button(longtable_options_->check_1head_2border_above, 0);
492 fl_set_button(longtable_options_->check_1head_empty, 0);
493 fl_set_button(longtable_options_->check_lt_head, 0);
494 fl_set_button(longtable_options_->check_head_2border_above, 0);
495 fl_set_button(longtable_options_->check_head_2border_above, 0);
496 fl_set_button(longtable_options_->check_lt_foot, 0);
497 fl_set_button(longtable_options_->check_foot_2border_above, 0);
498 fl_set_button(longtable_options_->check_foot_2border_above, 0);
499 fl_set_button(longtable_options_->check_lt_lastfoot, 0);
500 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
501 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
502 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
503 fl_set_button(longtable_options_->check_lt_newpage, 0);
505 fl_set_button(tabular_options_->check_rotate_tabular,
506 tabular->GetRotateTabular());
510 bool FormTabular::input(FL_OBJECT * ob, long)
516 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
519 int cell = inset_->getActCell();
521 // ugly hack to auto-apply the stuff that hasn't been
522 // yet. don't let this continue to exist ...
523 if (ob == dialog_->button_close) {
525 LyXTabular * tabular = inset_->tabular.get();
527 getLengthFromWidgets(column_options_->input_column_width,
528 column_options_->choice_value_column_width);
530 LyXLength llen = tabular->GetColumnPWidth(cell);
532 str2 = llen.asString();
534 input(column_options_->input_column_width, 0);
535 str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
536 cell_options_->choice_value_mcolumn_width);
537 llen = tabular->GetMColumnPWidth(cell);
541 str2 = llen.asString();
543 input(cell_options_->input_mcolumn_width, 0);
544 str1 = fl_get_input(column_options_->input_special_alignment);
545 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
547 input(column_options_->input_special_alignment, 0);
548 str1 = fl_get_input(cell_options_->input_special_multialign);
549 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
551 input(cell_options_->input_special_multialign, 0);
557 if (actCell_ != cell) {
559 postWarning(_("Wrong Cursor position, updated window"));
562 // No point in processing directives that you can't do anything with
563 // anyhow, so exit now if the buffer is read-only.
564 if (lv_->buffer()->isReadonly()) {
568 if ((ob == column_options_->input_column_width) ||
569 (ob == column_options_->choice_value_column_width)) {
571 getLengthFromWidgets(column_options_->input_column_width,
572 column_options_->choice_value_column_width);
573 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
575 //check if the input is valid
577 fl_get_input(column_options_->input_column_width);
578 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
579 postWarning(_("Invalid Length (valid example: 10mm)"));
583 update(); // update for alignment
587 if ((ob == cell_options_->input_mcolumn_width) ||
588 (ob == cell_options_->choice_value_mcolumn_width)) {
590 getLengthFromWidgets(cell_options_->input_mcolumn_width,
591 cell_options_->choice_value_mcolumn_width);
592 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
594 //check if the input is valid
596 fl_get_input(cell_options_->input_mcolumn_width);
597 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
598 postWarning(_("Invalid Length (valid example: 10mm)"));
601 update(); // update for alignment
605 if (ob == tabular_options_->button_append_row)
606 num = LyXTabular::APPEND_ROW;
607 else if (ob == tabular_options_->button_append_column)
608 num = LyXTabular::APPEND_COLUMN;
609 else if (ob == tabular_options_->button_delete_row)
610 num = LyXTabular::DELETE_ROW;
611 else if (ob == tabular_options_->button_delete_column)
612 num = LyXTabular::DELETE_COLUMN;
613 else if (ob == tabular_options_->button_set_borders)
614 num = LyXTabular::SET_ALL_LINES;
615 else if (ob == tabular_options_->button_unset_borders)
616 num = LyXTabular::UNSET_ALL_LINES;
617 else if (ob == column_options_->check_border_top)
618 num = LyXTabular::TOGGLE_LINE_TOP;
619 else if (ob == column_options_->check_border_bottom)
620 num = LyXTabular::TOGGLE_LINE_BOTTOM;
621 else if (ob == column_options_->check_border_left)
622 num = LyXTabular::TOGGLE_LINE_LEFT;
623 else if (ob == column_options_->check_border_right)
624 num = LyXTabular::TOGGLE_LINE_RIGHT;
625 else if (ob == column_options_->radio_align_left)
626 num = LyXTabular::ALIGN_LEFT;
627 else if (ob == column_options_->radio_align_right)
628 num = LyXTabular::ALIGN_RIGHT;
629 else if (ob == column_options_->radio_align_center)
630 num = LyXTabular::ALIGN_CENTER;
631 else if (ob == column_options_->radio_valign_top)
632 num = LyXTabular::VALIGN_TOP;
633 else if (ob == column_options_->radio_valign_bottom)
634 num = LyXTabular::VALIGN_BOTTOM;
635 else if (ob == column_options_->radio_valign_center)
636 num = LyXTabular::VALIGN_CENTER;
637 else if (ob == cell_options_->check_multicolumn)
638 num = LyXTabular::MULTICOLUMN;
639 else if (ob == tabular_options_->check_longtable) {
640 if (fl_get_button(tabular_options_->check_longtable))
641 num = LyXTabular::SET_LONGTABULAR;
643 num = LyXTabular::UNSET_LONGTABULAR;
644 } else if (ob == tabular_options_->check_rotate_tabular) {
645 s = fl_get_button(tabular_options_->check_rotate_tabular);
647 num = LyXTabular::SET_ROTATE_TABULAR;
649 num = LyXTabular::UNSET_ROTATE_TABULAR;
650 } else if (ob == cell_options_->check_rotate_cell) {
651 s = fl_get_button(cell_options_->check_rotate_cell);
653 num = LyXTabular::SET_ROTATE_CELL;
655 num = LyXTabular::UNSET_ROTATE_CELL;
656 } else if (ob == cell_options_->check_useminipage) {
657 num = LyXTabular::SET_USEBOX;
659 } else if ((ob == longtable_options_->check_lt_firsthead) ||
660 (ob == longtable_options_->check_1head_2border_above) ||
661 (ob == longtable_options_->check_1head_2border_below) ||
662 (ob == longtable_options_->check_1head_empty) ||
663 (ob == longtable_options_->check_lt_head) ||
664 (ob == longtable_options_->check_head_2border_above) ||
665 (ob == longtable_options_->check_head_2border_below) ||
666 (ob == longtable_options_->check_lt_foot) ||
667 (ob == longtable_options_->check_foot_2border_above) ||
668 (ob == longtable_options_->check_foot_2border_below) ||
669 (ob == longtable_options_->check_lt_lastfoot) ||
670 (ob == longtable_options_->check_lastfoot_2border_above) ||
671 (ob == longtable_options_->check_lastfoot_2border_below) ||
672 (ob == longtable_options_->check_lastfoot_empty)) {
673 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
674 } else if (ob == longtable_options_->check_lt_newpage) {
675 num = LyXTabular::SET_LTNEWPAGE;
676 } else if (ob == column_options_->input_special_alignment) {
677 special = fl_get_input(column_options_->input_special_alignment);
678 num = LyXTabular::SET_SPECIAL_COLUMN;
679 } else if (ob == cell_options_->input_special_multialign) {
680 special = fl_get_input(cell_options_->input_special_multialign);
681 num = LyXTabular::SET_SPECIAL_MULTI;
682 } else if (ob == cell_options_->check_border_top)
683 num = LyXTabular::M_TOGGLE_LINE_TOP;
684 else if (ob == cell_options_->check_border_bottom)
685 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
686 else if (ob == cell_options_->check_border_left)
687 num = LyXTabular::M_TOGGLE_LINE_LEFT;
688 else if (ob == cell_options_->check_border_right)
689 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
690 else if (ob == cell_options_->radio_align_left)
691 num = LyXTabular::M_ALIGN_LEFT;
692 else if (ob == cell_options_->radio_align_right)
693 num = LyXTabular::M_ALIGN_RIGHT;
694 else if (ob == cell_options_->radio_align_center)
695 num = LyXTabular::M_ALIGN_CENTER;
696 else if (ob == cell_options_->radio_valign_top)
697 num = LyXTabular::M_VALIGN_TOP;
698 else if (ob == cell_options_->radio_valign_bottom)
699 num = LyXTabular::M_VALIGN_BOTTOM;
700 else if (ob == cell_options_->radio_valign_center)
701 num = LyXTabular::M_VALIGN_CENTER;
705 inset_->tabularFeatures(lv_->view(), num, special);
711 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
713 bool flag = fl_get_button(ob);
714 if ((ob == longtable_options_->check_1head_2border_above) ||
715 (ob == longtable_options_->check_head_2border_above) ||
716 (ob == longtable_options_->check_foot_2border_above) ||
717 (ob == longtable_options_->check_lastfoot_2border_above)) {
718 special = "dl_above";
719 } else if ((ob == longtable_options_->check_1head_2border_below) ||
720 (ob == longtable_options_->check_head_2border_below) ||
721 (ob == longtable_options_->check_foot_2border_below) ||
722 (ob == longtable_options_->check_lastfoot_2border_below)) {
723 special = "dl_below";
724 } else if ((ob == longtable_options_->check_1head_empty) ||
725 (ob == longtable_options_->check_lastfoot_empty)) {
730 if ((ob == longtable_options_->check_lt_firsthead) ||
731 (ob == longtable_options_->check_1head_2border_above) ||
732 (ob == longtable_options_->check_1head_2border_below) ||
733 (ob == longtable_options_->check_1head_empty)) {
734 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
735 LyXTabular::UNSET_LTFIRSTHEAD);
736 } else if ((ob == longtable_options_->check_lt_head) ||
737 (ob == longtable_options_->check_head_2border_above) ||
738 (ob == longtable_options_->check_head_2border_below)) {
739 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
740 } else if ((ob == longtable_options_->check_lt_foot) ||
741 (ob == longtable_options_->check_foot_2border_above) ||
742 (ob == longtable_options_->check_foot_2border_below)) {
743 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
744 } else if ((ob == longtable_options_->check_lt_lastfoot) ||
745 (ob == longtable_options_->check_lastfoot_2border_above) ||
746 (ob == longtable_options_->check_lastfoot_2border_below) ||
747 (ob == longtable_options_->check_lastfoot_empty)) {
748 return (flag ? LyXTabular::SET_LTLASTFOOT :
749 LyXTabular::UNSET_LTLASTFOOT);
752 return LyXTabular::LAST_ACTION;