1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-2001 The LyX Team.
9 *======================================================*/
11 * FormTabular Interface Class Implementation
17 #pragma implementation
22 #include "FormTabular.h"
23 #include "form_tabular.h"
27 #include "xforms_helpers.h"
28 #include "lyxrc.h" // to set the default length values
29 #include "helper_funcs.h"
30 #include "input_validators.h"
32 #include "insets/insettabular.h"
34 #include "support/lstrings.h"
45 FormTabular::FormTabular(LyXView * lv, Dialogs * d)
46 : FormInset(lv, d, _("Tabular Layout")),
47 inset_(0), actCell_(-1), closing_(false)
49 // let the dialog be shown
50 // This is a permanent connection so we won't bother
51 // storing a copy because we won't be disconnecting.
52 d->showTabular.connect(slot(this, &FormTabular::showInset));
53 d->updateTabular.connect(slot(this, &FormTabular::updateInset));
57 void FormTabular::redraw()
59 if (form() && form()->visible)
60 fl_redraw_form(form());
64 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabFolder);
65 if (outer_form && outer_form->visible)
66 fl_redraw_form(outer_form);
70 FL_FORM * FormTabular::form() const
78 void FormTabular::disconnect()
81 FormInset::disconnect();
85 void FormTabular::showInset(InsetTabular * inset)
87 if (inset == 0) return;
89 // If connected to another inset, disconnect from it.
90 if (inset_ != inset) {
92 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
100 void FormTabular::updateInset(InsetTabular * inset)
102 if (inset == 0 || inset_ == 0) return;
104 // If connected to another inset, disconnect from it.
105 if (inset_ != inset) {
107 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
115 void FormTabular::build()
117 dialog_.reset(build_tabular());
118 tabular_options_.reset(build_tabular_options());
119 column_options_.reset(build_column_options());
120 cell_options_.reset(build_cell_options());
121 longtable_options_.reset(build_longtable_options());
123 fl_set_input_return(column_options_->input_column_width,
125 fl_set_input_return(column_options_->input_special_alignment,
127 fl_set_input_return(cell_options_->input_mcolumn_width,
129 fl_set_input_return(cell_options_->input_special_multialign,
132 fl_addto_tabfolder(dialog_->tabFolder, _("Tabular"),
133 tabular_options_->form);
134 fl_addto_tabfolder(dialog_->tabFolder, _("Column/Row"),
135 column_options_->form);
136 fl_addto_tabfolder(dialog_->tabFolder, _("Cell"),
137 cell_options_->form);
138 fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"),
139 longtable_options_->form);
141 // We should set these input filters on width fields to make them accept
142 // only unsigned numbers.
143 // But this leeds to trouble with the current apply behaviour (JSpitzm).
144 // fl_set_input_filter(column_options_->input_column_width,
145 // fl_unsigned_float_filter);
146 // fl_set_input_filter(cell_options_->input_mcolumn_width,
147 // fl_unsigned_float_filter);
149 // Create the contents of the unit choices
150 // Don't include the "%" terms...
151 vector<string> units_vec = getLatexUnits();
153 for (vector<string>::iterator it = units_vec.begin();
154 it != units_vec.end(); ++it)
156 if (contains(*it, "%"))
157 it = units_vec.erase(it, it + 1) - 1;
160 vector<string>::iterator ret =
161 remove_if(units_vec.begin(), units_vec.end(),
162 bind2nd(contains_functor(), "%"));
163 units_vec.erase(ret, units_vec.end());
166 string units = getStringFromVector(units_vec, "|");
168 fl_addto_choice(column_options_->choice_value_column_width,
170 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
175 void FormTabular::update()
180 if (!inset_ || !inset_->tabular.get())
183 LyXTabular * tabular = inset_->tabular.get();
189 int cell = inset_->getActCell();
191 int column = tabular->column_of_cell(cell) + 1;
192 fl_set_object_label(dialog_->text_warning, "");
193 fl_activate_object(column_options_->input_special_alignment);
194 fl_activate_object(cell_options_->input_special_multialign);
195 fl_activate_object(column_options_->input_column_width);
196 fl_activate_object(column_options_->choice_value_column_width);
197 sprintf(buf, "%d", column);
198 fl_set_input(dialog_->input_tabular_column, buf);
199 fl_deactivate_object(dialog_->input_tabular_column);
200 int row = tabular->row_of_cell(cell);
201 sprintf(buf, "%d", row + 1);
202 fl_set_input(dialog_->input_tabular_row, buf);
203 fl_deactivate_object(dialog_->input_tabular_row);
204 if (tabular->IsMultiColumn(cell)) {
205 fl_set_button(cell_options_->radio_multicolumn, 1);
206 fl_set_button(cell_options_->radio_border_top,
207 tabular->TopLine(cell)?1:0);
208 setEnabled(cell_options_->radio_border_top, true);
209 fl_set_button(cell_options_->radio_border_bottom,
210 tabular->BottomLine(cell)?1:0);
211 setEnabled(cell_options_->radio_border_bottom, true);
212 fl_set_button(cell_options_->radio_border_left,
213 tabular->LeftLine(cell)?1:0);
214 setEnabled(cell_options_->radio_border_left, true);
215 fl_set_button(cell_options_->radio_border_right,
216 tabular->RightLine(cell)?1:0);
217 setEnabled(cell_options_->radio_border_right, true);
218 pwidth = tabular->GetMColumnPWidth(cell);
219 align = tabular->GetAlignment(cell);
220 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
221 fl_set_button(cell_options_->radio_align_left, 1);
222 else if (align == LYX_ALIGN_RIGHT)
223 fl_set_button(cell_options_->radio_align_right, 1);
225 fl_set_button(cell_options_->radio_align_center, 1);
227 align = tabular->GetVAlignment(cell);
228 fl_set_button(cell_options_->radio_valign_top, 0);
229 fl_set_button(cell_options_->radio_valign_bottom, 0);
230 fl_set_button(cell_options_->radio_valign_center, 0);
231 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
232 fl_set_button(cell_options_->radio_valign_center, 1);
233 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
234 fl_set_button(cell_options_->radio_valign_bottom, 1);
236 fl_set_button(cell_options_->radio_valign_top, 1);
238 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
239 fl_set_input(cell_options_->input_special_multialign, special.c_str());
240 bool const metric = lyxrc.default_papersize > 3;
241 string const default_unit = metric ? "cm" : "in";
242 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
243 cell_options_->choice_value_mcolumn_width,
244 pwidth, default_unit);
246 if (!lv_->buffer()->isReadonly()) {
247 setEnabled(cell_options_->input_special_multialign, true);
248 setEnabled(cell_options_->input_mcolumn_width, true);
249 setEnabled(cell_options_->choice_value_mcolumn_width, true);
252 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
253 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
254 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
256 setEnabled(cell_options_->radio_align_left, pwidth.zero());
257 setEnabled(cell_options_->radio_align_right, pwidth.zero());
258 setEnabled(cell_options_->radio_align_center, pwidth.zero());
260 fl_set_button(cell_options_->radio_multicolumn, 0);
262 fl_set_button(cell_options_->radio_border_top, 0);
263 setEnabled(cell_options_->radio_border_top, false);
265 fl_set_button(cell_options_->radio_border_bottom, 0);
266 setEnabled(cell_options_->radio_border_bottom, false);
268 fl_set_button(cell_options_->radio_border_left, 0);
269 setEnabled(cell_options_->radio_border_left, false);
271 fl_set_button(cell_options_->radio_border_right, 0);
272 setEnabled(cell_options_->radio_border_right, false);
274 fl_set_button(cell_options_->radio_align_left, 0);
275 setEnabled(cell_options_->radio_align_left, false);
277 fl_set_button(cell_options_->radio_align_right, 0);
278 setEnabled(cell_options_->radio_align_right, false);
280 fl_set_button(cell_options_->radio_align_center, 0);
281 setEnabled(cell_options_->radio_align_center, false);
283 fl_set_button(cell_options_->radio_valign_top, 0);
284 setEnabled(cell_options_->radio_valign_top, false);
286 fl_set_button(cell_options_->radio_valign_bottom, 0);
287 setEnabled(cell_options_->radio_valign_bottom, false);
289 fl_set_button(cell_options_->radio_valign_center, 0);
290 setEnabled(cell_options_->radio_valign_center, false);
292 fl_set_input(cell_options_->input_special_multialign, "");
293 setEnabled(cell_options_->input_special_multialign, false);
295 fl_set_input(cell_options_->input_mcolumn_width, "");
296 setEnabled(cell_options_->input_mcolumn_width, false);
297 setEnabled(cell_options_->choice_value_mcolumn_width, false);
299 if (tabular->GetRotateCell(cell))
300 fl_set_button(cell_options_->radio_rotate_cell, 1);
302 fl_set_button(cell_options_->radio_rotate_cell, 0);
303 if (tabular->TopLine(cell, true))
304 fl_set_button(column_options_->radio_border_top, 1);
306 fl_set_button(column_options_->radio_border_top, 0);
307 if (tabular->BottomLine(cell, true))
308 fl_set_button(column_options_->radio_border_bottom, 1);
310 fl_set_button(column_options_->radio_border_bottom, 0);
311 if (tabular->LeftLine(cell, true))
312 fl_set_button(column_options_->radio_border_left, 1);
314 fl_set_button(column_options_->radio_border_left, 0);
315 if (tabular->RightLine(cell, true))
316 fl_set_button(column_options_->radio_border_right, 1);
318 fl_set_button(column_options_->radio_border_right, 0);
319 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
320 fl_set_input(column_options_->input_special_alignment, special.c_str());
322 bool const isReadonly = lv_->buffer()->isReadonly();
323 setEnabled(column_options_->input_special_alignment, !isReadonly);
325 pwidth = tabular->GetColumnPWidth(cell);
326 bool const metric = lyxrc.default_papersize > 3;
327 string const default_unit = metric ? "cm" : "in";
328 updateWidgetsFromLength(column_options_->input_column_width,
329 column_options_->choice_value_column_width,
330 pwidth, default_unit);
331 setEnabled(column_options_->input_column_width, !isReadonly);
332 setEnabled(column_options_->choice_value_column_width, !isReadonly);
334 setEnabled(cell_options_->radio_useminipage, !pwidth.zero());
335 if (!pwidth.zero()) {
336 if (tabular->GetUsebox(cell) == 2)
337 fl_set_button(cell_options_->radio_useminipage, 1);
339 fl_set_button(cell_options_->radio_useminipage, 0);
341 fl_set_button(cell_options_->radio_useminipage, 0);
343 align = tabular->GetAlignment(cell, true);
344 fl_set_button(column_options_->radio_align_left, 0);
345 fl_set_button(column_options_->radio_align_right, 0);
346 fl_set_button(column_options_->radio_align_center, 0);
347 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
348 fl_set_button(column_options_->radio_align_left, 1);
349 else if (align == LYX_ALIGN_RIGHT)
350 fl_set_button(column_options_->radio_align_right, 1);
352 fl_set_button(column_options_->radio_align_center, 1);
353 align = tabular->GetVAlignment(cell, true);
354 fl_set_button(column_options_->radio_valign_top, 0);
355 fl_set_button(column_options_->radio_valign_bottom, 0);
356 fl_set_button(column_options_->radio_valign_center, 0);
357 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
358 fl_set_button(column_options_->radio_valign_center, 1);
359 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
360 fl_set_button(column_options_->radio_valign_bottom, 1);
362 fl_set_button(column_options_->radio_valign_top, 1);
364 setEnabled(column_options_->radio_align_left, pwidth.zero());
365 setEnabled(column_options_->radio_align_right, pwidth.zero());
366 setEnabled(column_options_->radio_align_center, pwidth.zero());
368 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
369 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
370 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
372 fl_set_button(tabular_options_->radio_longtable,
373 tabular->IsLongTabular());
375 bool const enable = tabular->IsLongTabular();
377 setEnabled(longtable_options_->radio_lt_firsthead, enable);
378 setEnabled(longtable_options_->check_1head_2border_above, enable);
379 setEnabled(longtable_options_->check_1head_2border_below, enable);
380 setEnabled(longtable_options_->check_1head_empty, enable);
381 setEnabled(longtable_options_->radio_lt_head, enable);
382 setEnabled(longtable_options_->check_head_2border_above, enable);
383 setEnabled(longtable_options_->check_head_2border_below, enable);
384 setEnabled(longtable_options_->radio_lt_foot, enable);
385 setEnabled(longtable_options_->check_foot_2border_above, enable);
386 setEnabled(longtable_options_->check_foot_2border_below, enable);
387 setEnabled(longtable_options_->radio_lt_lastfoot, enable);
388 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
389 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
390 setEnabled(longtable_options_->check_lastfoot_empty, enable);
391 setEnabled(longtable_options_->radio_lt_newpage, enable);
394 LyXTabular::ltType ltt;
396 bool row_set = tabular->GetRowOfLTHead(row, ltt);
397 fl_set_button(longtable_options_->radio_lt_head, row_set);
399 fl_set_button(longtable_options_->check_head_2border_above,
401 fl_set_button(longtable_options_->check_head_2border_above,
405 setEnabled(longtable_options_->check_head_2border_above, 0);
406 setEnabled(longtable_options_->check_head_2border_below, 0);
407 fl_set_button(longtable_options_->check_head_2border_above,0);
408 fl_set_button(longtable_options_->check_head_2border_above,0);
409 fl_set_button(longtable_options_->check_1head_empty,0);
410 setEnabled(longtable_options_->check_1head_empty, 0);
414 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
415 fl_set_button(longtable_options_->radio_lt_firsthead, row_set);
416 if (ltt.set && (!ltt.empty || !use_empty)) {
417 fl_set_button(longtable_options_->check_1head_2border_above,
419 fl_set_button(longtable_options_->check_1head_2border_above,
422 setEnabled(longtable_options_->check_1head_2border_above, 0);
423 setEnabled(longtable_options_->check_1head_2border_below, 0);
424 fl_set_button(longtable_options_->check_1head_2border_above,0);
425 fl_set_button(longtable_options_->check_1head_2border_above,0);
427 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
429 setEnabled(longtable_options_->radio_lt_firsthead, 0);
433 row_set = tabular->GetRowOfLTFoot(row, ltt);
434 fl_set_button(longtable_options_->radio_lt_foot, row_set);
436 fl_set_button(longtable_options_->check_foot_2border_above,
438 fl_set_button(longtable_options_->check_foot_2border_above,
442 setEnabled(longtable_options_->check_foot_2border_above, 0);
443 setEnabled(longtable_options_->check_foot_2border_below, 0);
444 fl_set_button(longtable_options_->check_foot_2border_above,0);
445 fl_set_button(longtable_options_->check_foot_2border_above,0);
446 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
447 setEnabled(longtable_options_->check_lastfoot_empty, 0);
451 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
452 fl_set_button(longtable_options_->radio_lt_lastfoot, row_set);
453 if (ltt.set && (!ltt.empty || !use_empty)) {
454 fl_set_button(longtable_options_->check_lastfoot_2border_above,
456 fl_set_button(longtable_options_->check_lastfoot_2border_above,
459 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
460 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
461 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
462 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
464 fl_set_button(longtable_options_->check_lastfoot_empty,
467 setEnabled(longtable_options_->radio_lt_lastfoot, 0);
470 fl_set_button(longtable_options_->radio_lt_newpage,
471 tabular->GetLTNewPage(row));
473 fl_set_button(longtable_options_->radio_lt_firsthead, 0);
474 fl_set_button(longtable_options_->check_1head_2border_above, 0);
475 fl_set_button(longtable_options_->check_1head_2border_above, 0);
476 fl_set_button(longtable_options_->check_1head_empty, 0);
477 fl_set_button(longtable_options_->radio_lt_head, 0);
478 fl_set_button(longtable_options_->check_head_2border_above, 0);
479 fl_set_button(longtable_options_->check_head_2border_above, 0);
480 fl_set_button(longtable_options_->radio_lt_foot, 0);
481 fl_set_button(longtable_options_->check_foot_2border_above, 0);
482 fl_set_button(longtable_options_->check_foot_2border_above, 0);
483 fl_set_button(longtable_options_->radio_lt_lastfoot, 0);
484 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
485 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
486 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
487 fl_set_button(longtable_options_->radio_lt_newpage, 0);
489 fl_set_button(tabular_options_->radio_rotate_tabular,
490 tabular->GetRotateTabular());
494 bool FormTabular::input(FL_OBJECT * ob, long)
500 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
503 int cell = inset_->getActCell();
505 // ugly hack to auto-apply the stuff that hasn't been
506 // yet. don't let this continue to exist ...
507 if (ob == dialog_->button_close) {
509 LyXTabular * tabular = inset_->tabular.get();
511 getLengthFromWidgets(column_options_->input_column_width,
512 column_options_->choice_value_column_width);
514 LyXLength llen = tabular->GetColumnPWidth(cell);
516 str2 = llen.asString();
518 input(column_options_->input_column_width, 0);
519 str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
520 cell_options_->choice_value_mcolumn_width);
521 llen = tabular->GetMColumnPWidth(cell);
525 str2 = llen.asString();
527 input(cell_options_->input_mcolumn_width, 0);
528 str1 = fl_get_input(column_options_->input_special_alignment);
529 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
531 input(column_options_->input_special_alignment, 0);
532 str1 = fl_get_input(cell_options_->input_special_multialign);
533 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
535 input(cell_options_->input_special_multialign, 0);
541 if (actCell_ != cell) {
543 fl_set_object_label(dialog_->text_warning,
544 _("Warning: Wrong Cursor position, updated window"));
545 fl_show_object(dialog_->text_warning);
548 // No point in processing directives that you can't do anything with
549 // anyhow, so exit now if the buffer is read-only.
550 if (lv_->buffer()->isReadonly()) {
554 if ((ob == column_options_->input_column_width) ||
555 (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(), 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 fl_set_object_label(dialog_->text_warning,
567 _("Warning: Invalid Length (valid example: 10mm)"));
568 fl_show_object(dialog_->text_warning);
571 update(); // update for alignment
574 if ((ob == cell_options_->input_mcolumn_width) ||
575 (ob == cell_options_->choice_value_mcolumn_width))
578 getLengthFromWidgets(cell_options_->input_mcolumn_width,
579 cell_options_->choice_value_mcolumn_width);
580 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
582 //check if the input is valid
584 fl_get_input(cell_options_->input_mcolumn_width);
585 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
586 fl_set_object_label(dialog_->text_warning,
587 _("Warning: Invalid Length (valid example: 10mm)"));
588 fl_show_object(dialog_->text_warning);
591 update(); // update for alignment
595 if (ob == tabular_options_->button_append_row)
596 num = LyXTabular::APPEND_ROW;
597 else if (ob == tabular_options_->button_append_column)
598 num = LyXTabular::APPEND_COLUMN;
599 else if (ob == tabular_options_->button_delete_row)
600 num = LyXTabular::DELETE_ROW;
601 else if (ob == tabular_options_->button_delete_column)
602 num = LyXTabular::DELETE_COLUMN;
603 else if (ob == tabular_options_->button_set_borders)
604 num = LyXTabular::SET_ALL_LINES;
605 else if (ob == tabular_options_->button_unset_borders)
606 num = LyXTabular::UNSET_ALL_LINES;
607 else if (ob == column_options_->radio_border_top)
608 num = LyXTabular::TOGGLE_LINE_TOP;
609 else if (ob == column_options_->radio_border_bottom)
610 num = LyXTabular::TOGGLE_LINE_BOTTOM;
611 else if (ob == column_options_->radio_border_left)
612 num = LyXTabular::TOGGLE_LINE_LEFT;
613 else if (ob == column_options_->radio_border_right)
614 num = LyXTabular::TOGGLE_LINE_RIGHT;
615 else if (ob == column_options_->radio_align_left)
616 num = LyXTabular::ALIGN_LEFT;
617 else if (ob == column_options_->radio_align_right)
618 num = LyXTabular::ALIGN_RIGHT;
619 else if (ob == column_options_->radio_align_center)
620 num = LyXTabular::ALIGN_CENTER;
621 else if (ob == column_options_->radio_valign_top)
622 num = LyXTabular::VALIGN_TOP;
623 else if (ob == column_options_->radio_valign_bottom)
624 num = LyXTabular::VALIGN_BOTTOM;
625 else if (ob == column_options_->radio_valign_center)
626 num = LyXTabular::VALIGN_CENTER;
627 else if (ob == cell_options_->radio_multicolumn)
628 num = LyXTabular::MULTICOLUMN;
629 else if (ob == tabular_options_->radio_longtable) {
630 if (fl_get_button(tabular_options_->radio_longtable))
631 num = LyXTabular::SET_LONGTABULAR;
633 num = LyXTabular::UNSET_LONGTABULAR;
634 } else if (ob == tabular_options_->radio_rotate_tabular) {
635 s = fl_get_button(tabular_options_->radio_rotate_tabular);
637 num = LyXTabular::SET_ROTATE_TABULAR;
639 num = LyXTabular::UNSET_ROTATE_TABULAR;
640 } else if (ob == cell_options_->radio_rotate_cell) {
641 s = fl_get_button(cell_options_->radio_rotate_cell);
643 num = LyXTabular::SET_ROTATE_CELL;
645 num = LyXTabular::UNSET_ROTATE_CELL;
646 } else if (ob == cell_options_->radio_useminipage) {
647 num = LyXTabular::SET_USEBOX;
649 } else if ((ob == longtable_options_->radio_lt_firsthead) ||
650 (ob == longtable_options_->check_1head_2border_above) ||
651 (ob == longtable_options_->check_1head_2border_below) ||
652 (ob == longtable_options_->check_1head_empty) ||
653 (ob == longtable_options_->radio_lt_head) ||
654 (ob == longtable_options_->check_head_2border_above) ||
655 (ob == longtable_options_->check_head_2border_below) ||
656 (ob == longtable_options_->radio_lt_foot) ||
657 (ob == longtable_options_->check_foot_2border_above) ||
658 (ob == longtable_options_->check_foot_2border_below) ||
659 (ob == longtable_options_->radio_lt_lastfoot) ||
660 (ob == longtable_options_->check_lastfoot_2border_above) ||
661 (ob == longtable_options_->check_lastfoot_2border_below) ||
662 (ob == longtable_options_->check_lastfoot_empty))
664 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
665 } else if (ob == longtable_options_->radio_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_->radio_border_top)
674 num = LyXTabular::M_TOGGLE_LINE_TOP;
675 else if (ob == cell_options_->radio_border_bottom)
676 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
677 else if (ob == cell_options_->radio_border_left)
678 num = LyXTabular::M_TOGGLE_LINE_LEFT;
679 else if (ob == cell_options_->radio_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(), 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))
710 special = "dl_above";
711 } else if ((ob == longtable_options_->check_1head_2border_below) ||
712 (ob == longtable_options_->check_head_2border_below) ||
713 (ob == longtable_options_->check_foot_2border_below) ||
714 (ob == longtable_options_->check_lastfoot_2border_below))
716 special = "dl_below";
717 } else if ((ob == longtable_options_->check_1head_empty) ||
718 (ob == longtable_options_->check_lastfoot_empty))
724 if ((ob == longtable_options_->radio_lt_firsthead) ||
725 (ob == longtable_options_->check_1head_2border_above) ||
726 (ob == longtable_options_->check_1head_2border_below) ||
727 (ob == longtable_options_->check_1head_empty))
729 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
730 LyXTabular::UNSET_LTFIRSTHEAD);
731 } else if ((ob == longtable_options_->radio_lt_head) ||
732 (ob == longtable_options_->check_head_2border_above) ||
733 (ob == longtable_options_->check_head_2border_below))
735 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
736 } else if ((ob == longtable_options_->radio_lt_foot) ||
737 (ob == longtable_options_->check_foot_2border_above) ||
738 (ob == longtable_options_->check_foot_2border_below))
740 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
741 } else if ((ob == longtable_options_->radio_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))
746 return (flag ? LyXTabular::SET_LTLASTFOOT :
747 LyXTabular::UNSET_LTLASTFOOT);
749 return LyXTabular::LAST_ACTION;