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
20 #include "FormTabular.h"
21 #include "form_tabular.h"
25 #include "xforms_helpers.h"
26 #include "lyxrc.h" // to set the default length values
27 #include "helper_funcs.h"
28 #include "input_validators.h"
30 #include "insets/insettabular.h"
32 #include "support/lstrings.h"
43 FormTabular::FormTabular(LyXView * lv, Dialogs * d)
44 : FormInset(lv, d, _("Tabular Layout")),
45 inset_(0), actCell_(-1), closing_(false)
47 // let the dialog be shown
48 // This is a permanent connection so we won't bother
49 // storing a copy because we won't be disconnecting.
50 d->showTabular.connect(slot(this, &FormTabular::showInset));
51 d->updateTabular.connect(slot(this, &FormTabular::updateInset));
55 void FormTabular::redraw()
57 if (form() && form()->visible)
58 fl_redraw_form(form());
62 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabFolder);
63 if (outer_form && outer_form->visible)
64 fl_redraw_form(outer_form);
68 FL_FORM * FormTabular::form() const
76 void FormTabular::disconnect()
79 FormInset::disconnect();
83 void FormTabular::showInset(InsetTabular * inset)
85 if (inset == 0) return;
87 // If connected to another inset, disconnect from it.
88 if (inset_ != inset) {
90 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
98 void FormTabular::updateInset(InsetTabular * inset)
100 if (inset == 0 || inset_ == 0) return;
102 // If connected to another inset, disconnect from it.
103 if (inset_ != inset) {
105 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
113 void FormTabular::build()
115 dialog_.reset(build_tabular());
116 tabular_options_.reset(build_tabular_options());
117 column_options_.reset(build_column_options());
118 cell_options_.reset(build_cell_options());
119 longtable_options_.reset(build_longtable_options());
121 fl_set_input_return(column_options_->input_column_width,
123 fl_set_input_return(column_options_->input_special_alignment,
125 fl_set_input_return(cell_options_->input_mcolumn_width,
127 fl_set_input_return(cell_options_->input_special_multialign,
130 fl_addto_tabfolder(dialog_->tabFolder, _("Tabular"),
131 tabular_options_->form);
132 fl_addto_tabfolder(dialog_->tabFolder, _("Column/Row"),
133 column_options_->form);
134 fl_addto_tabfolder(dialog_->tabFolder, _("Cell"),
135 cell_options_->form);
136 fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"),
137 longtable_options_->form);
139 // We should set these input filters on width fields to make them accept
140 // only unsigned numbers.
141 // But this leeds to trouble with the current apply behaviour (JSpitzm).
142 // fl_set_input_filter(column_options_->input_column_width,
143 // fl_unsigned_float_filter);
144 // fl_set_input_filter(cell_options_->input_mcolumn_width,
145 // fl_unsigned_float_filter);
147 // Create the contents of the unit choices
148 // Don't include the "%" terms...
149 vector<string> units_vec = getLatexUnits();
151 for (vector<string>::iterator it = units_vec.begin();
152 it != units_vec.end(); ++it) {
153 if (contains(*it, "%"))
154 it = units_vec.erase(it, it + 1) - 1;
157 vector<string>::iterator ret =
158 remove_if(units_vec.begin(),
160 bind2nd(contains_functor(), "%"));
161 units_vec.erase(ret, units_vec.end());
164 string units = getStringFromVector(units_vec, "|");
166 fl_addto_choice(column_options_->choice_value_column_width,
168 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
173 void FormTabular::update()
178 if (!inset_ || !inset_->tabular.get())
181 LyXTabular * tabular = inset_->tabular.get();
187 int cell = inset_->getActCell();
189 int column = tabular->column_of_cell(cell) + 1;
190 fl_set_object_label(dialog_->text_warning, "");
191 fl_activate_object(column_options_->input_special_alignment);
192 fl_activate_object(cell_options_->input_special_multialign);
193 fl_activate_object(column_options_->input_column_width);
194 fl_activate_object(column_options_->choice_value_column_width);
195 sprintf(buf, "%d", column);
196 fl_set_input(dialog_->input_tabular_column, buf);
197 fl_deactivate_object(dialog_->input_tabular_column);
198 int row = tabular->row_of_cell(cell);
199 sprintf(buf, "%d", row + 1);
200 fl_set_input(dialog_->input_tabular_row, buf);
201 fl_deactivate_object(dialog_->input_tabular_row);
202 if (tabular->IsMultiColumn(cell)) {
203 fl_set_button(cell_options_->radio_multicolumn, 1);
204 fl_set_button(cell_options_->radio_border_top,
205 tabular->TopLine(cell)?1:0);
206 setEnabled(cell_options_->radio_border_top, true);
207 fl_set_button(cell_options_->radio_border_bottom,
208 tabular->BottomLine(cell)?1:0);
209 setEnabled(cell_options_->radio_border_bottom, true);
210 fl_set_button(cell_options_->radio_border_left,
211 tabular->LeftLine(cell)?1:0);
212 setEnabled(cell_options_->radio_border_left, true);
213 fl_set_button(cell_options_->radio_border_right,
214 tabular->RightLine(cell)?1:0);
215 setEnabled(cell_options_->radio_border_right, true);
216 pwidth = tabular->GetMColumnPWidth(cell);
217 align = tabular->GetAlignment(cell);
218 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
219 fl_set_button(cell_options_->radio_align_left, 1);
220 else if (align == LYX_ALIGN_RIGHT)
221 fl_set_button(cell_options_->radio_align_right, 1);
223 fl_set_button(cell_options_->radio_align_center, 1);
225 align = tabular->GetVAlignment(cell);
226 fl_set_button(cell_options_->radio_valign_top, 0);
227 fl_set_button(cell_options_->radio_valign_bottom, 0);
228 fl_set_button(cell_options_->radio_valign_center, 0);
229 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
230 fl_set_button(cell_options_->radio_valign_center, 1);
231 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
232 fl_set_button(cell_options_->radio_valign_bottom, 1);
234 fl_set_button(cell_options_->radio_valign_top, 1);
236 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
237 fl_set_input(cell_options_->input_special_multialign, special.c_str());
238 bool const metric = lyxrc.default_papersize > 3;
239 string const default_unit = metric ? "cm" : "in";
240 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
241 cell_options_->choice_value_mcolumn_width,
242 pwidth, default_unit);
244 if (!lv_->buffer()->isReadonly()) {
245 setEnabled(cell_options_->input_special_multialign, true);
246 setEnabled(cell_options_->input_mcolumn_width, true);
247 setEnabled(cell_options_->choice_value_mcolumn_width, true);
250 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
251 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
252 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
254 setEnabled(cell_options_->radio_align_left, pwidth.zero());
255 setEnabled(cell_options_->radio_align_right, pwidth.zero());
256 setEnabled(cell_options_->radio_align_center, pwidth.zero());
258 fl_set_button(cell_options_->radio_multicolumn, 0);
260 fl_set_button(cell_options_->radio_border_top, 0);
261 setEnabled(cell_options_->radio_border_top, false);
263 fl_set_button(cell_options_->radio_border_bottom, 0);
264 setEnabled(cell_options_->radio_border_bottom, false);
266 fl_set_button(cell_options_->radio_border_left, 0);
267 setEnabled(cell_options_->radio_border_left, false);
269 fl_set_button(cell_options_->radio_border_right, 0);
270 setEnabled(cell_options_->radio_border_right, false);
272 fl_set_button(cell_options_->radio_align_left, 0);
273 setEnabled(cell_options_->radio_align_left, false);
275 fl_set_button(cell_options_->radio_align_right, 0);
276 setEnabled(cell_options_->radio_align_right, false);
278 fl_set_button(cell_options_->radio_align_center, 0);
279 setEnabled(cell_options_->radio_align_center, false);
281 fl_set_button(cell_options_->radio_valign_top, 0);
282 setEnabled(cell_options_->radio_valign_top, false);
284 fl_set_button(cell_options_->radio_valign_bottom, 0);
285 setEnabled(cell_options_->radio_valign_bottom, false);
287 fl_set_button(cell_options_->radio_valign_center, 0);
288 setEnabled(cell_options_->radio_valign_center, false);
290 fl_set_input(cell_options_->input_special_multialign, "");
291 setEnabled(cell_options_->input_special_multialign, false);
293 fl_set_input(cell_options_->input_mcolumn_width, "");
294 setEnabled(cell_options_->input_mcolumn_width, false);
295 setEnabled(cell_options_->choice_value_mcolumn_width, false);
297 if (tabular->GetRotateCell(cell))
298 fl_set_button(cell_options_->radio_rotate_cell, 1);
300 fl_set_button(cell_options_->radio_rotate_cell, 0);
301 if (tabular->TopLine(cell, true))
302 fl_set_button(column_options_->radio_border_top, 1);
304 fl_set_button(column_options_->radio_border_top, 0);
305 if (tabular->BottomLine(cell, true))
306 fl_set_button(column_options_->radio_border_bottom, 1);
308 fl_set_button(column_options_->radio_border_bottom, 0);
309 if (tabular->LeftLine(cell, true))
310 fl_set_button(column_options_->radio_border_left, 1);
312 fl_set_button(column_options_->radio_border_left, 0);
313 if (tabular->RightLine(cell, true))
314 fl_set_button(column_options_->radio_border_right, 1);
316 fl_set_button(column_options_->radio_border_right, 0);
317 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
318 fl_set_input(column_options_->input_special_alignment, special.c_str());
320 bool const isReadonly = lv_->buffer()->isReadonly();
321 setEnabled(column_options_->input_special_alignment, !isReadonly);
323 pwidth = tabular->GetColumnPWidth(cell);
324 bool const metric = lyxrc.default_papersize > 3;
325 string const default_unit = metric ? "cm" : "in";
326 updateWidgetsFromLength(column_options_->input_column_width,
327 column_options_->choice_value_column_width,
328 pwidth, default_unit);
329 setEnabled(column_options_->input_column_width, !isReadonly);
330 setEnabled(column_options_->choice_value_column_width, !isReadonly);
332 setEnabled(cell_options_->radio_useminipage, !pwidth.zero());
333 if (!pwidth.zero()) {
334 if (tabular->GetUsebox(cell) == 2)
335 fl_set_button(cell_options_->radio_useminipage, 1);
337 fl_set_button(cell_options_->radio_useminipage, 0);
339 fl_set_button(cell_options_->radio_useminipage, 0);
341 align = tabular->GetAlignment(cell, true);
342 fl_set_button(column_options_->radio_align_left, 0);
343 fl_set_button(column_options_->radio_align_right, 0);
344 fl_set_button(column_options_->radio_align_center, 0);
345 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
346 fl_set_button(column_options_->radio_align_left, 1);
347 else if (align == LYX_ALIGN_RIGHT)
348 fl_set_button(column_options_->radio_align_right, 1);
350 fl_set_button(column_options_->radio_align_center, 1);
351 align = tabular->GetVAlignment(cell, true);
352 fl_set_button(column_options_->radio_valign_top, 0);
353 fl_set_button(column_options_->radio_valign_bottom, 0);
354 fl_set_button(column_options_->radio_valign_center, 0);
355 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
356 fl_set_button(column_options_->radio_valign_center, 1);
357 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
358 fl_set_button(column_options_->radio_valign_bottom, 1);
360 fl_set_button(column_options_->radio_valign_top, 1);
362 setEnabled(column_options_->radio_align_left, pwidth.zero());
363 setEnabled(column_options_->radio_align_right, pwidth.zero());
364 setEnabled(column_options_->radio_align_center, pwidth.zero());
366 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
367 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
368 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
370 fl_set_button(tabular_options_->radio_longtable,
371 tabular->IsLongTabular());
373 bool const enable = tabular->IsLongTabular();
375 setEnabled(longtable_options_->radio_lt_firsthead, enable);
376 setEnabled(longtable_options_->check_1head_2border_above, enable);
377 setEnabled(longtable_options_->check_1head_2border_below, enable);
378 setEnabled(longtable_options_->check_1head_empty, enable);
379 setEnabled(longtable_options_->radio_lt_head, enable);
380 setEnabled(longtable_options_->check_head_2border_above, enable);
381 setEnabled(longtable_options_->check_head_2border_below, enable);
382 setEnabled(longtable_options_->radio_lt_foot, enable);
383 setEnabled(longtable_options_->check_foot_2border_above, enable);
384 setEnabled(longtable_options_->check_foot_2border_below, enable);
385 setEnabled(longtable_options_->radio_lt_lastfoot, enable);
386 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
387 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
388 setEnabled(longtable_options_->check_lastfoot_empty, enable);
389 setEnabled(longtable_options_->radio_lt_newpage, enable);
392 LyXTabular::ltType ltt;
394 bool row_set = tabular->GetRowOfLTHead(row, ltt);
395 fl_set_button(longtable_options_->radio_lt_head, row_set);
397 fl_set_button(longtable_options_->check_head_2border_above,
399 fl_set_button(longtable_options_->check_head_2border_above,
403 setEnabled(longtable_options_->check_head_2border_above, 0);
404 setEnabled(longtable_options_->check_head_2border_below, 0);
405 fl_set_button(longtable_options_->check_head_2border_above,0);
406 fl_set_button(longtable_options_->check_head_2border_above,0);
407 fl_set_button(longtable_options_->check_1head_empty,0);
408 setEnabled(longtable_options_->check_1head_empty, 0);
412 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
413 fl_set_button(longtable_options_->radio_lt_firsthead, row_set);
414 if (ltt.set && (!ltt.empty || !use_empty)) {
415 fl_set_button(longtable_options_->check_1head_2border_above,
417 fl_set_button(longtable_options_->check_1head_2border_above,
420 setEnabled(longtable_options_->check_1head_2border_above, 0);
421 setEnabled(longtable_options_->check_1head_2border_below, 0);
422 fl_set_button(longtable_options_->check_1head_2border_above,0);
423 fl_set_button(longtable_options_->check_1head_2border_above,0);
425 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
427 setEnabled(longtable_options_->radio_lt_firsthead, 0);
431 row_set = tabular->GetRowOfLTFoot(row, ltt);
432 fl_set_button(longtable_options_->radio_lt_foot, row_set);
434 fl_set_button(longtable_options_->check_foot_2border_above,
436 fl_set_button(longtable_options_->check_foot_2border_above,
440 setEnabled(longtable_options_->check_foot_2border_above, 0);
441 setEnabled(longtable_options_->check_foot_2border_below, 0);
442 fl_set_button(longtable_options_->check_foot_2border_above,0);
443 fl_set_button(longtable_options_->check_foot_2border_above,0);
444 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
445 setEnabled(longtable_options_->check_lastfoot_empty, 0);
449 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
450 fl_set_button(longtable_options_->radio_lt_lastfoot, row_set);
451 if (ltt.set && (!ltt.empty || !use_empty)) {
452 fl_set_button(longtable_options_->check_lastfoot_2border_above,
454 fl_set_button(longtable_options_->check_lastfoot_2border_above,
457 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
458 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
459 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
460 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
462 fl_set_button(longtable_options_->check_lastfoot_empty,
465 setEnabled(longtable_options_->radio_lt_lastfoot, 0);
468 fl_set_button(longtable_options_->radio_lt_newpage,
469 tabular->GetLTNewPage(row));
471 fl_set_button(longtable_options_->radio_lt_firsthead, 0);
472 fl_set_button(longtable_options_->check_1head_2border_above, 0);
473 fl_set_button(longtable_options_->check_1head_2border_above, 0);
474 fl_set_button(longtable_options_->check_1head_empty, 0);
475 fl_set_button(longtable_options_->radio_lt_head, 0);
476 fl_set_button(longtable_options_->check_head_2border_above, 0);
477 fl_set_button(longtable_options_->check_head_2border_above, 0);
478 fl_set_button(longtable_options_->radio_lt_foot, 0);
479 fl_set_button(longtable_options_->check_foot_2border_above, 0);
480 fl_set_button(longtable_options_->check_foot_2border_above, 0);
481 fl_set_button(longtable_options_->radio_lt_lastfoot, 0);
482 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
483 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
484 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
485 fl_set_button(longtable_options_->radio_lt_newpage, 0);
487 fl_set_button(tabular_options_->radio_rotate_tabular,
488 tabular->GetRotateTabular());
492 bool FormTabular::input(FL_OBJECT * ob, long)
498 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
501 int cell = inset_->getActCell();
503 // ugly hack to auto-apply the stuff that hasn't been
504 // yet. don't let this continue to exist ...
505 if (ob == dialog_->button_close) {
507 input(column_options_->input_column_width, 0);
508 input(cell_options_->input_mcolumn_width, 0);
509 input(column_options_->input_special_alignment, 0);
510 input(cell_options_->input_special_multialign, 0);
516 if (actCell_ != cell) {
518 fl_set_object_label(dialog_->text_warning,
519 _("Warning: Wrong Cursor position, updated window"));
520 fl_show_object(dialog_->text_warning);
523 // No point in processing directives that you can't do anything with
524 // anyhow, so exit now if the buffer is read-only.
525 if (lv_->buffer()->isReadonly()) {
529 if ((ob == column_options_->input_column_width) ||
530 (ob == column_options_->choice_value_column_width))
533 getLengthFromWidgets(column_options_->input_column_width,
534 column_options_->choice_value_column_width);
535 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
537 //check if the input is valid
539 fl_get_input(column_options_->input_column_width);
540 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
541 fl_set_object_label(dialog_->text_warning,
542 _("Warning: Invalid Length (valid example: 10mm)"));
543 fl_show_object(dialog_->text_warning);
546 update(); // update for alignment
549 if ((ob == cell_options_->input_mcolumn_width) ||
550 (ob == cell_options_->choice_value_mcolumn_width))
553 getLengthFromWidgets(cell_options_->input_mcolumn_width,
554 cell_options_->choice_value_mcolumn_width);
555 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
557 //check if the input is valid
559 fl_get_input(cell_options_->input_mcolumn_width);
560 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
561 fl_set_object_label(dialog_->text_warning,
562 _("Warning: Invalid Length (valid example: 10mm)"));
563 fl_show_object(dialog_->text_warning);
566 update(); // update for alignment
570 if (ob == tabular_options_->button_append_row)
571 num = LyXTabular::APPEND_ROW;
572 else if (ob == tabular_options_->button_append_column)
573 num = LyXTabular::APPEND_COLUMN;
574 else if (ob == tabular_options_->button_delete_row)
575 num = LyXTabular::DELETE_ROW;
576 else if (ob == tabular_options_->button_delete_column)
577 num = LyXTabular::DELETE_COLUMN;
578 else if (ob == tabular_options_->button_set_borders)
579 num = LyXTabular::SET_ALL_LINES;
580 else if (ob == tabular_options_->button_unset_borders)
581 num = LyXTabular::UNSET_ALL_LINES;
582 else if (ob == column_options_->radio_border_top)
583 num = LyXTabular::TOGGLE_LINE_TOP;
584 else if (ob == column_options_->radio_border_bottom)
585 num = LyXTabular::TOGGLE_LINE_BOTTOM;
586 else if (ob == column_options_->radio_border_left)
587 num = LyXTabular::TOGGLE_LINE_LEFT;
588 else if (ob == column_options_->radio_border_right)
589 num = LyXTabular::TOGGLE_LINE_RIGHT;
590 else if (ob == column_options_->radio_align_left)
591 num = LyXTabular::ALIGN_LEFT;
592 else if (ob == column_options_->radio_align_right)
593 num = LyXTabular::ALIGN_RIGHT;
594 else if (ob == column_options_->radio_align_center)
595 num = LyXTabular::ALIGN_CENTER;
596 else if (ob == column_options_->radio_valign_top)
597 num = LyXTabular::VALIGN_TOP;
598 else if (ob == column_options_->radio_valign_bottom)
599 num = LyXTabular::VALIGN_BOTTOM;
600 else if (ob == column_options_->radio_valign_center)
601 num = LyXTabular::VALIGN_CENTER;
602 else if (ob == cell_options_->radio_multicolumn)
603 num = LyXTabular::MULTICOLUMN;
604 else if (ob == tabular_options_->radio_longtable) {
605 if (fl_get_button(tabular_options_->radio_longtable))
606 num = LyXTabular::SET_LONGTABULAR;
608 num = LyXTabular::UNSET_LONGTABULAR;
609 } else if (ob == tabular_options_->radio_rotate_tabular) {
610 s = fl_get_button(tabular_options_->radio_rotate_tabular);
612 num = LyXTabular::SET_ROTATE_TABULAR;
614 num = LyXTabular::UNSET_ROTATE_TABULAR;
615 } else if (ob == cell_options_->radio_rotate_cell) {
616 s = fl_get_button(cell_options_->radio_rotate_cell);
618 num = LyXTabular::SET_ROTATE_CELL;
620 num = LyXTabular::UNSET_ROTATE_CELL;
621 } else if (ob == cell_options_->radio_useminipage) {
622 num = LyXTabular::SET_USEBOX;
624 } else if ((ob == longtable_options_->radio_lt_firsthead) ||
625 (ob == longtable_options_->check_1head_2border_above) ||
626 (ob == longtable_options_->check_1head_2border_below) ||
627 (ob == longtable_options_->check_1head_empty) ||
628 (ob == longtable_options_->radio_lt_head) ||
629 (ob == longtable_options_->check_head_2border_above) ||
630 (ob == longtable_options_->check_head_2border_below) ||
631 (ob == longtable_options_->radio_lt_foot) ||
632 (ob == longtable_options_->check_foot_2border_above) ||
633 (ob == longtable_options_->check_foot_2border_below) ||
634 (ob == longtable_options_->radio_lt_lastfoot) ||
635 (ob == longtable_options_->check_lastfoot_2border_above) ||
636 (ob == longtable_options_->check_lastfoot_2border_below) ||
637 (ob == longtable_options_->check_lastfoot_empty))
639 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
640 } else if (ob == longtable_options_->radio_lt_newpage) {
641 num = LyXTabular::SET_LTNEWPAGE;
642 } else if (ob == column_options_->input_special_alignment) {
643 special = fl_get_input(column_options_->input_special_alignment);
644 num = LyXTabular::SET_SPECIAL_COLUMN;
645 } else if (ob == cell_options_->input_special_multialign) {
646 special = fl_get_input(cell_options_->input_special_multialign);
647 num = LyXTabular::SET_SPECIAL_MULTI;
648 } else if (ob == cell_options_->radio_border_top)
649 num = LyXTabular::M_TOGGLE_LINE_TOP;
650 else if (ob == cell_options_->radio_border_bottom)
651 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
652 else if (ob == cell_options_->radio_border_left)
653 num = LyXTabular::M_TOGGLE_LINE_LEFT;
654 else if (ob == cell_options_->radio_border_right)
655 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
656 else if (ob == cell_options_->radio_align_left)
657 num = LyXTabular::M_ALIGN_LEFT;
658 else if (ob == cell_options_->radio_align_right)
659 num = LyXTabular::M_ALIGN_RIGHT;
660 else if (ob == cell_options_->radio_align_center)
661 num = LyXTabular::M_ALIGN_CENTER;
662 else if (ob == cell_options_->radio_valign_top)
663 num = LyXTabular::M_VALIGN_TOP;
664 else if (ob == cell_options_->radio_valign_bottom)
665 num = LyXTabular::M_VALIGN_BOTTOM;
666 else if (ob == cell_options_->radio_valign_center)
667 num = LyXTabular::M_VALIGN_CENTER;
671 inset_->tabularFeatures(lv_->view(), num, special);
677 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
679 bool flag = fl_get_button(ob);
680 if ((ob == longtable_options_->check_1head_2border_above) ||
681 (ob == longtable_options_->check_head_2border_above) ||
682 (ob == longtable_options_->check_foot_2border_above) ||
683 (ob == longtable_options_->check_lastfoot_2border_above))
685 special = "dl_above";
686 } else if ((ob == longtable_options_->check_1head_2border_below) ||
687 (ob == longtable_options_->check_head_2border_below) ||
688 (ob == longtable_options_->check_foot_2border_below) ||
689 (ob == longtable_options_->check_lastfoot_2border_below))
691 special = "dl_below";
692 } else if ((ob == longtable_options_->check_1head_empty) ||
693 (ob == longtable_options_->check_lastfoot_empty))
699 if ((ob == longtable_options_->radio_lt_firsthead) ||
700 (ob == longtable_options_->check_1head_2border_above) ||
701 (ob == longtable_options_->check_1head_2border_below) ||
702 (ob == longtable_options_->check_1head_empty))
704 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
705 LyXTabular::UNSET_LTFIRSTHEAD);
706 } else if ((ob == longtable_options_->radio_lt_head) ||
707 (ob == longtable_options_->check_head_2border_above) ||
708 (ob == longtable_options_->check_head_2border_below))
710 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
711 } else if ((ob == longtable_options_->radio_lt_foot) ||
712 (ob == longtable_options_->check_foot_2border_above) ||
713 (ob == longtable_options_->check_foot_2border_below))
715 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
716 } else if ((ob == longtable_options_->radio_lt_lastfoot) ||
717 (ob == longtable_options_->check_lastfoot_2border_above) ||
718 (ob == longtable_options_->check_lastfoot_2border_below) ||
719 (ob == longtable_options_->check_lastfoot_empty))
721 return (flag ? LyXTabular::SET_LTLASTFOOT :
722 LyXTabular::UNSET_LTLASTFOOT);
724 return LyXTabular::LAST_ACTION;