#include "support/convert.h"
#include "support/debug.h"
+#include "support/lstrings.h"
#include <QCheckBox>
#include <QPushButton>
}
+void GuiTabular::on_columnTypeCO_activated(int index)
+{
+ checkEnabled();
+ if (index == 2)
+ columnWidthED->setFocus();
+}
+
+
void GuiTabular::enableWidgets() const
{
// if there is a LaTeX argument, the width and alignment will be overwritten
// therefore disable them in this case
- columnWidthED->setEnabled(specialAlignmentED->text().isEmpty());
- columnWidthUnitLC->setEnabled(specialAlignmentED->text().isEmpty());
+ bool const fixed = specialAlignmentED->text().isEmpty()
+ && columnTypeCO->currentIndex() == 2;
+ columnWidthED->setEnabled(fixed);
+ columnWidthUnitLC->setEnabled(fixed);
// if the column has a width, multirows are always left-aligned
// therefore disable hAlignCB in this case
hAlignCO->setEnabled(!(multirowCB->isChecked()
&& !widgetsToLength(columnWidthED, columnWidthUnitLC).empty())
&& specialAlignmentED->text().isEmpty());
// decimal alignment is only possible for non-multicol and non-multirow cells
- if ((multicolumnCB->isChecked() || multirowCB->isChecked())
+ if ((multicolumnCB->isChecked() || multirowCB->isChecked() || columnTypeCO->currentIndex() == 1)
&& hAlignCO->findData(toqstr("decimal")))
hAlignCO->removeItem(hAlignCO->findData(toqstr("decimal")));
else if (!multicolumnCB->isChecked() && !multirowCB->isChecked()
decimalPointED->setEnabled(dalign);
decimalLA->setEnabled(dalign);
- bool const setwidth = TableAlignCO->currentText() == qt_("Middle")
- && !longTabularCB->isChecked();
+ bool const setwidth = TableAlignCO->currentText() == qt_("Middle");
tabularWidthLA->setEnabled(setwidth);
tabularWidthED->setEnabled(setwidth);
tabularWidthUnitLC->setEnabled(setwidth);
- rotateTabularAngleSB->setEnabled(rotateTabularCB->isChecked());
+ rotateTabularAngleSB->setEnabled(rotateTabularCB->isChecked()
+ && !longTabularCB->isChecked());
rotateCellAngleSB->setEnabled(rotateCellCB->isChecked());
bool const enable_valign =
// setting as longtable is not allowed when table is inside a float
bool const is_tabular_star = !tabularWidthED->text().isEmpty();
- longTabularCB->setEnabled(!is_tabular_star && funcEnabled(Tabular::SET_LONGTABULAR));
+ longTabularCB->setEnabled(funcEnabled(Tabular::SET_LONGTABULAR));
bool const longtabular = longTabularCB->isChecked();
longtableGB->setEnabled(true);
newpageCB->setEnabled(longtabular);
// longtables and tabular* cannot have a vertical alignment
TableAlignLA->setDisabled(is_tabular_star || longtabular);
TableAlignCO->setDisabled(is_tabular_star || longtabular);
+ // longtable cannot be rotated with rotating package, only
+ // with [pdf]lscape, which only supports 90 deg.
+ rotateTabularAngleSB->setDisabled(longtabular);
// FIXME: This Dialog is really horrible, disabling/enabling a checkbox
// depending on the cursor position is very very unintuitive...
// this must be done before applying the column alignment
// because its value influences the alignment of multirow cells
string width = widgetsToLength(columnWidthED, columnWidthUnitLC);
- if (width.empty())
+ if (width.empty() || columnTypeCO->currentIndex() != 2)
width = "0pt";
if (multicolumnCB->isChecked())
setParam(param_str, Tabular::SET_MPWIDTH, width);
else
setParam(param_str, Tabular::SET_PWIDTH, width);
+ bool const varwidth = specialAlignmentED->text().isEmpty()
+ && columnTypeCO->currentIndex() == 1;
+ if (varwidth)
+ setParam(param_str, Tabular::TOGGLE_VARWIDTH_COLUMN, "on");
+ else
+ setParam(param_str, Tabular::TOGGLE_VARWIDTH_COLUMN, "off");
+
// apply the column alignment
// multirows inherit the alignment from the column; if a column width
// is set, multirows are always left-aligned so that in this case
// apply the special alignment
string special = fromqstr(specialAlignmentED->text());
- if (special.empty())
+ if (support::trim(special).empty())
special = "none";
if (multicolumnCB->isChecked())
setParam(param_str, Tabular::SET_SPECIAL_MULTICOLUMN, special);
//
if (newpageCB->isChecked())
setParam(param_str, Tabular::SET_LTNEWPAGE);
- else
+ else
setParam(param_str, Tabular::UNSET_LTNEWPAGE);
//
if (captionStatusCB->isChecked())
rotateCellAngleSB->setValue(90);
}
- rotateTabularCB->setChecked(tabular.rotate != 0);
- if (rotateTabularCB->isChecked())
- rotateTabularAngleSB->setValue(tabular.rotate != 0 ? tabular.rotate : 90);
-
longTabularCB->setChecked(tabular.is_long_tabular);
+ rotateTabularCB->setChecked(tabular.rotate != 0);
+ if (rotateTabularCB->isChecked()) {
+ if (longTabularCB->isChecked())
+ rotateTabularAngleSB->setValue(90);
+ else
+ rotateTabularAngleSB->setValue(tabular.rotate != 0 ? tabular.rotate : 90);
+ }
+
borders->setTop(tabular.topLine(cell));
borders->setBottom(tabular.bottomLine(cell));
borders->setLeft(tabular.leftLine(cell));
Tabular::SET_SPECIAL_COLUMN);
pwidth = getColumnPWidth(tabular, cell);
}
+ bool const varwidth = tabular.column_info[tabular.cellColumn(cell)].varwidth;
+ if (varwidth)
+ columnTypeCO->setCurrentIndex(1);
string colwidth;
if (pwidth.zero()
- && !(columnWidthED->hasFocus() && columnWidthED->text() == "0"))
+ && !(columnWidthED->hasFocus() && columnWidthED->text() == "0")) {
columnWidthED->clear();
- else {
+ if (!varwidth)
+ columnTypeCO->setCurrentIndex(0);
+ } else {
colwidth = pwidth.asString();
lengthToWidgets(columnWidthED, columnWidthUnitLC,
colwidth, default_unit);
+ columnTypeCO->setCurrentIndex(2);
}
Length mroffset;
if (multirow)
borders->setEnabled(false);
tabularWidthUnitLC->setEnabled(false);
columnWidthUnitLC->setEnabled(false);
+ columnTypeCO->setEnabled(false);
multirowOffsetUnitLC->setEnabled(false);
setBordersGB->setEnabled(false);
allBordersGB->setEnabled(false);