3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Jürgen Spitzmüller
11 * Full author contact details are available in file CREDITS.
16 #include "GuiTabular.h"
18 #include "GuiApplication.h"
19 #include "GuiSetBorder.h"
21 #include "LengthCombo.h"
22 #include "qt_helpers.h"
23 #include "Validator.h"
26 #include "BufferView.h"
28 #include "FuncRequest.h"
29 #include "FuncStatus.h"
34 #include "insets/InsetTabular.h"
36 #include "support/convert.h"
37 #include "support/debug.h"
38 #include "support/lstrings.h"
41 #include <QPushButton>
42 #include <QRadioButton>
50 GuiTabular::GuiTabular(QWidget * parent)
51 : InsetParamsWidget(parent), firstheader_suppressable_(false),
52 lastfooter_suppressable_(false), orig_leftborder_(GuiSetBorder::LINE_UNDEF),
53 orig_rightborder_(GuiSetBorder::LINE_UNDEF), lastrow_(0)
58 tabularWidthED->setValidator(unsignedLengthValidator(tabularWidthED));
59 columnWidthED->setValidator(unsignedLengthValidator(columnWidthED));
60 multirowOffsetED->setValidator(new LengthValidator(multirowOffsetED));
61 topspaceED->setValidator(new LengthValidator(topspaceED));
62 bottomspaceED->setValidator(new LengthValidator(bottomspaceED));
63 interlinespaceED->setValidator(new LengthValidator(interlinespaceED));
65 tabularWidthUnitLC->setCurrentItem(Length::defaultUnit());
66 columnWidthUnitLC->setCurrentItem(Length::defaultUnit());
67 multirowOffsetUnitLC->setCurrentItem(Length::defaultUnit());
68 topspaceUnitLC->setCurrentItem(Length::defaultUnit());
69 bottomspaceUnitLC->setCurrentItem(Length::defaultUnit());
70 interlinespaceUnitLC->setCurrentItem(Length::defaultUnit());
72 connect(topspaceED, SIGNAL(textEdited(const QString &)),
73 this, SLOT(checkEnabled()));
74 connect(topspaceUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
75 this, SLOT(checkEnabled()));
76 connect(bottomspaceED, SIGNAL(textEdited(const QString &)),
77 this, SLOT(checkEnabled()));
78 connect(bottomspaceUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
79 this, SLOT(checkEnabled()));
80 connect(interlinespaceED, SIGNAL(textEdited(const QString &)),
81 this, SLOT(checkEnabled()));
82 connect(interlinespaceUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
83 this, SLOT(checkEnabled()));
84 connect(booktabsRB, SIGNAL(clicked(bool)),
85 this, SLOT(booktabs_toggled(bool)));
86 connect(borderDefaultRB, SIGNAL(clicked(bool)),
87 this, SLOT(nonbooktabs_toggled(bool)));
88 connect(borderSetPB, SIGNAL(clicked()),
89 this, SLOT(borderSet_clicked()));
90 connect(borderUnsetPB, SIGNAL(clicked()),
91 this, SLOT(borderUnset_clicked()));
92 connect(resetFormalCB, SIGNAL(clicked()),
93 this, SLOT(checkEnabled()));
94 connect(hAlignCO, SIGNAL(activated(int)),
95 this, SLOT(checkEnabled()));
96 connect(vAlignCO, SIGNAL(activated(int)),
97 this, SLOT(checkEnabled()));
98 connect(multicolumnCB, SIGNAL(clicked()),
99 this, SLOT(checkEnabled()));
100 connect(multirowCB, SIGNAL(clicked()),
101 this, SLOT(checkEnabled()));
102 connect(multirowOffsetED, SIGNAL(textEdited(const QString &)),
103 this, SLOT(checkEnabled()));
104 connect(multirowOffsetUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
105 this, SLOT(checkEnabled()));
106 connect(newpageCB, SIGNAL(clicked()),
107 this, SLOT(checkEnabled()));
108 connect(headerStatusCB, SIGNAL(clicked()),
109 this, SLOT(checkEnabled()));
110 connect(headerBorderAboveCB, SIGNAL(clicked()),
111 this, SLOT(checkEnabled()));
112 connect(headerBorderBelowCB, SIGNAL(clicked()),
113 this, SLOT(checkEnabled()));
114 connect(firstheaderStatusCB, SIGNAL(clicked()),
115 this, SLOT(checkEnabled()));
116 connect(firstheaderBorderAboveCB, SIGNAL(clicked()),
117 this, SLOT(checkEnabled()));
118 connect(firstheaderBorderBelowCB, SIGNAL(clicked()),
119 this, SLOT(checkEnabled()));
120 connect(firstheaderNoContentsCB, SIGNAL(clicked()),
121 this, SLOT(checkEnabled()));
122 connect(footerStatusCB, SIGNAL(clicked()),
123 this, SLOT(checkEnabled()));
124 connect(footerBorderAboveCB, SIGNAL(clicked()),
125 this, SLOT(checkEnabled()));
126 connect(footerBorderBelowCB, SIGNAL(clicked()),
127 this, SLOT(checkEnabled()));
128 connect(lastfooterStatusCB, SIGNAL(clicked()),
129 this, SLOT(checkEnabled()));
130 connect(lastfooterBorderAboveCB, SIGNAL(clicked()),
131 this, SLOT(checkEnabled()));
132 connect(lastfooterBorderBelowCB, SIGNAL(clicked()),
133 this, SLOT(checkEnabled()));
134 connect(lastfooterNoContentsCB, SIGNAL(clicked()),
135 this, SLOT(checkEnabled()));
136 connect(captionStatusCB, SIGNAL(clicked()),
137 this, SLOT(checkEnabled()));
138 connect(specialAlignmentED, SIGNAL(textEdited(const QString &)),
139 this, SLOT(checkEnabled()));
140 connect(columnWidthED, SIGNAL(textEdited(const QString &)),
141 this, SLOT(checkEnabled()));
142 connect(columnWidthUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
143 this, SLOT(checkEnabled()));
144 connect(borders, SIGNAL(topSet()),
145 this, SLOT(checkEnabled()));
146 connect(borders, SIGNAL(bottomSet()),
147 this, SLOT(checkEnabled()));
148 connect(borders, SIGNAL(rightSet()),
149 this, SLOT(checkEnabled()));
150 connect(borders, SIGNAL(leftSet()),
151 this, SLOT(checkEnabled()));
152 connect(borders, SIGNAL(topLTSet()),
153 this, SLOT(checkEnabled()));
154 connect(borders, SIGNAL(topRTSet()),
155 this, SLOT(checkEnabled()));
156 connect(borders, SIGNAL(bottomLTSet()),
157 this, SLOT(checkEnabled()));
158 connect(borders, SIGNAL(bottomRTSet()),
159 this, SLOT(checkEnabled()));
160 connect(rotateTabularCB, SIGNAL(clicked()),
161 this, SLOT(checkEnabled()));
162 connect(rotateTabularAngleSB, SIGNAL(valueChanged(int)),
163 this, SLOT(checkEnabled()));
164 connect(rotateCellCB, SIGNAL(clicked()),
165 this, SLOT(checkEnabled()));
166 connect(rotateCellAngleSB, SIGNAL(valueChanged(int)),
167 this, SLOT(checkEnabled()));
168 connect(TableAlignCO, SIGNAL(activated(int)),
169 this, SLOT(checkEnabled()));
170 connect(longTabularCB, SIGNAL(clicked()),
171 this, SLOT(checkEnabled()));
172 connect(leftRB, SIGNAL(clicked()),
173 this, SLOT(checkEnabled()));
174 connect(centerRB, SIGNAL(clicked()),
175 this, SLOT(checkEnabled()));
176 connect(rightRB, SIGNAL(clicked()),
177 this, SLOT(checkEnabled()));
178 connect(tabularWidthED, SIGNAL(textEdited(const QString &)),
179 this, SLOT(checkEnabled()));
181 decimalPointED->setValidator(new QRegExpValidator(QRegExp("\\S"), this));
182 decimalPointED->setMaxLength(1);
184 // initialize the length validator
185 addCheckedWidget(columnWidthED, columnWidthLA);
186 addCheckedWidget(multirowOffsetED, multirowOffsetLA);
187 addCheckedWidget(topspaceED, topspaceLA);
188 addCheckedWidget(bottomspaceED, bottomspaceLA);
189 addCheckedWidget(interlinespaceED, interlinespaceLA);
190 addCheckedWidget(tabularWidthED, tabularWidthLA);
194 void GuiTabular::on_topspaceCO_activated(int index)
196 bool const enable = (index == 2);
197 topspaceED->setEnabled(enable);
198 topspaceUnitLC->setEnabled(enable);
202 void GuiTabular::on_bottomspaceCO_activated(int index)
204 bool const enable = (index == 2);
205 bottomspaceED->setEnabled(enable);
206 bottomspaceUnitLC->setEnabled(enable);
210 void GuiTabular::on_interlinespaceCO_activated(int index)
212 bool const enable = (index == 2);
213 interlinespaceED->setEnabled(enable);
214 interlinespaceUnitLC->setEnabled(enable);
218 void GuiTabular::on_columnTypeCO_activated(int index)
222 columnWidthED->setFocus();
226 void GuiTabular::enableWidgets() const
228 // if there is a LaTeX argument, the width and alignment will be overwritten
229 // therefore disable them in this case
230 bool const fixed = specialAlignmentED->text().isEmpty()
231 && columnTypeCO->currentIndex() == 2;
232 columnWidthED->setEnabled(fixed);
233 columnWidthUnitLC->setEnabled(fixed);
234 // if the column has a width, multirows are always left-aligned
235 // therefore disable hAlignCB in this case
236 hAlignCO->setEnabled(!(multirowCB->isChecked()
237 && !widgetsToLength(columnWidthED, columnWidthUnitLC).empty())
238 && specialAlignmentED->text().isEmpty());
239 // decimal alignment is only possible for non-multicol and non-multirow cells
240 if ((multicolumnCB->isChecked() || multirowCB->isChecked() || columnTypeCO->currentIndex() == 1)
241 && hAlignCO->findData(toqstr("decimal")))
242 hAlignCO->removeItem(hAlignCO->findData(toqstr("decimal")));
243 else if (!multicolumnCB->isChecked() && !multirowCB->isChecked()
244 && hAlignCO->findData(toqstr("decimal")) == -1)
245 hAlignCO->addItem(qt_("At Decimal Separator"), toqstr("decimal"));
247 hAlignCO->itemData(hAlignCO->currentIndex()).toString() == QString("decimal");
248 decimalPointED->setEnabled(dalign);
249 decimalLA->setEnabled(dalign);
250 resetFormalCB->setEnabled(booktabsRB->isChecked());
252 bool const setwidth = TableAlignCO->currentText() == qt_("Middle");
253 tabularWidthLA->setEnabled(setwidth);
254 tabularWidthED->setEnabled(setwidth);
255 tabularWidthUnitLC->setEnabled(setwidth);
257 rotateTabularAngleSB->setEnabled(rotateTabularCB->isChecked()
258 && !longTabularCB->isChecked());
259 rotateCellAngleSB->setEnabled(rotateCellCB->isChecked());
261 bool const enable_valign =
262 !multirowCB->isChecked()
263 && !widgetsToLength(columnWidthED, columnWidthUnitLC).empty()
264 && specialAlignmentED->text().isEmpty();
265 vAlignCO->setEnabled(enable_valign);
266 vAlignLA->setEnabled(enable_valign);
268 topspaceED->setEnabled(topspaceCO->currentIndex() == 2);
269 topspaceED->setEnabled(topspaceCO->currentIndex() == 2);
270 topspaceUnitLC->setEnabled(topspaceCO->currentIndex() == 2);
271 bottomspaceED->setEnabled(bottomspaceCO->currentIndex() == 2);
272 bottomspaceUnitLC->setEnabled(bottomspaceCO->currentIndex() == 2);
273 interlinespaceED->setEnabled(interlinespaceCO->currentIndex() == 2);
274 interlinespaceUnitLC->setEnabled(interlinespaceCO->currentIndex() == 2);
276 // setting as longtable is not allowed when table is inside a float
277 bool const is_tabular_star = !tabularWidthED->text().isEmpty();
278 longTabularCB->setEnabled(funcEnabled(Tabular::SET_LONGTABULAR));
279 bool const longtabular = longTabularCB->isChecked();
280 longtableGB->setEnabled(true);
281 newpageCB->setEnabled(longtabular);
282 alignmentGB->setEnabled(longtabular);
283 // longtables and tabular* cannot have a vertical alignment
284 TableAlignLA->setDisabled(is_tabular_star || longtabular);
285 TableAlignCO->setDisabled(is_tabular_star || longtabular);
286 // longtable cannot be rotated with rotating package, only
287 // with [pdf]lscape, which only supports 90 deg.
288 rotateTabularAngleSB->setDisabled(longtabular);
290 // FIXME: This Dialog is really horrible, disabling/enabling a checkbox
291 // depending on the cursor position is very very unintuitive...
292 // We need some edit boxes to show which rows are header/footer/etc
293 // without having to move the cursor first.
294 headerStatusCB->setEnabled(longtabular
295 && (headerStatusCB->isChecked() ?
296 funcEnabled(Tabular::UNSET_LTHEAD) :
297 funcEnabled(Tabular::SET_LTHEAD)));
298 headerBorderAboveCB->setEnabled(longtabular
299 && headerStatusCB->isChecked());
300 headerBorderBelowCB->setEnabled(longtabular
301 && headerStatusCB->isChecked());
303 // first header can only be suppressed when there is a header
304 // firstheader_suppressable_ is set in paramsToDialog
305 firstheaderNoContentsCB->setEnabled(longtabular && firstheader_suppressable_);
306 // check if setting a first header is allowed
307 // additionally check firstheaderNoContentsCB because when this is
308 // the case a first header makes no sense
309 firstheaderStatusCB->setEnabled((firstheaderStatusCB->isChecked() ?
310 funcEnabled(Tabular::UNSET_LTFIRSTHEAD) :
311 funcEnabled(Tabular::SET_LTFIRSTHEAD))
312 && longtabular && !firstheaderNoContentsCB->isChecked());
313 firstheaderBorderAboveCB->setEnabled(longtabular
314 && firstheaderStatusCB->isChecked());
315 firstheaderBorderBelowCB->setEnabled(longtabular
316 && firstheaderStatusCB->isChecked());
318 footerStatusCB->setEnabled(longtabular
319 && (footerStatusCB->isChecked() ?
320 funcEnabled(Tabular::UNSET_LTFOOT) :
321 funcEnabled(Tabular::SET_LTFOOT)));
322 footerBorderAboveCB->setEnabled(longtabular
323 && footerBorderAboveCB->isChecked());
324 footerBorderBelowCB->setEnabled(longtabular
325 && footerBorderAboveCB->isChecked());
327 // last footer can only be suppressed when there is a footer
328 // lastfooter_suppressable_ is set in paramsToDialog
329 lastfooterNoContentsCB->setEnabled(longtabular && lastfooter_suppressable_);
330 // check if setting a last footer is allowed
331 // additionally check lastfooterNoContentsCB because when this is
332 // the case a last footer makes no sense
333 lastfooterStatusCB->setEnabled((lastfooterStatusCB->isChecked() ?
334 funcEnabled(Tabular::UNSET_LTLASTFOOT) :
335 funcEnabled(Tabular::SET_LTLASTFOOT))
336 && longtabular && !lastfooterNoContentsCB->isChecked());
337 lastfooterBorderAboveCB->setEnabled(longtabular
338 && lastfooterBorderAboveCB->isChecked());
339 lastfooterBorderBelowCB->setEnabled(longtabular
340 && lastfooterBorderAboveCB->isChecked());
342 captionStatusCB->setEnabled(funcEnabled(Tabular::TOGGLE_LTCAPTION)
345 multicolumnCB->setEnabled(funcEnabled(Tabular::MULTICOLUMN)
346 && !dalign && !multirowCB->isChecked());
347 multirowCB->setEnabled(funcEnabled(Tabular::MULTIROW)
348 && !dalign && !multicolumnCB->isChecked());
349 bool const enable_mr = multirowCB->isChecked();
350 multirowOffsetLA->setEnabled(enable_mr);
351 multirowOffsetED->setEnabled(enable_mr);
352 multirowOffsetUnitLC->setEnabled(enable_mr);
354 // Vertical lines cannot be set in formal tables
355 borders->setLeftEnabled(!booktabsRB->isChecked());
356 borders->setRightEnabled(!booktabsRB->isChecked());
357 // Trimming is only allowed in booktabs and if the line is set
358 int const row = tabularRowED->text().toInt();
359 borders->setTopLeftTrimEnabled(booktabsRB->isChecked()
360 && borders->topLineSet()
362 borders->setTopRightTrimEnabled(booktabsRB->isChecked()
363 && borders->topLineSet()
365 borders->setBottomLeftTrimEnabled(booktabsRB->isChecked()
366 && borders->bottomLineSet()
368 borders->setBottomRightTrimEnabled(booktabsRB->isChecked()
369 && borders->bottomLineSet()
374 void GuiTabular::checkEnabled()
381 void GuiTabular::borderSet_clicked()
383 borders->setTop(GuiSetBorder::LINE_SET);
384 borders->setBottom(GuiSetBorder::LINE_SET);
385 borders->setLeft(GuiSetBorder::LINE_SET);
386 borders->setRight(GuiSetBorder::LINE_SET);
387 borders->setTopLeftTrim(GuiSetBorder::LINE_SET);
388 borders->setBottomLeftTrim(GuiSetBorder::LINE_SET);
389 borders->setTopRightTrim(GuiSetBorder::LINE_SET);
390 borders->setBottomRightTrim(GuiSetBorder::LINE_SET);
391 // repaint the setborder widget
397 void GuiTabular::borderUnset_clicked()
399 borders->setTop(GuiSetBorder::LINE_UNSET);
400 borders->setBottom(GuiSetBorder::LINE_UNSET);
401 borders->setLeft(GuiSetBorder::LINE_UNSET);
402 borders->setRight(GuiSetBorder::LINE_UNSET);
403 borders->setTopLeftTrim(GuiSetBorder::LINE_UNSET);
404 borders->setBottomLeftTrim(GuiSetBorder::LINE_UNSET);
405 borders->setTopRightTrim(GuiSetBorder::LINE_UNSET);
406 borders->setBottomRightTrim(GuiSetBorder::LINE_UNSET);
407 // repaint the setborder widget
413 void GuiTabular::booktabs_toggled(bool const check)
415 // when switching from formal, restore the left/right lines
417 borders->setLeft(orig_leftborder_);
418 borders->setRight(orig_rightborder_);
420 // repaint the setborder widget
426 void GuiTabular::nonbooktabs_toggled(bool const check)
428 booktabs_toggled(!check);
432 static void setParam(string & param_str, Tabular::Feature f, string const & arg = string())
435 param_str += featureAsString(f) + ' ' + arg;
439 void GuiTabular::setHAlign(string & param_str) const
441 Tabular::Feature num = Tabular::ALIGN_LEFT;
442 Tabular::Feature multi_num = Tabular::M_ALIGN_LEFT;
444 fromqstr(hAlignCO->itemData(hAlignCO->currentIndex()).toString());
445 if (align == "left") {
446 num = Tabular::ALIGN_LEFT;
447 multi_num = Tabular::M_ALIGN_LEFT;
448 } else if (align == "center") {
449 num = Tabular::ALIGN_CENTER;
450 multi_num = Tabular::M_ALIGN_CENTER;
451 } else if (align == "right") {
452 num = Tabular::ALIGN_RIGHT;
453 multi_num = Tabular::M_ALIGN_RIGHT;
454 } else if (align == "justified") {
455 num = Tabular::ALIGN_BLOCK;
456 //multi_num: no equivalent
457 } else if (align == "decimal") {
458 num = Tabular::ALIGN_DECIMAL;
459 //multi_num: no equivalent
462 if (multicolumnCB->isChecked())
463 setParam(param_str, multi_num);
465 setParam(param_str, num);
469 void GuiTabular::setVAlign(string & param_str) const
471 int const align = vAlignCO->currentIndex();
472 enum VALIGN { TOP, MIDDLE, BOTTOM };
476 case 0: v = TOP; break;
477 case 1: v = MIDDLE; break;
478 case 2: v = BOTTOM; break;
481 Tabular::Feature num = Tabular::VALIGN_MIDDLE;
482 Tabular::Feature multi_num = Tabular::M_VALIGN_MIDDLE;
486 num = Tabular::VALIGN_TOP;
487 multi_num = Tabular::M_VALIGN_TOP;
490 num = Tabular::VALIGN_MIDDLE;
491 multi_num = Tabular::M_VALIGN_MIDDLE;
494 num = Tabular::VALIGN_BOTTOM;
495 multi_num = Tabular::M_VALIGN_BOTTOM;
498 if (multicolumnCB->isChecked() || multirowCB->isChecked())
499 setParam(param_str, multi_num);
501 setParam(param_str, num);
505 void GuiTabular::setTableAlignment(string & param_str) const
507 int const align = TableAlignCO->currentIndex();
509 case 0: setParam(param_str, Tabular::TABULAR_VALIGN_TOP);
511 case 1: setParam(param_str, Tabular::TABULAR_VALIGN_MIDDLE);
513 case 2: setParam(param_str, Tabular::TABULAR_VALIGN_BOTTOM);
519 docstring GuiTabular::dialogToParams() const
521 string param_str = "tabular";
524 string tabwidth = widgetsToLength(tabularWidthED, tabularWidthUnitLC);
525 if (tabwidth.empty())
527 setParam(param_str, Tabular::SET_TABULAR_WIDTH, tabwidth);
529 // apply the fixed width values
530 // this must be done before applying the column alignment
531 // because its value influences the alignment of multirow cells
532 string width = widgetsToLength(columnWidthED, columnWidthUnitLC);
533 if (width.empty() || columnTypeCO->currentIndex() != 2)
535 if (multicolumnCB->isChecked())
536 setParam(param_str, Tabular::SET_MPWIDTH, width);
538 setParam(param_str, Tabular::SET_PWIDTH, width);
540 bool const varwidth = specialAlignmentED->text().isEmpty()
541 && columnTypeCO->currentIndex() == 1;
543 setParam(param_str, Tabular::TOGGLE_VARWIDTH_COLUMN, "on");
545 setParam(param_str, Tabular::TOGGLE_VARWIDTH_COLUMN, "off");
547 // apply the column alignment
548 // multirows inherit the alignment from the column; if a column width
549 // is set, multirows are always left-aligned so that in this case
550 // its alignment must not be applied (see bug #8084)
551 if (!(multirowCB->isChecked() && width != "0pt"))
552 setHAlign(param_str);
554 // SET_DECIMAL_POINT must come after setHAlign() (ALIGN_DECIMAL)
555 string decimal_sep = fromqstr(decimalPointED->text());
556 if (decimal_sep.empty())
557 decimal_sep = to_utf8(decimal_sep_);
558 setParam(param_str, Tabular::SET_DECIMAL_POINT, decimal_sep);
560 setVAlign(param_str);
561 setTableAlignment(param_str);
563 if (booktabsRB->isChecked())
564 setParam(param_str, Tabular::SET_BOOKTABS);
566 setParam(param_str, Tabular::UNSET_BOOKTABS);
569 switch (topspaceCO->currentIndex()) {
571 setParam(param_str, Tabular::SET_TOP_SPACE, "none");
574 setParam(param_str, Tabular::SET_TOP_SPACE, "default");
577 if (!topspaceED->text().isEmpty())
578 setParam(param_str, Tabular::SET_TOP_SPACE,
579 widgetsToLength(topspaceED, topspaceUnitLC));
584 switch (bottomspaceCO->currentIndex()) {
586 setParam(param_str, Tabular::SET_BOTTOM_SPACE, "none");
589 setParam(param_str, Tabular::SET_BOTTOM_SPACE, "default");
592 if (!bottomspaceED->text().isEmpty())
593 setParam(param_str, Tabular::SET_BOTTOM_SPACE,
594 widgetsToLength(bottomspaceED,
600 switch (interlinespaceCO->currentIndex()) {
602 setParam(param_str, Tabular::SET_INTERLINE_SPACE, "none");
605 setParam(param_str, Tabular::SET_INTERLINE_SPACE, "default");
608 if (!interlinespaceED->text().isEmpty())
609 setParam(param_str, Tabular::SET_INTERLINE_SPACE,
610 widgetsToLength(interlinespaceED,
611 interlinespaceUnitLC));
616 if (resetFormalCB->isChecked())
617 setParam(param_str, Tabular::RESET_FORMAL_DEFAULT);
618 else if (borders->topLineSet() && borders->bottomLineSet() && borders->leftLineSet()
619 && borders->rightLineSet())
620 setParam(param_str, Tabular::SET_ALL_LINES);
621 else if (borders->topLineUnset() && borders->bottomLineUnset() && borders->leftLineUnset()
622 && borders->rightLineUnset())
623 setParam(param_str, Tabular::UNSET_ALL_LINES);
625 if (borders->getLeft() != GuiSetBorder::LINE_UNDECIDED)
626 setParam(param_str, Tabular::SET_LINE_LEFT,
627 borders->leftLineSet() ? "true" : "false");
628 if (borders->getRight() != GuiSetBorder::LINE_UNDECIDED)
629 setParam(param_str, Tabular::SET_LINE_RIGHT,
630 borders->rightLineSet() ? "true" : "false");
631 if (borders->getTop() != GuiSetBorder::LINE_UNDECIDED)
632 setParam(param_str, Tabular::SET_LINE_TOP,
633 borders->topLineSet() ? "true" : "false");
634 if (borders->getBottom() != GuiSetBorder::LINE_UNDECIDED)
635 setParam(param_str, Tabular::SET_LINE_BOTTOM,
636 borders->bottomLineSet() ? "true" : "false");
638 if (borders->topLineLTSet())
639 setParam(param_str, Tabular::SET_LTRIM_TOP, "false");
640 else if (borders->topLineLTUnset())
641 setParam(param_str, Tabular::SET_LTRIM_TOP, "true");
642 if (borders->topLineRTSet())
643 setParam(param_str, Tabular::SET_RTRIM_TOP, "false");
644 else if (borders->topLineRTUnset())
645 setParam(param_str, Tabular::SET_RTRIM_TOP, "true");
646 if (borders->bottomLineLTSet())
647 setParam(param_str, Tabular::SET_LTRIM_BOTTOM, "false");
648 else if (borders->bottomLineLTUnset())
649 setParam(param_str, Tabular::SET_LTRIM_BOTTOM, "true");
650 if (borders->bottomLineRTSet())
651 setParam(param_str, Tabular::SET_RTRIM_BOTTOM, "false");
652 else if (borders->bottomLineRTUnset())
653 setParam(param_str, Tabular::SET_RTRIM_BOTTOM, "true");
655 // apply the special alignment
656 string special = fromqstr(specialAlignmentED->text());
657 if (support::trim(special).empty())
659 if (multicolumnCB->isChecked())
660 setParam(param_str, Tabular::SET_SPECIAL_MULTICOLUMN, special);
662 setParam(param_str, Tabular::SET_SPECIAL_COLUMN, special);
665 if (multicolumnCB->isChecked())
666 setParam(param_str, Tabular::SET_MULTICOLUMN);
668 setParam(param_str, Tabular::UNSET_MULTICOLUMN);
670 // apply the multirow offset
671 string mroffset = widgetsToLength(multirowOffsetED, multirowOffsetUnitLC);
672 if (mroffset.empty())
674 if (multirowCB->isChecked())
675 setParam(param_str, Tabular::SET_MROFFSET, mroffset);
677 if (multirowCB->isChecked())
678 setParam(param_str, Tabular::SET_MULTIROW);
680 setParam(param_str, Tabular::UNSET_MULTIROW);
681 // store the table rotation angle
682 string const tabular_angle = convert<string>(rotateTabularAngleSB->value());
683 if (rotateTabularCB->isChecked())
684 setParam(param_str, Tabular::SET_ROTATE_TABULAR, tabular_angle);
686 setParam(param_str, Tabular::UNSET_ROTATE_TABULAR, tabular_angle);
687 // store the cell rotation angle
688 string const cell_angle = convert<string>(rotateCellAngleSB->value());
689 if (rotateCellCB->isChecked())
690 setParam(param_str, Tabular::SET_ROTATE_CELL, cell_angle);
692 setParam(param_str, Tabular::UNSET_ROTATE_CELL, cell_angle);
694 if (longTabularCB->isChecked())
695 setParam(param_str, Tabular::SET_LONGTABULAR);
697 setParam(param_str, Tabular::UNSET_LONGTABULAR);
699 if (newpageCB->isChecked())
700 setParam(param_str, Tabular::SET_LTNEWPAGE);
702 setParam(param_str, Tabular::UNSET_LTNEWPAGE);
704 if (captionStatusCB->isChecked())
705 setParam(param_str, Tabular::SET_LTCAPTION);
707 setParam(param_str, Tabular::UNSET_LTCAPTION);
709 if (headerStatusCB->isChecked())
710 setParam(param_str, Tabular::SET_LTHEAD, "none");
712 setParam(param_str, Tabular::UNSET_LTHEAD, "none");
714 if (headerBorderAboveCB->isChecked())
715 setParam(param_str, Tabular::SET_LTHEAD, "dl_above");
717 setParam(param_str, Tabular::UNSET_LTHEAD, "dl_above");
719 if (headerBorderBelowCB->isChecked())
720 setParam(param_str, Tabular::SET_LTHEAD, "dl_below");
722 setParam(param_str, Tabular::UNSET_LTHEAD, "dl_below");
723 if (firstheaderBorderAboveCB->isChecked())
724 setParam(param_str, Tabular::SET_LTFIRSTHEAD, "dl_above");
726 setParam(param_str, Tabular::UNSET_LTFIRSTHEAD, "dl_above");
727 if (firstheaderBorderBelowCB->isChecked())
728 setParam(param_str, Tabular::SET_LTFIRSTHEAD, "dl_below");
730 setParam(param_str, Tabular::UNSET_LTFIRSTHEAD, "dl_below");
731 if (firstheaderStatusCB->isChecked())
732 setParam(param_str, Tabular::SET_LTFIRSTHEAD, "none");
734 setParam(param_str, Tabular::UNSET_LTFIRSTHEAD, "none");
735 if (firstheaderNoContentsCB->isChecked())
736 setParam(param_str, Tabular::SET_LTFIRSTHEAD, "empty");
738 setParam(param_str, Tabular::UNSET_LTFIRSTHEAD, "empty");
739 if (footerStatusCB->isChecked())
740 setParam(param_str, Tabular::SET_LTFOOT, "none");
742 setParam(param_str, Tabular::UNSET_LTFOOT, "none");
743 if (footerBorderAboveCB->isChecked())
744 setParam(param_str, Tabular::SET_LTFOOT, "dl_above");
746 setParam(param_str, Tabular::UNSET_LTFOOT, "dl_above");
747 if (footerBorderBelowCB->isChecked())
748 setParam(param_str, Tabular::SET_LTFOOT, "dl_below");
750 setParam(param_str, Tabular::UNSET_LTFOOT, "dl_below");
751 if (lastfooterStatusCB->isChecked())
752 setParam(param_str, Tabular::SET_LTLASTFOOT, "none");
754 setParam(param_str, Tabular::UNSET_LTLASTFOOT, "none");
755 if (lastfooterBorderAboveCB->isChecked())
756 setParam(param_str, Tabular::SET_LTLASTFOOT, "dl_above");
758 setParam(param_str, Tabular::UNSET_LTLASTFOOT, "dl_above");
759 if (lastfooterBorderBelowCB->isChecked())
760 setParam(param_str, Tabular::SET_LTLASTFOOT, "dl_below");
762 setParam(param_str, Tabular::UNSET_LTLASTFOOT, "dl_below");
763 if (lastfooterNoContentsCB->isChecked())
764 setParam(param_str, Tabular::SET_LTLASTFOOT, "empty");
766 setParam(param_str, Tabular::UNSET_LTLASTFOOT, "empty");
768 if (leftRB->isChecked())
769 setParam(param_str, Tabular::LONGTABULAR_ALIGN_LEFT);
770 else if (centerRB->isChecked())
771 setParam(param_str, Tabular::LONGTABULAR_ALIGN_CENTER);
772 else if (rightRB->isChecked())
773 setParam(param_str, Tabular::LONGTABULAR_ALIGN_RIGHT);
775 return from_utf8(param_str);
779 static Length getColumnPWidth(Tabular const & t, size_t cell)
781 return t.column_info[t.cellColumn(cell)].p_width;
785 static Length getMColumnPWidth(Tabular const & t, size_t cell)
787 if (t.isMultiColumn(cell) || t.isMultiRow(cell))
788 return t.cellInfo(cell).p_width;
793 static Length getMROffset(Tabular const & t, size_t cell)
795 if (t.isMultiRow(cell))
796 return t.cellInfo(cell).mroffset;
801 static docstring getAlignSpecial(Tabular const & t, size_t cell, int what)
803 if (what == Tabular::SET_SPECIAL_MULTICOLUMN)
804 return t.cellInfo(cell).align_special;
805 return t.column_info[t.cellColumn(cell)].align_special;
809 GuiSetBorder::BorderState GuiTabular::borderState(GuiSetBorder::BorderState bs,
812 if (bs == GuiSetBorder::LINE_UNDEF)
813 bs = line ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
814 else if ((bs == GuiSetBorder::LINE_SET && !line)
815 || (bs == GuiSetBorder::LINE_UNSET && line))
816 bs = GuiSetBorder::LINE_UNDECIDED;
821 void GuiTabular::paramsToDialog(Inset const * inset)
823 InsetTabular const * itab = static_cast<InsetTabular const *>(inset);
824 // Copy Tabular of current inset.
825 Tabular const & tabular = itab->tabular;
827 BufferView const * bv = guiApp->currentView()->currentBufferView();
828 size_t const cell = bv->cursor().idx();
830 Tabular::row_type const row = tabular.cellRow(cell);
831 Tabular::col_type const col = tabular.cellColumn(cell);
833 tabularRowED->setText(QString::number(row + 1));
834 tabularColumnED->setText(QString::number(col + 1));
835 lastrow_ = int(tabular.nrows());
837 bool const multicol = tabular.isMultiColumn(cell);
838 multicolumnCB->setChecked(multicol);
840 bool const multirow = tabular.isMultiRow(cell);
841 multirowCB->setChecked(multirow);
843 rotateCellCB->setChecked(tabular.getRotateCell(cell) != 0);
844 if (rotateCellCB->isChecked()) {
845 if (tabular.getRotateCell(cell) != 0)
846 rotateCellAngleSB->setValue(tabular.getRotateCell(cell));
848 rotateCellAngleSB->setValue(90);
851 longTabularCB->setChecked(tabular.is_long_tabular);
853 rotateTabularCB->setChecked(tabular.rotate != 0);
854 if (rotateTabularCB->isChecked()) {
855 if (longTabularCB->isChecked())
856 rotateTabularAngleSB->setValue(90);
858 rotateTabularAngleSB->setValue(tabular.rotate != 0 ? tabular.rotate : 90);
861 // In what follows, we check the borders of all selected cells,
862 // and if there are diverging settings, we use the LINE_UNDECIDED
864 GuiSetBorder::BorderState ltop = GuiSetBorder::LINE_UNDEF;
865 GuiSetBorder::BorderState lbottom = GuiSetBorder::LINE_UNDEF;
866 GuiSetBorder::BorderState lleft = GuiSetBorder::LINE_UNDEF;
867 GuiSetBorder::BorderState lright = GuiSetBorder::LINE_UNDEF;
868 GuiSetBorder::BorderState ltop_ltrim = GuiSetBorder::LINE_UNDEF;
869 GuiSetBorder::BorderState ltop_rtrim = GuiSetBorder::LINE_UNDEF;
870 GuiSetBorder::BorderState lbottom_ltrim = GuiSetBorder::LINE_UNDEF;
871 GuiSetBorder::BorderState lbottom_rtrim = GuiSetBorder::LINE_UNDEF;
872 CursorSlice const & beg = bv->cursor().selBegin();
873 CursorSlice const & end = bv->cursor().selEnd();
875 Tabular::col_type cs = tabular.cellColumn(beg.idx());
876 Tabular::col_type ce = tabular.cellColumn(end.idx());
879 Tabular::row_type rs = tabular.cellRow(beg.idx());
880 Tabular::row_type re = tabular.cellRow(end.idx());
883 for (Tabular::row_type r = rs; r <= re; ++r)
884 for (Tabular::col_type c = cs; c <= ce; ++c) {
885 idx_type const cc = tabular.cellIndex(r, c);
886 ltop = borderState(ltop, tabular.topLine(cc));
887 lbottom = borderState(lbottom, tabular.bottomLine(cc));
888 lleft = borderState(lleft, tabular.leftLine(cc));
889 lright = borderState(lright, tabular.rightLine(cc));
890 ltop_ltrim = borderState(ltop_ltrim, !tabular.topLineTrim(cc).first);
891 ltop_rtrim = borderState(ltop_rtrim, !tabular.topLineTrim(cc).second);
892 lbottom_ltrim = borderState(lbottom_ltrim, !tabular.bottomLineTrim(cc).first);
893 lbottom_rtrim = borderState(lbottom_rtrim, !tabular.bottomLineTrim(cc).second);
894 // store left/right borders for the case of formal/nonformal switch
895 orig_leftborder_ = borderState(lleft, tabular.leftLine(cc, true));
896 orig_rightborder_ = borderState(lright, tabular.rightLine(cc, true));
899 ltop = tabular.topLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
900 lbottom = tabular.bottomLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
901 lleft = tabular.leftLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
902 lright = tabular.rightLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
903 ltop_ltrim = tabular.topLineTrim(cell).first ? GuiSetBorder::LINE_UNSET : GuiSetBorder::LINE_SET;
904 ltop_rtrim = tabular.topLineTrim(cell).second ? GuiSetBorder::LINE_UNSET : GuiSetBorder::LINE_SET;
905 lbottom_ltrim = tabular.bottomLineTrim(cell).first ? GuiSetBorder::LINE_UNSET : GuiSetBorder::LINE_SET;
906 lbottom_rtrim = tabular.bottomLineTrim(cell).second ? GuiSetBorder::LINE_UNSET : GuiSetBorder::LINE_SET;
907 // store left/right borders for the case of formal/nonformal switch
908 orig_leftborder_ = tabular.leftLine(cell, true) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
909 orig_rightborder_ = tabular.rightLine(cell, true) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
911 borders->setTop(ltop);
912 borders->setBottom(lbottom);
913 borders->setLeft(lleft);
914 borders->setRight(lright);
915 borders->setTopLeftTrim(ltop_ltrim);
916 borders->setTopRightTrim(ltop_rtrim);
917 borders->setBottomLeftTrim(lbottom_ltrim);
918 borders->setBottomRightTrim(lbottom_rtrim);
919 // repaint the setborder widget
922 Length::UNIT const default_unit = Length::defaultUnit();
924 ///////////////////////////////////
925 // Set width and alignment
927 Length const tabwidth = tabular.tabularWidth();
929 && !(tabularWidthED->hasFocus() && tabularWidthED->text() == "0"))
930 tabularWidthED->clear();
932 lengthToWidgets(tabularWidthED, tabularWidthUnitLC,
933 tabwidth.asString(), default_unit);
938 special = getAlignSpecial(tabular, cell,
939 Tabular::SET_SPECIAL_MULTICOLUMN);
940 pwidth = getMColumnPWidth(tabular, cell);
942 special = getAlignSpecial(tabular, cell,
943 Tabular::SET_SPECIAL_COLUMN);
944 pwidth = getColumnPWidth(tabular, cell);
946 bool const varwidth = tabular.column_info[tabular.cellColumn(cell)].varwidth;
948 columnTypeCO->setCurrentIndex(1);
951 && !(columnWidthED->hasFocus() && columnWidthED->text() == "0")) {
952 columnWidthED->clear();
954 columnTypeCO->setCurrentIndex(0);
956 colwidth = pwidth.asString();
957 lengthToWidgets(columnWidthED, columnWidthUnitLC,
958 colwidth, default_unit);
959 columnTypeCO->setCurrentIndex(2);
963 mroffset = getMROffset(tabular, cell);
966 && !(multirowOffsetED->hasFocus() && multirowOffsetED->text() == "0"))
967 multirowOffsetED->clear();
969 offset = mroffset.asString();
970 lengthToWidgets(multirowOffsetED, multirowOffsetUnitLC,
971 offset, default_unit);
973 specialAlignmentED->setText(toqstr(special));
974 ///////////////////////////////////
977 borderDefaultRB->setChecked(!tabular.use_booktabs);
978 booktabsRB->setChecked(tabular.use_booktabs);
980 if (tabular.row_info[row].top_space.empty()
981 && !tabular.row_info[row].top_space_default) {
982 topspaceCO->setCurrentIndex(0);
983 } else if (tabular.row_info[row].top_space_default) {
984 topspaceCO->setCurrentIndex(1);
986 topspaceCO->setCurrentIndex(2);
987 lengthToWidgets(topspaceED,
989 tabular.row_info[row].top_space.asString(),
993 if (tabular.row_info[row].bottom_space.empty()
994 && !tabular.row_info[row].bottom_space_default) {
995 bottomspaceCO->setCurrentIndex(0);
996 } else if (tabular.row_info[row].bottom_space_default) {
997 bottomspaceCO->setCurrentIndex(1);
999 bottomspaceCO->setCurrentIndex(2);
1000 lengthToWidgets(bottomspaceED,
1002 tabular.row_info[row].bottom_space.asString(),
1006 if (tabular.row_info[row].interline_space.empty()
1007 && !tabular.row_info[row].interline_space_default) {
1008 interlinespaceCO->setCurrentIndex(0);
1009 } else if (tabular.row_info[row].interline_space_default) {
1010 interlinespaceCO->setCurrentIndex(1);
1012 interlinespaceCO->setCurrentIndex(2);
1013 lengthToWidgets(interlinespaceED,
1014 interlinespaceUnitLC,
1015 tabular.row_info[row].interline_space.asString(),
1020 hAlignCO->addItem(qt_("Left"), toqstr("left"));
1021 hAlignCO->addItem(qt_("Center"), toqstr("center"));
1022 hAlignCO->addItem(qt_("Right"), toqstr("right"));
1023 if (!multicol && !pwidth.zero())
1024 hAlignCO->addItem(qt_("Justified"), toqstr("justified"));
1025 if (!multicol && !multirow)
1026 hAlignCO->addItem(qt_("At Decimal Separator"), toqstr("decimal"));
1029 switch (tabular.getAlignment(cell)) {
1030 case LYX_ALIGN_LEFT:
1033 case LYX_ALIGN_CENTER:
1036 case LYX_ALIGN_RIGHT:
1039 case LYX_ALIGN_BLOCK:
1041 if (!multicol && !pwidth.zero())
1042 align = "justified";
1045 case LYX_ALIGN_DECIMAL:
1047 if (!multicol && !multirow)
1052 // we should never end up here
1055 hAlignCO->setCurrentIndex(hAlignCO->findData(toqstr(align)));
1058 decimal_sep_ = tabular.column_info[col].decimal_point;
1059 if (decimal_sep_.empty()) {
1060 Language const * lang = itab->buffer().paragraphs().front().getParLanguage(itab->buffer().params());
1061 decimal_sep_ = lang->decimalSeparator();
1063 decimalPointED->setText(toqstr(decimal_sep_));
1066 switch (tabular.getVAlignment(cell)) {
1067 case Tabular::LYX_VALIGN_TOP:
1070 case Tabular::LYX_VALIGN_MIDDLE:
1073 case Tabular::LYX_VALIGN_BOTTOM:
1082 vAlignCO->setCurrentIndex(valign);
1084 int tableValign = 1;
1085 switch (tabular.tabular_valignment) {
1086 case Tabular::LYX_VALIGN_TOP:
1089 case Tabular::LYX_VALIGN_MIDDLE:
1092 case Tabular::LYX_VALIGN_BOTTOM:
1099 TableAlignCO->setCurrentIndex(tableValign);
1101 if (!tabular.is_long_tabular) {
1102 headerStatusCB->setChecked(false);
1103 headerBorderAboveCB->setChecked(false);
1104 headerBorderBelowCB->setChecked(false);
1105 firstheaderStatusCB->setChecked(false);
1106 firstheaderBorderAboveCB->setChecked(false);
1107 firstheaderBorderBelowCB->setChecked(false);
1108 firstheaderNoContentsCB->setChecked(false);
1109 footerStatusCB->setChecked(false);
1110 footerBorderAboveCB->setChecked(false);
1111 footerBorderBelowCB->setChecked(false);
1112 lastfooterStatusCB->setChecked(false);
1113 lastfooterBorderAboveCB->setChecked(false);
1114 lastfooterBorderBelowCB->setChecked(false);
1115 lastfooterNoContentsCB->setChecked(false);
1116 newpageCB->setChecked(false);
1117 captionStatusCB->blockSignals(true);
1118 captionStatusCB->setChecked(false);
1119 captionStatusCB->blockSignals(false);
1123 // longtables cannot have a vertical alignment
1124 TableAlignCO->setCurrentIndex(Tabular::LYX_VALIGN_MIDDLE);
1126 switch (tabular.longtabular_alignment) {
1127 case Tabular::LYX_LONGTABULAR_ALIGN_LEFT:
1128 leftRB->setChecked(true);
1130 case Tabular::LYX_LONGTABULAR_ALIGN_CENTER:
1131 centerRB->setChecked(true);
1133 case Tabular::LYX_LONGTABULAR_ALIGN_RIGHT:
1134 rightRB->setChecked(true);
1137 centerRB->setChecked(true);
1140 captionStatusCB->blockSignals(true);
1141 captionStatusCB->setChecked(tabular.ltCaption(row));
1142 captionStatusCB->blockSignals(false);
1144 Tabular::ltType ltt;
1146 bool row_set = tabular.getRowOfLTHead(row, ltt);
1147 headerStatusCB->setChecked(row_set);
1149 headerBorderAboveCB->setChecked(ltt.topDL);
1150 headerBorderBelowCB->setChecked(ltt.bottomDL);
1153 headerBorderAboveCB->setChecked(false);
1154 headerBorderBelowCB->setChecked(false);
1155 firstheaderNoContentsCB->setChecked(false);
1159 row_set = tabular.getRowOfLTFirstHead(row, ltt);
1160 firstheaderStatusCB->setChecked(row_set);
1161 if (ltt.set && (!ltt.empty || !use_empty)) {
1162 firstheaderBorderAboveCB->setChecked(ltt.topDL);
1163 firstheaderBorderBelowCB->setChecked(ltt.bottomDL);
1165 firstheaderBorderAboveCB->setChecked(false);
1166 firstheaderBorderBelowCB->setChecked(false);
1169 row_set = tabular.getRowOfLTFoot(row, ltt);
1170 footerStatusCB->setChecked(row_set);
1172 footerBorderAboveCB->setChecked(ltt.topDL);
1173 footerBorderBelowCB->setChecked(ltt.bottomDL);
1176 footerBorderAboveCB->setChecked(false);
1177 footerBorderBelowCB->setChecked(false);
1178 lastfooterNoContentsCB->setChecked(false);
1182 row_set = tabular.getRowOfLTLastFoot(row, ltt);
1183 lastfooterStatusCB->setChecked(row_set);
1184 if (ltt.set && (!ltt.empty || !use_empty)) {
1185 lastfooterBorderAboveCB->setChecked(ltt.topDL);
1186 lastfooterBorderBelowCB->setChecked(ltt.bottomDL);
1188 lastfooterBorderAboveCB->setChecked(false);
1189 lastfooterBorderBelowCB->setChecked(false);
1191 newpageCB->setChecked(tabular.getLTNewPage(row));
1193 // first header can only be suppressed when there is a header
1194 firstheader_suppressable_ = tabular.haveLTHead()
1195 && !tabular.haveLTFirstHead();
1196 // last footer can only be suppressed when there is a footer
1197 lastfooter_suppressable_ = tabular.haveLTFoot()
1198 && !tabular.haveLTLastFoot();
1200 // after setting the features, check if they are enabled
1205 bool GuiTabular::checkWidgets(bool readonly) const
1207 tabularRowED->setReadOnly(readonly);
1208 tabularColumnED->setReadOnly(readonly);
1209 tabularWidthED->setReadOnly(readonly);
1210 specialAlignmentED->setReadOnly(readonly);
1211 columnWidthED->setReadOnly(readonly);
1212 multirowOffsetED->setReadOnly(readonly);
1213 decimalPointED->setReadOnly(readonly);
1216 multicolumnCB->setEnabled(false);
1217 multirowCB->setEnabled(false);
1218 rotateCellCB->setEnabled(false);
1219 rotateCellAngleSB->setEnabled(false);
1220 rotateTabularCB->setEnabled(false);
1221 rotateTabularAngleSB->setEnabled(false);
1222 longTabularCB->setEnabled(false);
1223 borders->setEnabled(false);
1224 tabularWidthUnitLC->setEnabled(false);
1225 columnWidthUnitLC->setEnabled(false);
1226 columnTypeCO->setEnabled(false);
1227 multirowOffsetUnitLC->setEnabled(false);
1228 setBordersGB->setEnabled(false);
1229 allBordersGB->setEnabled(false);
1230 borderStyleGB->setEnabled(false);
1231 booktabsRB->setEnabled(false);
1232 topspaceCO->setEnabled(false);
1233 topspaceUnitLC->setEnabled(false);
1234 bottomspaceCO->setEnabled(false);
1235 bottomspaceUnitLC->setEnabled(false);
1236 interlinespaceCO->setEnabled(false);
1237 interlinespaceUnitLC->setEnabled(false);
1238 hAlignCO->setEnabled(false);
1239 vAlignCO->setEnabled(false);
1240 TableAlignCO->setEnabled(false);
1241 longtableGB->setEnabled(false);
1242 alignmentGB->setEnabled(false);
1246 return InsetParamsWidget::checkWidgets();
1250 bool GuiTabular::funcEnabled(Tabular::Feature f) const
1252 FuncRequest r(LFUN_INSET_MODIFY, "tabular for-dialog" + featureAsString(f));
1253 return getStatus(r).enabled();
1257 } // namespace frontend
1260 #include "moc_GuiTabular.cpp"