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"
42 FormTabular::FormTabular(LyXView * lv, Dialogs * d)
43 : FormInset(lv, d, _("Tabular Layout")),
44 inset_(0), actCell_(-1), closing_(false)
46 // let the dialog be shown
47 // This is a permanent connection so we won't bother
48 // storing a copy because we won't be disconnecting.
49 d->showTabular.connect(slot(this, &FormTabular::showInset));
50 d->updateTabular.connect(slot(this, &FormTabular::updateInset));
54 void FormTabular::redraw()
56 if (form() && form()->visible)
57 fl_redraw_form(form());
61 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabFolder);
62 if (outer_form && outer_form->visible)
63 fl_redraw_form(outer_form);
67 FL_FORM * FormTabular::form() const
75 void FormTabular::disconnect()
78 FormInset::disconnect();
82 void FormTabular::showInset(InsetTabular * inset)
84 if (inset == 0) return;
86 // If connected to another inset, disconnect from it.
87 if (inset_ != inset) {
89 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
97 void FormTabular::updateInset(InsetTabular * inset)
99 if (inset == 0 || inset_ == 0) return;
101 // If connected to another inset, disconnect from it.
102 if (inset_ != inset) {
104 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
112 void FormTabular::build()
114 dialog_.reset(build_tabular());
115 tabular_options_.reset(build_tabular_options());
116 column_options_.reset(build_column_options());
117 cell_options_.reset(build_cell_options());
118 longtable_options_.reset(build_longtable_options());
120 fl_set_input_return(column_options_->input_column_width,
122 fl_set_input_return(column_options_->input_special_alignment,
124 fl_set_input_return(cell_options_->input_mcolumn_width,
126 fl_set_input_return(cell_options_->input_special_multialign,
129 fl_addto_tabfolder(dialog_->tabFolder, _("Tabular"),
130 tabular_options_->form);
131 fl_addto_tabfolder(dialog_->tabFolder, _("Column/Row"),
132 column_options_->form);
133 fl_addto_tabfolder(dialog_->tabFolder, _("Cell"),
134 cell_options_->form);
135 fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"),
136 longtable_options_->form);
138 // We should set these input filters on width fields to make them accept
139 // only unsigned numbers.
140 // But this leeds to trouble with the current apply behaviour (JSpitzm).
141 // fl_set_input_filter(column_options_->input_column_width,
142 // fl_unsigned_float_filter);
143 // fl_set_input_filter(cell_options_->input_mcolumn_width,
144 // fl_unsigned_float_filter);
146 // Create the contents of the unit choices
147 // Don't include the "%" terms...
148 vector<string> units_vec = getLatexUnits();
150 for (vector<string>::iterator it = units_vec.begin();
151 it != units_vec.end(); ++it) {
152 if (contains(*it, "%"))
153 it = units_vec.erase(it, it + 1) - 1;
156 vector<string>::iterator ret =
157 remove_if(units_vec.begin(),
159 bind2nd(contains_functor(), "%"));
160 units_vec.erase(ret, units_vec.end());
163 string units = getStringFromVector(units_vec, "|");
165 fl_addto_choice(column_options_->choice_value_column_width,
167 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
172 void FormTabular::update()
177 if (!inset_ || !inset_->tabular.get())
180 LyXTabular * tabular = inset_->tabular.get();
186 int cell = inset_->getActCell();
188 int column = tabular->column_of_cell(cell) + 1;
189 fl_set_object_label(dialog_->text_warning, "");
190 fl_activate_object(column_options_->input_special_alignment);
191 fl_activate_object(cell_options_->input_special_multialign);
192 fl_activate_object(column_options_->input_column_width);
193 fl_activate_object(column_options_->choice_value_column_width);
194 sprintf(buf, "%d", column);
195 fl_set_input(dialog_->input_tabular_column, buf);
196 fl_deactivate_object(dialog_->input_tabular_column);
197 int row = tabular->row_of_cell(cell);
198 sprintf(buf, "%d", row + 1);
199 fl_set_input(dialog_->input_tabular_row, buf);
200 fl_deactivate_object(dialog_->input_tabular_row);
201 if (tabular->IsMultiColumn(cell)) {
202 fl_set_button(cell_options_->radio_multicolumn, 1);
203 fl_set_button(cell_options_->radio_border_top,
204 tabular->TopLine(cell)?1:0);
205 setEnabled(cell_options_->radio_border_top, true);
206 fl_set_button(cell_options_->radio_border_bottom,
207 tabular->BottomLine(cell)?1:0);
208 setEnabled(cell_options_->radio_border_bottom, true);
209 fl_set_button(cell_options_->radio_border_left,
210 tabular->LeftLine(cell)?1:0);
211 setEnabled(cell_options_->radio_border_left, true);
212 fl_set_button(cell_options_->radio_border_right,
213 tabular->RightLine(cell)?1:0);
214 setEnabled(cell_options_->radio_border_right, true);
215 pwidth = tabular->GetMColumnPWidth(cell);
216 align = tabular->GetAlignment(cell);
217 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
218 fl_set_button(cell_options_->radio_align_left, 1);
219 else if (align == LYX_ALIGN_RIGHT)
220 fl_set_button(cell_options_->radio_align_right, 1);
222 fl_set_button(cell_options_->radio_align_center, 1);
224 align = tabular->GetVAlignment(cell);
225 fl_set_button(cell_options_->radio_valign_top, 0);
226 fl_set_button(cell_options_->radio_valign_bottom, 0);
227 fl_set_button(cell_options_->radio_valign_center, 0);
228 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
229 fl_set_button(cell_options_->radio_valign_center, 1);
230 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
231 fl_set_button(cell_options_->radio_valign_bottom, 1);
233 fl_set_button(cell_options_->radio_valign_top, 1);
235 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
236 fl_set_input(cell_options_->input_special_multialign, special.c_str());
237 bool const metric = lyxrc.default_papersize > 3;
238 string const default_unit = metric ? "cm" : "in";
239 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
240 cell_options_->choice_value_mcolumn_width,
241 pwidth, default_unit);
243 if (!lv_->buffer()->isReadonly()) {
244 setEnabled(cell_options_->input_special_multialign, true);
245 setEnabled(cell_options_->input_mcolumn_width, true);
246 setEnabled(cell_options_->choice_value_mcolumn_width, true);
249 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
250 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
251 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
253 setEnabled(cell_options_->radio_align_left, pwidth.zero());
254 setEnabled(cell_options_->radio_align_right, pwidth.zero());
255 setEnabled(cell_options_->radio_align_center, pwidth.zero());
257 fl_set_button(cell_options_->radio_multicolumn, 0);
259 fl_set_button(cell_options_->radio_border_top, 0);
260 setEnabled(cell_options_->radio_border_top, false);
262 fl_set_button(cell_options_->radio_border_bottom, 0);
263 setEnabled(cell_options_->radio_border_bottom, false);
265 fl_set_button(cell_options_->radio_border_left, 0);
266 setEnabled(cell_options_->radio_border_left, false);
268 fl_set_button(cell_options_->radio_border_right, 0);
269 setEnabled(cell_options_->radio_border_right, false);
271 fl_set_button(cell_options_->radio_align_left, 0);
272 setEnabled(cell_options_->radio_align_left, false);
274 fl_set_button(cell_options_->radio_align_right, 0);
275 setEnabled(cell_options_->radio_align_right, false);
277 fl_set_button(cell_options_->radio_align_center, 0);
278 setEnabled(cell_options_->radio_align_center, false);
280 fl_set_button(cell_options_->radio_valign_top, 0);
281 setEnabled(cell_options_->radio_valign_top, false);
283 fl_set_button(cell_options_->radio_valign_bottom, 0);
284 setEnabled(cell_options_->radio_valign_bottom, false);
286 fl_set_button(cell_options_->radio_valign_center, 0);
287 setEnabled(cell_options_->radio_valign_center, false);
289 fl_set_input(cell_options_->input_special_multialign, "");
290 setEnabled(cell_options_->input_special_multialign, false);
292 fl_set_input(cell_options_->input_mcolumn_width, "");
293 setEnabled(cell_options_->input_mcolumn_width, false);
294 setEnabled(cell_options_->choice_value_mcolumn_width, false);
296 if (tabular->GetRotateCell(cell))
297 fl_set_button(cell_options_->radio_rotate_cell, 1);
299 fl_set_button(cell_options_->radio_rotate_cell, 0);
300 if (tabular->TopLine(cell, true))
301 fl_set_button(column_options_->radio_border_top, 1);
303 fl_set_button(column_options_->radio_border_top, 0);
304 if (tabular->BottomLine(cell, true))
305 fl_set_button(column_options_->radio_border_bottom, 1);
307 fl_set_button(column_options_->radio_border_bottom, 0);
308 if (tabular->LeftLine(cell, true))
309 fl_set_button(column_options_->radio_border_left, 1);
311 fl_set_button(column_options_->radio_border_left, 0);
312 if (tabular->RightLine(cell, true))
313 fl_set_button(column_options_->radio_border_right, 1);
315 fl_set_button(column_options_->radio_border_right, 0);
316 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
317 fl_set_input(column_options_->input_special_alignment, special.c_str());
319 bool const isReadonly = lv_->buffer()->isReadonly();
320 setEnabled(column_options_->input_special_alignment, !isReadonly);
322 pwidth = tabular->GetColumnPWidth(cell);
323 bool const metric = lyxrc.default_papersize > 3;
324 string const default_unit = metric ? "cm" : "in";
325 updateWidgetsFromLength(column_options_->input_column_width,
326 column_options_->choice_value_column_width,
327 pwidth, default_unit);
328 setEnabled(column_options_->input_column_width, !isReadonly);
329 setEnabled(column_options_->choice_value_column_width, !isReadonly);
331 setEnabled(cell_options_->radio_useminipage, !pwidth.zero());
332 if (!pwidth.zero()) {
333 if (tabular->GetUsebox(cell) == 2)
334 fl_set_button(cell_options_->radio_useminipage, 1);
336 fl_set_button(cell_options_->radio_useminipage, 0);
338 fl_set_button(cell_options_->radio_useminipage, 0);
340 align = tabular->GetAlignment(cell, true);
341 fl_set_button(column_options_->radio_align_left, 0);
342 fl_set_button(column_options_->radio_align_right, 0);
343 fl_set_button(column_options_->radio_align_center, 0);
344 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
345 fl_set_button(column_options_->radio_align_left, 1);
346 else if (align == LYX_ALIGN_RIGHT)
347 fl_set_button(column_options_->radio_align_right, 1);
349 fl_set_button(column_options_->radio_align_center, 1);
350 align = tabular->GetVAlignment(cell, true);
351 fl_set_button(column_options_->radio_valign_top, 0);
352 fl_set_button(column_options_->radio_valign_bottom, 0);
353 fl_set_button(column_options_->radio_valign_center, 0);
354 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
355 fl_set_button(column_options_->radio_valign_center, 1);
356 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
357 fl_set_button(column_options_->radio_valign_bottom, 1);
359 fl_set_button(column_options_->radio_valign_top, 1);
361 setEnabled(column_options_->radio_align_left, pwidth.zero());
362 setEnabled(column_options_->radio_align_right, pwidth.zero());
363 setEnabled(column_options_->radio_align_center, pwidth.zero());
365 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
366 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
367 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
369 fl_set_button(tabular_options_->radio_longtable,
370 tabular->IsLongTabular());
372 bool const enable = tabular->IsLongTabular();
374 setEnabled(longtable_options_->radio_lt_firsthead, enable);
375 setEnabled(longtable_options_->check_1head_2border_above, enable);
376 setEnabled(longtable_options_->check_1head_2border_below, enable);
377 setEnabled(longtable_options_->check_1head_empty, enable);
378 setEnabled(longtable_options_->radio_lt_head, enable);
379 setEnabled(longtable_options_->check_head_2border_above, enable);
380 setEnabled(longtable_options_->check_head_2border_below, enable);
381 setEnabled(longtable_options_->radio_lt_foot, enable);
382 setEnabled(longtable_options_->check_foot_2border_above, enable);
383 setEnabled(longtable_options_->check_foot_2border_below, enable);
384 setEnabled(longtable_options_->radio_lt_lastfoot, enable);
385 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
386 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
387 setEnabled(longtable_options_->check_lastfoot_empty, enable);
388 setEnabled(longtable_options_->radio_lt_newpage, enable);
391 LyXTabular::ltType ltt;
393 bool row_set = tabular->GetRowOfLTHead(row, ltt);
394 fl_set_button(longtable_options_->radio_lt_head, row_set);
396 fl_set_button(longtable_options_->check_head_2border_above,
398 fl_set_button(longtable_options_->check_head_2border_above,
402 setEnabled(longtable_options_->check_head_2border_above, 0);
403 setEnabled(longtable_options_->check_head_2border_below, 0);
404 fl_set_button(longtable_options_->check_head_2border_above,0);
405 fl_set_button(longtable_options_->check_head_2border_above,0);
406 fl_set_button(longtable_options_->check_1head_empty,0);
407 setEnabled(longtable_options_->check_1head_empty, 0);
411 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
412 fl_set_button(longtable_options_->radio_lt_firsthead, row_set);
413 if (ltt.set && (!ltt.empty || !use_empty)) {
414 fl_set_button(longtable_options_->check_1head_2border_above,
416 fl_set_button(longtable_options_->check_1head_2border_above,
419 setEnabled(longtable_options_->check_1head_2border_above, 0);
420 setEnabled(longtable_options_->check_1head_2border_below, 0);
421 fl_set_button(longtable_options_->check_1head_2border_above,0);
422 fl_set_button(longtable_options_->check_1head_2border_above,0);
424 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
426 setEnabled(longtable_options_->radio_lt_firsthead, 0);
430 row_set = tabular->GetRowOfLTFoot(row, ltt);
431 fl_set_button(longtable_options_->radio_lt_foot, row_set);
433 fl_set_button(longtable_options_->check_foot_2border_above,
435 fl_set_button(longtable_options_->check_foot_2border_above,
439 setEnabled(longtable_options_->check_foot_2border_above, 0);
440 setEnabled(longtable_options_->check_foot_2border_below, 0);
441 fl_set_button(longtable_options_->check_foot_2border_above,0);
442 fl_set_button(longtable_options_->check_foot_2border_above,0);
443 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
444 setEnabled(longtable_options_->check_lastfoot_empty, 0);
448 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
449 fl_set_button(longtable_options_->radio_lt_lastfoot, row_set);
450 if (ltt.set && (!ltt.empty || !use_empty)) {
451 fl_set_button(longtable_options_->check_lastfoot_2border_above,
453 fl_set_button(longtable_options_->check_lastfoot_2border_above,
456 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
457 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
458 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
459 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
461 fl_set_button(longtable_options_->check_lastfoot_empty,
464 setEnabled(longtable_options_->radio_lt_lastfoot, 0);
467 fl_set_button(longtable_options_->radio_lt_newpage,
468 tabular->GetLTNewPage(row));
470 fl_set_button(longtable_options_->radio_lt_firsthead, 0);
471 fl_set_button(longtable_options_->check_1head_2border_above, 0);
472 fl_set_button(longtable_options_->check_1head_2border_above, 0);
473 fl_set_button(longtable_options_->check_1head_empty, 0);
474 fl_set_button(longtable_options_->radio_lt_head, 0);
475 fl_set_button(longtable_options_->check_head_2border_above, 0);
476 fl_set_button(longtable_options_->check_head_2border_above, 0);
477 fl_set_button(longtable_options_->radio_lt_foot, 0);
478 fl_set_button(longtable_options_->check_foot_2border_above, 0);
479 fl_set_button(longtable_options_->check_foot_2border_above, 0);
480 fl_set_button(longtable_options_->radio_lt_lastfoot, 0);
481 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
482 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
483 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
484 fl_set_button(longtable_options_->radio_lt_newpage, 0);
486 fl_set_button(tabular_options_->radio_rotate_tabular,
487 tabular->GetRotateTabular());
491 bool FormTabular::input(FL_OBJECT * ob, long)
497 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
500 int cell = inset_->getActCell();
502 // ugly hack to auto-apply the stuff that hasn't been
503 // yet. don't let this continue to exist ...
504 if (ob == dialog_->button_close) {
506 input(column_options_->input_column_width, 0);
507 input(cell_options_->input_mcolumn_width, 0);
508 input(column_options_->input_special_alignment, 0);
509 input(cell_options_->input_special_multialign, 0);
515 if (actCell_ != cell) {
517 fl_set_object_label(dialog_->text_warning,
518 _("Warning: Wrong Cursor position, updated window"));
519 fl_show_object(dialog_->text_warning);
522 // No point in processing directives that you can't do anything with
523 // anyhow, so exit now if the buffer is read-only.
524 if (lv_->buffer()->isReadonly()) {
528 if ((ob == column_options_->input_column_width) ||
529 (ob == column_options_->choice_value_column_width))
532 getLengthFromWidgets(column_options_->input_column_width,
533 column_options_->choice_value_column_width);
534 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
536 //check if the input is valid
538 fl_get_input(column_options_->input_column_width);
539 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
540 fl_set_object_label(dialog_->text_warning,
541 _("Warning: Invalid Length (valid example: 10mm)"));
542 fl_show_object(dialog_->text_warning);
545 update(); // update for alignment
548 if ((ob == cell_options_->input_mcolumn_width) ||
549 (ob == cell_options_->choice_value_mcolumn_width))
552 getLengthFromWidgets(cell_options_->input_mcolumn_width,
553 cell_options_->choice_value_mcolumn_width);
554 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
556 //check if the input is valid
558 fl_get_input(cell_options_->input_mcolumn_width);
559 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
560 fl_set_object_label(dialog_->text_warning,
561 _("Warning: Invalid Length (valid example: 10mm)"));
562 fl_show_object(dialog_->text_warning);
565 update(); // update for alignment
569 if (ob == tabular_options_->button_append_row)
570 num = LyXTabular::APPEND_ROW;
571 else if (ob == tabular_options_->button_append_column)
572 num = LyXTabular::APPEND_COLUMN;
573 else if (ob == tabular_options_->button_delete_row)
574 num = LyXTabular::DELETE_ROW;
575 else if (ob == tabular_options_->button_delete_column)
576 num = LyXTabular::DELETE_COLUMN;
577 else if (ob == tabular_options_->button_set_borders)
578 num = LyXTabular::SET_ALL_LINES;
579 else if (ob == tabular_options_->button_unset_borders)
580 num = LyXTabular::UNSET_ALL_LINES;
581 else if (ob == column_options_->radio_border_top)
582 num = LyXTabular::TOGGLE_LINE_TOP;
583 else if (ob == column_options_->radio_border_bottom)
584 num = LyXTabular::TOGGLE_LINE_BOTTOM;
585 else if (ob == column_options_->radio_border_left)
586 num = LyXTabular::TOGGLE_LINE_LEFT;
587 else if (ob == column_options_->radio_border_right)
588 num = LyXTabular::TOGGLE_LINE_RIGHT;
589 else if (ob == column_options_->radio_align_left)
590 num = LyXTabular::ALIGN_LEFT;
591 else if (ob == column_options_->radio_align_right)
592 num = LyXTabular::ALIGN_RIGHT;
593 else if (ob == column_options_->radio_align_center)
594 num = LyXTabular::ALIGN_CENTER;
595 else if (ob == column_options_->radio_valign_top)
596 num = LyXTabular::VALIGN_TOP;
597 else if (ob == column_options_->radio_valign_bottom)
598 num = LyXTabular::VALIGN_BOTTOM;
599 else if (ob == column_options_->radio_valign_center)
600 num = LyXTabular::VALIGN_CENTER;
601 else if (ob == cell_options_->radio_multicolumn)
602 num = LyXTabular::MULTICOLUMN;
603 else if (ob == tabular_options_->radio_longtable) {
604 if (fl_get_button(tabular_options_->radio_longtable))
605 num = LyXTabular::SET_LONGTABULAR;
607 num = LyXTabular::UNSET_LONGTABULAR;
608 } else if (ob == tabular_options_->radio_rotate_tabular) {
609 s = fl_get_button(tabular_options_->radio_rotate_tabular);
611 num = LyXTabular::SET_ROTATE_TABULAR;
613 num = LyXTabular::UNSET_ROTATE_TABULAR;
614 } else if (ob == cell_options_->radio_rotate_cell) {
615 s = fl_get_button(cell_options_->radio_rotate_cell);
617 num = LyXTabular::SET_ROTATE_CELL;
619 num = LyXTabular::UNSET_ROTATE_CELL;
620 } else if (ob == cell_options_->radio_useminipage) {
621 num = LyXTabular::SET_USEBOX;
623 } else if ((ob == longtable_options_->radio_lt_firsthead) ||
624 (ob == longtable_options_->check_1head_2border_above) ||
625 (ob == longtable_options_->check_1head_2border_below) ||
626 (ob == longtable_options_->check_1head_empty) ||
627 (ob == longtable_options_->radio_lt_head) ||
628 (ob == longtable_options_->check_head_2border_above) ||
629 (ob == longtable_options_->check_head_2border_below) ||
630 (ob == longtable_options_->radio_lt_foot) ||
631 (ob == longtable_options_->check_foot_2border_above) ||
632 (ob == longtable_options_->check_foot_2border_below) ||
633 (ob == longtable_options_->radio_lt_lastfoot) ||
634 (ob == longtable_options_->check_lastfoot_2border_above) ||
635 (ob == longtable_options_->check_lastfoot_2border_below) ||
636 (ob == longtable_options_->check_lastfoot_empty))
638 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
639 } else if (ob == longtable_options_->radio_lt_newpage) {
640 num = LyXTabular::SET_LTNEWPAGE;
641 } else if (ob == column_options_->input_special_alignment) {
642 special = fl_get_input(column_options_->input_special_alignment);
643 num = LyXTabular::SET_SPECIAL_COLUMN;
644 } else if (ob == cell_options_->input_special_multialign) {
645 special = fl_get_input(cell_options_->input_special_multialign);
646 num = LyXTabular::SET_SPECIAL_MULTI;
647 } else if (ob == cell_options_->radio_border_top)
648 num = LyXTabular::M_TOGGLE_LINE_TOP;
649 else if (ob == cell_options_->radio_border_bottom)
650 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
651 else if (ob == cell_options_->radio_border_left)
652 num = LyXTabular::M_TOGGLE_LINE_LEFT;
653 else if (ob == cell_options_->radio_border_right)
654 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
655 else if (ob == cell_options_->radio_align_left)
656 num = LyXTabular::M_ALIGN_LEFT;
657 else if (ob == cell_options_->radio_align_right)
658 num = LyXTabular::M_ALIGN_RIGHT;
659 else if (ob == cell_options_->radio_align_center)
660 num = LyXTabular::M_ALIGN_CENTER;
661 else if (ob == cell_options_->radio_valign_top)
662 num = LyXTabular::M_VALIGN_TOP;
663 else if (ob == cell_options_->radio_valign_bottom)
664 num = LyXTabular::M_VALIGN_BOTTOM;
665 else if (ob == cell_options_->radio_valign_center)
666 num = LyXTabular::M_VALIGN_CENTER;
670 inset_->tabularFeatures(lv_->view(), num, special);
676 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
678 bool flag = fl_get_button(ob);
679 if ((ob == longtable_options_->check_1head_2border_above) ||
680 (ob == longtable_options_->check_head_2border_above) ||
681 (ob == longtable_options_->check_foot_2border_above) ||
682 (ob == longtable_options_->check_lastfoot_2border_above))
684 special = "dl_above";
685 } else if ((ob == longtable_options_->check_1head_2border_below) ||
686 (ob == longtable_options_->check_head_2border_below) ||
687 (ob == longtable_options_->check_foot_2border_below) ||
688 (ob == longtable_options_->check_lastfoot_2border_below))
690 special = "dl_below";
691 } else if ((ob == longtable_options_->check_1head_empty) ||
692 (ob == longtable_options_->check_lastfoot_empty))
698 if ((ob == longtable_options_->radio_lt_firsthead) ||
699 (ob == longtable_options_->check_1head_2border_above) ||
700 (ob == longtable_options_->check_1head_2border_below) ||
701 (ob == longtable_options_->check_1head_empty))
703 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
704 LyXTabular::UNSET_LTFIRSTHEAD);
705 } else if ((ob == longtable_options_->radio_lt_head) ||
706 (ob == longtable_options_->check_head_2border_above) ||
707 (ob == longtable_options_->check_head_2border_below))
709 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
710 } else if ((ob == longtable_options_->radio_lt_foot) ||
711 (ob == longtable_options_->check_foot_2border_above) ||
712 (ob == longtable_options_->check_foot_2border_below))
714 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
715 } else if ((ob == longtable_options_->radio_lt_lastfoot) ||
716 (ob == longtable_options_->check_lastfoot_2border_above) ||
717 (ob == longtable_options_->check_lastfoot_2border_below) ||
718 (ob == longtable_options_->check_lastfoot_empty))
720 return (flag ? LyXTabular::SET_LTLASTFOOT :
721 LyXTabular::UNSET_LTLASTFOOT);
723 return LyXTabular::LAST_ACTION;