2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiTabular.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Jürgen Spitzmüller
|
|
|
|
* \author Herbert Voß
|
2009-07-13 23:25:47 +00:00
|
|
|
* \author Uwe Stöhr
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiTabular.h"
|
2007-08-31 22:16:11 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
#include "GuiApplication.h"
|
2007-08-31 22:16:11 +00:00
|
|
|
#include "GuiSetBorder.h"
|
2008-04-21 13:33:39 +00:00
|
|
|
#include "GuiView.h"
|
2007-04-26 03:53:02 +00:00
|
|
|
#include "LengthCombo.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
2007-10-06 09:19:53 +00:00
|
|
|
#include "Validator.h"
|
|
|
|
|
2008-04-21 13:33:39 +00:00
|
|
|
#include "BufferView.h"
|
|
|
|
#include "Cursor.h"
|
|
|
|
#include "FuncRequest.h"
|
2009-02-10 18:08:09 +00:00
|
|
|
#include "FuncStatus.h"
|
2010-02-09 16:11:13 +00:00
|
|
|
#include "LyX.h"
|
2010-06-05 07:44:44 +00:00
|
|
|
#include "LyXRC.h"
|
2008-04-21 13:33:39 +00:00
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
#include "insets/InsetTabular.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
#include "support/debug.h"
|
|
|
|
|
2007-04-24 17:46:08 +00:00
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QRadioButton>
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
GuiTabular::GuiTabular(QWidget * parent)
|
|
|
|
: InsetParamsWidget(parent)
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
|
2011-02-03 23:11:26 +00:00
|
|
|
tabularWidthED->setValidator(unsignedLengthValidator(tabularWidthED));
|
2011-02-04 13:11:48 +00:00
|
|
|
columnWidthED->setValidator(unsignedLengthValidator(columnWidthED));
|
2010-11-07 05:32:28 +00:00
|
|
|
multirowOffsetED->setValidator(new LengthValidator(multirowOffsetED));
|
2007-04-24 17:46:08 +00:00
|
|
|
topspaceED->setValidator(new LengthValidator(topspaceED));
|
|
|
|
bottomspaceED->setValidator(new LengthValidator(bottomspaceED));
|
|
|
|
interlinespaceED->setValidator(new LengthValidator(interlinespaceED));
|
|
|
|
|
2011-02-04 13:11:48 +00:00
|
|
|
tabularWidthUnitLC->setCurrentItem(Length::defaultUnit());
|
|
|
|
columnWidthUnitLC->setCurrentItem(Length::defaultUnit());
|
|
|
|
multirowOffsetUnitLC->setCurrentItem(Length::defaultUnit());
|
|
|
|
topspaceUnitLC->setCurrentItem(Length::defaultUnit());
|
|
|
|
bottomspaceUnitLC->setCurrentItem(Length::defaultUnit());
|
|
|
|
interlinespaceUnitLC->setCurrentItem(Length::defaultUnit());
|
2009-07-16 07:47:02 +00:00
|
|
|
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(topspaceED, SIGNAL(textEdited(const QString &)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(topspaceUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(bottomspaceED, SIGNAL(textEdited(const QString &)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(bottomspaceUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(interlinespaceED, SIGNAL(textEdited(const QString &)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(interlinespaceUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(booktabsRB, SIGNAL(clicked(bool)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(borderDefaultRB, SIGNAL(clicked(bool)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(borderSetPB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(borderSet_clicked()));
|
2010-11-02 13:35:16 +00:00
|
|
|
connect(borderUnsetPB, SIGNAL(clicked()),
|
2009-05-17 09:36:07 +00:00
|
|
|
this, SLOT(borderUnset_clicked()));
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(hAlignCO, SIGNAL(activated(int)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(vAlignCO, SIGNAL(activated(int)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(multicolumnCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2010-02-11 01:07:54 +00:00
|
|
|
connect(multirowCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(multirowOffsetED, SIGNAL(textEdited(const QString &)),
|
2010-11-07 05:32:28 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(multirowOffsetUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
2010-11-07 05:32:28 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(newpageCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(headerStatusCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(headerBorderAboveCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(headerBorderBelowCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(firstheaderStatusCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(firstheaderBorderAboveCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(firstheaderBorderBelowCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(firstheaderNoContentsCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(footerStatusCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(footerBorderAboveCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(footerBorderBelowCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(lastfooterStatusCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(lastfooterBorderAboveCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(lastfooterBorderBelowCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(lastfooterNoContentsCB, SIGNAL(clicked()),
|
2010-11-01 21:52:08 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
|
|
|
connect(captionStatusCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2010-11-29 02:38:29 +00:00
|
|
|
connect(specialAlignmentED, SIGNAL(editingFinished()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(columnWidthED, SIGNAL(textEdited(const QString &)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(columnWidthUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2010-01-29 14:52:15 +00:00
|
|
|
connect(borders, SIGNAL(topSet(bool)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2010-01-29 14:52:15 +00:00
|
|
|
connect(borders, SIGNAL(bottomSet(bool)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2010-01-29 14:52:15 +00:00
|
|
|
connect(borders, SIGNAL(rightSet(bool)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2010-01-29 14:52:15 +00:00
|
|
|
connect(borders, SIGNAL(leftSet(bool)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(rotateTabularCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(rotateCellCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2011-02-04 13:11:48 +00:00
|
|
|
connect(TableAlignCO, SIGNAL(activated(int)),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(longTabularCB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-07-11 13:09:45 +00:00
|
|
|
connect(leftRB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-07-11 13:09:45 +00:00
|
|
|
connect(centerRB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2009-07-11 13:09:45 +00:00
|
|
|
connect(rightRB, SIGNAL(clicked()),
|
2010-02-18 08:28:46 +00:00
|
|
|
this, SLOT(checkEnabled()));
|
2011-02-03 23:11:26 +00:00
|
|
|
connect(tabularWidthED, SIGNAL(textEdited(const QString &)),
|
|
|
|
this, SLOT(checkEnabled()));
|
2010-11-02 13:35:16 +00:00
|
|
|
|
2011-02-04 13:11:48 +00:00
|
|
|
decimalPointED->setInputMask("X; ");
|
|
|
|
decimalPointED->setMaxLength(1);
|
2010-12-09 20:31:56 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
// initialize the length validator
|
2011-02-04 13:11:48 +00:00
|
|
|
addCheckedWidget(columnWidthED, columnWidthLA);
|
2010-11-07 05:32:28 +00:00
|
|
|
addCheckedWidget(multirowOffsetED, multirowOffsetLA);
|
2010-02-18 08:28:46 +00:00
|
|
|
addCheckedWidget(topspaceED, topspaceLA);
|
|
|
|
addCheckedWidget(bottomspaceED, bottomspaceLA);
|
|
|
|
addCheckedWidget(interlinespaceED, interlinespaceLA);
|
2011-02-04 13:11:48 +00:00
|
|
|
addCheckedWidget(tabularWidthED, tabularWidthLA);
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-04 10:55:03 +00:00
|
|
|
void GuiTabular::on_topspaceCO_activated(int index)
|
|
|
|
{
|
|
|
|
bool const enable = (index == 2);
|
|
|
|
topspaceED->setEnabled(enable);
|
2011-02-04 13:11:48 +00:00
|
|
|
topspaceUnitLC->setEnabled(enable);
|
2010-12-04 10:55:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::on_bottomspaceCO_activated(int index)
|
|
|
|
{
|
|
|
|
bool const enable = (index == 2);
|
|
|
|
bottomspaceED->setEnabled(enable);
|
2011-02-04 13:11:48 +00:00
|
|
|
bottomspaceUnitLC->setEnabled(enable);
|
2010-12-04 10:55:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::on_interlinespaceCO_activated(int index)
|
|
|
|
{
|
|
|
|
bool const enable = (index == 2);
|
|
|
|
interlinespaceED->setEnabled(enable);
|
2011-02-04 13:11:48 +00:00
|
|
|
interlinespaceUnitLC->setEnabled(enable);
|
2010-12-04 10:55:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
void GuiTabular::checkEnabled()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2010-12-10 06:25:52 +00:00
|
|
|
// if there is a LaTeX argument, the width and alignment will be overwritten
|
2010-11-29 02:38:29 +00:00
|
|
|
// therefore disable them in this case
|
2011-02-04 13:11:48 +00:00
|
|
|
columnWidthED->setEnabled(specialAlignmentED->text().isEmpty());
|
2010-11-20 07:57:35 +00:00
|
|
|
// if the column has a width, multirows are always left-aligned
|
|
|
|
// therefore disable hAlignCB in this case
|
2011-02-04 13:11:48 +00:00
|
|
|
hAlignCO->setEnabled(!(multirowCB->isChecked()
|
|
|
|
&& !widgetsToLength(columnWidthED, columnWidthUnitLC).empty())
|
2010-11-29 02:38:29 +00:00
|
|
|
&& specialAlignmentED->text().isEmpty());
|
2011-02-04 13:11:48 +00:00
|
|
|
bool const dalign =
|
|
|
|
hAlignCO->itemData(hAlignCO->currentIndex()).toString() == QString("decimal");
|
|
|
|
decimalPointED->setEnabled(dalign);
|
|
|
|
decimalLA->setEnabled(dalign);
|
2010-06-05 07:44:44 +00:00
|
|
|
|
2011-02-04 13:11:48 +00:00
|
|
|
bool const setwidth = TableAlignCO->currentText() == qt_("Middle")
|
2011-02-03 23:11:26 +00:00
|
|
|
&& !longTabularCB->isChecked() && !rotateTabularCB->isChecked();
|
2011-02-04 13:11:48 +00:00
|
|
|
tabularWidthLA->setEnabled(setwidth);
|
2011-02-03 23:11:26 +00:00
|
|
|
tabularWidthED->setEnabled(setwidth);
|
2011-02-04 13:11:48 +00:00
|
|
|
tabularWidthUnitLC->setEnabled(setwidth);
|
2011-02-03 23:11:26 +00:00
|
|
|
|
|
|
|
bool const is_tabular_star = !tabularWidthED->text().isEmpty();
|
|
|
|
rotateTabularCB->setDisabled(is_tabular_star);
|
|
|
|
|
2011-02-04 13:11:48 +00:00
|
|
|
vAlignCO->setEnabled(!multirowCB->isChecked()
|
|
|
|
&& !widgetsToLength(columnWidthED, columnWidthUnitLC).empty()
|
2010-11-29 02:38:29 +00:00
|
|
|
&& specialAlignmentED->text().isEmpty());
|
2010-03-06 19:08:10 +00:00
|
|
|
|
2011-02-03 23:11:26 +00:00
|
|
|
topspaceED->setEnabled(topspaceCO->currentIndex() == 2);
|
2010-02-18 08:28:46 +00:00
|
|
|
topspaceED->setEnabled(topspaceCO->currentIndex() == 2);
|
2011-02-04 13:11:48 +00:00
|
|
|
topspaceUnitLC->setEnabled(topspaceCO->currentIndex() == 2);
|
2010-02-18 08:28:46 +00:00
|
|
|
bottomspaceED->setEnabled(bottomspaceCO->currentIndex() == 2);
|
2011-02-04 13:11:48 +00:00
|
|
|
bottomspaceUnitLC->setEnabled(bottomspaceCO->currentIndex() == 2);
|
2010-02-18 08:28:46 +00:00
|
|
|
interlinespaceED->setEnabled(interlinespaceCO->currentIndex() == 2);
|
2011-02-04 13:11:48 +00:00
|
|
|
interlinespaceUnitLC->setEnabled(interlinespaceCO->currentIndex() == 2);
|
2010-03-06 19:08:10 +00:00
|
|
|
|
2010-10-29 01:18:18 +00:00
|
|
|
// setting as longtable is not allowed when table is inside a float
|
2011-02-03 23:11:26 +00:00
|
|
|
longTabularCB->setEnabled(!is_tabular_star && funcEnabled(Tabular::SET_LONGTABULAR));
|
2010-03-06 19:08:10 +00:00
|
|
|
bool const longtabular = longTabularCB->isChecked();
|
|
|
|
longtableGB->setEnabled(true);
|
|
|
|
newpageCB->setEnabled(longtabular);
|
|
|
|
alignmentGB->setEnabled(longtabular);
|
2011-02-03 23:11:26 +00:00
|
|
|
// longtables and tabular* cannot have a vertical alignment
|
2011-02-04 13:11:48 +00:00
|
|
|
TableAlignLA->setDisabled(is_tabular_star || longtabular);
|
2011-02-03 23:11:26 +00:00
|
|
|
TableAlignCO->setDisabled(is_tabular_star || longtabular);
|
2010-03-06 19:08:10 +00:00
|
|
|
|
|
|
|
// FIXME: This Dialog is really horrible, disabling/enabling a checkbox
|
|
|
|
// depending on the cursor position is very very unintuitive...
|
|
|
|
// We need some edit boxes to show which rows are header/footer/etc
|
|
|
|
// without having to move the cursor first.
|
|
|
|
headerStatusCB->setEnabled(longtabular);
|
|
|
|
headerBorderAboveCB->setEnabled(longtabular
|
|
|
|
&& headerStatusCB->isChecked());
|
|
|
|
headerBorderBelowCB->setEnabled(longtabular
|
|
|
|
&& headerStatusCB->isChecked());
|
|
|
|
|
2010-11-03 01:29:01 +00:00
|
|
|
// first header can only be suppressed when there is a header
|
|
|
|
// firstheader_suppressable_ is set in paramsToDialog
|
2010-11-02 13:35:16 +00:00
|
|
|
firstheaderNoContentsCB->setEnabled(longtabular && firstheader_suppressable_);
|
2010-03-06 19:08:10 +00:00
|
|
|
// check if setting a first header is allowed
|
|
|
|
// additionally check firstheaderNoContentsCB because when this is
|
|
|
|
// the case a first header makes no sense
|
2010-08-25 06:25:07 +00:00
|
|
|
firstheaderStatusCB->setEnabled(funcEnabled(Tabular::SET_LTFIRSTHEAD)
|
2010-08-25 02:56:27 +00:00
|
|
|
&& longtabular && !firstheaderNoContentsCB->isChecked());
|
2010-03-06 19:08:10 +00:00
|
|
|
firstheaderBorderAboveCB->setEnabled(longtabular
|
|
|
|
&& firstheaderStatusCB->isChecked());
|
|
|
|
firstheaderBorderBelowCB->setEnabled(longtabular
|
|
|
|
&& firstheaderStatusCB->isChecked());
|
|
|
|
|
|
|
|
footerStatusCB->setEnabled(longtabular);
|
|
|
|
footerBorderAboveCB->setEnabled(longtabular
|
|
|
|
&& footerBorderAboveCB->isChecked());
|
|
|
|
footerBorderBelowCB->setEnabled(longtabular
|
|
|
|
&& footerBorderAboveCB->isChecked());
|
|
|
|
|
2010-11-03 01:29:01 +00:00
|
|
|
// last footer can only be suppressed when there is a footer
|
|
|
|
// lastfooter_suppressable_ is set in paramsToDialog
|
2010-11-02 13:35:16 +00:00
|
|
|
lastfooterNoContentsCB->setEnabled(longtabular && lastfooter_suppressable_);
|
2010-03-06 19:08:10 +00:00
|
|
|
// check if setting a last footer is allowed
|
|
|
|
// additionally check lastfooterNoContentsCB because when this is
|
|
|
|
// the case a last footer makes no sense
|
2010-08-25 06:25:07 +00:00
|
|
|
lastfooterStatusCB->setEnabled(funcEnabled(Tabular::SET_LTLASTFOOT)
|
2010-08-25 02:56:27 +00:00
|
|
|
&& longtabular && !lastfooterNoContentsCB->isChecked());
|
2010-03-06 19:08:10 +00:00
|
|
|
lastfooterBorderAboveCB->setEnabled(longtabular
|
|
|
|
&& lastfooterBorderAboveCB->isChecked());
|
|
|
|
lastfooterBorderBelowCB->setEnabled(longtabular
|
|
|
|
&& lastfooterBorderAboveCB->isChecked());
|
|
|
|
|
2010-10-29 01:38:58 +00:00
|
|
|
captionStatusCB->setEnabled(funcEnabled(Tabular::TOGGLE_LTCAPTION)
|
|
|
|
&& longtabular);
|
2010-11-02 13:35:16 +00:00
|
|
|
|
2010-08-25 06:25:07 +00:00
|
|
|
multicolumnCB->setEnabled(funcEnabled(Tabular::MULTICOLUMN));
|
2010-08-25 06:37:37 +00:00
|
|
|
multirowCB->setEnabled(funcEnabled(Tabular::MULTIROW));
|
2010-11-07 05:32:28 +00:00
|
|
|
multirowOffsetED->setEnabled(multirowCB->isChecked());
|
2011-02-04 13:11:48 +00:00
|
|
|
multirowOffsetUnitLC->setEnabled(multirowCB->isChecked());
|
2010-03-06 19:08:10 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::borderSet_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2010-02-18 08:28:46 +00:00
|
|
|
borders->setTop(true);
|
|
|
|
borders->setBottom(true);
|
|
|
|
borders->setLeft(true);
|
|
|
|
borders->setRight(true);
|
|
|
|
// repaint the setborder widget
|
|
|
|
borders->update();
|
|
|
|
checkEnabled();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::borderUnset_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2010-02-18 08:28:46 +00:00
|
|
|
borders->setTop(false);
|
|
|
|
borders->setBottom(false);
|
|
|
|
borders->setLeft(false);
|
|
|
|
borders->setRight(false);
|
|
|
|
// repaint the setborder widget
|
|
|
|
borders->update();
|
|
|
|
checkEnabled();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
static void setParam(string & param_str, Tabular::Feature f, string const & arg = string())
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2010-02-18 08:28:46 +00:00
|
|
|
param_str += ' ';
|
|
|
|
param_str += featureAsString(f) + ' ' + arg;
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
2010-01-29 14:52:15 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
void GuiTabular::setHAlign(string & param_str) const
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2010-02-18 08:28:46 +00:00
|
|
|
Tabular::Feature num = Tabular::ALIGN_LEFT;
|
|
|
|
Tabular::Feature multi_num = Tabular::M_ALIGN_LEFT;
|
2010-11-02 13:35:16 +00:00
|
|
|
string const align =
|
2011-02-04 13:11:48 +00:00
|
|
|
fromqstr(hAlignCO->itemData(hAlignCO->currentIndex()).toString());
|
2010-08-14 15:10:53 +00:00
|
|
|
if (align == "left") {
|
2010-06-05 07:44:44 +00:00
|
|
|
num = Tabular::ALIGN_LEFT;
|
|
|
|
multi_num = Tabular::M_ALIGN_LEFT;
|
2010-08-14 15:10:53 +00:00
|
|
|
} else if (align == "center") {
|
2010-06-05 07:44:44 +00:00
|
|
|
num = Tabular::ALIGN_CENTER;
|
|
|
|
multi_num = Tabular::M_ALIGN_CENTER;
|
2010-08-14 15:10:53 +00:00
|
|
|
} else if (align == "right") {
|
2010-06-05 07:44:44 +00:00
|
|
|
num = Tabular::ALIGN_RIGHT;
|
|
|
|
multi_num = Tabular::M_ALIGN_RIGHT;
|
2010-08-14 15:10:53 +00:00
|
|
|
} else if (align == "justified") {
|
2010-06-05 07:44:44 +00:00
|
|
|
num = Tabular::ALIGN_BLOCK;
|
|
|
|
//multi_num: no equivalent
|
2010-08-14 15:10:53 +00:00
|
|
|
} else if (align == "decimal") {
|
2010-06-05 07:44:44 +00:00
|
|
|
num = Tabular::ALIGN_DECIMAL;
|
|
|
|
//multi_num: no equivalent
|
2010-02-18 08:28:46 +00:00
|
|
|
}
|
2007-04-24 17:46:08 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
if (multicolumnCB->isChecked())
|
|
|
|
setParam(param_str, multi_num);
|
|
|
|
else
|
|
|
|
setParam(param_str, num);
|
2010-01-29 14:52:15 +00:00
|
|
|
}
|
2007-04-24 17:46:08 +00:00
|
|
|
|
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
void GuiTabular::setVAlign(string & param_str) const
|
2010-01-29 14:52:15 +00:00
|
|
|
{
|
2011-02-04 13:11:48 +00:00
|
|
|
int const align = vAlignCO->currentIndex();
|
2010-02-18 08:28:46 +00:00
|
|
|
enum VALIGN { TOP, MIDDLE, BOTTOM };
|
|
|
|
VALIGN v = TOP;
|
2010-01-29 14:52:15 +00:00
|
|
|
|
|
|
|
switch (align) {
|
2010-02-18 08:28:46 +00:00
|
|
|
case 0: v = TOP; break;
|
|
|
|
case 1: v = MIDDLE; break;
|
|
|
|
case 2: v = BOTTOM; break;
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
Tabular::Feature num = Tabular::VALIGN_MIDDLE;
|
|
|
|
Tabular::Feature multi_num = Tabular::M_VALIGN_MIDDLE;
|
2007-04-24 17:46:08 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
switch (v) {
|
|
|
|
case TOP:
|
|
|
|
num = Tabular::VALIGN_TOP;
|
|
|
|
multi_num = Tabular::M_VALIGN_TOP;
|
|
|
|
break;
|
|
|
|
case MIDDLE:
|
|
|
|
num = Tabular::VALIGN_MIDDLE;
|
|
|
|
multi_num = Tabular::M_VALIGN_MIDDLE;
|
|
|
|
break;
|
|
|
|
case BOTTOM:
|
|
|
|
num = Tabular::VALIGN_BOTTOM;
|
|
|
|
multi_num = Tabular::M_VALIGN_BOTTOM;
|
|
|
|
break;
|
2010-01-29 14:52:15 +00:00
|
|
|
}
|
2010-02-18 08:28:46 +00:00
|
|
|
if (multicolumnCB->isChecked() || multirowCB->isChecked())
|
|
|
|
setParam(param_str, multi_num);
|
|
|
|
else
|
|
|
|
setParam(param_str, num);
|
2010-01-29 14:52:15 +00:00
|
|
|
}
|
2007-04-24 17:46:08 +00:00
|
|
|
|
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
void GuiTabular::setTableAlignment(string & param_str) const
|
2010-01-29 14:52:15 +00:00
|
|
|
{
|
2011-02-04 13:11:48 +00:00
|
|
|
int const align = TableAlignCO->currentIndex();
|
2010-01-29 14:52:15 +00:00
|
|
|
switch (align) {
|
2010-02-18 08:28:46 +00:00
|
|
|
case 0: setParam(param_str, Tabular::TABULAR_VALIGN_TOP);
|
2010-01-29 14:44:21 +00:00
|
|
|
break;
|
2010-02-18 08:28:46 +00:00
|
|
|
case 1: setParam(param_str, Tabular::TABULAR_VALIGN_MIDDLE);
|
2010-01-29 14:44:21 +00:00
|
|
|
break;
|
2010-02-18 08:28:46 +00:00
|
|
|
case 2: setParam(param_str, Tabular::TABULAR_VALIGN_BOTTOM);
|
2009-07-11 13:09:45 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-01-29 14:52:15 +00:00
|
|
|
}
|
2007-04-24 17:46:08 +00:00
|
|
|
|
2008-05-04 07:51:50 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
docstring GuiTabular::dialogToParams() const
|
2010-01-29 14:52:15 +00:00
|
|
|
{
|
2010-02-18 08:28:46 +00:00
|
|
|
// FIXME: We should use Tabular directly.
|
2011-02-16 23:09:29 +00:00
|
|
|
string param_str = "tabular from-dialog";
|
2010-11-20 07:57:35 +00:00
|
|
|
|
2011-02-03 23:11:26 +00:00
|
|
|
// table width
|
2011-02-04 13:11:48 +00:00
|
|
|
string tabwidth = widgetsToLength(tabularWidthED, tabularWidthUnitLC);
|
2011-02-03 23:11:26 +00:00
|
|
|
if (tabwidth.empty())
|
|
|
|
tabwidth = "0pt";
|
|
|
|
setParam(param_str, Tabular::SET_TABULAR_WIDTH, tabwidth);
|
|
|
|
|
2010-11-20 07:57:35 +00:00
|
|
|
// apply the fixed width values
|
|
|
|
// this must be done before applying the column alignment
|
|
|
|
// because its value influences the alignment of multirow cells
|
2011-02-04 13:11:48 +00:00
|
|
|
string width = widgetsToLength(columnWidthED, columnWidthUnitLC);
|
2010-11-20 07:57:35 +00:00
|
|
|
if (width.empty())
|
|
|
|
width = "0pt";
|
|
|
|
if (multicolumnCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_MPWIDTH, width);
|
|
|
|
else
|
|
|
|
setParam(param_str, Tabular::SET_PWIDTH, width);
|
|
|
|
|
|
|
|
// apply the column alignment
|
2010-02-18 08:28:46 +00:00
|
|
|
setHAlign(param_str);
|
2010-06-05 07:44:44 +00:00
|
|
|
|
|
|
|
// SET_DECIMAL_POINT must come after setHAlign() (ALIGN_DECIMAL)
|
2011-02-04 13:11:48 +00:00
|
|
|
string decimal_point = fromqstr(decimalPointED->text());
|
2010-06-05 07:44:44 +00:00
|
|
|
if (decimal_point.empty())
|
|
|
|
decimal_point = lyxrc.default_decimal_point;
|
|
|
|
setParam(param_str, Tabular::SET_DECIMAL_POINT, decimal_point);
|
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
setVAlign(param_str);
|
|
|
|
setTableAlignment(param_str);
|
|
|
|
//
|
|
|
|
if (booktabsRB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_BOOKTABS);
|
|
|
|
else
|
|
|
|
setParam(param_str, Tabular::UNSET_BOOKTABS);
|
2010-01-29 14:52:15 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
//
|
|
|
|
switch (topspaceCO->currentIndex()) {
|
|
|
|
case 0:
|
|
|
|
setParam(param_str, Tabular::SET_TOP_SPACE, "none");
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
setParam(param_str, Tabular::SET_TOP_SPACE, "default");
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (!topspaceED->text().isEmpty())
|
|
|
|
setParam(param_str, Tabular::SET_TOP_SPACE,
|
2011-02-04 13:11:48 +00:00
|
|
|
widgetsToLength(topspaceED, topspaceUnitLC));
|
2010-02-18 08:28:46 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-01-29 14:52:15 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
//
|
|
|
|
switch (bottomspaceCO->currentIndex()) {
|
|
|
|
case 0:
|
|
|
|
setParam(param_str, Tabular::SET_BOTTOM_SPACE, "none");
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
setParam(param_str, Tabular::SET_BOTTOM_SPACE, "default");
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (!bottomspaceED->text().isEmpty())
|
|
|
|
setParam(param_str, Tabular::SET_BOTTOM_SPACE,
|
|
|
|
widgetsToLength(bottomspaceED,
|
2011-02-04 13:11:48 +00:00
|
|
|
bottomspaceUnitLC));
|
2010-02-18 08:28:46 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-01-29 14:52:15 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
//
|
|
|
|
switch (interlinespaceCO->currentIndex()) {
|
|
|
|
case 0:
|
|
|
|
setParam(param_str, Tabular::SET_INTERLINE_SPACE, "none");
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
setParam(param_str, Tabular::SET_INTERLINE_SPACE, "default");
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (!interlinespaceED->text().isEmpty())
|
|
|
|
setParam(param_str, Tabular::SET_INTERLINE_SPACE,
|
|
|
|
widgetsToLength(interlinespaceED,
|
2011-02-04 13:11:48 +00:00
|
|
|
interlinespaceUnitLC));
|
2010-02-18 08:28:46 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-05-04 07:51:50 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
//
|
|
|
|
if (borders->getTop() && borders->getBottom() && borders->getLeft()
|
|
|
|
&& borders->getRight())
|
|
|
|
setParam(param_str, Tabular::SET_ALL_LINES);
|
|
|
|
else if (!borders->getTop() && !borders->getBottom() && !borders->getLeft()
|
|
|
|
&& !borders->getRight())
|
|
|
|
setParam(param_str, Tabular::UNSET_ALL_LINES);
|
2010-02-19 08:20:58 +00:00
|
|
|
else {
|
2010-02-19 10:03:03 +00:00
|
|
|
setParam(param_str, Tabular::SET_LINE_LEFT,
|
|
|
|
borders->getLeft() ? "true" : "false");
|
|
|
|
setParam(param_str, Tabular::SET_LINE_RIGHT,
|
|
|
|
borders->getRight() ? "true" : "false");
|
|
|
|
setParam(param_str, Tabular::SET_LINE_TOP,
|
|
|
|
borders->getTop() ? "true" : "false");
|
|
|
|
setParam(param_str, Tabular::SET_LINE_BOTTOM,
|
|
|
|
borders->getBottom() ? "true" : "false");
|
2010-02-19 08:20:58 +00:00
|
|
|
}
|
2010-01-29 14:52:15 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
// apply the special alignment
|
|
|
|
string special = fromqstr(specialAlignmentED->text());
|
|
|
|
if (special.empty())
|
|
|
|
special = "none";
|
|
|
|
if (multicolumnCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_SPECIAL_MULTICOLUMN, special);
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::SET_SPECIAL_COLUMN, special);
|
2010-01-29 14:52:15 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
//
|
|
|
|
if (multicolumnCB->isChecked())
|
2010-10-29 04:09:49 +00:00
|
|
|
setParam(param_str, Tabular::SET_MULTICOLUMN);
|
|
|
|
else
|
|
|
|
setParam(param_str, Tabular::UNSET_MULTICOLUMN);
|
2010-11-07 05:32:28 +00:00
|
|
|
|
|
|
|
// apply the multirow offset
|
2011-02-04 13:11:48 +00:00
|
|
|
string mroffset = widgetsToLength(multirowOffsetED, multirowOffsetUnitLC);
|
2010-11-07 05:32:28 +00:00
|
|
|
if (mroffset.empty())
|
|
|
|
mroffset = "0pt";
|
|
|
|
if (multirowCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_MROFFSET, mroffset);
|
2010-02-18 08:28:46 +00:00
|
|
|
//
|
|
|
|
if (multirowCB->isChecked())
|
2010-10-29 04:09:49 +00:00
|
|
|
setParam(param_str, Tabular::SET_MULTIROW);
|
|
|
|
else
|
|
|
|
setParam(param_str, Tabular::UNSET_MULTIROW);
|
2010-02-18 08:28:46 +00:00
|
|
|
//
|
|
|
|
if (rotateTabularCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_ROTATE_TABULAR);
|
|
|
|
else
|
|
|
|
setParam(param_str, Tabular::UNSET_ROTATE_TABULAR);
|
|
|
|
//
|
|
|
|
if (rotateCellCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_ROTATE_CELL);
|
|
|
|
else
|
|
|
|
setParam(param_str, Tabular::UNSET_ROTATE_CELL);
|
|
|
|
//
|
|
|
|
if (longTabularCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_LONGTABULAR);
|
|
|
|
else
|
|
|
|
setParam(param_str, Tabular::UNSET_LONGTABULAR);
|
|
|
|
//
|
|
|
|
if (newpageCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_LTNEWPAGE);
|
|
|
|
//
|
|
|
|
if (captionStatusCB->isChecked())
|
2010-10-29 04:09:49 +00:00
|
|
|
setParam(param_str, Tabular::SET_LTCAPTION);
|
|
|
|
else
|
|
|
|
setParam(param_str, Tabular::UNSET_LTCAPTION);
|
2010-02-18 08:28:46 +00:00
|
|
|
//
|
|
|
|
if (headerStatusCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_LTHEAD, "none");
|
|
|
|
else
|
|
|
|
setParam(param_str, Tabular::UNSET_LTHEAD, "none");
|
|
|
|
//
|
2010-01-29 14:44:21 +00:00
|
|
|
if (headerBorderAboveCB->isChecked())
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::SET_LTHEAD, "dl_above");
|
2010-01-29 14:44:21 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTHEAD, "dl_above");
|
|
|
|
//
|
2007-04-24 17:46:08 +00:00
|
|
|
if (headerBorderBelowCB->isChecked())
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::SET_LTHEAD, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTHEAD, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
if (firstheaderBorderAboveCB->isChecked())
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::SET_LTFIRSTHEAD, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTFIRSTHEAD, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
if (firstheaderBorderBelowCB->isChecked())
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::SET_LTFIRSTHEAD, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTFIRSTHEAD, "dl_below");
|
|
|
|
if (firstheaderStatusCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_LTFIRSTHEAD, "none");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTFIRSTHEAD, "none");
|
|
|
|
if (firstheaderNoContentsCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_LTFIRSTHEAD, "empty");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTFIRSTHEAD, "empty");
|
|
|
|
if (footerStatusCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_LTFOOT, "none");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTFOOT, "none");
|
2007-04-24 17:46:08 +00:00
|
|
|
if (footerBorderAboveCB->isChecked())
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::SET_LTFOOT, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTFOOT, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
if (footerBorderBelowCB->isChecked())
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::SET_LTFOOT, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTFOOT, "dl_below");
|
|
|
|
if (lastfooterStatusCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_LTLASTFOOT, "none");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTLASTFOOT, "none");
|
2007-04-24 17:46:08 +00:00
|
|
|
if (lastfooterBorderAboveCB->isChecked())
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::SET_LTLASTFOOT, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTLASTFOOT, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
if (lastfooterBorderBelowCB->isChecked())
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::SET_LTLASTFOOT, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTLASTFOOT, "dl_below");
|
|
|
|
if (lastfooterNoContentsCB->isChecked())
|
|
|
|
setParam(param_str, Tabular::SET_LTLASTFOOT, "empty");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::UNSET_LTLASTFOOT, "empty");
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2009-07-11 13:09:45 +00:00
|
|
|
if (leftRB->isChecked())
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::LONGTABULAR_ALIGN_LEFT);
|
2009-07-11 13:09:45 +00:00
|
|
|
else if (centerRB->isChecked())
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::LONGTABULAR_ALIGN_CENTER);
|
2009-07-11 13:09:45 +00:00
|
|
|
else if (rightRB->isChecked())
|
2010-02-18 08:28:46 +00:00
|
|
|
setParam(param_str, Tabular::LONGTABULAR_ALIGN_RIGHT);
|
2009-07-11 13:09:45 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
return from_utf8(param_str);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
static Length getColumnPWidth(Tabular const & t, size_t cell)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2010-01-29 14:52:15 +00:00
|
|
|
return t.column_info[t.cellColumn(cell)].p_width;
|
|
|
|
}
|
2010-01-29 14:44:21 +00:00
|
|
|
|
2010-01-29 14:52:15 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
static Length getMColumnPWidth(Tabular const & t, size_t cell)
|
2010-01-29 14:52:15 +00:00
|
|
|
{
|
2010-02-11 01:07:54 +00:00
|
|
|
if (t.isMultiColumn(cell) || t.isMultiRow(cell))
|
2010-01-29 14:52:15 +00:00
|
|
|
return t.cellInfo(cell).p_width;
|
|
|
|
return Length();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-07 05:32:28 +00:00
|
|
|
static Length getMROffset(Tabular const & t, size_t cell)
|
|
|
|
{
|
|
|
|
if (t.isMultiRow(cell))
|
|
|
|
return t.cellInfo(cell).mroffset;
|
|
|
|
return Length();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
static docstring getAlignSpecial(Tabular const & t, size_t cell, int what)
|
2010-01-29 14:52:15 +00:00
|
|
|
{
|
2010-10-30 16:36:08 +00:00
|
|
|
if (what == Tabular::SET_SPECIAL_MULTICOLUMN)
|
2010-01-29 14:52:15 +00:00
|
|
|
return t.cellInfo(cell).align_special;
|
|
|
|
return t.column_info[t.cellColumn(cell)].align_special;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
void GuiTabular::paramsToDialog(Inset const * inset)
|
2010-01-29 14:52:15 +00:00
|
|
|
{
|
2010-02-18 08:28:46 +00:00
|
|
|
InsetTabular const * itab = static_cast<InsetTabular const *>(inset);
|
|
|
|
// Copy Tabular of current inset.
|
|
|
|
Tabular const & tabular = itab->tabular;
|
2010-02-11 10:38:41 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
BufferView const * bv = guiApp->currentView()->currentBufferView();
|
|
|
|
size_t const cell = bv->cursor().idx();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2010-02-11 10:38:41 +00:00
|
|
|
Tabular::row_type const row = tabular.cellRow(cell);
|
|
|
|
Tabular::col_type const col = tabular.cellColumn(cell);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-11 21:27:57 +00:00
|
|
|
tabularRowED->setText(QString::number(row + 1));
|
|
|
|
tabularColumnED->setText(QString::number(col + 1));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
bool const multicol = tabular.isMultiColumn(cell);
|
2007-09-05 20:33:29 +00:00
|
|
|
multicolumnCB->setChecked(multicol);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2010-02-18 08:28:46 +00:00
|
|
|
bool const multirow = tabular.isMultiRow(cell);
|
2010-02-11 01:07:54 +00:00
|
|
|
multirowCB->setChecked(multirow);
|
|
|
|
|
2010-02-11 10:38:41 +00:00
|
|
|
rotateCellCB->setChecked(tabular.getRotateCell(cell));
|
|
|
|
rotateTabularCB->setChecked(tabular.rotate);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2010-02-11 10:38:41 +00:00
|
|
|
longTabularCB->setChecked(tabular.is_long_tabular);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2010-02-19 10:03:03 +00:00
|
|
|
borders->setTop(tabular.topLine(cell));
|
|
|
|
borders->setBottom(tabular.bottomLine(cell));
|
|
|
|
borders->setLeft(tabular.leftLine(cell));
|
|
|
|
borders->setRight(tabular.rightLine(cell));
|
2010-02-18 08:28:46 +00:00
|
|
|
// repaint the setborder widget
|
|
|
|
borders->update();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2010-02-19 10:25:20 +00:00
|
|
|
Length::UNIT const default_unit = Length::defaultUnit();
|
|
|
|
|
|
|
|
///////////////////////////////////
|
|
|
|
// Set width and alignment
|
2011-02-03 23:11:26 +00:00
|
|
|
|
|
|
|
Length const tabwidth = tabular.tabularWidth();
|
|
|
|
if (tabwidth.zero())
|
|
|
|
tabularWidthED->clear();
|
|
|
|
else
|
2011-02-04 13:11:48 +00:00
|
|
|
lengthToWidgets(tabularWidthED, tabularWidthUnitLC,
|
2011-02-03 23:11:26 +00:00
|
|
|
tabwidth.asString(), default_unit);
|
|
|
|
|
2007-04-28 12:58:49 +00:00
|
|
|
Length pwidth;
|
2007-01-05 17:11:32 +00:00
|
|
|
docstring special;
|
2006-03-05 17:24:44 +00:00
|
|
|
if (multicol) {
|
2010-02-11 10:38:41 +00:00
|
|
|
special = getAlignSpecial(tabular, cell,
|
2010-02-11 01:07:54 +00:00
|
|
|
Tabular::SET_SPECIAL_MULTICOLUMN);
|
2010-02-11 10:38:41 +00:00
|
|
|
pwidth = getMColumnPWidth(tabular, cell);
|
2010-10-30 19:00:23 +00:00
|
|
|
} else {
|
2010-02-11 10:38:41 +00:00
|
|
|
special = getAlignSpecial(tabular, cell,
|
2009-05-17 09:36:07 +00:00
|
|
|
Tabular::SET_SPECIAL_COLUMN);
|
2010-02-11 10:38:41 +00:00
|
|
|
pwidth = getColumnPWidth(tabular, cell);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
2010-02-19 10:25:20 +00:00
|
|
|
string colwidth;
|
|
|
|
if (pwidth.zero())
|
2011-02-04 13:11:48 +00:00
|
|
|
columnWidthED->clear();
|
2010-02-19 10:25:20 +00:00
|
|
|
else {
|
|
|
|
colwidth = pwidth.asString();
|
2011-02-04 13:11:48 +00:00
|
|
|
lengthToWidgets(columnWidthED, columnWidthUnitLC,
|
2010-02-19 10:25:20 +00:00
|
|
|
colwidth, default_unit);
|
|
|
|
}
|
2010-11-07 05:32:28 +00:00
|
|
|
Length mroffset;
|
|
|
|
if (multirow)
|
|
|
|
mroffset = getMROffset(tabular, cell);
|
|
|
|
string offset;
|
|
|
|
if (mroffset.zero())
|
|
|
|
multirowOffsetED->clear();
|
|
|
|
else {
|
|
|
|
offset = mroffset.asString();
|
2011-02-04 13:11:48 +00:00
|
|
|
lengthToWidgets(multirowOffsetED, multirowOffsetUnitLC,
|
2010-11-07 05:32:28 +00:00
|
|
|
offset, default_unit);
|
|
|
|
}
|
2007-09-05 20:33:29 +00:00
|
|
|
specialAlignmentED->setText(toqstr(special));
|
2010-02-19 10:25:20 +00:00
|
|
|
///////////////////////////////////
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
2010-02-11 10:38:41 +00:00
|
|
|
borderDefaultRB->setChecked(!tabular.use_booktabs);
|
|
|
|
booktabsRB->setChecked(tabular.use_booktabs);
|
2006-07-03 19:13:56 +00:00
|
|
|
|
2010-02-11 10:38:41 +00:00
|
|
|
if (tabular.row_info[row].top_space.empty()
|
|
|
|
&& !tabular.row_info[row].top_space_default) {
|
2007-09-05 20:33:29 +00:00
|
|
|
topspaceCO->setCurrentIndex(0);
|
2010-02-11 10:38:41 +00:00
|
|
|
} else if (tabular.row_info[row].top_space_default) {
|
2007-09-05 20:33:29 +00:00
|
|
|
topspaceCO->setCurrentIndex(1);
|
2006-07-03 19:13:56 +00:00
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
topspaceCO->setCurrentIndex(2);
|
|
|
|
lengthToWidgets(topspaceED,
|
2011-02-04 13:11:48 +00:00
|
|
|
topspaceUnitLC,
|
2010-02-11 10:38:41 +00:00
|
|
|
tabular.row_info[row].top_space.asString(),
|
2006-07-03 19:13:56 +00:00
|
|
|
default_unit);
|
|
|
|
}
|
|
|
|
|
2010-02-11 10:38:41 +00:00
|
|
|
if (tabular.row_info[row].bottom_space.empty()
|
|
|
|
&& !tabular.row_info[row].bottom_space_default) {
|
2007-09-05 20:33:29 +00:00
|
|
|
bottomspaceCO->setCurrentIndex(0);
|
2010-02-11 10:38:41 +00:00
|
|
|
} else if (tabular.row_info[row].bottom_space_default) {
|
2007-09-05 20:33:29 +00:00
|
|
|
bottomspaceCO->setCurrentIndex(1);
|
2006-07-03 19:13:56 +00:00
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
bottomspaceCO->setCurrentIndex(2);
|
|
|
|
lengthToWidgets(bottomspaceED,
|
2011-02-04 13:11:48 +00:00
|
|
|
bottomspaceUnitLC,
|
2010-02-11 10:38:41 +00:00
|
|
|
tabular.row_info[row].bottom_space.asString(),
|
2006-07-03 19:13:56 +00:00
|
|
|
default_unit);
|
|
|
|
}
|
|
|
|
|
2010-02-11 10:38:41 +00:00
|
|
|
if (tabular.row_info[row].interline_space.empty()
|
|
|
|
&& !tabular.row_info[row].interline_space_default) {
|
2007-09-05 20:33:29 +00:00
|
|
|
interlinespaceCO->setCurrentIndex(0);
|
2010-02-11 10:38:41 +00:00
|
|
|
} else if (tabular.row_info[row].interline_space_default) {
|
2007-09-05 20:33:29 +00:00
|
|
|
interlinespaceCO->setCurrentIndex(1);
|
2006-07-03 19:13:56 +00:00
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
interlinespaceCO->setCurrentIndex(2);
|
|
|
|
lengthToWidgets(interlinespaceED,
|
2011-02-04 13:11:48 +00:00
|
|
|
interlinespaceUnitLC,
|
2010-02-11 10:38:41 +00:00
|
|
|
tabular.row_info[row].interline_space.asString(),
|
2006-07-03 19:13:56 +00:00
|
|
|
default_unit);
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2011-02-04 13:11:48 +00:00
|
|
|
hAlignCO->clear();
|
|
|
|
hAlignCO->addItem(qt_("Left"), toqstr("left"));
|
|
|
|
hAlignCO->addItem(qt_("Center"), toqstr("center"));
|
|
|
|
hAlignCO->addItem(qt_("Right"), toqstr("right"));
|
2006-03-05 17:24:44 +00:00
|
|
|
if (!multicol && !pwidth.zero())
|
2011-02-04 13:11:48 +00:00
|
|
|
hAlignCO->addItem(qt_("Justified"), toqstr("justified"));
|
2010-06-05 07:44:44 +00:00
|
|
|
if (!multicol)
|
2011-02-04 13:11:48 +00:00
|
|
|
hAlignCO->addItem(qt_("At Decimal Separator"), toqstr("decimal"));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2010-08-14 15:10:53 +00:00
|
|
|
string align;
|
2010-02-11 10:38:41 +00:00
|
|
|
switch (tabular.getAlignment(cell)) {
|
2010-06-05 07:44:44 +00:00
|
|
|
case LYX_ALIGN_LEFT:
|
2010-08-14 15:10:53 +00:00
|
|
|
align = "left";
|
2010-06-05 07:44:44 +00:00
|
|
|
break;
|
|
|
|
case LYX_ALIGN_CENTER:
|
2010-08-14 15:10:53 +00:00
|
|
|
align = "center";
|
2010-06-05 07:44:44 +00:00
|
|
|
break;
|
|
|
|
case LYX_ALIGN_RIGHT:
|
2010-08-14 15:10:53 +00:00
|
|
|
align = "right";
|
2010-06-05 07:44:44 +00:00
|
|
|
break;
|
|
|
|
case LYX_ALIGN_BLOCK:
|
|
|
|
{
|
|
|
|
if (!multicol && !pwidth.zero())
|
2010-08-14 15:10:53 +00:00
|
|
|
align = "justified";
|
2010-06-05 07:44:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case LYX_ALIGN_DECIMAL:
|
|
|
|
{
|
|
|
|
if (!multicol)
|
2010-08-14 15:10:53 +00:00
|
|
|
align = "decimal";
|
2010-06-05 07:44:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
// we should never end up here
|
|
|
|
break;
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
2011-02-04 13:11:48 +00:00
|
|
|
hAlignCO->setCurrentIndex(hAlignCO->findData(toqstr(align)));
|
2010-06-05 07:44:44 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
QString decimal_point = toqstr(tabular.column_info[col].decimal_point);
|
|
|
|
if (decimal_point.isEmpty())
|
|
|
|
decimal_point = toqstr(from_utf8(lyxrc.default_decimal_point));
|
2011-02-04 13:11:48 +00:00
|
|
|
decimalPointED->setText(decimal_point);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
int valign = 0;
|
2010-02-11 10:38:41 +00:00
|
|
|
switch (tabular.getVAlignment(cell)) {
|
2007-04-26 13:39:14 +00:00
|
|
|
case Tabular::LYX_VALIGN_TOP:
|
2006-03-05 17:24:44 +00:00
|
|
|
valign = 0;
|
|
|
|
break;
|
2007-04-26 13:39:14 +00:00
|
|
|
case Tabular::LYX_VALIGN_MIDDLE:
|
2006-03-05 17:24:44 +00:00
|
|
|
valign = 1;
|
|
|
|
break;
|
2007-04-26 13:39:14 +00:00
|
|
|
case Tabular::LYX_VALIGN_BOTTOM:
|
2006-03-05 17:24:44 +00:00
|
|
|
valign = 2;
|
|
|
|
break;
|
|
|
|
default:
|
2008-11-17 11:58:14 +00:00
|
|
|
valign = 0;
|
2006-03-05 17:24:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (pwidth.zero())
|
2008-11-17 11:58:14 +00:00
|
|
|
valign = 0;
|
2011-02-04 13:11:48 +00:00
|
|
|
vAlignCO->setCurrentIndex(valign);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2009-07-11 14:33:05 +00:00
|
|
|
int tableValign = 1;
|
2010-02-11 10:38:41 +00:00
|
|
|
switch (tabular.tabular_valignment) {
|
2009-07-11 13:09:45 +00:00
|
|
|
case Tabular::LYX_VALIGN_TOP:
|
|
|
|
tableValign = 0;
|
|
|
|
break;
|
|
|
|
case Tabular::LYX_VALIGN_MIDDLE:
|
|
|
|
tableValign = 1;
|
|
|
|
break;
|
|
|
|
case Tabular::LYX_VALIGN_BOTTOM:
|
|
|
|
tableValign = 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
tableValign = 0;
|
|
|
|
break;
|
|
|
|
}
|
2011-02-04 13:11:48 +00:00
|
|
|
TableAlignCO->setCurrentIndex(tableValign);
|
2009-07-11 13:09:45 +00:00
|
|
|
|
2010-02-11 10:38:41 +00:00
|
|
|
if (!tabular.is_long_tabular) {
|
2007-09-05 20:33:29 +00:00
|
|
|
headerStatusCB->setChecked(false);
|
|
|
|
headerBorderAboveCB->setChecked(false);
|
|
|
|
headerBorderBelowCB->setChecked(false);
|
|
|
|
firstheaderStatusCB->setChecked(false);
|
|
|
|
firstheaderBorderAboveCB->setChecked(false);
|
|
|
|
firstheaderBorderBelowCB->setChecked(false);
|
|
|
|
firstheaderNoContentsCB->setChecked(false);
|
|
|
|
footerStatusCB->setChecked(false);
|
|
|
|
footerBorderAboveCB->setChecked(false);
|
|
|
|
footerBorderBelowCB->setChecked(false);
|
|
|
|
lastfooterStatusCB->setChecked(false);
|
|
|
|
lastfooterBorderAboveCB->setChecked(false);
|
|
|
|
lastfooterBorderBelowCB->setChecked(false);
|
|
|
|
lastfooterNoContentsCB->setChecked(false);
|
|
|
|
newpageCB->setChecked(false);
|
2008-05-04 07:51:50 +00:00
|
|
|
captionStatusCB->blockSignals(true);
|
|
|
|
captionStatusCB->setChecked(false);
|
|
|
|
captionStatusCB->blockSignals(false);
|
2010-06-05 07:44:44 +00:00
|
|
|
checkEnabled();
|
2006-03-05 17:24:44 +00:00
|
|
|
return;
|
2010-02-18 08:28:46 +00:00
|
|
|
} else {
|
2009-07-11 14:33:05 +00:00
|
|
|
// longtables cannot have a vertical alignment
|
2011-02-04 13:11:48 +00:00
|
|
|
TableAlignCO->setCurrentIndex(Tabular::LYX_VALIGN_MIDDLE);
|
2010-02-18 08:28:46 +00:00
|
|
|
}
|
2010-02-11 10:38:41 +00:00
|
|
|
switch (tabular.longtabular_alignment) {
|
2009-07-11 13:09:45 +00:00
|
|
|
case Tabular::LYX_LONGTABULAR_ALIGN_LEFT:
|
|
|
|
leftRB->setChecked(true);
|
|
|
|
break;
|
|
|
|
case Tabular::LYX_LONGTABULAR_ALIGN_CENTER:
|
|
|
|
centerRB->setChecked(true);
|
|
|
|
break;
|
|
|
|
case Tabular::LYX_LONGTABULAR_ALIGN_RIGHT:
|
|
|
|
rightRB->setChecked(true);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
centerRB->setChecked(true);
|
|
|
|
break;
|
|
|
|
}
|
2008-05-04 07:51:50 +00:00
|
|
|
captionStatusCB->blockSignals(true);
|
2010-02-11 10:38:41 +00:00
|
|
|
captionStatusCB->setChecked(tabular.ltCaption(row));
|
2008-05-04 07:51:50 +00:00
|
|
|
captionStatusCB->blockSignals(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-04-26 13:39:14 +00:00
|
|
|
Tabular::ltType ltt;
|
2006-03-05 17:24:44 +00:00
|
|
|
bool use_empty;
|
2010-02-11 10:38:41 +00:00
|
|
|
bool row_set = tabular.getRowOfLTHead(row, ltt);
|
2007-09-05 20:33:29 +00:00
|
|
|
headerStatusCB->setChecked(row_set);
|
2006-03-05 17:24:44 +00:00
|
|
|
if (ltt.set) {
|
2007-09-05 20:33:29 +00:00
|
|
|
headerBorderAboveCB->setChecked(ltt.topDL);
|
|
|
|
headerBorderBelowCB->setChecked(ltt.bottomDL);
|
2006-03-05 17:24:44 +00:00
|
|
|
use_empty = true;
|
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
headerBorderAboveCB->setChecked(false);
|
|
|
|
headerBorderBelowCB->setChecked(false);
|
|
|
|
firstheaderNoContentsCB->setChecked(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
use_empty = false;
|
|
|
|
}
|
|
|
|
|
2010-02-11 10:38:41 +00:00
|
|
|
row_set = tabular.getRowOfLTFirstHead(row, ltt);
|
2007-09-05 20:33:29 +00:00
|
|
|
firstheaderStatusCB->setChecked(row_set);
|
2006-03-05 17:24:44 +00:00
|
|
|
if (ltt.set && (!ltt.empty || !use_empty)) {
|
2007-09-05 20:33:29 +00:00
|
|
|
firstheaderBorderAboveCB->setChecked(ltt.topDL);
|
|
|
|
firstheaderBorderBelowCB->setChecked(ltt.bottomDL);
|
2006-03-05 17:24:44 +00:00
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
firstheaderBorderAboveCB->setChecked(false);
|
|
|
|
firstheaderBorderBelowCB->setChecked(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
2010-02-11 10:38:41 +00:00
|
|
|
row_set = tabular.getRowOfLTFoot(row, ltt);
|
2007-09-05 20:33:29 +00:00
|
|
|
footerStatusCB->setChecked(row_set);
|
2006-03-05 17:24:44 +00:00
|
|
|
if (ltt.set) {
|
2007-09-05 20:33:29 +00:00
|
|
|
footerBorderAboveCB->setChecked(ltt.topDL);
|
|
|
|
footerBorderBelowCB->setChecked(ltt.bottomDL);
|
2006-03-05 17:24:44 +00:00
|
|
|
use_empty = true;
|
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
footerBorderAboveCB->setChecked(false);
|
|
|
|
footerBorderBelowCB->setChecked(false);
|
|
|
|
lastfooterNoContentsCB->setChecked(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
use_empty = false;
|
|
|
|
}
|
|
|
|
|
2010-02-11 10:38:41 +00:00
|
|
|
row_set = tabular.getRowOfLTLastFoot(row, ltt);
|
2009-02-09 00:06:32 +00:00
|
|
|
lastfooterStatusCB->setChecked(row_set);
|
2006-03-05 17:24:44 +00:00
|
|
|
if (ltt.set && (!ltt.empty || !use_empty)) {
|
2007-09-05 20:33:29 +00:00
|
|
|
lastfooterBorderAboveCB->setChecked(ltt.topDL);
|
|
|
|
lastfooterBorderBelowCB->setChecked(ltt.bottomDL);
|
2006-03-05 17:24:44 +00:00
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
lastfooterBorderAboveCB->setChecked(false);
|
|
|
|
lastfooterBorderBelowCB->setChecked(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
2010-02-11 10:38:41 +00:00
|
|
|
newpageCB->setChecked(tabular.getLTNewPage(row));
|
2010-11-01 21:20:27 +00:00
|
|
|
|
2010-11-02 13:35:16 +00:00
|
|
|
// first header can only be suppressed when there is a header
|
|
|
|
firstheader_suppressable_ = tabular.haveLTHead()
|
|
|
|
&& !tabular.haveLTFirstHead();
|
|
|
|
// last footer can only be suppressed when there is a footer
|
|
|
|
lastfooter_suppressable_ = tabular.haveLTFoot()
|
|
|
|
&& !tabular.haveLTLastFoot();
|
|
|
|
|
2010-11-01 21:20:27 +00:00
|
|
|
// after setting the features, check if they are enabled
|
2010-11-01 21:00:03 +00:00
|
|
|
checkEnabled();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-25 06:25:07 +00:00
|
|
|
bool GuiTabular::funcEnabled(Tabular::Feature f) const
|
|
|
|
{
|
|
|
|
string cmd = "tabular " + featureAsString(f);
|
|
|
|
return getStatus(FuncRequest(LFUN_INSET_MODIFY, cmd)).enabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-24 17:46:08 +00:00
|
|
|
|
2008-11-14 14:28:50 +00:00
|
|
|
#include "moc_GuiTabular.cpp"
|