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
|
|
|
|
|
* \author J<EFBFBD>rgen Spitzm<EFBFBD>ller
|
|
|
|
|
* \author Herbert Vo<EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
#include "ControlTabular.h"
|
2007-08-31 22:16:11 +00:00
|
|
|
|
#include "GuiSetBorder.h"
|
2007-04-26 03:53:02 +00:00
|
|
|
|
#include "LengthCombo.h"
|
|
|
|
|
#include "Validator.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
|
|
|
|
#include "support/convert.h"
|
|
|
|
|
|
2007-04-24 17:46:08 +00:00
|
|
|
|
#include <QCloseEvent>
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QRadioButton>
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
using std::string;
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
GuiTabularDialog::GuiTabularDialog(LyXView & lv)
|
|
|
|
|
: GuiDialog(lv, "tabular")
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
setupUi(this);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
setViewTitle(_("Table Settings"));
|
|
|
|
|
setController(new ControlTabular(*this));
|
2007-04-24 17:46:08 +00:00
|
|
|
|
|
|
|
|
|
widthED->setValidator(unsignedLengthValidator(widthED));
|
|
|
|
|
topspaceED->setValidator(new LengthValidator(topspaceED));
|
|
|
|
|
bottomspaceED->setValidator(new LengthValidator(bottomspaceED));
|
|
|
|
|
interlinespaceED->setValidator(new LengthValidator(interlinespaceED));
|
|
|
|
|
|
|
|
|
|
connect(topspaceED, SIGNAL(returnPressed()),
|
2007-05-28 22:27:45 +00:00
|
|
|
|
this, SLOT(topspace_changed()));
|
2007-04-28 12:58:49 +00:00
|
|
|
|
connect(topspaceUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
2007-05-28 22:27:45 +00:00
|
|
|
|
this, SLOT(topspace_changed()));
|
2007-04-24 17:46:08 +00:00
|
|
|
|
connect(topspaceCO, SIGNAL(activated(int)), this, SLOT(topspace_changed()));
|
|
|
|
|
connect(bottomspaceED, SIGNAL(returnPressed()),
|
2007-05-28 22:27:45 +00:00
|
|
|
|
this, SLOT(bottomspace_changed()));
|
2007-04-28 12:58:49 +00:00
|
|
|
|
connect(bottomspaceUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
2007-05-28 22:27:45 +00:00
|
|
|
|
this, SLOT(bottomspace_changed()));
|
2007-04-24 17:46:08 +00:00
|
|
|
|
connect(bottomspaceCO, SIGNAL(activated(int)), this, SLOT(bottomspace_changed()));
|
|
|
|
|
connect(interlinespaceED, SIGNAL(returnPressed()),
|
2007-05-28 22:27:45 +00:00
|
|
|
|
this, SLOT(interlinespace_changed()));
|
2007-04-28 12:58:49 +00:00
|
|
|
|
connect(interlinespaceUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
2007-05-28 22:27:45 +00:00
|
|
|
|
this, SLOT(interlinespace_changed()));
|
2007-04-24 17:46:08 +00:00
|
|
|
|
connect(interlinespaceCO, SIGNAL(activated(int)), this, SLOT(interlinespace_changed()));
|
|
|
|
|
connect(booktabsRB, SIGNAL(clicked(bool)), this, SLOT(booktabsChanged(bool)));
|
|
|
|
|
connect(borderDefaultRB, SIGNAL(clicked(bool)), this, SLOT(booktabsChanged(bool)));
|
|
|
|
|
connect(borderSetPB, SIGNAL(clicked()), this, SLOT(borderSet_clicked()));
|
|
|
|
|
connect(borderUnsetPB, SIGNAL(clicked()), this, SLOT(borderUnset_clicked()));
|
|
|
|
|
connect(longTabularCB, SIGNAL(toggled(bool)), longtableGB, SLOT(setEnabled(bool)));
|
|
|
|
|
connect(longTabularCB, SIGNAL(toggled(bool)), newpageCB, SLOT(setEnabled(bool)));
|
|
|
|
|
connect(hAlignCB, SIGNAL(activated(int)), this, SLOT(hAlign_changed(int)));
|
|
|
|
|
connect(vAlignCB, SIGNAL(activated(int)), this, SLOT(vAlign_changed(int)));
|
|
|
|
|
connect(multicolumnCB, SIGNAL(clicked()), this, SLOT(multicolumn_clicked()));
|
|
|
|
|
connect(newpageCB, SIGNAL(clicked()), this, SLOT(ltNewpage_clicked()));
|
|
|
|
|
connect(headerStatusCB, SIGNAL(clicked()), this, SLOT(ltHeaderStatus_clicked()));
|
|
|
|
|
connect(headerBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltHeaderBorderAbove_clicked()));
|
|
|
|
|
connect(headerBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltHeaderBorderBelow_clicked()));
|
|
|
|
|
connect(firstheaderStatusCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderStatus_clicked()));
|
|
|
|
|
connect(firstheaderBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderBorderAbove_clicked()));
|
|
|
|
|
connect(firstheaderBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderBorderBelow_clicked()));
|
|
|
|
|
connect(firstheaderNoContentsCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderEmpty_clicked()));
|
|
|
|
|
connect(footerStatusCB, SIGNAL(clicked()), this, SLOT(ltFooterStatus_clicked()));
|
|
|
|
|
connect(footerBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltFooterBorderAbove_clicked()));
|
|
|
|
|
connect(footerBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltFooterBorderBelow_clicked()));
|
|
|
|
|
connect(lastfooterStatusCB, SIGNAL(clicked()), this, SLOT(ltLastFooterStatus_clicked()));
|
|
|
|
|
connect(lastfooterBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltLastFooterBorderAbove_clicked()));
|
|
|
|
|
connect(lastfooterBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltLastFooterBorderBelow_clicked()));
|
|
|
|
|
connect(lastfooterNoContentsCB, SIGNAL(clicked()), this, SLOT(ltLastFooterEmpty_clicked()));
|
|
|
|
|
connect(specialAlignmentED, SIGNAL(returnPressed()), this, SLOT(specialAlignment_changed()));
|
|
|
|
|
connect(widthED, SIGNAL(returnPressed()), this, SLOT(width_changed()));
|
2007-04-28 12:58:49 +00:00
|
|
|
|
connect(widthUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)), this, SLOT(width_changed()));
|
2007-04-24 17:46:08 +00:00
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(close_clicked()));
|
|
|
|
|
connect(borders, SIGNAL(topSet(bool)), this, SLOT(topBorder_changed()));
|
|
|
|
|
connect(borders, SIGNAL(bottomSet(bool)), this, SLOT(bottomBorder_changed()));
|
|
|
|
|
connect(borders, SIGNAL(rightSet(bool)), this, SLOT(rightBorder_changed()));
|
|
|
|
|
connect(borders, SIGNAL(leftSet(bool)), this, SLOT(leftBorder_changed()));
|
|
|
|
|
connect(rotateTabularCB, SIGNAL(clicked()), this, SLOT(rotateTabular()));
|
|
|
|
|
connect(rotateCellCB, SIGNAL(clicked()), this, SLOT(rotateCell()));
|
|
|
|
|
connect(longTabularCB, SIGNAL(clicked()), this, SLOT(longTabular()));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
|
|
|
|
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
|
bc().setCancel(closePB);
|
|
|
|
|
|
|
|
|
|
bc().addReadOnly(topspaceED);
|
|
|
|
|
bc().addReadOnly(topspaceUnit);
|
|
|
|
|
bc().addReadOnly(topspaceCO);
|
|
|
|
|
bc().addReadOnly(bottomspaceED);
|
|
|
|
|
bc().addReadOnly(bottomspaceUnit);
|
|
|
|
|
bc().addReadOnly(bottomspaceCO);
|
|
|
|
|
bc().addReadOnly(interlinespaceED);
|
|
|
|
|
bc().addReadOnly(interlinespaceUnit);
|
|
|
|
|
bc().addReadOnly(interlinespaceCO);
|
|
|
|
|
bc().addReadOnly(borderDefaultRB);
|
|
|
|
|
bc().addReadOnly(booktabsRB);
|
|
|
|
|
|
|
|
|
|
bc().addReadOnly(multicolumnCB);
|
|
|
|
|
bc().addReadOnly(rotateCellCB);
|
|
|
|
|
bc().addReadOnly(rotateTabularCB);
|
|
|
|
|
bc().addReadOnly(specialAlignmentED);
|
|
|
|
|
bc().addReadOnly(widthED);
|
|
|
|
|
bc().addReadOnly(widthUnit);
|
|
|
|
|
bc().addReadOnly(hAlignCB);
|
|
|
|
|
bc().addReadOnly(vAlignCB);
|
|
|
|
|
bc().addReadOnly(borderSetPB);
|
|
|
|
|
bc().addReadOnly(borderUnsetPB);
|
|
|
|
|
bc().addReadOnly(borders);
|
|
|
|
|
bc().addReadOnly(longTabularCB);
|
|
|
|
|
bc().addReadOnly(headerStatusCB);
|
|
|
|
|
bc().addReadOnly(headerBorderAboveCB);
|
|
|
|
|
bc().addReadOnly(headerBorderBelowCB);
|
|
|
|
|
bc().addReadOnly(firstheaderStatusCB);
|
|
|
|
|
bc().addReadOnly(firstheaderBorderAboveCB);
|
|
|
|
|
bc().addReadOnly(firstheaderBorderBelowCB);
|
|
|
|
|
bc().addReadOnly(firstheaderNoContentsCB);
|
|
|
|
|
bc().addReadOnly(footerStatusCB);
|
|
|
|
|
bc().addReadOnly(footerBorderAboveCB);
|
|
|
|
|
bc().addReadOnly(footerBorderBelowCB);
|
|
|
|
|
bc().addReadOnly(lastfooterStatusCB);
|
|
|
|
|
bc().addReadOnly(lastfooterBorderAboveCB);
|
|
|
|
|
bc().addReadOnly(lastfooterBorderBelowCB);
|
|
|
|
|
bc().addReadOnly(lastfooterNoContentsCB);
|
|
|
|
|
bc().addReadOnly(newpageCB);
|
|
|
|
|
|
|
|
|
|
// initialize the length validator
|
|
|
|
|
bc().addCheckedLineEdit(widthED, fixedWidthColLA);
|
|
|
|
|
bc().addCheckedLineEdit(topspaceED, topspaceLA);
|
|
|
|
|
bc().addCheckedLineEdit(bottomspaceED, bottomspaceLA);
|
|
|
|
|
bc().addCheckedLineEdit(interlinespaceED, interlinespaceLA);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ControlTabular & GuiTabularDialog::controller() const
|
|
|
|
|
{
|
2007-09-10 22:32:59 +00:00
|
|
|
|
return static_cast<ControlTabular &>(GuiDialog::controller());
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::change_adaptor()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::closeEvent(QCloseEvent * e)
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
slotWMHide();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
e->accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::booktabsChanged(bool)
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
|
|
|
|
controller().booktabs(booktabsRB->isChecked());
|
|
|
|
|
update_borders();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::topspace_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
switch(topspaceCO->currentIndex()) {
|
|
|
|
|
case 0: {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_TOP_SPACE, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
topspaceED->setEnabled(false);
|
|
|
|
|
topspaceUnit->setEnabled(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 1: {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_TOP_SPACE, "default");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
topspaceED->setEnabled(false);
|
|
|
|
|
topspaceUnit->setEnabled(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2: {
|
|
|
|
|
if (!topspaceED->text().isEmpty())
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_TOP_SPACE,
|
2007-04-24 17:46:08 +00:00
|
|
|
|
widgetsToLength(topspaceED, topspaceUnit));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
if (!bc().policy().isReadOnly()) {
|
2007-04-24 17:46:08 +00:00
|
|
|
|
topspaceED->setEnabled(true);
|
|
|
|
|
topspaceUnit->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::bottomspace_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
switch(bottomspaceCO->currentIndex()) {
|
|
|
|
|
case 0: {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_BOTTOM_SPACE, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
bottomspaceED->setEnabled(false);
|
|
|
|
|
bottomspaceUnit->setEnabled(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 1: {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_BOTTOM_SPACE, "default");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
bottomspaceED->setEnabled(false);
|
|
|
|
|
bottomspaceUnit->setEnabled(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2: {
|
|
|
|
|
if (!bottomspaceED->text().isEmpty())
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_BOTTOM_SPACE,
|
2007-04-24 17:46:08 +00:00
|
|
|
|
widgetsToLength(bottomspaceED, bottomspaceUnit));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
if (!bc().policy().isReadOnly()) {
|
2007-04-24 17:46:08 +00:00
|
|
|
|
bottomspaceED->setEnabled(true);
|
|
|
|
|
bottomspaceUnit->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::interlinespace_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
switch(interlinespaceCO->currentIndex()) {
|
|
|
|
|
case 0: {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_INTERLINE_SPACE, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
interlinespaceED->setEnabled(false);
|
|
|
|
|
interlinespaceUnit->setEnabled(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 1: {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_INTERLINE_SPACE, "default");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
interlinespaceED->setEnabled(false);
|
|
|
|
|
interlinespaceUnit->setEnabled(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2: {
|
|
|
|
|
if (!interlinespaceED->text().isEmpty())
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_INTERLINE_SPACE,
|
2007-04-24 17:46:08 +00:00
|
|
|
|
widgetsToLength(interlinespaceED, interlinespaceUnit));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
if (!bc().policy().isReadOnly()) {
|
2007-04-24 17:46:08 +00:00
|
|
|
|
interlinespaceED->setEnabled(true);
|
|
|
|
|
interlinespaceUnit->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::close_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
closeGUI();
|
|
|
|
|
slotClose();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::borderSet_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_ALL_LINES);
|
|
|
|
|
update_borders();
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::borderUnset_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_ALL_LINES);
|
|
|
|
|
update_borders();
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::leftBorder_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().toggleLeftLine();
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::rightBorder_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().toggleRightLine();
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::topBorder_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().toggleTopLine();
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::bottomBorder_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().toggleBottomLine();
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::specialAlignment_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
string special = fromqstr(specialAlignmentED->text());
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().setSpecial(special);
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::width_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
string const width = widgetsToLength(widthED, widthUnit);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().setWidth(width);
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::multicolumn_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().toggleMultiColumn();
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::rotateTabular()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().rotateTabular(rotateTabularCB->isChecked());
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::rotateCell()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().rotateCell(rotateCellCB->isChecked());
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::hAlign_changed(int align)
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
ControlTabular::HALIGN h = ControlTabular::LEFT;
|
|
|
|
|
|
|
|
|
|
switch (align) {
|
|
|
|
|
case 0: h = ControlTabular::LEFT; break;
|
|
|
|
|
case 1: h = ControlTabular::CENTER; break;
|
|
|
|
|
case 2: h = ControlTabular::RIGHT; break;
|
|
|
|
|
case 3: h = ControlTabular::BLOCK; break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().halign(h);
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::vAlign_changed(int align)
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
ControlTabular::VALIGN v = ControlTabular::TOP;
|
|
|
|
|
|
|
|
|
|
switch (align) {
|
|
|
|
|
case 0: v = ControlTabular::TOP; break;
|
|
|
|
|
case 1: v = ControlTabular::MIDDLE; break;
|
|
|
|
|
case 2: v = ControlTabular::BOTTOM; break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().valign(v);
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::longTabular()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().longTabular(longTabularCB->isChecked());
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltNewpage_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTNEWPAGE);
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltHeaderStatus_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
bool enable(headerStatusCB->isChecked());
|
|
|
|
|
if (enable)
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTHEAD, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTHEAD, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
headerBorderAboveCB->setEnabled(enable);
|
|
|
|
|
headerBorderBelowCB->setEnabled(enable);
|
|
|
|
|
firstheaderNoContentsCB->setEnabled(enable);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltHeaderBorderAbove_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (headerBorderAboveCB->isChecked())
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTHEAD, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTHEAD, "dl_above");
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltHeaderBorderBelow_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (headerBorderBelowCB->isChecked())
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTHEAD, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTHEAD, "dl_below");
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltFirstHeaderBorderAbove_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (firstheaderBorderAboveCB->isChecked())
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTFIRSTHEAD, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTFIRSTHEAD, "dl_above");
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltFirstHeaderBorderBelow_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (firstheaderBorderBelowCB->isChecked())
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTFIRSTHEAD, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTFIRSTHEAD, "dl_below");
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltFirstHeaderStatus_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
bool enable(firstheaderStatusCB->isChecked());
|
|
|
|
|
if (enable)
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTFIRSTHEAD, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTFIRSTHEAD, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
firstheaderBorderAboveCB->setEnabled(enable);
|
|
|
|
|
firstheaderBorderBelowCB->setEnabled(enable);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltFirstHeaderEmpty_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
bool enable(firstheaderNoContentsCB->isChecked());
|
|
|
|
|
if (enable)
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTFIRSTHEAD, "empty");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTFIRSTHEAD, "empty");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
firstheaderStatusCB->setEnabled(!enable);
|
|
|
|
|
firstheaderBorderAboveCB->setEnabled(!enable);
|
|
|
|
|
firstheaderBorderBelowCB->setEnabled(!enable);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltFooterStatus_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
bool enable(footerStatusCB->isChecked());
|
|
|
|
|
if (enable)
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTFOOT, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTFOOT, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
footerBorderAboveCB->setEnabled(enable);
|
|
|
|
|
footerBorderBelowCB->setEnabled(enable);
|
|
|
|
|
lastfooterNoContentsCB->setEnabled(enable);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltFooterBorderAbove_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (footerBorderAboveCB->isChecked())
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTFOOT, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTFOOT, "dl_above");
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltFooterBorderBelow_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (footerBorderBelowCB->isChecked())
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTFOOT, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTFOOT, "dl_below");
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltLastFooterStatus_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
bool enable(lastfooterStatusCB->isChecked());
|
|
|
|
|
if (enable)
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTLASTFOOT, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTLASTFOOT, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
lastfooterBorderAboveCB->setEnabled(enable);
|
|
|
|
|
lastfooterBorderBelowCB->setEnabled(enable);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltLastFooterBorderAbove_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (lastfooterBorderAboveCB->isChecked())
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTLASTFOOT, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTLASTFOOT, "dl_above");
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltLastFooterBorderBelow_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (lastfooterBorderBelowCB->isChecked())
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTLASTFOOT, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTLASTFOOT, "dl_below");
|
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltLastFooterEmpty_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
bool enable(lastfooterNoContentsCB->isChecked());
|
|
|
|
|
if (enable)
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::SET_LTLASTFOOT, "empty");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-09-05 20:33:29 +00:00
|
|
|
|
controller().set(Tabular::UNSET_LTLASTFOOT, "empty");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
lastfooterStatusCB->setEnabled(!enable);
|
|
|
|
|
lastfooterBorderAboveCB->setEnabled(!enable);
|
|
|
|
|
lastfooterBorderBelowCB->setEnabled(!enable);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
changed();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
void GuiTabularDialog::update_borders()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2007-04-26 13:39:14 +00:00
|
|
|
|
Tabular const & tabular = controller().tabular();
|
|
|
|
|
Tabular::idx_type const cell = controller().getActiveCell();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
bool const isMulticolumnCell = tabular.isMultiColumn(cell);
|
|
|
|
|
|
|
|
|
|
if (!isMulticolumnCell) {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
borders->setLeftEnabled(true);
|
|
|
|
|
borders->setRightEnabled(true);
|
|
|
|
|
borders->setTop(tabular.topLine(cell, true));
|
|
|
|
|
borders->setBottom(tabular.bottomLine(cell, true));
|
|
|
|
|
borders->setLeft(tabular.leftLine(cell, true));
|
|
|
|
|
borders->setRight(tabular.rightLine(cell, true));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
// repaint the setborder widget
|
2007-09-05 20:33:29 +00:00
|
|
|
|
borders->update();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
borders->setTop(tabular.topLine(cell));
|
|
|
|
|
borders->setBottom(tabular.bottomLine(cell));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
// pay attention to left/right lines: they are only allowed
|
|
|
|
|
// to set if we are in first/last cell of row or if the left/right
|
|
|
|
|
// cell is also a multicolumn.
|
|
|
|
|
if (tabular.isFirstCellInRow(cell) || tabular.isMultiColumn(cell - 1)) {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
borders->setLeftEnabled(true);
|
|
|
|
|
borders->setLeft(tabular.leftLine(cell));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
borders->setLeft(false);
|
|
|
|
|
borders->setLeftEnabled(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
if (tabular.isLastCellInRow(cell) || tabular.isMultiColumn(cell + 1)) {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
borders->setRightEnabled(true);
|
|
|
|
|
borders->setRight(tabular.rightLine(cell));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
borders->setRight(false);
|
|
|
|
|
borders->setRightEnabled(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
// repaint the setborder widget
|
2007-09-05 20:33:29 +00:00
|
|
|
|
borders->update();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
void GuiTabularDialog::update_contents()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2007-07-18 09:55:33 +00:00
|
|
|
|
controller().initialiseParams(string());
|
|
|
|
|
|
2007-04-26 13:39:14 +00:00
|
|
|
|
Tabular const & tabular(controller().tabular());
|
|
|
|
|
Tabular::idx_type const cell = controller().getActiveCell();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-04 18:08:51 +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-05 20:33:29 +00:00
|
|
|
|
tabularRowED->setText(toqstr(convert<string>(row + 1)));
|
|
|
|
|
tabularColumnED->setText(toqstr(convert<string>(col + 1)));
|
2006-03-05 17:24:44 +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
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
rotateCellCB->setChecked(tabular.getRotateCell(cell));
|
|
|
|
|
rotateTabularCB->setChecked(tabular.getRotateTabular());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
longTabularCB->setChecked(tabular.isLongTabular());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
update_borders();
|
|
|
|
|
|
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) {
|
2007-04-26 13:39:14 +00:00
|
|
|
|
special = tabular.getAlignSpecial(cell, Tabular::SET_SPECIAL_MULTI);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
pwidth = tabular.getMColumnPWidth(cell);
|
|
|
|
|
} else {
|
2007-04-26 13:39:14 +00:00
|
|
|
|
special = tabular.getAlignSpecial(cell, Tabular::SET_SPECIAL_COLUMN);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
pwidth = tabular.getColumnPWidth(cell);
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
specialAlignmentED->setText(toqstr(special));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-02 07:53:07 +00:00
|
|
|
|
bool const isReadonly = bc().policy().isReadOnly();
|
2007-09-05 20:33:29 +00:00
|
|
|
|
specialAlignmentED->setEnabled(!isReadonly);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
|
Length::UNIT default_unit =
|
|
|
|
|
controller().useMetricUnits() ? Length::CM : Length::IN;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
borderDefaultRB->setChecked(!tabular.useBookTabs());
|
|
|
|
|
booktabsRB->setChecked(tabular.useBookTabs());
|
2006-07-03 19:13:56 +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);
|
2006-07-03 19:13:56 +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,
|
|
|
|
|
topspaceUnit,
|
2006-07-03 19:13:56 +00:00
|
|
|
|
tabular.row_info[row].top_space.asString(),
|
|
|
|
|
default_unit);
|
|
|
|
|
}
|
2007-09-05 20:33:29 +00:00
|
|
|
|
topspaceED->setEnabled(!isReadonly
|
|
|
|
|
&& (topspaceCO->currentIndex() == 2));
|
|
|
|
|
topspaceUnit->setEnabled(!isReadonly
|
|
|
|
|
&& (topspaceCO->currentIndex() == 2));
|
|
|
|
|
topspaceCO->setEnabled(!isReadonly);
|
2006-07-03 19:13:56 +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);
|
2006-07-03 19:13:56 +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,
|
|
|
|
|
bottomspaceUnit,
|
2006-07-03 19:13:56 +00:00
|
|
|
|
tabular.row_info[row].bottom_space.asString(),
|
|
|
|
|
default_unit);
|
|
|
|
|
}
|
2007-09-05 20:33:29 +00:00
|
|
|
|
bottomspaceED->setEnabled(!isReadonly
|
|
|
|
|
&& (bottomspaceCO->currentIndex() == 2));
|
|
|
|
|
bottomspaceUnit->setEnabled(!isReadonly
|
|
|
|
|
&& (bottomspaceCO->currentIndex() == 2));
|
|
|
|
|
bottomspaceCO->setEnabled(!isReadonly);
|
2006-07-03 19:13:56 +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);
|
2006-07-03 19:13:56 +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,
|
|
|
|
|
interlinespaceUnit,
|
2006-07-03 19:13:56 +00:00
|
|
|
|
tabular.row_info[row].interline_space.asString(),
|
|
|
|
|
default_unit);
|
|
|
|
|
}
|
2007-09-05 20:33:29 +00:00
|
|
|
|
interlinespaceED->setEnabled(!isReadonly
|
|
|
|
|
&& (interlinespaceCO->currentIndex() == 2));
|
|
|
|
|
interlinespaceUnit->setEnabled(!isReadonly
|
|
|
|
|
&& (interlinespaceCO->currentIndex() == 2));
|
|
|
|
|
interlinespaceCO->setEnabled(!isReadonly);
|
2006-07-03 19:13:56 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
string colwidth;
|
|
|
|
|
if (!pwidth.zero())
|
|
|
|
|
colwidth = pwidth.asString();
|
2007-09-05 20:33:29 +00:00
|
|
|
|
lengthToWidgets(widthED, widthUnit,
|
2006-03-05 17:24:44 +00:00
|
|
|
|
colwidth, default_unit);
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
widthED->setEnabled(!isReadonly);
|
|
|
|
|
widthUnit->setEnabled(!isReadonly);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
hAlignCB->clear();
|
|
|
|
|
hAlignCB->addItem(qt_("Left"));
|
|
|
|
|
hAlignCB->addItem(qt_("Center"));
|
|
|
|
|
hAlignCB->addItem(qt_("Right"));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
if (!multicol && !pwidth.zero())
|
2007-09-05 20:33:29 +00:00
|
|
|
|
hAlignCB->addItem(qt_("Justified"));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
int align = 0;
|
|
|
|
|
switch (tabular.getAlignment(cell)) {
|
|
|
|
|
case LYX_ALIGN_LEFT:
|
|
|
|
|
align = 0;
|
|
|
|
|
break;
|
|
|
|
|
case LYX_ALIGN_CENTER:
|
|
|
|
|
align = 1;
|
|
|
|
|
break;
|
|
|
|
|
case LYX_ALIGN_RIGHT:
|
|
|
|
|
align = 2;
|
|
|
|
|
break;
|
|
|
|
|
case LYX_ALIGN_BLOCK:
|
|
|
|
|
{
|
|
|
|
|
if (!multicol && !pwidth.zero())
|
|
|
|
|
align = 3;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
align = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-09-05 20:33:29 +00:00
|
|
|
|
hAlignCB->setCurrentIndex(align);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
int valign = 0;
|
|
|
|
|
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:
|
|
|
|
|
valign = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (pwidth.zero())
|
|
|
|
|
valign = 1;
|
2007-09-05 20:33:29 +00:00
|
|
|
|
vAlignCB->setCurrentIndex(valign);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
hAlignCB->setEnabled(true);
|
|
|
|
|
vAlignCB->setEnabled(!pwidth.zero());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
if (!tabular.isLongTabular()) {
|
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);
|
|
|
|
|
newpageCB->setEnabled(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-04-26 13:39:14 +00:00
|
|
|
|
Tabular::ltType ltt;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
bool use_empty;
|
|
|
|
|
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);
|
|
|
|
|
headerBorderAboveCB->setEnabled(false);
|
|
|
|
|
headerBorderBelowCB->setEnabled(false);
|
|
|
|
|
firstheaderNoContentsCB->setChecked(false);
|
|
|
|
|
firstheaderNoContentsCB->setEnabled(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
use_empty = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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->setEnabled(false);
|
|
|
|
|
firstheaderBorderBelowCB->setEnabled(false);
|
|
|
|
|
firstheaderBorderAboveCB->setChecked(false);
|
|
|
|
|
firstheaderBorderBelowCB->setChecked(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
if (use_empty) {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
firstheaderNoContentsCB->setChecked(ltt.empty);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
if (ltt.empty)
|
2007-09-05 20:33:29 +00:00
|
|
|
|
firstheaderStatusCB->setEnabled(false);
|
2006-03-05 17:24:44 +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);
|
|
|
|
|
footerBorderAboveCB->setEnabled(false);
|
|
|
|
|
footerBorderBelowCB->setEnabled(false);
|
|
|
|
|
lastfooterNoContentsCB->setChecked(false);
|
|
|
|
|
lastfooterNoContentsCB->setEnabled(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
use_empty = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
row_set = tabular.getRowOfLTLastFoot(row, ltt);
|
2007-09-05 20:33:29 +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->setEnabled(false);
|
|
|
|
|
lastfooterBorderBelowCB->setEnabled(false);
|
|
|
|
|
lastfooterBorderAboveCB->setChecked(false);
|
|
|
|
|
lastfooterBorderBelowCB->setChecked(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
if (use_empty) {
|
2007-09-05 20:33:29 +00:00
|
|
|
|
lastfooterNoContentsCB->setChecked(ltt.empty);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
if (ltt.empty)
|
2007-09-05 20:33:29 +00:00
|
|
|
|
lastfooterStatusCB->setEnabled(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-09-05 20:33:29 +00:00
|
|
|
|
newpageCB->setChecked(tabular.getLTNewPage(row));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
void GuiTabularDialog::closeGUI()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
// ugly hack to auto-apply the stuff that hasn't been
|
|
|
|
|
// yet. don't let this continue to exist ...
|
|
|
|
|
|
|
|
|
|
// Subtle here, we must /not/ apply any changes and
|
|
|
|
|
// then refer to tabular, as it will have been freed
|
|
|
|
|
// since the changes update the actual controller().tabular()
|
2007-04-26 13:39:14 +00:00
|
|
|
|
Tabular const & tabular(controller().tabular());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
// apply the fixed width values
|
2007-04-26 13:39:14 +00:00
|
|
|
|
Tabular::idx_type const cell = controller().getActiveCell();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
bool const multicol = tabular.isMultiColumn(cell);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
string width = widgetsToLength(widthED, widthUnit);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
string width2;
|
|
|
|
|
|
2007-04-28 12:58:49 +00:00
|
|
|
|
Length llen = tabular.getColumnPWidth(cell);
|
|
|
|
|
Length llenMulti = tabular.getMColumnPWidth(cell);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
if (multicol && !llenMulti.zero())
|
|
|
|
|
width2 = llenMulti.asString();
|
|
|
|
|
else if (!multicol && !llen.zero())
|
|
|
|
|
width2 = llen.asString();
|
|
|
|
|
|
|
|
|
|
// apply the special alignment
|
2007-09-05 20:33:29 +00:00
|
|
|
|
docstring const sa1 = qstring_to_ucs4(specialAlignmentED->text());
|
2007-01-05 17:11:32 +00:00
|
|
|
|
docstring sa2;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
if (multicol)
|
2007-04-26 13:39:14 +00:00
|
|
|
|
sa2 = tabular.getAlignSpecial(cell, Tabular::SET_SPECIAL_MULTI);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
sa2 = tabular.getAlignSpecial(cell, Tabular::SET_SPECIAL_COLUMN);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
if (sa1 != sa2) {
|
|
|
|
|
if (multicol)
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_SPECIAL_MULTI, to_utf8(sa1));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_SPECIAL_COLUMN, to_utf8(sa1));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (width != width2) {
|
|
|
|
|
if (multicol)
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_MPWIDTH, width);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_PWIDTH, width);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
2006-07-03 19:13:56 +00:00
|
|
|
|
|
|
|
|
|
/* DO WE NEED THIS?
|
2007-09-05 20:33:29 +00:00
|
|
|
|
switch (topspaceCO->currentIndex()) {
|
2006-07-03 19:13:56 +00:00
|
|
|
|
case 0:
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_TOP_SPACE, "");
|
2006-07-03 19:13:56 +00:00
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_TOP_SPACE, "default");
|
2006-07-03 19:13:56 +00:00
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_TOP_SPACE,
|
2007-09-05 20:33:29 +00:00
|
|
|
|
widgetsToLength(topspaceED,
|
|
|
|
|
topspaceUnit));
|
2006-07-03 19:13:56 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
switch (bottomspaceCO->currentIndex()) {
|
2006-07-03 19:13:56 +00:00
|
|
|
|
case 0:
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_BOTTOM_SPACE, "");
|
2006-07-03 19:13:56 +00:00
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_BOTTOM_SPACE, "default");
|
2006-07-03 19:13:56 +00:00
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_BOTTOM_SPACE,
|
2007-09-05 20:33:29 +00:00
|
|
|
|
widgetsToLength(bottomspaceED,
|
|
|
|
|
bottomspaceUnit));
|
2006-07-03 19:13:56 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
switch (interlinespaceCO->currentIndex()) {
|
2006-07-03 19:13:56 +00:00
|
|
|
|
case 0:
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_INTERLINE_SPACE, "");
|
2006-07-03 19:13:56 +00:00
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_INTERLINE_SPACE, "default");
|
2006-07-03 19:13:56 +00:00
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2007-04-26 13:39:14 +00:00
|
|
|
|
controller().set(Tabular::SET_INTERLINE_SPACE,
|
2007-09-05 20:33:29 +00:00
|
|
|
|
widgetsToLength(interlinespaceED,
|
|
|
|
|
interlinespaceUnit));
|
2006-07-03 19:13:56 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
*/
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
2007-04-24 17:46:08 +00:00
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
#include "GuiTabular_moc.cpp"
|