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 "support/convert.h"
35 #include "support/debug.h"
36 #include "support/lstrings.h"
39 #include <QPushButton>
40 #include <QRadioButton>
48 GuiTabular::GuiTabular(QWidget * parent)
49 : InsetParamsWidget(parent), firstheader_suppressable_(false),
50 lastfooter_suppressable_(false), orig_leftborder_(GuiSetBorder::LINE_UNDEF),
51 orig_rightborder_(GuiSetBorder::LINE_UNDEF), lastrow_(0)
56 tabularWidthED->setValidator(unsignedLengthValidator(tabularWidthED));
57 columnWidthED->setValidator(unsignedLengthValidator(columnWidthED));
58 multirowOffsetED->setValidator(new LengthValidator(multirowOffsetED));
59 topspaceED->setValidator(new LengthValidator(topspaceED));
60 bottomspaceED->setValidator(new LengthValidator(bottomspaceED));
61 interlinespaceED->setValidator(new LengthValidator(interlinespaceED));
63 tabularWidthUnitLC->setCurrentItem(Length::defaultUnit());
64 columnWidthUnitLC->setCurrentItem(Length::defaultUnit());
65 multirowOffsetUnitLC->setCurrentItem(Length::defaultUnit());
66 topspaceUnitLC->setCurrentItem(Length::defaultUnit());
67 bottomspaceUnitLC->setCurrentItem(Length::defaultUnit());
68 interlinespaceUnitLC->setCurrentItem(Length::defaultUnit());
70 connect(topspaceED, SIGNAL(textEdited(const QString &)),
71 this, SLOT(checkEnabled()));
72 connect(topspaceUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
73 this, SLOT(checkEnabled()));
74 connect(bottomspaceED, SIGNAL(textEdited(const QString &)),
75 this, SLOT(checkEnabled()));
76 connect(bottomspaceUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
77 this, SLOT(checkEnabled()));
78 connect(interlinespaceED, SIGNAL(textEdited(const QString &)),
79 this, SLOT(checkEnabled()));
80 connect(interlinespaceUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
81 this, SLOT(checkEnabled()));
82 connect(booktabsRB, SIGNAL(clicked(bool)),
83 this, SLOT(booktabs_toggled(bool)));
84 connect(borderDefaultRB, SIGNAL(clicked(bool)),
85 this, SLOT(nonbooktabs_toggled(bool)));
86 connect(borderSetPB, SIGNAL(clicked()),
87 this, SLOT(borderSet_clicked()));
88 connect(borderUnsetPB, SIGNAL(clicked()),
89 this, SLOT(borderUnset_clicked()));
90 connect(resetFormalCB, SIGNAL(clicked()),
91 this, SLOT(checkEnabled()));
92 connect(hAlignCO, SIGNAL(activated(int)),
93 this, SLOT(checkEnabled()));
94 connect(decimalPointED, SIGNAL(textEdited(const QString &)),
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 QRegularExpressionValidator(QRegularExpression("\\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 addParam(set<string> & params, Tabular::Feature f,
433 string const & arg = string())
436 params.insert(featureAsString(f));
438 params.insert(featureAsString(f) + ' ' + arg);
442 void GuiTabular::setHAlign(set<string> & params) const
444 Tabular::Feature num = Tabular::ALIGN_LEFT;
445 Tabular::Feature multi_num = Tabular::M_ALIGN_LEFT;
447 fromqstr(hAlignCO->itemData(hAlignCO->currentIndex()).toString());
448 if (align == "left") {
449 num = Tabular::ALIGN_LEFT;
450 multi_num = Tabular::M_ALIGN_LEFT;
451 } else if (align == "center") {
452 num = Tabular::ALIGN_CENTER;
453 multi_num = Tabular::M_ALIGN_CENTER;
454 } else if (align == "right") {
455 num = Tabular::ALIGN_RIGHT;
456 multi_num = Tabular::M_ALIGN_RIGHT;
457 } else if (align == "justified") {
458 num = Tabular::ALIGN_BLOCK;
459 //multi_num: no equivalent
460 } else if (align == "decimal") {
461 num = Tabular::ALIGN_DECIMAL;
462 //multi_num: no equivalent
465 if (multicolumnCB->isChecked())
466 addParam(params, multi_num);
468 addParam(params, num);
472 void GuiTabular::setVAlign(set<string> & params) const
474 int const align = vAlignCO->currentIndex();
475 enum VALIGN { TOP, MIDDLE, BOTTOM };
479 case 0: v = TOP; break;
480 case 1: v = MIDDLE; break;
481 case 2: v = BOTTOM; break;
484 Tabular::Feature num = Tabular::VALIGN_MIDDLE;
485 Tabular::Feature multi_num = Tabular::M_VALIGN_MIDDLE;
489 num = Tabular::VALIGN_TOP;
490 multi_num = Tabular::M_VALIGN_TOP;
493 num = Tabular::VALIGN_MIDDLE;
494 multi_num = Tabular::M_VALIGN_MIDDLE;
497 num = Tabular::VALIGN_BOTTOM;
498 multi_num = Tabular::M_VALIGN_BOTTOM;
501 if (multicolumnCB->isChecked() || multirowCB->isChecked())
502 addParam(params, multi_num);
504 addParam(params, num);
508 void GuiTabular::setTableAlignment(set<string> & params) const
510 int const align = TableAlignCO->currentIndex();
512 case 0: addParam(params, Tabular::TABULAR_VALIGN_TOP);
514 case 1: addParam(params, Tabular::TABULAR_VALIGN_MIDDLE);
516 case 2: addParam(params, Tabular::TABULAR_VALIGN_BOTTOM);
522 set<string> const GuiTabular::getTabFeatures() const
526 string tabwidth = widgetsToLength(tabularWidthED, tabularWidthUnitLC);
527 if (tabwidth.empty())
529 addParam(res, Tabular::SET_TABULAR_WIDTH, tabwidth);
531 // apply the fixed width values
532 // this must be done before applying the column alignment
533 // because its value influences the alignment of multirow cells
534 string width = widgetsToLength(columnWidthED, columnWidthUnitLC);
535 if (width.empty() || columnTypeCO->currentIndex() != 2)
537 if (multicolumnCB->isChecked())
538 addParam(res, Tabular::SET_MPWIDTH, width);
540 addParam(res, Tabular::SET_PWIDTH, width);
542 bool const varwidth = specialAlignmentED->text().isEmpty()
543 && columnTypeCO->currentIndex() == 1;
545 addParam(res, Tabular::TOGGLE_VARWIDTH_COLUMN, "on");
547 addParam(res, Tabular::TOGGLE_VARWIDTH_COLUMN, "off");
549 // apply the column alignment
550 // multirows inherit the alignment from the column; if a column width
551 // is set, multirows are always left-aligned so that in this case
552 // its alignment must not be applied (see bug #8084)
553 if (!(multirowCB->isChecked() && width != "0pt"))
556 // SET_DECIMAL_POINT must come after setHAlign() (ALIGN_DECIMAL)
557 string decimal_sep = fromqstr(decimalPointED->text());
558 if (decimal_sep.empty())
559 decimal_sep = to_utf8(decimal_sep_);
560 addParam(res, Tabular::SET_DECIMAL_POINT, decimal_sep);
563 setTableAlignment(res);
565 if (booktabsRB->isChecked())
566 addParam(res, Tabular::SET_BOOKTABS);
568 addParam(res, Tabular::UNSET_BOOKTABS);
571 switch (topspaceCO->currentIndex()) {
573 addParam(res, Tabular::SET_TOP_SPACE, "none");
576 addParam(res, Tabular::SET_TOP_SPACE, "default");
579 if (!topspaceED->text().isEmpty())
580 addParam(res, Tabular::SET_TOP_SPACE,
581 widgetsToLength(topspaceED, topspaceUnitLC));
586 switch (bottomspaceCO->currentIndex()) {
588 addParam(res, Tabular::SET_BOTTOM_SPACE, "none");
591 addParam(res, Tabular::SET_BOTTOM_SPACE, "default");
594 if (!bottomspaceED->text().isEmpty())
595 addParam(res, Tabular::SET_BOTTOM_SPACE,
596 widgetsToLength(bottomspaceED,
602 switch (interlinespaceCO->currentIndex()) {
604 addParam(res, Tabular::SET_INTERLINE_SPACE, "none");
607 addParam(res, Tabular::SET_INTERLINE_SPACE, "default");
610 if (!interlinespaceED->text().isEmpty())
611 addParam(res, Tabular::SET_INTERLINE_SPACE,
612 widgetsToLength(interlinespaceED,
613 interlinespaceUnitLC));
618 if (resetFormalCB->isChecked())
619 addParam(res, Tabular::RESET_FORMAL_DEFAULT);
620 else if (borders->topLineSet() && borders->bottomLineSet() && borders->leftLineSet()
621 && borders->rightLineSet())
622 addParam(res, Tabular::SET_ALL_LINES);
623 else if (borders->topLineUnset() && borders->bottomLineUnset() && borders->leftLineUnset()
624 && borders->rightLineUnset())
625 addParam(res, Tabular::UNSET_ALL_LINES);
627 if (borders->getLeft() != GuiSetBorder::LINE_UNDECIDED)
628 addParam(res, Tabular::SET_LINE_LEFT,
629 borders->leftLineSet() ? "true" : "false");
630 if (borders->getRight() != GuiSetBorder::LINE_UNDECIDED)
631 addParam(res, Tabular::SET_LINE_RIGHT,
632 borders->rightLineSet() ? "true" : "false");
633 if (borders->getTop() != GuiSetBorder::LINE_UNDECIDED)
634 addParam(res, Tabular::SET_LINE_TOP,
635 borders->topLineSet() ? "true" : "false");
636 if (borders->getBottom() != GuiSetBorder::LINE_UNDECIDED)
637 addParam(res, Tabular::SET_LINE_BOTTOM,
638 borders->bottomLineSet() ? "true" : "false");
640 if (borders->topLineLTSet())
641 addParam(res, Tabular::SET_LTRIM_TOP, "false");
642 else if (borders->topLineLTUnset())
643 addParam(res, Tabular::SET_LTRIM_TOP, "true");
644 if (borders->topLineRTSet())
645 addParam(res, Tabular::SET_RTRIM_TOP, "false");
646 else if (borders->topLineRTUnset())
647 addParam(res, Tabular::SET_RTRIM_TOP, "true");
648 if (borders->bottomLineLTSet())
649 addParam(res, Tabular::SET_LTRIM_BOTTOM, "false");
650 else if (borders->bottomLineLTUnset())
651 addParam(res, Tabular::SET_LTRIM_BOTTOM, "true");
652 if (borders->bottomLineRTSet())
653 addParam(res, Tabular::SET_RTRIM_BOTTOM, "false");
654 else if (borders->bottomLineRTUnset())
655 addParam(res, Tabular::SET_RTRIM_BOTTOM, "true");
657 // apply the special alignment
658 string special = fromqstr(specialAlignmentED->text());
659 if (support::trim(special).empty())
661 if (multicolumnCB->isChecked())
662 addParam(res, Tabular::SET_SPECIAL_MULTICOLUMN, special);
664 addParam(res, Tabular::SET_SPECIAL_COLUMN, special);
667 if (multicolumnCB->isChecked())
668 addParam(res, Tabular::SET_MULTICOLUMN);
670 addParam(res, Tabular::UNSET_MULTICOLUMN);
672 // apply the multirow offset
673 string mroffset = widgetsToLength(multirowOffsetED, multirowOffsetUnitLC);
674 if (mroffset.empty())
676 if (multirowCB->isChecked())
677 addParam(res, Tabular::SET_MROFFSET, mroffset);
679 if (multirowCB->isChecked())
680 addParam(res, Tabular::SET_MULTIROW);
682 addParam(res, Tabular::UNSET_MULTIROW);
683 // store the table rotation angle
684 string const tabular_angle = convert<string>(rotateTabularAngleSB->value());
685 if (rotateTabularCB->isChecked())
686 addParam(res, Tabular::SET_ROTATE_TABULAR, tabular_angle);
688 addParam(res, Tabular::UNSET_ROTATE_TABULAR, tabular_angle);
689 // store the cell rotation angle
690 string const cell_angle = convert<string>(rotateCellAngleSB->value());
691 if (rotateCellCB->isChecked())
692 addParam(res, Tabular::SET_ROTATE_CELL, cell_angle);
694 addParam(res, Tabular::UNSET_ROTATE_CELL, cell_angle);
696 if (longTabularCB->isChecked())
697 addParam(res, Tabular::SET_LONGTABULAR);
699 addParam(res, Tabular::UNSET_LONGTABULAR);
701 if (newpageCB->isChecked())
702 addParam(res, Tabular::SET_LTNEWPAGE);
704 addParam(res, Tabular::UNSET_LTNEWPAGE);
706 if (captionStatusCB->isChecked())
707 addParam(res, Tabular::SET_LTCAPTION);
709 addParam(res, Tabular::UNSET_LTCAPTION);
711 if (headerStatusCB->isChecked())
712 addParam(res, Tabular::SET_LTHEAD, "none");
714 addParam(res, Tabular::UNSET_LTHEAD, "none");
716 if (headerBorderAboveCB->isChecked())
717 addParam(res, Tabular::SET_LTHEAD, "dl_above");
719 addParam(res, Tabular::UNSET_LTHEAD, "dl_above");
721 if (headerBorderBelowCB->isChecked())
722 addParam(res, Tabular::SET_LTHEAD, "dl_below");
724 addParam(res, Tabular::UNSET_LTHEAD, "dl_below");
725 if (firstheaderBorderAboveCB->isChecked())
726 addParam(res, Tabular::SET_LTFIRSTHEAD, "dl_above");
728 addParam(res, Tabular::UNSET_LTFIRSTHEAD, "dl_above");
729 if (firstheaderBorderBelowCB->isChecked())
730 addParam(res, Tabular::SET_LTFIRSTHEAD, "dl_below");
732 addParam(res, Tabular::UNSET_LTFIRSTHEAD, "dl_below");
733 if (firstheaderStatusCB->isChecked())
734 addParam(res, Tabular::SET_LTFIRSTHEAD, "none");
736 addParam(res, Tabular::UNSET_LTFIRSTHEAD, "none");
737 if (firstheaderNoContentsCB->isChecked())
738 addParam(res, Tabular::SET_LTFIRSTHEAD, "empty");
740 addParam(res, Tabular::UNSET_LTFIRSTHEAD, "empty");
741 if (footerStatusCB->isChecked())
742 addParam(res, Tabular::SET_LTFOOT, "none");
744 addParam(res, Tabular::UNSET_LTFOOT, "none");
745 if (footerBorderAboveCB->isChecked())
746 addParam(res, Tabular::SET_LTFOOT, "dl_above");
748 addParam(res, Tabular::UNSET_LTFOOT, "dl_above");
749 if (footerBorderBelowCB->isChecked())
750 addParam(res, Tabular::SET_LTFOOT, "dl_below");
752 addParam(res, Tabular::UNSET_LTFOOT, "dl_below");
753 if (lastfooterStatusCB->isChecked())
754 addParam(res, Tabular::SET_LTLASTFOOT, "none");
756 addParam(res, Tabular::UNSET_LTLASTFOOT, "none");
757 if (lastfooterBorderAboveCB->isChecked())
758 addParam(res, Tabular::SET_LTLASTFOOT, "dl_above");
760 addParam(res, Tabular::UNSET_LTLASTFOOT, "dl_above");
761 if (lastfooterBorderBelowCB->isChecked())
762 addParam(res, Tabular::SET_LTLASTFOOT, "dl_below");
764 addParam(res, Tabular::UNSET_LTLASTFOOT, "dl_below");
765 if (lastfooterNoContentsCB->isChecked())
766 addParam(res, Tabular::SET_LTLASTFOOT, "empty");
768 addParam(res, Tabular::UNSET_LTLASTFOOT, "empty");
770 if (leftRB->isChecked())
771 addParam(res, Tabular::LONGTABULAR_ALIGN_LEFT);
772 else if (centerRB->isChecked())
773 addParam(res, Tabular::LONGTABULAR_ALIGN_CENTER);
774 else if (rightRB->isChecked())
775 addParam(res, Tabular::LONGTABULAR_ALIGN_RIGHT);
781 docstring GuiTabular::dialogToParams() const
783 set<string> features = getTabFeatures();
784 // Only modify features that have changed
785 vector<string> changed_features;
786 for (auto const & f : features) {
787 if (features_.find(f) == features_.end())
788 changed_features.push_back(f);
790 if (changed_features.empty())
793 return from_utf8("tabular " + support::getStringFromVector(changed_features, " "));
797 static Length getColumnPWidth(Tabular const & t, size_t cell)
799 return t.column_info[t.cellColumn(cell)].p_width;
803 static Length getMColumnPWidth(Tabular const & t, size_t cell)
805 if (t.isMultiColumn(cell) || t.isMultiRow(cell))
806 return t.cellInfo(cell).p_width;
811 static Length getMROffset(Tabular const & t, size_t cell)
813 if (t.isMultiRow(cell))
814 return t.cellInfo(cell).mroffset;
819 static docstring getAlignSpecial(Tabular const & t, size_t cell, int what)
821 if (what == Tabular::SET_SPECIAL_MULTICOLUMN)
822 return t.cellInfo(cell).align_special;
823 return t.column_info[t.cellColumn(cell)].align_special;
827 GuiSetBorder::BorderState GuiTabular::borderState(GuiSetBorder::BorderState bs,
830 if (bs == GuiSetBorder::LINE_UNDEF)
831 bs = line ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
832 else if ((bs == GuiSetBorder::LINE_SET && !line)
833 || (bs == GuiSetBorder::LINE_UNSET && line))
834 bs = GuiSetBorder::LINE_UNDECIDED;
839 void GuiTabular::paramsToDialog(Inset const * inset)
841 InsetTabular const * itab = static_cast<InsetTabular const *>(inset);
842 // Copy Tabular of current inset.
843 Tabular const & tabular = itab->tabular;
845 BufferView const * bv = guiApp->currentView()->currentBufferView();
846 size_t const cell = bv->cursor().idx();
848 row_type const row = tabular.cellRow(cell);
849 col_type const col = tabular.cellColumn(cell);
851 tabularRowED->setText(QString::number(row + 1));
852 tabularColumnED->setText(QString::number(col + 1));
853 lastrow_ = int(tabular.nrows());
855 bool const multicol = tabular.isMultiColumn(cell);
856 multicolumnCB->setChecked(multicol);
858 bool const multirow = tabular.isMultiRow(cell);
859 multirowCB->setChecked(multirow);
861 rotateCellCB->setChecked(tabular.getRotateCell(cell) != 0);
862 if (rotateCellCB->isChecked()) {
863 if (tabular.getRotateCell(cell) != 0)
864 rotateCellAngleSB->setValue(tabular.getRotateCell(cell));
866 rotateCellAngleSB->setValue(90);
869 longTabularCB->setChecked(tabular.is_long_tabular);
871 rotateTabularCB->setChecked(tabular.rotate != 0);
872 if (rotateTabularCB->isChecked()) {
873 if (longTabularCB->isChecked())
874 rotateTabularAngleSB->setValue(90);
876 rotateTabularAngleSB->setValue(tabular.rotate != 0 ? tabular.rotate : 90);
879 // In what follows, we check the borders of all selected cells,
880 // and if there are diverging settings, we use the LINE_UNDECIDED
882 GuiSetBorder::BorderState ltop = GuiSetBorder::LINE_UNDEF;
883 GuiSetBorder::BorderState lbottom = GuiSetBorder::LINE_UNDEF;
884 GuiSetBorder::BorderState lleft = GuiSetBorder::LINE_UNDEF;
885 GuiSetBorder::BorderState lright = GuiSetBorder::LINE_UNDEF;
886 GuiSetBorder::BorderState ltop_ltrim = GuiSetBorder::LINE_UNDEF;
887 GuiSetBorder::BorderState ltop_rtrim = GuiSetBorder::LINE_UNDEF;
888 GuiSetBorder::BorderState lbottom_ltrim = GuiSetBorder::LINE_UNDEF;
889 GuiSetBorder::BorderState lbottom_rtrim = GuiSetBorder::LINE_UNDEF;
890 CursorSlice const & beg = bv->cursor().selBegin();
891 CursorSlice const & end = bv->cursor().selEnd();
893 col_type cs = tabular.cellColumn(beg.idx());
894 col_type ce = tabular.cellColumn(end.idx());
897 row_type rs = tabular.cellRow(beg.idx());
898 row_type re = tabular.cellRow(end.idx());
901 for (row_type r = rs; r <= re; ++r)
902 for (col_type c = cs; c <= ce; ++c) {
903 idx_type const cc = tabular.cellIndex(r, c);
904 ltop = borderState(ltop, tabular.topLine(cc));
905 lbottom = borderState(lbottom, tabular.bottomLine(cc));
906 lleft = borderState(lleft, tabular.leftLine(cc));
907 lright = borderState(lright, tabular.rightLine(cc));
908 ltop_ltrim = borderState(ltop_ltrim, !tabular.topLineTrim(cc).first);
909 ltop_rtrim = borderState(ltop_rtrim, !tabular.topLineTrim(cc).second);
910 lbottom_ltrim = borderState(lbottom_ltrim, !tabular.bottomLineTrim(cc).first);
911 lbottom_rtrim = borderState(lbottom_rtrim, !tabular.bottomLineTrim(cc).second);
912 // store left/right borders for the case of formal/nonformal switch
913 orig_leftborder_ = borderState(lleft, tabular.leftLine(cc, true));
914 orig_rightborder_ = borderState(lright, tabular.rightLine(cc, true));
917 ltop = tabular.topLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
918 lbottom = tabular.bottomLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
919 lleft = tabular.leftLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
920 lright = tabular.rightLine(cell) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
921 ltop_ltrim = tabular.topLineTrim(cell).first ? GuiSetBorder::LINE_UNSET : GuiSetBorder::LINE_SET;
922 ltop_rtrim = tabular.topLineTrim(cell).second ? GuiSetBorder::LINE_UNSET : GuiSetBorder::LINE_SET;
923 lbottom_ltrim = tabular.bottomLineTrim(cell).first ? GuiSetBorder::LINE_UNSET : GuiSetBorder::LINE_SET;
924 lbottom_rtrim = tabular.bottomLineTrim(cell).second ? GuiSetBorder::LINE_UNSET : GuiSetBorder::LINE_SET;
925 // store left/right borders for the case of formal/nonformal switch
926 orig_leftborder_ = tabular.leftLine(cell, true) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
927 orig_rightborder_ = tabular.rightLine(cell, true) ? GuiSetBorder::LINE_SET : GuiSetBorder::LINE_UNSET;
929 borders->setTop(ltop);
930 borders->setBottom(lbottom);
931 borders->setLeft(lleft);
932 borders->setRight(lright);
933 borders->setTopLeftTrim(ltop_ltrim);
934 borders->setTopRightTrim(ltop_rtrim);
935 borders->setBottomLeftTrim(lbottom_ltrim);
936 borders->setBottomRightTrim(lbottom_rtrim);
937 // repaint the setborder widget
940 Length::UNIT const default_unit = Length::defaultUnit();
942 ///////////////////////////////////
943 // Set width and alignment
945 Length const tabwidth = tabular.tabularWidth();
947 && !(tabularWidthED->hasFocus() && tabularWidthED->text() == "0"))
948 tabularWidthED->clear();
950 lengthToWidgets(tabularWidthED, tabularWidthUnitLC,
951 tabwidth.asString(), default_unit);
956 special = getAlignSpecial(tabular, cell,
957 Tabular::SET_SPECIAL_MULTICOLUMN);
958 pwidth = getMColumnPWidth(tabular, cell);
960 special = getAlignSpecial(tabular, cell,
961 Tabular::SET_SPECIAL_COLUMN);
962 pwidth = getColumnPWidth(tabular, cell);
964 bool const varwidth = tabular.column_info[tabular.cellColumn(cell)].varwidth;
966 columnTypeCO->setCurrentIndex(1);
969 && !(columnWidthED->hasFocus() && columnWidthED->text() == "0")) {
970 columnWidthED->clear();
972 columnTypeCO->setCurrentIndex(0);
974 colwidth = pwidth.asString();
975 lengthToWidgets(columnWidthED, columnWidthUnitLC,
976 colwidth, default_unit);
977 columnTypeCO->setCurrentIndex(2);
981 mroffset = getMROffset(tabular, cell);
984 && !(multirowOffsetED->hasFocus() && multirowOffsetED->text() == "0"))
985 multirowOffsetED->clear();
987 offset = mroffset.asString();
988 lengthToWidgets(multirowOffsetED, multirowOffsetUnitLC,
989 offset, default_unit);
991 specialAlignmentED->setText(toqstr(special));
992 ///////////////////////////////////
995 borderDefaultRB->setChecked(!tabular.use_booktabs);
996 booktabsRB->setChecked(tabular.use_booktabs);
998 if (tabular.row_info[row].top_space.empty()
999 && !tabular.row_info[row].top_space_default) {
1000 topspaceCO->setCurrentIndex(0);
1001 } else if (tabular.row_info[row].top_space_default) {
1002 topspaceCO->setCurrentIndex(1);
1004 topspaceCO->setCurrentIndex(2);
1005 lengthToWidgets(topspaceED,
1007 tabular.row_info[row].top_space.asString(),
1011 if (tabular.row_info[row].bottom_space.empty()
1012 && !tabular.row_info[row].bottom_space_default) {
1013 bottomspaceCO->setCurrentIndex(0);
1014 } else if (tabular.row_info[row].bottom_space_default) {
1015 bottomspaceCO->setCurrentIndex(1);
1017 bottomspaceCO->setCurrentIndex(2);
1018 lengthToWidgets(bottomspaceED,
1020 tabular.row_info[row].bottom_space.asString(),
1024 if (tabular.row_info[row].interline_space.empty()
1025 && !tabular.row_info[row].interline_space_default) {
1026 interlinespaceCO->setCurrentIndex(0);
1027 } else if (tabular.row_info[row].interline_space_default) {
1028 interlinespaceCO->setCurrentIndex(1);
1030 interlinespaceCO->setCurrentIndex(2);
1031 lengthToWidgets(interlinespaceED,
1032 interlinespaceUnitLC,
1033 tabular.row_info[row].interline_space.asString(),
1038 hAlignCO->addItem(qt_("Left"), toqstr("left"));
1039 hAlignCO->addItem(qt_("Center"), toqstr("center"));
1040 hAlignCO->addItem(qt_("Right"), toqstr("right"));
1041 if (!multicol && !pwidth.zero())
1042 hAlignCO->addItem(qt_("Justified"), toqstr("justified"));
1043 if (!multicol && !multirow)
1044 hAlignCO->addItem(qt_("At Decimal Separator"), toqstr("decimal"));
1047 switch (tabular.getAlignment(cell)) {
1048 case LYX_ALIGN_LEFT:
1051 case LYX_ALIGN_CENTER:
1054 case LYX_ALIGN_RIGHT:
1057 case LYX_ALIGN_BLOCK:
1059 if (!multicol && !pwidth.zero())
1060 align = "justified";
1063 case LYX_ALIGN_DECIMAL:
1065 if (!multicol && !multirow)
1070 // we should never end up here
1073 hAlignCO->setCurrentIndex(hAlignCO->findData(toqstr(align)));
1076 decimal_sep_ = tabular.column_info[col].decimal_point;
1077 if (decimal_sep_.empty()) {
1078 Language const * lang = itab->buffer().paragraphs().front().getParLanguage(itab->buffer().params());
1079 decimal_sep_ = lang->decimalSeparator();
1081 decimalPointED->setText(toqstr(decimal_sep_));
1084 switch (tabular.getVAlignment(cell)) {
1085 case Tabular::LYX_VALIGN_TOP:
1088 case Tabular::LYX_VALIGN_MIDDLE:
1091 case Tabular::LYX_VALIGN_BOTTOM:
1100 vAlignCO->setCurrentIndex(valign);
1102 int tableValign = 1;
1103 switch (tabular.tabular_valignment) {
1104 case Tabular::LYX_VALIGN_TOP:
1107 case Tabular::LYX_VALIGN_MIDDLE:
1110 case Tabular::LYX_VALIGN_BOTTOM:
1117 TableAlignCO->setCurrentIndex(tableValign);
1119 if (!tabular.is_long_tabular) {
1120 headerStatusCB->setChecked(false);
1121 headerBorderAboveCB->setChecked(false);
1122 headerBorderBelowCB->setChecked(false);
1123 firstheaderStatusCB->setChecked(false);
1124 firstheaderBorderAboveCB->setChecked(false);
1125 firstheaderBorderBelowCB->setChecked(false);
1126 firstheaderNoContentsCB->setChecked(false);
1127 footerStatusCB->setChecked(false);
1128 footerBorderAboveCB->setChecked(false);
1129 footerBorderBelowCB->setChecked(false);
1130 lastfooterStatusCB->setChecked(false);
1131 lastfooterBorderAboveCB->setChecked(false);
1132 lastfooterBorderBelowCB->setChecked(false);
1133 lastfooterNoContentsCB->setChecked(false);
1134 newpageCB->setChecked(false);
1135 captionStatusCB->blockSignals(true);
1136 captionStatusCB->setChecked(false);
1137 captionStatusCB->blockSignals(false);
1139 // Store feature status
1140 features_ = getTabFeatures();
1143 // longtables cannot have a vertical alignment
1144 TableAlignCO->setCurrentIndex(Tabular::LYX_VALIGN_MIDDLE);
1146 switch (tabular.longtabular_alignment) {
1147 case Tabular::LYX_LONGTABULAR_ALIGN_LEFT:
1148 leftRB->setChecked(true);
1150 case Tabular::LYX_LONGTABULAR_ALIGN_CENTER:
1151 centerRB->setChecked(true);
1153 case Tabular::LYX_LONGTABULAR_ALIGN_RIGHT:
1154 rightRB->setChecked(true);
1157 centerRB->setChecked(true);
1160 captionStatusCB->blockSignals(true);
1161 captionStatusCB->setChecked(tabular.ltCaption(row));
1162 captionStatusCB->blockSignals(false);
1164 Tabular::ltType ltt;
1166 bool row_set = tabular.getRowOfLTHead(row, ltt);
1167 headerStatusCB->setChecked(row_set);
1169 headerBorderAboveCB->setChecked(ltt.topDL);
1170 headerBorderBelowCB->setChecked(ltt.bottomDL);
1173 headerBorderAboveCB->setChecked(false);
1174 headerBorderBelowCB->setChecked(false);
1175 firstheaderNoContentsCB->setChecked(false);
1179 row_set = tabular.getRowOfLTFirstHead(row, ltt);
1180 firstheaderStatusCB->setChecked(row_set);
1181 if (ltt.set && (!ltt.empty || !use_empty)) {
1182 firstheaderBorderAboveCB->setChecked(ltt.topDL);
1183 firstheaderBorderBelowCB->setChecked(ltt.bottomDL);
1185 firstheaderBorderAboveCB->setChecked(false);
1186 firstheaderBorderBelowCB->setChecked(false);
1189 row_set = tabular.getRowOfLTFoot(row, ltt);
1190 footerStatusCB->setChecked(row_set);
1192 footerBorderAboveCB->setChecked(ltt.topDL);
1193 footerBorderBelowCB->setChecked(ltt.bottomDL);
1196 footerBorderAboveCB->setChecked(false);
1197 footerBorderBelowCB->setChecked(false);
1198 lastfooterNoContentsCB->setChecked(false);
1202 row_set = tabular.getRowOfLTLastFoot(row, ltt);
1203 lastfooterStatusCB->setChecked(row_set);
1204 if (ltt.set && (!ltt.empty || !use_empty)) {
1205 lastfooterBorderAboveCB->setChecked(ltt.topDL);
1206 lastfooterBorderBelowCB->setChecked(ltt.bottomDL);
1208 lastfooterBorderAboveCB->setChecked(false);
1209 lastfooterBorderBelowCB->setChecked(false);
1211 newpageCB->setChecked(tabular.getLTNewPage(row));
1213 // first header can only be suppressed when there is a header
1214 firstheader_suppressable_ = tabular.haveLTHead()
1215 && !tabular.haveLTFirstHead();
1216 // last footer can only be suppressed when there is a footer
1217 lastfooter_suppressable_ = tabular.haveLTFoot()
1218 && !tabular.haveLTLastFoot();
1220 // after setting the features, check if they are enabled
1223 // Finally, store feature status
1224 features_ = getTabFeatures();
1228 bool GuiTabular::checkWidgets(bool readonly) const
1230 tabularRowED->setReadOnly(readonly);
1231 tabularColumnED->setReadOnly(readonly);
1232 tabularWidthED->setReadOnly(readonly);
1233 specialAlignmentED->setReadOnly(readonly);
1234 columnWidthED->setReadOnly(readonly);
1235 multirowOffsetED->setReadOnly(readonly);
1236 decimalPointED->setReadOnly(readonly);
1239 multicolumnCB->setEnabled(false);
1240 multirowCB->setEnabled(false);
1241 rotateCellCB->setEnabled(false);
1242 rotateCellAngleSB->setEnabled(false);
1243 rotateTabularCB->setEnabled(false);
1244 rotateTabularAngleSB->setEnabled(false);
1245 longTabularCB->setEnabled(false);
1246 borders->setEnabled(false);
1247 tabularWidthUnitLC->setEnabled(false);
1248 columnWidthUnitLC->setEnabled(false);
1249 columnTypeCO->setEnabled(false);
1250 multirowOffsetUnitLC->setEnabled(false);
1251 setBordersGB->setEnabled(false);
1252 allBordersGB->setEnabled(false);
1253 borderStyleGB->setEnabled(false);
1254 booktabsRB->setEnabled(false);
1255 topspaceCO->setEnabled(false);
1256 topspaceUnitLC->setEnabled(false);
1257 bottomspaceCO->setEnabled(false);
1258 bottomspaceUnitLC->setEnabled(false);
1259 interlinespaceCO->setEnabled(false);
1260 interlinespaceUnitLC->setEnabled(false);
1261 hAlignCO->setEnabled(false);
1262 vAlignCO->setEnabled(false);
1263 TableAlignCO->setEnabled(false);
1264 longtableGB->setEnabled(false);
1265 alignmentGB->setEnabled(false);
1269 return InsetParamsWidget::checkWidgets();
1273 bool GuiTabular::funcEnabled(Tabular::Feature f) const
1275 FuncRequest r(LFUN_INSET_MODIFY, "tabular for-dialog" + featureAsString(f));
1276 return getStatus(r).enabled();
1280 } // namespace frontend
1283 #include "moc_GuiTabular.cpp"