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()
159 if (!inset_ || !inset_->tabular.get())
162 LyXTabular * tabular = inset_->tabular.get();
168 int cell = inset_->getActCell();
170 int column = tabular->column_of_cell(cell) + 1;
171 fl_set_object_label(dialog_->text_warning, "");
172 fl_activate_object(column_options_->input_special_alignment);
173 fl_activate_object(cell_options_->input_special_multialign);
174 fl_activate_object(column_options_->input_column_width);
175 fl_activate_object(column_options_->choice_value_column_width);
176 sprintf(buf, "%d", column);
177 fl_set_input(dialog_->input_tabular_column, buf);
178 fl_deactivate_object(dialog_->input_tabular_column);
179 int row = tabular->row_of_cell(cell);
180 sprintf(buf, "%d", row + 1);
181 fl_set_input(dialog_->input_tabular_row, buf);
182 fl_deactivate_object(dialog_->input_tabular_row);
183 if (tabular->IsMultiColumn(cell)) {
184 fl_set_button(cell_options_->radio_multicolumn, 1);
185 fl_set_button(cell_options_->radio_border_top,
186 tabular->TopLine(cell)?1:0);
187 setEnabled(cell_options_->radio_border_top, true);
188 fl_set_button(cell_options_->radio_border_bottom,
189 tabular->BottomLine(cell)?1:0);
190 setEnabled(cell_options_->radio_border_bottom, true);
191 fl_set_button(cell_options_->radio_border_left,
192 tabular->LeftLine(cell)?1:0);
193 setEnabled(cell_options_->radio_border_left, true);
194 fl_set_button(cell_options_->radio_border_right,
195 tabular->RightLine(cell)?1:0);
196 setEnabled(cell_options_->radio_border_right, true);
197 pwidth = tabular->GetMColumnPWidth(cell);
198 align = tabular->GetAlignment(cell);
199 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
200 fl_set_button(cell_options_->radio_align_left, 1);
201 else if (align == LYX_ALIGN_RIGHT)
202 fl_set_button(cell_options_->radio_align_right, 1);
204 fl_set_button(cell_options_->radio_align_center, 1);
205 setEnabled(cell_options_->radio_align_left, true);
206 setEnabled(cell_options_->radio_align_right, true);
207 setEnabled(cell_options_->radio_align_center, true);
208 align = tabular->GetVAlignment(cell);
209 fl_set_button(cell_options_->radio_valign_top, 0);
210 fl_set_button(cell_options_->radio_valign_bottom, 0);
211 fl_set_button(cell_options_->radio_valign_center, 0);
212 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
213 fl_set_button(cell_options_->radio_valign_center, 1);
214 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
215 fl_set_button(cell_options_->radio_valign_bottom, 1);
217 fl_set_button(cell_options_->radio_valign_top, 1);
218 setEnabled(cell_options_->radio_valign_top, true);
219 setEnabled(cell_options_->radio_valign_bottom, true);
220 setEnabled(cell_options_->radio_valign_center, true);
221 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
222 fl_set_input(cell_options_->input_special_multialign, special.c_str());
223 string const default_unit = "cm";
224 updateWidgetsFromLength(cell_options_->input_mcolumn_width,
225 cell_options_->choice_value_mcolumn_width,
226 pwidth, default_unit);
228 if (!lv_->buffer()->isReadonly()) {
229 setEnabled(cell_options_->input_special_multialign, true);
230 setEnabled(cell_options_->input_mcolumn_width, true);
231 setEnabled(cell_options_->choice_value_mcolumn_width, true);
234 setEnabled(cell_options_->radio_valign_top, !pwidth.zero());
235 setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
236 setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
238 setEnabled(cell_options_->radio_align_left, pwidth.zero());
239 setEnabled(cell_options_->radio_align_right, pwidth.zero());
240 setEnabled(cell_options_->radio_align_center, pwidth.zero());
242 fl_set_button(cell_options_->radio_multicolumn, 0);
244 fl_set_button(cell_options_->radio_border_top, 0);
245 setEnabled(cell_options_->radio_border_top, false);
247 fl_set_button(cell_options_->radio_border_bottom, 0);
248 setEnabled(cell_options_->radio_border_bottom, false);
250 fl_set_button(cell_options_->radio_border_left, 0);
251 setEnabled(cell_options_->radio_border_left, false);
253 fl_set_button(cell_options_->radio_border_right, 0);
254 setEnabled(cell_options_->radio_border_right, false);
256 fl_set_button(cell_options_->radio_align_left, 0);
257 setEnabled(cell_options_->radio_align_left, false);
259 fl_set_button(cell_options_->radio_align_right, 0);
260 setEnabled(cell_options_->radio_align_right, false);
262 fl_set_button(cell_options_->radio_align_center, 0);
263 setEnabled(cell_options_->radio_align_center, false);
265 fl_set_button(cell_options_->radio_valign_top, 0);
266 setEnabled(cell_options_->radio_valign_top, false);
268 fl_set_button(cell_options_->radio_valign_bottom, 0);
269 setEnabled(cell_options_->radio_valign_bottom, false);
271 fl_set_button(cell_options_->radio_valign_center, 0);
272 setEnabled(cell_options_->radio_valign_center, false);
274 fl_set_input(cell_options_->input_special_multialign, "");
275 setEnabled(cell_options_->input_special_multialign, false);
277 fl_set_input(cell_options_->input_mcolumn_width, "");
278 setEnabled(cell_options_->input_mcolumn_width, false);
279 setEnabled(cell_options_->choice_value_mcolumn_width, false);
281 if (tabular->GetRotateCell(cell))
282 fl_set_button(cell_options_->radio_rotate_cell, 1);
284 fl_set_button(cell_options_->radio_rotate_cell, 0);
285 if (tabular->TopLine(cell, true))
286 fl_set_button(column_options_->radio_border_top, 1);
288 fl_set_button(column_options_->radio_border_top, 0);
289 if (tabular->BottomLine(cell, true))
290 fl_set_button(column_options_->radio_border_bottom, 1);
292 fl_set_button(column_options_->radio_border_bottom, 0);
293 if (tabular->LeftLine(cell, true))
294 fl_set_button(column_options_->radio_border_left, 1);
296 fl_set_button(column_options_->radio_border_left, 0);
297 if (tabular->RightLine(cell, true))
298 fl_set_button(column_options_->radio_border_right, 1);
300 fl_set_button(column_options_->radio_border_right, 0);
301 special = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
302 fl_set_input(column_options_->input_special_alignment, special.c_str());
304 bool const isReadonly = lv_->buffer()->isReadonly();
305 setEnabled(column_options_->input_special_alignment, !isReadonly);
307 pwidth = tabular->GetColumnPWidth(cell);
308 string const default_unit = "cm";
309 updateWidgetsFromLength(column_options_->input_column_width,
310 column_options_->choice_value_column_width,
311 pwidth, default_unit);
312 setEnabled(column_options_->input_column_width, !isReadonly);
313 setEnabled(column_options_->choice_value_column_width, !isReadonly);
315 setEnabled(cell_options_->radio_useminipage, !pwidth.zero());
316 if (!pwidth.zero()) {
317 if (tabular->GetUsebox(cell) == 2)
318 fl_set_button(cell_options_->radio_useminipage, 1);
320 fl_set_button(cell_options_->radio_useminipage, 0);
322 fl_set_button(cell_options_->radio_useminipage, 0);
324 align = tabular->GetAlignment(cell, true);
325 fl_set_button(column_options_->radio_align_left, 0);
326 fl_set_button(column_options_->radio_align_right, 0);
327 fl_set_button(column_options_->radio_align_center, 0);
328 if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
329 fl_set_button(column_options_->radio_align_left, 1);
330 else if (align == LYX_ALIGN_RIGHT)
331 fl_set_button(column_options_->radio_align_right, 1);
333 fl_set_button(column_options_->radio_align_center, 1);
334 align = tabular->GetVAlignment(cell, true);
335 fl_set_button(column_options_->radio_valign_top, 0);
336 fl_set_button(column_options_->radio_valign_bottom, 0);
337 fl_set_button(column_options_->radio_valign_center, 0);
338 if (pwidth.zero() || (align == LyXTabular::LYX_VALIGN_CENTER))
339 fl_set_button(column_options_->radio_valign_center, 1);
340 else if (align == LyXTabular::LYX_VALIGN_BOTTOM)
341 fl_set_button(column_options_->radio_valign_bottom, 1);
343 fl_set_button(column_options_->radio_valign_top, 1);
345 setEnabled(column_options_->radio_align_left, pwidth.zero());
346 setEnabled(column_options_->radio_align_right, pwidth.zero());
347 setEnabled(column_options_->radio_align_center, pwidth.zero());
349 setEnabled(column_options_->radio_valign_top, !pwidth.zero());
350 setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
351 setEnabled(column_options_->radio_valign_center, !pwidth.zero());
353 fl_set_button(tabular_options_->radio_longtable,
354 tabular->IsLongTabular());
356 bool const enable = tabular->IsLongTabular();
358 setEnabled(longtable_options_->radio_lt_firsthead, enable);
359 setEnabled(longtable_options_->check_1head_2border_above, enable);
360 setEnabled(longtable_options_->check_1head_2border_below, enable);
361 setEnabled(longtable_options_->check_1head_empty, enable);
362 setEnabled(longtable_options_->radio_lt_head, enable);
363 setEnabled(longtable_options_->check_head_2border_above, enable);
364 setEnabled(longtable_options_->check_head_2border_below, enable);
365 setEnabled(longtable_options_->radio_lt_foot, enable);
366 setEnabled(longtable_options_->check_foot_2border_above, enable);
367 setEnabled(longtable_options_->check_foot_2border_below, enable);
368 setEnabled(longtable_options_->radio_lt_lastfoot, enable);
369 setEnabled(longtable_options_->check_lastfoot_2border_above, enable);
370 setEnabled(longtable_options_->check_lastfoot_2border_below, enable);
371 setEnabled(longtable_options_->check_lastfoot_empty, enable);
372 setEnabled(longtable_options_->radio_lt_newpage, enable);
375 LyXTabular::ltType ltt;
377 bool row_set = tabular->GetRowOfLTHead(row, ltt);
378 fl_set_button(longtable_options_->radio_lt_head, row_set);
380 fl_set_button(longtable_options_->check_head_2border_above,
382 fl_set_button(longtable_options_->check_head_2border_above,
386 setEnabled(longtable_options_->check_head_2border_above, 0);
387 setEnabled(longtable_options_->check_head_2border_below, 0);
388 fl_set_button(longtable_options_->check_head_2border_above,0);
389 fl_set_button(longtable_options_->check_head_2border_above,0);
390 fl_set_button(longtable_options_->check_1head_empty,0);
391 setEnabled(longtable_options_->check_1head_empty, 0);
395 row_set = tabular->GetRowOfLTFirstHead(row, ltt);
396 fl_set_button(longtable_options_->radio_lt_firsthead, row_set);
397 if (ltt.set && (!ltt.empty || !use_empty)) {
398 fl_set_button(longtable_options_->check_1head_2border_above,
400 fl_set_button(longtable_options_->check_1head_2border_above,
403 setEnabled(longtable_options_->check_1head_2border_above, 0);
404 setEnabled(longtable_options_->check_1head_2border_below, 0);
405 fl_set_button(longtable_options_->check_1head_2border_above,0);
406 fl_set_button(longtable_options_->check_1head_2border_above,0);
408 fl_set_button(longtable_options_->check_1head_empty,ltt.empty);
410 setEnabled(longtable_options_->radio_lt_firsthead, 0);
414 row_set = tabular->GetRowOfLTFoot(row, ltt);
415 fl_set_button(longtable_options_->radio_lt_foot, row_set);
417 fl_set_button(longtable_options_->check_foot_2border_above,
419 fl_set_button(longtable_options_->check_foot_2border_above,
423 setEnabled(longtable_options_->check_foot_2border_above, 0);
424 setEnabled(longtable_options_->check_foot_2border_below, 0);
425 fl_set_button(longtable_options_->check_foot_2border_above,0);
426 fl_set_button(longtable_options_->check_foot_2border_above,0);
427 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
428 setEnabled(longtable_options_->check_lastfoot_empty, 0);
432 row_set = tabular->GetRowOfLTLastFoot(row, ltt);
433 fl_set_button(longtable_options_->radio_lt_lastfoot, row_set);
434 if (ltt.set && (!ltt.empty || !use_empty)) {
435 fl_set_button(longtable_options_->check_lastfoot_2border_above,
437 fl_set_button(longtable_options_->check_lastfoot_2border_above,
440 setEnabled(longtable_options_->check_lastfoot_2border_above,0);
441 setEnabled(longtable_options_->check_lastfoot_2border_below,0);
442 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
443 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
445 fl_set_button(longtable_options_->check_lastfoot_empty,
448 setEnabled(longtable_options_->radio_lt_lastfoot, 0);
451 fl_set_button(longtable_options_->radio_lt_newpage,
452 tabular->GetLTNewPage(row));
454 fl_set_button(longtable_options_->radio_lt_firsthead, 0);
455 fl_set_button(longtable_options_->check_1head_2border_above, 0);
456 fl_set_button(longtable_options_->check_1head_2border_above, 0);
457 fl_set_button(longtable_options_->check_1head_empty, 0);
458 fl_set_button(longtable_options_->radio_lt_head, 0);
459 fl_set_button(longtable_options_->check_head_2border_above, 0);
460 fl_set_button(longtable_options_->check_head_2border_above, 0);
461 fl_set_button(longtable_options_->radio_lt_foot, 0);
462 fl_set_button(longtable_options_->check_foot_2border_above, 0);
463 fl_set_button(longtable_options_->check_foot_2border_above, 0);
464 fl_set_button(longtable_options_->radio_lt_lastfoot, 0);
465 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
466 fl_set_button(longtable_options_->check_lastfoot_2border_above, 0);
467 fl_set_button(longtable_options_->check_lastfoot_empty, 0);
468 fl_set_button(longtable_options_->radio_lt_newpage, 0);
470 fl_set_button(tabular_options_->radio_rotate_tabular,
471 tabular->GetRotateTabular());
475 bool FormTabular::input(FL_OBJECT * ob, long)
481 LyXTabular::Feature num = LyXTabular::LAST_ACTION;
484 int cell = inset_->getActCell();
486 // ugly hack to auto-apply the stuff that hasn't been
487 // yet. don't let this continue to exist ...
488 if (ob == dialog_->button_close) {
490 input(column_options_->input_column_width, 0);
491 input(cell_options_->input_mcolumn_width, 0);
492 input(column_options_->input_special_alignment, 0);
493 input(cell_options_->input_special_multialign, 0);
499 if (actCell_ != cell) {
501 fl_set_object_label(dialog_->text_warning,
502 _("Warning: Wrong Cursor position, updated window"));
503 fl_show_object(dialog_->text_warning);
506 // No point in processing directives that you can't do anything with
507 // anyhow, so exit now if the buffer is read-only.
508 if (lv_->buffer()->isReadonly()) {
512 if ((ob == column_options_->input_column_width) ||
513 (ob == column_options_->choice_value_column_width))
516 getLengthFromWidgets(column_options_->input_column_width,
517 column_options_->choice_value_column_width);
518 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
519 update(); // update for alignment
522 if ((ob == cell_options_->input_mcolumn_width) ||
523 (ob == cell_options_->choice_value_mcolumn_width))
526 getLengthFromWidgets(cell_options_->input_mcolumn_width,
527 cell_options_->choice_value_mcolumn_width);
528 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
529 update(); // update for alignment
533 if (ob == tabular_options_->button_append_row)
534 num = LyXTabular::APPEND_ROW;
535 else if (ob == tabular_options_->button_append_column)
536 num = LyXTabular::APPEND_COLUMN;
537 else if (ob == tabular_options_->button_delete_row)
538 num = LyXTabular::DELETE_ROW;
539 else if (ob == tabular_options_->button_delete_column)
540 num = LyXTabular::DELETE_COLUMN;
541 else if (ob == tabular_options_->button_set_borders)
542 num = LyXTabular::SET_ALL_LINES;
543 else if (ob == tabular_options_->button_unset_borders)
544 num = LyXTabular::UNSET_ALL_LINES;
545 else if (ob == column_options_->radio_border_top)
546 num = LyXTabular::TOGGLE_LINE_TOP;
547 else if (ob == column_options_->radio_border_bottom)
548 num = LyXTabular::TOGGLE_LINE_BOTTOM;
549 else if (ob == column_options_->radio_border_left)
550 num = LyXTabular::TOGGLE_LINE_LEFT;
551 else if (ob == column_options_->radio_border_right)
552 num = LyXTabular::TOGGLE_LINE_RIGHT;
553 else if (ob == column_options_->radio_align_left)
554 num = LyXTabular::ALIGN_LEFT;
555 else if (ob == column_options_->radio_align_right)
556 num = LyXTabular::ALIGN_RIGHT;
557 else if (ob == column_options_->radio_align_center)
558 num = LyXTabular::ALIGN_CENTER;
559 else if (ob == column_options_->radio_valign_top)
560 num = LyXTabular::VALIGN_TOP;
561 else if (ob == column_options_->radio_valign_bottom)
562 num = LyXTabular::VALIGN_BOTTOM;
563 else if (ob == column_options_->radio_valign_center)
564 num = LyXTabular::VALIGN_CENTER;
565 else if (ob == cell_options_->radio_multicolumn)
566 num = LyXTabular::MULTICOLUMN;
567 else if (ob == tabular_options_->radio_longtable) {
568 if (fl_get_button(tabular_options_->radio_longtable))
569 num = LyXTabular::SET_LONGTABULAR;
571 num = LyXTabular::UNSET_LONGTABULAR;
572 } else if (ob == tabular_options_->radio_rotate_tabular) {
573 s = fl_get_button(tabular_options_->radio_rotate_tabular);
575 num = LyXTabular::SET_ROTATE_TABULAR;
577 num = LyXTabular::UNSET_ROTATE_TABULAR;
578 } else if (ob == cell_options_->radio_rotate_cell) {
579 s = fl_get_button(cell_options_->radio_rotate_cell);
581 num = LyXTabular::SET_ROTATE_CELL;
583 num = LyXTabular::UNSET_ROTATE_CELL;
584 } else if (ob == cell_options_->radio_useminipage) {
585 num = LyXTabular::SET_USEBOX;
587 } else if ((ob == longtable_options_->radio_lt_firsthead) ||
588 (ob == longtable_options_->check_1head_2border_above) ||
589 (ob == longtable_options_->check_1head_2border_below) ||
590 (ob == longtable_options_->check_1head_empty) ||
591 (ob == longtable_options_->radio_lt_head) ||
592 (ob == longtable_options_->check_head_2border_above) ||
593 (ob == longtable_options_->check_head_2border_below) ||
594 (ob == longtable_options_->radio_lt_foot) ||
595 (ob == longtable_options_->check_foot_2border_above) ||
596 (ob == longtable_options_->check_foot_2border_below) ||
597 (ob == longtable_options_->radio_lt_lastfoot) ||
598 (ob == longtable_options_->check_lastfoot_2border_above) ||
599 (ob == longtable_options_->check_lastfoot_2border_below) ||
600 (ob == longtable_options_->check_lastfoot_empty))
602 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
603 } else if (ob == longtable_options_->radio_lt_newpage) {
604 num = LyXTabular::SET_LTNEWPAGE;
605 } else if (ob == column_options_->input_special_alignment) {
606 special = fl_get_input(column_options_->input_special_alignment);
607 num = LyXTabular::SET_SPECIAL_COLUMN;
608 } else if (ob == cell_options_->input_special_multialign) {
609 special = fl_get_input(cell_options_->input_special_multialign);
610 num = LyXTabular::SET_SPECIAL_MULTI;
611 } else if (ob == cell_options_->radio_border_top)
612 num = LyXTabular::M_TOGGLE_LINE_TOP;
613 else if (ob == cell_options_->radio_border_bottom)
614 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
615 else if (ob == cell_options_->radio_border_left)
616 num = LyXTabular::M_TOGGLE_LINE_LEFT;
617 else if (ob == cell_options_->radio_border_right)
618 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
619 else if (ob == cell_options_->radio_align_left)
620 num = LyXTabular::M_ALIGN_LEFT;
621 else if (ob == cell_options_->radio_align_right)
622 num = LyXTabular::M_ALIGN_RIGHT;
623 else if (ob == cell_options_->radio_align_center)
624 num = LyXTabular::M_ALIGN_CENTER;
625 else if (ob == cell_options_->radio_valign_top)
626 num = LyXTabular::M_VALIGN_TOP;
627 else if (ob == cell_options_->radio_valign_bottom)
628 num = LyXTabular::M_VALIGN_BOTTOM;
629 else if (ob == cell_options_->radio_valign_center)
630 num = LyXTabular::M_VALIGN_CENTER;
634 inset_->tabularFeatures(lv_->view(), num, special);
640 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
642 bool flag = fl_get_button(ob);
643 if ((ob == longtable_options_->check_1head_2border_above) ||
644 (ob == longtable_options_->check_head_2border_above) ||
645 (ob == longtable_options_->check_foot_2border_above) ||
646 (ob == longtable_options_->check_lastfoot_2border_above))
648 special = "dl_above";
649 } else if ((ob == longtable_options_->check_1head_2border_below) ||
650 (ob == longtable_options_->check_head_2border_below) ||
651 (ob == longtable_options_->check_foot_2border_below) ||
652 (ob == longtable_options_->check_lastfoot_2border_below))
654 special = "dl_below";
655 } else if ((ob == longtable_options_->check_1head_empty) ||
656 (ob == longtable_options_->check_lastfoot_empty))
662 if ((ob == longtable_options_->radio_lt_firsthead) ||
663 (ob == longtable_options_->check_1head_2border_above) ||
664 (ob == longtable_options_->check_1head_2border_below) ||
665 (ob == longtable_options_->check_1head_empty))
667 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
668 LyXTabular::UNSET_LTFIRSTHEAD);
669 } else if ((ob == longtable_options_->radio_lt_head) ||
670 (ob == longtable_options_->check_head_2border_above) ||
671 (ob == longtable_options_->check_head_2border_below))
673 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
674 } else if ((ob == longtable_options_->radio_lt_foot) ||
675 (ob == longtable_options_->check_foot_2border_above) ||
676 (ob == longtable_options_->check_foot_2border_below))
678 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
679 } else if ((ob == longtable_options_->radio_lt_lastfoot) ||
680 (ob == longtable_options_->check_lastfoot_2border_above) ||
681 (ob == longtable_options_->check_lastfoot_2border_below) ||
682 (ob == longtable_options_->check_lastfoot_empty))
684 return (flag ? LyXTabular::SET_LTLASTFOOT :
685 LyXTabular::UNSET_LTLASTFOOT);
687 return LyXTabular::LAST_ACTION;