3 * Copyright 2000-2001 The LyX Team.
4 * See the file COPYING.
6 * \author Jürgen Vigna, jug@sad.it
12 #pragma implementation
17 #include "FormTabular.h"
18 #include "form_tabular.h"
22 #include "xforms_helpers.h"
23 #include "lyxrc.h" // to set the default length values
24 #include "helper_funcs.h"
25 #include "input_validators.h"
27 #include "insets/insettabular.h"
29 #include "support/lstrings.h"
40 FormTabular::FormTabular(LyXView * lv, Dialogs * d)
41 : FormInset(lv, d, _("Tabular Layout")),
42 inset_(0), actCell_(-1), closing_(false)
44 // let the dialog be shown
45 // This is a permanent connection so we won't bother
46 // storing a copy because we won't be disconnecting.
47 d->showTabular.connect(slot(this, &FormTabular::showInset));
48 d->updateTabular.connect(slot(this, &FormTabular::updateInset));
52 void FormTabular::redraw()
54 if (form() && form()->visible)
55 fl_redraw_form(form());
59 FL_FORM * outer_form = fl_get_active_folder(dialog_->tabFolder);
60 if (outer_form && outer_form->visible)
61 fl_redraw_form(outer_form);
65 FL_FORM * FormTabular::form() const
73 void FormTabular::disconnect()
76 FormInset::disconnect();
80 void FormTabular::showInset(InsetTabular * inset)
82 if (inset == 0) return;
84 // If connected to another inset, disconnect from it.
85 if (inset_ != inset) {
87 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
95 void FormTabular::updateInset(InsetTabular * inset)
97 if (inset == 0 || inset_ == 0) return;
99 // If connected to another inset, disconnect from it.
100 if (inset_ != inset) {
102 ih_ = inset->hideDialog.connect(slot(this, &FormTabular::hide));
110 void FormTabular::build()
112 dialog_.reset(build_tabular());
114 setPrehandler(dialog_->input_tabular_column);
115 setPrehandler(dialog_->input_tabular_row);
117 tabular_options_.reset(build_tabular_options());
118 column_options_.reset(build_column_options());
119 cell_options_.reset(build_cell_options());
120 longtable_options_.reset(build_longtable_options());
122 fl_set_input_return(column_options_->input_column_width,
124 fl_set_input_return(column_options_->input_special_alignment,
127 setPrehandler(column_options_->input_column_width);
128 setPrehandler(column_options_->input_special_alignment);
130 fl_set_input_return(cell_options_->input_mcolumn_width,
132 fl_set_input_return(cell_options_->input_special_multialign,
135 setPrehandler(cell_options_->input_mcolumn_width);
136 setPrehandler(cell_options_->input_special_multialign);
138 fl_addto_tabfolder(dialog_->tabFolder, _("Tabular"),
139 tabular_options_->form);
140 fl_addto_tabfolder(dialog_->tabFolder, _("Column/Row"),
141 column_options_->form);
142 fl_addto_tabfolder(dialog_->tabFolder, _("Cell"),
143 cell_options_->form);
144 fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"),
145 longtable_options_->form);
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)
154 if (contains(*it, "%"))
155 it = units_vec.erase(it, it + 1) - 1;
158 vector<string>::iterator ret =
159 remove_if(units_vec.begin(), units_vec.end(),
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 LyXTabular * tabular = inset_->tabular.get();
509 getLengthFromWidgets(column_options_->input_column_width,
510 column_options_->choice_value_column_width);
512 LyXLength llen = tabular->GetColumnPWidth(cell);
514 str2 = llen.asString();
516 input(column_options_->input_column_width, 0);
517 str1 = getLengthFromWidgets(cell_options_->input_mcolumn_width,
518 cell_options_->choice_value_mcolumn_width);
519 llen = tabular->GetMColumnPWidth(cell);
523 str2 = llen.asString();
525 input(cell_options_->input_mcolumn_width, 0);
526 str1 = fl_get_input(column_options_->input_special_alignment);
527 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_COLUMN);
529 input(column_options_->input_special_alignment, 0);
530 str1 = fl_get_input(cell_options_->input_special_multialign);
531 str2 = tabular->GetAlignSpecial(cell, LyXTabular::SET_SPECIAL_MULTI);
533 input(cell_options_->input_special_multialign, 0);
539 if (actCell_ != cell) {
541 fl_set_object_label(dialog_->text_warning,
542 _("Warning: Wrong Cursor position, updated window"));
543 fl_show_object(dialog_->text_warning);
546 // No point in processing directives that you can't do anything with
547 // anyhow, so exit now if the buffer is read-only.
548 if (lv_->buffer()->isReadonly()) {
552 if ((ob == column_options_->input_column_width) ||
553 (ob == column_options_->choice_value_column_width))
556 getLengthFromWidgets(column_options_->input_column_width,
557 column_options_->choice_value_column_width);
558 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_PWIDTH, str);
560 //check if the input is valid
562 fl_get_input(column_options_->input_column_width);
563 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
564 fl_set_object_label(dialog_->text_warning,
565 _("Warning: Invalid Length (valid example: 10mm)"));
566 fl_show_object(dialog_->text_warning);
569 update(); // update for alignment
572 if ((ob == cell_options_->input_mcolumn_width) ||
573 (ob == cell_options_->choice_value_mcolumn_width))
576 getLengthFromWidgets(cell_options_->input_mcolumn_width,
577 cell_options_->choice_value_mcolumn_width);
578 inset_->tabularFeatures(lv_->view(), LyXTabular::SET_MPWIDTH, str);
580 //check if the input is valid
582 fl_get_input(cell_options_->input_mcolumn_width);
583 if (!input.empty() && !isValidLength(input) && !isStrDbl(input)) {
584 fl_set_object_label(dialog_->text_warning,
585 _("Warning: Invalid Length (valid example: 10mm)"));
586 fl_show_object(dialog_->text_warning);
589 update(); // update for alignment
593 if (ob == tabular_options_->button_append_row)
594 num = LyXTabular::APPEND_ROW;
595 else if (ob == tabular_options_->button_append_column)
596 num = LyXTabular::APPEND_COLUMN;
597 else if (ob == tabular_options_->button_delete_row)
598 num = LyXTabular::DELETE_ROW;
599 else if (ob == tabular_options_->button_delete_column)
600 num = LyXTabular::DELETE_COLUMN;
601 else if (ob == tabular_options_->button_set_borders)
602 num = LyXTabular::SET_ALL_LINES;
603 else if (ob == tabular_options_->button_unset_borders)
604 num = LyXTabular::UNSET_ALL_LINES;
605 else if (ob == column_options_->radio_border_top)
606 num = LyXTabular::TOGGLE_LINE_TOP;
607 else if (ob == column_options_->radio_border_bottom)
608 num = LyXTabular::TOGGLE_LINE_BOTTOM;
609 else if (ob == column_options_->radio_border_left)
610 num = LyXTabular::TOGGLE_LINE_LEFT;
611 else if (ob == column_options_->radio_border_right)
612 num = LyXTabular::TOGGLE_LINE_RIGHT;
613 else if (ob == column_options_->radio_align_left)
614 num = LyXTabular::ALIGN_LEFT;
615 else if (ob == column_options_->radio_align_right)
616 num = LyXTabular::ALIGN_RIGHT;
617 else if (ob == column_options_->radio_align_center)
618 num = LyXTabular::ALIGN_CENTER;
619 else if (ob == column_options_->radio_valign_top)
620 num = LyXTabular::VALIGN_TOP;
621 else if (ob == column_options_->radio_valign_bottom)
622 num = LyXTabular::VALIGN_BOTTOM;
623 else if (ob == column_options_->radio_valign_center)
624 num = LyXTabular::VALIGN_CENTER;
625 else if (ob == cell_options_->radio_multicolumn)
626 num = LyXTabular::MULTICOLUMN;
627 else if (ob == tabular_options_->radio_longtable) {
628 if (fl_get_button(tabular_options_->radio_longtable))
629 num = LyXTabular::SET_LONGTABULAR;
631 num = LyXTabular::UNSET_LONGTABULAR;
632 } else if (ob == tabular_options_->radio_rotate_tabular) {
633 s = fl_get_button(tabular_options_->radio_rotate_tabular);
635 num = LyXTabular::SET_ROTATE_TABULAR;
637 num = LyXTabular::UNSET_ROTATE_TABULAR;
638 } else if (ob == cell_options_->radio_rotate_cell) {
639 s = fl_get_button(cell_options_->radio_rotate_cell);
641 num = LyXTabular::SET_ROTATE_CELL;
643 num = LyXTabular::UNSET_ROTATE_CELL;
644 } else if (ob == cell_options_->radio_useminipage) {
645 num = LyXTabular::SET_USEBOX;
647 } else if ((ob == longtable_options_->radio_lt_firsthead) ||
648 (ob == longtable_options_->check_1head_2border_above) ||
649 (ob == longtable_options_->check_1head_2border_below) ||
650 (ob == longtable_options_->check_1head_empty) ||
651 (ob == longtable_options_->radio_lt_head) ||
652 (ob == longtable_options_->check_head_2border_above) ||
653 (ob == longtable_options_->check_head_2border_below) ||
654 (ob == longtable_options_->radio_lt_foot) ||
655 (ob == longtable_options_->check_foot_2border_above) ||
656 (ob == longtable_options_->check_foot_2border_below) ||
657 (ob == longtable_options_->radio_lt_lastfoot) ||
658 (ob == longtable_options_->check_lastfoot_2border_above) ||
659 (ob == longtable_options_->check_lastfoot_2border_below) ||
660 (ob == longtable_options_->check_lastfoot_empty))
662 num = static_cast<LyXTabular::Feature>(checkLongtableOptions(ob, special));
663 } else if (ob == longtable_options_->radio_lt_newpage) {
664 num = LyXTabular::SET_LTNEWPAGE;
665 } else if (ob == column_options_->input_special_alignment) {
666 special = fl_get_input(column_options_->input_special_alignment);
667 num = LyXTabular::SET_SPECIAL_COLUMN;
668 } else if (ob == cell_options_->input_special_multialign) {
669 special = fl_get_input(cell_options_->input_special_multialign);
670 num = LyXTabular::SET_SPECIAL_MULTI;
671 } else if (ob == cell_options_->radio_border_top)
672 num = LyXTabular::M_TOGGLE_LINE_TOP;
673 else if (ob == cell_options_->radio_border_bottom)
674 num = LyXTabular::M_TOGGLE_LINE_BOTTOM;
675 else if (ob == cell_options_->radio_border_left)
676 num = LyXTabular::M_TOGGLE_LINE_LEFT;
677 else if (ob == cell_options_->radio_border_right)
678 num = LyXTabular::M_TOGGLE_LINE_RIGHT;
679 else if (ob == cell_options_->radio_align_left)
680 num = LyXTabular::M_ALIGN_LEFT;
681 else if (ob == cell_options_->radio_align_right)
682 num = LyXTabular::M_ALIGN_RIGHT;
683 else if (ob == cell_options_->radio_align_center)
684 num = LyXTabular::M_ALIGN_CENTER;
685 else if (ob == cell_options_->radio_valign_top)
686 num = LyXTabular::M_VALIGN_TOP;
687 else if (ob == cell_options_->radio_valign_bottom)
688 num = LyXTabular::M_VALIGN_BOTTOM;
689 else if (ob == cell_options_->radio_valign_center)
690 num = LyXTabular::M_VALIGN_CENTER;
694 inset_->tabularFeatures(lv_->view(), num, special);
700 int FormTabular::checkLongtableOptions(FL_OBJECT * ob, string & special)
702 bool flag = fl_get_button(ob);
703 if ((ob == longtable_options_->check_1head_2border_above) ||
704 (ob == longtable_options_->check_head_2border_above) ||
705 (ob == longtable_options_->check_foot_2border_above) ||
706 (ob == longtable_options_->check_lastfoot_2border_above))
708 special = "dl_above";
709 } else if ((ob == longtable_options_->check_1head_2border_below) ||
710 (ob == longtable_options_->check_head_2border_below) ||
711 (ob == longtable_options_->check_foot_2border_below) ||
712 (ob == longtable_options_->check_lastfoot_2border_below))
714 special = "dl_below";
715 } else if ((ob == longtable_options_->check_1head_empty) ||
716 (ob == longtable_options_->check_lastfoot_empty))
722 if ((ob == longtable_options_->radio_lt_firsthead) ||
723 (ob == longtable_options_->check_1head_2border_above) ||
724 (ob == longtable_options_->check_1head_2border_below) ||
725 (ob == longtable_options_->check_1head_empty))
727 return (flag ? LyXTabular::SET_LTFIRSTHEAD :
728 LyXTabular::UNSET_LTFIRSTHEAD);
729 } else if ((ob == longtable_options_->radio_lt_head) ||
730 (ob == longtable_options_->check_head_2border_above) ||
731 (ob == longtable_options_->check_head_2border_below))
733 return (flag ? LyXTabular::SET_LTHEAD : LyXTabular::UNSET_LTHEAD);
734 } else if ((ob == longtable_options_->radio_lt_foot) ||
735 (ob == longtable_options_->check_foot_2border_above) ||
736 (ob == longtable_options_->check_foot_2border_below))
738 return (flag ? LyXTabular::SET_LTFOOT : LyXTabular::UNSET_LTFOOT);
739 } else if ((ob == longtable_options_->radio_lt_lastfoot) ||
740 (ob == longtable_options_->check_lastfoot_2border_above) ||
741 (ob == longtable_options_->check_lastfoot_2border_below) ||
742 (ob == longtable_options_->check_lastfoot_empty))
744 return (flag ? LyXTabular::SET_LTLASTFOOT :
745 LyXTabular::UNSET_LTLASTFOOT);
747 return LyXTabular::LAST_ACTION;