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"
24 #include "insets/insettabular.h"
26 #include "xforms_helpers.h"
27 #include "helper_funcs.h"
28 #include "input_validators.h"
29 #include "support/lstrings.h"
33 FormTabular::FormTabular(LyXView * lv, Dialogs * d)
34 : FormInset(lv, d, _("Tabular Layout")),
35 inset_(0), actCell_(-1)
37 // let the dialog be shown
38 // This is a permanent connection so we won't bother
39 // storing a copy because we won't be disconnecting.
40 d->showTabular.connect(slot(this, &FormTabular::showInset));
41 d->updateTabular.connect(slot(this, &FormTabular::updateInset));
45 void FormTabular::redraw()
47 if(form() && form()->visible)
48 fl_redraw_form(form());
52 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabFolder);
53 if (outer_form && outer_form->visible)
54 fl_redraw_form(outer_form);
58 FL_FORM * FormTabular::form() const
66 void FormTabular::disconnect()
69 FormInset::disconnect();
73 void FormTabular::showInset(InsetTabular * inset)
75 if (inset == 0) return;
77 // If connected to another inset, disconnect from it.
78 if (inset_ != inset) {
80 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
88 void FormTabular::updateInset(InsetTabular * inset)
90 if (inset == 0 || inset_ == 0) return;
92 // If connected to another inset, disconnect from it.
93 if (inset_ != inset) {
95 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
103 void FormTabular::build()
105 dialog_.reset(build_tabular());
106 tabular_options_.reset(build_tabular_options());
107 column_options_.reset(build_column_options());
108 cell_options_.reset(build_cell_options());
109 longtable_options_.reset(build_longtable_options());
111 fl_set_input_return(column_options_->input_column_width,
113 fl_set_input_return(column_options_->input_special_alignment,
115 fl_set_input_return(cell_options_->input_mcolumn_width,
117 fl_set_input_return(cell_options_->input_special_multialign,
120 fl_addto_tabfolder(dialog_->tabFolder, _("Tabular"),
121 tabular_options_->form);
122 fl_addto_tabfolder(dialog_->tabFolder, _("Column/Row"),
123 column_options_->form);
124 fl_addto_tabfolder(dialog_->tabFolder, _("Cell"),
125 cell_options_->form);
126 fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"),
127 longtable_options_->form);
129 // We should set these input filters on width fields to make them accept
130 // only unsigned numbers.
131 // But this leeds to trouble with the current apply behaviour (JSpitzm).
132 // fl_set_input_filter(column_options_->input_column_width,
133 // fl_unsigned_float_filter);
134 // fl_set_input_filter(cell_options_->input_mcolumn_width,
135 // fl_unsigned_float_filter);
137 // Create the contents of the unit choices
138 // Don't include the "%" terms...
139 std::vector<string> units_vec = getLatexUnits();
140 for (std::vector<string>::iterator it = units_vec.begin();
141 it != units_vec.end(); ++it) {
142 if (contains(*it, "%"))
143 it = units_vec.erase(it, it + 1) - 1;
145 string units = getStringFromVector(units_vec, "|");
147 fl_addto_choice(column_options_->choice_value_column_width,
149 fl_addto_choice(cell_options_->choice_value_mcolumn_width,
154 void FormTabular::update()
156 if (!inset_ || !inset_->tabular.get())
159 LyXTabular * tabular = inset_->tabular.get();
165 int cell = inset_->getActCell();
167 int column = tabular->column_of_cell(cell) + 1;
168 fl_set_object_label(dialog_->text_warning, "");
169 fl_activate_object(column_options_->input_special_alignment);
170 fl_activate_object(cell_options_->input_special_multialign);
171 fl_activate_object(column_options_->input_column_width);
172 fl_activate_object(column_options_->choice_value_column_width);
173 sprintf(buf, "%d", column);
174 fl_set_input(dialog_->input_tabular_column, buf);
175 fl_deactivate_object(dialog_->input_tabular_column);
176 int row = tabular->row_of_cell(cell);
177 sprintf(buf, "%d", row + 1);
178 fl_set_input(dialog_->input_tabular_row, buf);
179 fl_deactivate_object(dialog_->input_tabular_row);
180 if (tabular->IsMultiColumn(cell)) {
181 fl_set_button(cell_options_->radio_multicolumn, 1);
182 fl_set_button(cell_options_->radio_border_top,
183 tabular->TopLine(cell)?1:0);
184 setEnabled(cell_options_->radio_border_top, true);
185 fl_set_button(cell_options_->radio_border_bottom,
186 tabular->BottomLine(cell)?1:0);
187 setEnabled(cell_options_->radio_border_bottom, true);
188 fl_set_button(cell_options_->radio_border_left,
189 tabular->LeftLine(cell)?1:0);
190 setEnabled(cell_options_->radio_border_left, true);
191 fl_set_button(cell_options_->radio_border_right,
192 tabular->RightLine(cell)?1:0);
193 setEnabled(cell_options_->radio_border_right, true);
194 pwidth = tabular->GetMColumnPWidth(cell);
195 align = tabular->GetAlignment(cell);
196 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
197 fl_set_button(cell_options_->radio_align_left, 1);
198 else if (align == LYX_ALIGN_RIGHT)
199 fl_set_button(cell_options_->radio_align_right, 1);
201 fl_set_button(cell_options_->radio_align_center, 1);
202 setEnabled(cell_options_->radio_align_left, true);
203 setEnabled(cell_options_->radio_align_right, true);
204 setEnabled(cell_options_->radio_align_center, true);
205 align = tabular->GetVAlignment(cell);
206 fl_set_button(cell_options_->radio_valign_top, 0);
207 fl_set_button(cell_options_->radio_valign_bottom, 0);
208 fl_set_button(cell_options_->radio_valign_center, 0);
209 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
210 fl_set_button(cell_options_->radio_valign_center, 1);
211 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
212 fl_set_button(cell_options_->radio_valign_bottom, 1);
214 fl_set_button(cell_options_->radio_valign_top, 1);
215 setEnabled(cell_options_->radio_valign_top, true);
216 setEnabled(cell_options_->radio_valign_bottom, true);
217 setEnabled(cell_options_->radio_valign_center, true);
218 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
219 fl_set_input(cell_options_->input_special_multialign, special.c_str());
220 string const default_unit = "cm";
221 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
222 cell_options_->choice_value_mcolumn_width,
223 pwidth, default_unit);
225 if (!lv_->buffer()->isReadonly()) {
226 setEnabled(cell_options_->input_special_multialign, true);
227 setEnabled(cell_options_->input_mcolumn_width, true);
228 setEnabled(cell_options_->choice_value_mcolumn_width, true);
231 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
232 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
233 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
235 setEnabled(cell_options_->radio_align_left, pwidth.zero());
236 setEnabled(cell_options_->radio_align_right, pwidth.zero());
237 setEnabled(cell_options_->radio_align_center, pwidth.zero());
239 fl_set_button(cell_options_->radio_multicolumn, 0);
241 fl_set_button(cell_options_->radio_border_top, 0);
242 setEnabled(cell_options_->radio_border_top, false);
244 fl_set_button(cell_options_->radio_border_bottom, 0);
245 setEnabled(cell_options_->radio_border_bottom, false);
247 fl_set_button(cell_options_->radio_border_left, 0);
248 setEnabled(cell_options_->radio_border_left, false);
250 fl_set_button(cell_options_->radio_border_right, 0);
251 setEnabled(cell_options_->radio_border_right, false);
253 fl_set_button(cell_options_->radio_align_left, 0);
254 setEnabled(cell_options_->radio_align_left, false);
256 fl_set_button(cell_options_->radio_align_right, 0);
257 setEnabled(cell_options_->radio_align_right, false);
259 fl_set_button(cell_options_->radio_align_center, 0);
260 setEnabled(cell_options_->radio_align_center, false);
262 fl_set_button(cell_options_->radio_valign_top, 0);
263 setEnabled(cell_options_->radio_valign_top, false);
265 fl_set_button(cell_options_->radio_valign_bottom, 0);
266 setEnabled(cell_options_->radio_valign_bottom, false);
268 fl_set_button(cell_options_->radio_valign_center, 0);
269 setEnabled(cell_options_->radio_valign_center, false);
271 fl_set_input(cell_options_->input_special_multialign, "");
272 setEnabled(cell_options_->input_special_multialign, false);
274 fl_set_input(cell_options_->input_mcolumn_width, "");
275 setEnabled(cell_options_->input_mcolumn_width, false);
276 setEnabled(cell_options_->choice_value_mcolumn_width, false);
278 if (tabular->GetRotateCell(cell))
279 fl_set_button(cell_options_->radio_rotate_cell, 1);
281 fl_set_button(cell_options_->radio_rotate_cell, 0);
282 if (tabular->TopLine(cell, true))
283 fl_set_button(column_options_->radio_border_top, 1);
285 fl_set_button(column_options_->radio_border_top, 0);
286 if (tabular->BottomLine(cell, true))
287 fl_set_button(column_options_->radio_border_bottom, 1);
289 fl_set_button(column_options_->radio_border_bottom, 0);
290 if (tabular->LeftLine(cell, true))
291 fl_set_button(column_options_->radio_border_left, 1);
293 fl_set_button(column_options_->radio_border_left, 0);
294 if (tabular->RightLine(cell, true))
295 fl_set_button(column_options_->radio_border_right, 1);
297 fl_set_button(column_options_->radio_border_right, 0);
298 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
299 fl_set_input(column_options_->input_special_alignment, special.c_str());
301 bool const isReadonly = lv_->buffer()->isReadonly();
302 setEnabled(column_options_->input_special_alignment, !isReadonly);
304 pwidth = tabular->GetColumnPWidth(cell);
305 string const default_unit = "cm";
306 updateWidgetsFromLength(column_options_->input_column_width,
307 column_options_->choice_value_column_width,
308 pwidth, default_unit);
309 setEnabled(column_options_->input_column_width, !isReadonly);
310 setEnabled(column_options_->choice_value_column_width, !isReadonly);
312 setEnabled(cell_options_->radio_useminipage, !pwidth.zero());
313 if (!pwidth.zero()) {
314 if (tabular->GetUsebox(cell) == 2)
315 fl_set_button(cell_options_->radio_useminipage, 1);
317 fl_set_button(cell_options_->radio_useminipage, 0);
319 fl_set_button(cell_options_->radio_useminipage, 0);
321 align = tabular->GetAlignment(cell, true);
322 fl_set_button(column_options_->radio_align_left, 0);
323 fl_set_button(column_options_->radio_align_right, 0);
324 fl_set_button(column_options_->radio_align_center, 0);
325 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
326 fl_set_button(column_options_->radio_align_left, 1);
327 else if (align == LYX_ALIGN_RIGHT)
328 fl_set_button(column_options_->radio_align_right, 1);
330 fl_set_button(column_options_->radio_align_center, 1);
331 align = tabular->GetVAlignment(cell, true);
332 fl_set_button(column_options_->radio_valign_top, 0);
333 fl_set_button(column_options_->radio_valign_bottom, 0);
334 fl_set_button(column_options_->radio_valign_center, 0);
335 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
336 fl_set_button(column_options_->radio_valign_center, 1);
337 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
338 fl_set_button(column_options_->radio_valign_bottom, 1);
340 fl_set_button(column_options_->radio_valign_top, 1);
342 setEnabled(column_options_->radio_align_left, pwidth.zero());
343 setEnabled(column_options_->radio_align_right, pwidth.zero());
344 setEnabled(column_options_->radio_align_center, pwidth.zero());
346 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
347 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
348 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
350 fl_set_button(tabular_options_->radio_longtable,
351 tabular->IsLongTabular());
353 bool const enable = tabular->IsLongTabular();
355 setEnabled(longtable_options_->radio_lt_firsthead, enable);
356 setEnabled(longtable_options_->check_1head_2border_above, enable);
357 setEnabled(longtable_options_->check_1head_2border_below, enable);
358 setEnabled(longtable_options_->check_1head_empty, enable);
359 setEnabled(longtable_options_->radio_lt_head, enable);
360 setEnabled(longtable_options_->check_head_2border_above, enable);
361 setEnabled(longtable_options_->check_head_2border_below, enable);
362 setEnabled(longtable_options_->radio_lt_foot, enable);
363 setEnabled(longtable_options_->check_foot_2border_above, enable);
364 setEnabled(longtable_options_->check_foot_2border_below, enable);
365 setEnabled(longtable_options_->radio_lt_lastfoot, enable);
366 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
367 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
368 setEnabled(longtable_options_->check_lastfoot_empty, enable);
369 setEnabled(longtable_options_->radio_lt_newpage, enable);
372 LyXTabular::ltType ltt;
374 bool row_set = tabular->GetRowOfLTHead(row, ltt);
375 fl_set_button(longtable_options_->radio_lt_head, row_set);
377 fl_set_button(longtable_options_->check_head_2border_above,
379 fl_set_button(longtable_options_->check_head_2border_above,
383 setEnabled(longtable_options_->check_head_2border_above, 0);
384 setEnabled(longtable_options_->check_head_2border_below, 0);
385 fl_set_button(longtable_options_->check_head_2border_above,0);
386 fl_set_button(longtable_options_->check_head_2border_above,0);
387 fl_set_button(longtable_options_->check_1head_empty,0);
388 setEnabled(longtable_options_->check_1head_empty, 0);
392 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
393 fl_set_button(longtable_options_->radio_lt_firsthead, row_set);
394 if (ltt.set && (!ltt.empty || !use_empty)) {
395 fl_set_button(longtable_options_->check_1head_2border_above,
397 fl_set_button(longtable_options_->check_1head_2border_above,
400 setEnabled(longtable_options_->check_1head_2border_above, 0);
401 setEnabled(longtable_options_->check_1head_2border_below, 0);
402 fl_set_button(longtable_options_->check_1head_2border_above,0);
403 fl_set_button(longtable_options_->check_1head_2border_above,0);
405 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
407 setEnabled(longtable_options_->radio_lt_firsthead, 0);
411 row_set = tabular->GetRowOfLTFoot(row, ltt);
412 fl_set_button(longtable_options_->radio_lt_foot, row_set);
414 fl_set_button(longtable_options_->check_foot_2border_above,
416 fl_set_button(longtable_options_->check_foot_2border_above,
420 setEnabled(longtable_options_->check_foot_2border_above, 0);
421 setEnabled(longtable_options_->check_foot_2border_below, 0);
422 fl_set_button(longtable_options_->check_foot_2border_above,0);
423 fl_set_button(longtable_options_->check_foot_2border_above,0);
424 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
425 setEnabled(longtable_options_->check_lastfoot_empty, 0);
429 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
430 fl_set_button(longtable_options_->radio_lt_lastfoot, row_set);
431 if (ltt.set && (!ltt.empty || !use_empty)) {
432 fl_set_button(longtable_options_->check_lastfoot_2border_above,
434 fl_set_button(longtable_options_->check_lastfoot_2border_above,
437 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
438 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
439 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
440 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
442 fl_set_button(longtable_options_->check_lastfoot_empty,
445 setEnabled(longtable_options_->radio_lt_lastfoot, 0);
448 fl_set_button(longtable_options_->radio_lt_newpage,
449 tabular->GetLTNewPage(row));
451 fl_set_button(longtable_options_->radio_lt_firsthead, 0);
452 fl_set_button(longtable_options_->check_1head_2border_above, 0);
453 fl_set_button(longtable_options_->check_1head_2border_above, 0);
454 fl_set_button(longtable_options_->check_1head_empty, 0);
455 fl_set_button(longtable_options_->radio_lt_head, 0);
456 fl_set_button(longtable_options_->check_head_2border_above, 0);
457 fl_set_button(longtable_options_->check_head_2border_above, 0);
458 fl_set_button(longtable_options_->radio_lt_foot, 0);
459 fl_set_button(longtable_options_->check_foot_2border_above, 0);
460 fl_set_button(longtable_options_->check_foot_2border_above, 0);
461 fl_set_button(longtable_options_->radio_lt_lastfoot, 0);
462 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
463 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
464 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
465 fl_set_button(longtable_options_->radio_lt_newpage, 0);
467 fl_set_button(tabular_options_->radio_rotate_tabular,
468 tabular->GetRotateTabular());
472 bool FormTabular::input(FL_OBJECT * ob, long)
478 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
481 int cell = inset_->getActCell();
483 if (actCell_ != cell) {
485 fl_set_object_label(dialog_->text_warning,
486 _("Warning: Wrong Cursor position, updated window"));
487 fl_show_object(dialog_->text_warning);
490 // No point in processing directives that you can't do anything with
491 // anyhow, so exit now if the buffer is read-only.
492 if (lv_->buffer()->isReadonly()) {
496 if ((ob == column_options_->input_column_width) ||
497 (ob == column_options_->choice_value_column_width))
500 getLengthFromWidgets(column_options_->input_column_width,
501 column_options_->choice_value_column_width);
502 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
503 update(); // update for alignment
506 if ((ob == cell_options_->input_mcolumn_width) ||
507 (ob == cell_options_->choice_value_mcolumn_width))
510 getLengthFromWidgets(cell_options_->input_mcolumn_width,
511 cell_options_->choice_value_mcolumn_width);
512 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
513 update(); // update for alignment
517 if (ob == tabular_options_->button_append_row)
518 num = LyXTabular::APPEND_ROW;
519 else if (ob == tabular_options_->button_append_column)
520 num = LyXTabular::APPEND_COLUMN;
521 else if (ob == tabular_options_->button_delete_row)
522 num = LyXTabular::DELETE_ROW;
523 else if (ob == tabular_options_->button_delete_column)
524 num = LyXTabular::DELETE_COLUMN;
525 else if (ob == tabular_options_->button_set_borders)
526 num = LyXTabular::SET_ALL_LINES;
527 else if (ob == tabular_options_->button_unset_borders)
528 num = LyXTabular::UNSET_ALL_LINES;
529 else if (ob == column_options_->radio_border_top)
530 num = LyXTabular::TOGGLE_LINE_TOP;
531 else if (ob == column_options_->radio_border_bottom)
532 num = LyXTabular::TOGGLE_LINE_BOTTOM;
533 else if (ob == column_options_->radio_border_left)
534 num = LyXTabular::TOGGLE_LINE_LEFT;
535 else if (ob == column_options_->radio_border_right)
536 num = LyXTabular::TOGGLE_LINE_RIGHT;
537 else if (ob == column_options_->radio_align_left)
538 num = LyXTabular::ALIGN_LEFT;
539 else if (ob == column_options_->radio_align_right)
540 num = LyXTabular::ALIGN_RIGHT;
541 else if (ob == column_options_->radio_align_center)
542 num = LyXTabular::ALIGN_CENTER;
543 else if (ob == column_options_->radio_valign_top)
544 num = LyXTabular::VALIGN_TOP;
545 else if (ob == column_options_->radio_valign_bottom)
546 num = LyXTabular::VALIGN_BOTTOM;
547 else if (ob == column_options_->radio_valign_center)
548 num = LyXTabular::VALIGN_CENTER;
549 else if (ob == cell_options_->radio_multicolumn)
550 num = LyXTabular::MULTICOLUMN;
551 else if (ob == tabular_options_->radio_longtable) {
552 if (fl_get_button(tabular_options_->radio_longtable))
553 num = LyXTabular::SET_LONGTABULAR;
555 num = LyXTabular::UNSET_LONGTABULAR;
556 } else if (ob == tabular_options_->radio_rotate_tabular) {
557 s = fl_get_button(tabular_options_->radio_rotate_tabular);
559 num = LyXTabular::SET_ROTATE_TABULAR;
561 num = LyXTabular::UNSET_ROTATE_TABULAR;
562 } else if (ob == cell_options_->radio_rotate_cell) {
563 s = fl_get_button(cell_options_->radio_rotate_cell);
565 num = LyXTabular::SET_ROTATE_CELL;
567 num = LyXTabular::UNSET_ROTATE_CELL;
568 } else if (ob == cell_options_->radio_useminipage) {
569 num = LyXTabular::SET_USEBOX;
571 } else if ((ob == longtable_options_->radio_lt_firsthead) ||
572 (ob == longtable_options_->check_1head_2border_above) ||
573 (ob == longtable_options_->check_1head_2border_below) ||
574 (ob == longtable_options_->check_1head_empty) ||
575 (ob == longtable_options_->radio_lt_head) ||
576 (ob == longtable_options_->check_head_2border_above) ||
577 (ob == longtable_options_->check_head_2border_below) ||
578 (ob == longtable_options_->radio_lt_foot) ||
579 (ob == longtable_options_->check_foot_2border_above) ||
580 (ob == longtable_options_->check_foot_2border_below) ||
581 (ob == longtable_options_->radio_lt_lastfoot) ||
582 (ob == longtable_options_->check_lastfoot_2border_above) ||
583 (ob == longtable_options_->check_lastfoot_2border_below) ||
584 (ob == longtable_options_->check_lastfoot_empty))
586 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
587 } else if (ob == longtable_options_->radio_lt_newpage) {
588 num = LyXTabular::SET_LTNEWPAGE;
589 } else if (ob == column_options_->input_special_alignment) {
590 special = fl_get_input(column_options_->input_special_alignment);
591 num = LyXTabular::SET_SPECIAL_COLUMN;
592 } else if (ob == cell_options_->input_special_multialign) {
593 special = fl_get_input(cell_options_->input_special_multialign);
594 num = LyXTabular::SET_SPECIAL_MULTI;
595 } else if (ob == cell_options_->radio_border_top)
596 num = LyXTabular::M_TOGGLE_LINE_TOP;
597 else if (ob == cell_options_->radio_border_bottom)
598 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
599 else if (ob == cell_options_->radio_border_left)
600 num = LyXTabular::M_TOGGLE_LINE_LEFT;
601 else if (ob == cell_options_->radio_border_right)
602 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
603 else if (ob == cell_options_->radio_align_left)
604 num = LyXTabular::M_ALIGN_LEFT;
605 else if (ob == cell_options_->radio_align_right)
606 num = LyXTabular::M_ALIGN_RIGHT;
607 else if (ob == cell_options_->radio_align_center)
608 num = LyXTabular::M_ALIGN_CENTER;
609 else if (ob == cell_options_->radio_valign_top)
610 num = LyXTabular::M_VALIGN_TOP;
611 else if (ob == cell_options_->radio_valign_bottom)
612 num = LyXTabular::M_VALIGN_BOTTOM;
613 else if (ob == cell_options_->radio_valign_center)
614 num = LyXTabular::M_VALIGN_CENTER;
618 inset_->tabularFeatures(lv_->view(), num, special);
624 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
626 bool flag = fl_get_button(ob);
627 if ((ob == longtable_options_->check_1head_2border_above) ||
628 (ob == longtable_options_->check_head_2border_above) ||
629 (ob == longtable_options_->check_foot_2border_above) ||
630 (ob == longtable_options_->check_lastfoot_2border_above))
632 special = "dl_above";
633 } else if ((ob == longtable_options_->check_1head_2border_below) ||
634 (ob == longtable_options_->check_head_2border_below) ||
635 (ob == longtable_options_->check_foot_2border_below) ||
636 (ob == longtable_options_->check_lastfoot_2border_below))
638 special = "dl_below";
639 } else if ((ob == longtable_options_->check_1head_empty) ||
640 (ob == longtable_options_->check_lastfoot_empty))
646 if ((ob == longtable_options_->radio_lt_firsthead) ||
647 (ob == longtable_options_->check_1head_2border_above) ||
648 (ob == longtable_options_->check_1head_2border_below) ||
649 (ob == longtable_options_->check_1head_empty))
651 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
652 LyXTabular::UNSET_LTFIRSTHEAD);
653 } else if ((ob == longtable_options_->radio_lt_head) ||
654 (ob == longtable_options_->check_head_2border_above) ||
655 (ob == longtable_options_->check_head_2border_below))
657 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
658 } else if ((ob == longtable_options_->radio_lt_foot) ||
659 (ob == longtable_options_->check_foot_2border_above) ||
660 (ob == longtable_options_->check_foot_2border_below))
662 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
663 } else if ((ob == longtable_options_->radio_lt_lastfoot) ||
664 (ob == longtable_options_->check_lastfoot_2border_above) ||
665 (ob == longtable_options_->check_lastfoot_2border_below) ||
666 (ob == longtable_options_->check_lastfoot_empty))
668 return (flag ? LyXTabular::SET_LTLASTFOOT :
669 LyXTabular::UNSET_LTLASTFOOT);
671 return LyXTabular::LAST_ACTION;