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
|
|
|
|
|
|
|
|
|
#include "CheckedLineEdit.h"
|
|
|
|
|
#include "GuiSetBorder.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
#include "Qt2BC.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 "controllers/ButtonController.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;
|
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2007-04-24 17:46:08 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2007-08-31 05:53:55 +00:00
|
|
|
|
// GuiTabularDialog
|
2007-04-24 17:46:08 +00:00
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
GuiTabularDialog::GuiTabularDialog(GuiTabular * form)
|
2007-04-24 17:46:08 +00:00
|
|
|
|
: form_(form)
|
|
|
|
|
{
|
|
|
|
|
setupUi(this);
|
|
|
|
|
|
|
|
|
|
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-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::change_adaptor()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::closeEvent(QCloseEvent * e)
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->slotWMHide();
|
|
|
|
|
e->accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::booktabsChanged(bool)
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->changed();
|
|
|
|
|
form_->controller().booktabs(booktabsRB->isChecked());
|
|
|
|
|
form_->update_borders();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_TOP_SPACE, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
topspaceED->setEnabled(false);
|
|
|
|
|
topspaceUnit->setEnabled(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 1: {
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->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-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_TOP_SPACE,
|
2007-04-24 17:46:08 +00:00
|
|
|
|
widgetsToLength(topspaceED, topspaceUnit));
|
|
|
|
|
if (!form_->bc().bp().isReadOnly()) {
|
|
|
|
|
topspaceED->setEnabled(true);
|
|
|
|
|
topspaceUnit->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_BOTTOM_SPACE, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
bottomspaceED->setEnabled(false);
|
|
|
|
|
bottomspaceUnit->setEnabled(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 1: {
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->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-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_BOTTOM_SPACE,
|
2007-04-24 17:46:08 +00:00
|
|
|
|
widgetsToLength(bottomspaceED, bottomspaceUnit));
|
|
|
|
|
if (!form_->bc().bp().isReadOnly()) {
|
|
|
|
|
bottomspaceED->setEnabled(true);
|
|
|
|
|
bottomspaceUnit->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_INTERLINE_SPACE, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
interlinespaceED->setEnabled(false);
|
|
|
|
|
interlinespaceUnit->setEnabled(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 1: {
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->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-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_INTERLINE_SPACE,
|
2007-04-24 17:46:08 +00:00
|
|
|
|
widgetsToLength(interlinespaceED, interlinespaceUnit));
|
|
|
|
|
if (!form_->bc().bp().isReadOnly()) {
|
|
|
|
|
interlinespaceED->setEnabled(true);
|
|
|
|
|
interlinespaceUnit->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::close_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->closeGUI();
|
|
|
|
|
form_->slotClose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::borderSet_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_ALL_LINES);
|
2007-04-24 17:46:08 +00:00
|
|
|
|
form_->update_borders();
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::borderUnset_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_ALL_LINES);
|
2007-04-24 17:46:08 +00:00
|
|
|
|
form_->update_borders();
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::leftBorder_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->controller().toggleLeftLine();
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::rightBorder_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->controller().toggleRightLine();
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::topBorder_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->controller().toggleTopLine();
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::bottomBorder_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->controller().toggleBottomLine();
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
form_->controller().setSpecial(special);
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::width_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->changed();
|
|
|
|
|
string const width = widgetsToLength(widthED, widthUnit);
|
|
|
|
|
form_->controller().setWidth(width);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::multicolumn_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->controller().toggleMultiColumn();
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::rotateTabular()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->controller().rotateTabular(rotateTabularCB->isChecked());
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::rotateCell()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->controller().rotateCell(rotateCellCB->isChecked());
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
form_->controller().halign(h);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
form_->controller().valign(v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::longTabular()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
form_->controller().longTabular(longTabularCB->isChecked());
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltNewpage_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTNEWPAGE);
|
2007-04-24 17:46:08 +00:00
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTHEAD, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTHEAD, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
headerBorderAboveCB->setEnabled(enable);
|
|
|
|
|
headerBorderBelowCB->setEnabled(enable);
|
|
|
|
|
firstheaderNoContentsCB->setEnabled(enable);
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltHeaderBorderAbove_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (headerBorderAboveCB->isChecked())
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTHEAD, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTHEAD, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltHeaderBorderBelow_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (headerBorderBelowCB->isChecked())
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTHEAD, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTHEAD, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltFirstHeaderBorderAbove_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (firstheaderBorderAboveCB->isChecked())
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTFIRSTHEAD, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTFIRSTHEAD, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltFirstHeaderBorderBelow_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (firstheaderBorderBelowCB->isChecked())
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTFIRSTHEAD, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTFIRSTHEAD, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTFIRSTHEAD, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTFIRSTHEAD, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
firstheaderBorderAboveCB->setEnabled(enable);
|
|
|
|
|
firstheaderBorderBelowCB->setEnabled(enable);
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTFIRSTHEAD, "empty");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTFIRSTHEAD, "empty");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
firstheaderStatusCB->setEnabled(!enable);
|
|
|
|
|
firstheaderBorderAboveCB->setEnabled(!enable);
|
|
|
|
|
firstheaderBorderBelowCB->setEnabled(!enable);
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTFOOT, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTFOOT, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
footerBorderAboveCB->setEnabled(enable);
|
|
|
|
|
footerBorderBelowCB->setEnabled(enable);
|
|
|
|
|
lastfooterNoContentsCB->setEnabled(enable);
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltFooterBorderAbove_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (footerBorderAboveCB->isChecked())
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTFOOT, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTFOOT, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltFooterBorderBelow_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (footerBorderBelowCB->isChecked())
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTFOOT, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTFOOT, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTLASTFOOT, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTLASTFOOT, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
lastfooterBorderAboveCB->setEnabled(enable);
|
|
|
|
|
lastfooterBorderBelowCB->setEnabled(enable);
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltLastFooterBorderAbove_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (lastfooterBorderAboveCB->isChecked())
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTLASTFOOT, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTLASTFOOT, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabularDialog::ltLastFooterBorderBelow_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (lastfooterBorderBelowCB->isChecked())
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTLASTFOOT, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTLASTFOOT, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::SET_LTLASTFOOT, "empty");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
else
|
2007-04-26 13:39:14 +00:00
|
|
|
|
form_->controller().set(Tabular::UNSET_LTLASTFOOT, "empty");
|
2007-04-24 17:46:08 +00:00
|
|
|
|
lastfooterStatusCB->setEnabled(!enable);
|
|
|
|
|
lastfooterBorderAboveCB->setEnabled(!enable);
|
|
|
|
|
lastfooterBorderBelowCB->setEnabled(!enable);
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2007-08-31 05:53:55 +00:00
|
|
|
|
// GuiTabular
|
2007-04-24 17:46:08 +00:00
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
GuiTabular::GuiTabular(Dialog & parent)
|
2007-08-31 22:16:11 +00:00
|
|
|
|
: GuiView<GuiTabularDialog>(parent, _("Table Settings"))
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabular::build_dialog()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2007-08-31 05:53:55 +00:00
|
|
|
|
dialog_.reset(new GuiTabularDialog(this));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
bcview().setCancel(dialog_->closePB);
|
|
|
|
|
|
2006-07-03 19:13:56 +00:00
|
|
|
|
bcview().addReadOnly(dialog_->topspaceED);
|
|
|
|
|
bcview().addReadOnly(dialog_->topspaceUnit);
|
|
|
|
|
bcview().addReadOnly(dialog_->topspaceCO);
|
|
|
|
|
bcview().addReadOnly(dialog_->bottomspaceED);
|
|
|
|
|
bcview().addReadOnly(dialog_->bottomspaceUnit);
|
|
|
|
|
bcview().addReadOnly(dialog_->bottomspaceCO);
|
|
|
|
|
bcview().addReadOnly(dialog_->interlinespaceED);
|
|
|
|
|
bcview().addReadOnly(dialog_->interlinespaceUnit);
|
|
|
|
|
bcview().addReadOnly(dialog_->interlinespaceCO);
|
|
|
|
|
bcview().addReadOnly(dialog_->borderDefaultRB);
|
|
|
|
|
bcview().addReadOnly(dialog_->booktabsRB);
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
bcview().addReadOnly(dialog_->multicolumnCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->rotateCellCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->rotateTabularCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->specialAlignmentED);
|
|
|
|
|
bcview().addReadOnly(dialog_->widthED);
|
|
|
|
|
bcview().addReadOnly(dialog_->widthUnit);
|
|
|
|
|
bcview().addReadOnly(dialog_->hAlignCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->vAlignCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->borderSetPB);
|
|
|
|
|
bcview().addReadOnly(dialog_->borderUnsetPB);
|
|
|
|
|
bcview().addReadOnly(dialog_->borders);
|
|
|
|
|
bcview().addReadOnly(dialog_->longTabularCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->headerStatusCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->headerBorderAboveCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->headerBorderBelowCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->firstheaderStatusCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->firstheaderBorderAboveCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->firstheaderBorderBelowCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->firstheaderNoContentsCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->footerStatusCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->footerBorderAboveCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->footerBorderBelowCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->lastfooterStatusCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->lastfooterBorderAboveCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->lastfooterBorderBelowCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->lastfooterNoContentsCB);
|
|
|
|
|
bcview().addReadOnly(dialog_->newpageCB);
|
|
|
|
|
|
|
|
|
|
// initialize the length validator
|
|
|
|
|
addCheckedLineEdit(bcview(), dialog_->widthED,
|
|
|
|
|
dialog_->fixedWidthColLA);
|
2006-07-03 19:13:56 +00:00
|
|
|
|
addCheckedLineEdit(bcview(), dialog_->topspaceED,
|
|
|
|
|
dialog_->topspaceLA);
|
|
|
|
|
addCheckedLineEdit(bcview(), dialog_->bottomspaceED,
|
|
|
|
|
dialog_->bottomspaceLA);
|
|
|
|
|
addCheckedLineEdit(bcview(), dialog_->interlinespaceED,
|
|
|
|
|
dialog_->interlinespaceLA);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
bool GuiTabular::isValid()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabular::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) {
|
|
|
|
|
dialog_->borders->setLeftEnabled(true);
|
|
|
|
|
dialog_->borders->setRightEnabled(true);
|
|
|
|
|
dialog_->borders->setTop(tabular.topLine(cell, true));
|
|
|
|
|
dialog_->borders->setBottom(tabular.bottomLine(cell, true));
|
|
|
|
|
dialog_->borders->setLeft(tabular.leftLine(cell, true));
|
|
|
|
|
dialog_->borders->setRight(tabular.rightLine(cell, true));
|
|
|
|
|
// repaint the setborder widget
|
|
|
|
|
dialog_->borders->update();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dialog_->borders->setTop(tabular.topLine(cell));
|
|
|
|
|
dialog_->borders->setBottom(tabular.bottomLine(cell));
|
|
|
|
|
// 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)) {
|
|
|
|
|
dialog_->borders->setLeftEnabled(true);
|
|
|
|
|
dialog_->borders->setLeft(tabular.leftLine(cell));
|
|
|
|
|
} else {
|
|
|
|
|
dialog_->borders->setLeft(false);
|
|
|
|
|
dialog_->borders->setLeftEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
if (tabular.isLastCellInRow(cell) || tabular.isMultiColumn(cell + 1)) {
|
|
|
|
|
dialog_->borders->setRightEnabled(true);
|
|
|
|
|
dialog_->borders->setRight(tabular.rightLine(cell));
|
|
|
|
|
} else {
|
|
|
|
|
dialog_->borders->setRight(false);
|
|
|
|
|
dialog_->borders->setRightEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
// repaint the setborder widget
|
|
|
|
|
dialog_->borders->update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabular::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-04-26 13:39:14 +00:00
|
|
|
|
Tabular::row_type const row(tabular.row_of_cell(cell));
|
|
|
|
|
Tabular::col_type const col(tabular.column_of_cell(cell));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
dialog_->tabularRowED->setText(toqstr(convert<string>(row + 1)));
|
|
|
|
|
dialog_->tabularColumnED->setText(toqstr(convert<string>(col + 1)));
|
|
|
|
|
|
|
|
|
|
bool const multicol(tabular.isMultiColumn(cell));
|
|
|
|
|
|
|
|
|
|
dialog_->multicolumnCB->setChecked(multicol);
|
|
|
|
|
|
|
|
|
|
dialog_->rotateCellCB->setChecked(tabular.getRotateCell(cell));
|
|
|
|
|
dialog_->rotateTabularCB->setChecked(tabular.getRotateTabular());
|
|
|
|
|
|
|
|
|
|
dialog_->longTabularCB->setChecked(tabular.isLongTabular());
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dialog_->specialAlignmentED->setText(toqstr(special));
|
|
|
|
|
|
|
|
|
|
bool const isReadonly = bc().bp().isReadOnly();
|
|
|
|
|
dialog_->specialAlignmentED->setEnabled(!isReadonly);
|
|
|
|
|
|
2007-04-28 12:58:49 +00:00
|
|
|
|
Length::UNIT default_unit = controller().useMetricUnits() ? Length::CM : Length::IN;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-07-03 19:13:56 +00:00
|
|
|
|
dialog_->borderDefaultRB->setChecked(!tabular.useBookTabs());
|
|
|
|
|
dialog_->booktabsRB->setChecked(tabular.useBookTabs());
|
|
|
|
|
|
|
|
|
|
if (tabular.row_info[row].top_space.empty()
|
|
|
|
|
&& !tabular.row_info[row].top_space_default) {
|
2006-08-17 09:00:54 +00:00
|
|
|
|
dialog_->topspaceCO->setCurrentIndex(0);
|
2006-07-03 19:13:56 +00:00
|
|
|
|
} else if (tabular.row_info[row].top_space_default) {
|
2006-08-17 09:00:54 +00:00
|
|
|
|
dialog_->topspaceCO->setCurrentIndex(1);
|
2006-07-03 19:13:56 +00:00
|
|
|
|
} else {
|
2006-08-17 09:00:54 +00:00
|
|
|
|
dialog_->topspaceCO->setCurrentIndex(2);
|
2007-05-28 22:27:45 +00:00
|
|
|
|
lengthToWidgets(dialog_->topspaceED,
|
2006-07-03 19:13:56 +00:00
|
|
|
|
dialog_->topspaceUnit,
|
|
|
|
|
tabular.row_info[row].top_space.asString(),
|
|
|
|
|
default_unit);
|
|
|
|
|
}
|
2007-05-28 22:27:45 +00:00
|
|
|
|
dialog_->topspaceED->setEnabled(!isReadonly
|
2006-08-17 09:00:54 +00:00
|
|
|
|
&& (dialog_->topspaceCO->currentIndex() == 2));
|
2007-05-28 22:27:45 +00:00
|
|
|
|
dialog_->topspaceUnit->setEnabled(!isReadonly
|
2006-08-17 09:00:54 +00:00
|
|
|
|
&& (dialog_->topspaceCO->currentIndex() == 2));
|
2006-07-03 19:13:56 +00:00
|
|
|
|
dialog_->topspaceCO->setEnabled(!isReadonly);
|
|
|
|
|
|
|
|
|
|
if (tabular.row_info[row].bottom_space.empty()
|
|
|
|
|
&& !tabular.row_info[row].bottom_space_default) {
|
2006-08-17 09:00:54 +00:00
|
|
|
|
dialog_->bottomspaceCO->setCurrentIndex(0);
|
2006-07-03 19:13:56 +00:00
|
|
|
|
} else if (tabular.row_info[row].bottom_space_default) {
|
2006-08-17 09:00:54 +00:00
|
|
|
|
dialog_->bottomspaceCO->setCurrentIndex(1);
|
2006-07-03 19:13:56 +00:00
|
|
|
|
} else {
|
2006-08-17 09:00:54 +00:00
|
|
|
|
dialog_->bottomspaceCO->setCurrentIndex(2);
|
2007-05-28 22:27:45 +00:00
|
|
|
|
lengthToWidgets(dialog_->bottomspaceED,
|
2006-07-03 19:13:56 +00:00
|
|
|
|
dialog_->bottomspaceUnit,
|
|
|
|
|
tabular.row_info[row].bottom_space.asString(),
|
|
|
|
|
default_unit);
|
|
|
|
|
}
|
2007-05-28 22:27:45 +00:00
|
|
|
|
dialog_->bottomspaceED->setEnabled(!isReadonly
|
2006-08-17 09:00:54 +00:00
|
|
|
|
&& (dialog_->bottomspaceCO->currentIndex() == 2));
|
2007-05-28 22:27:45 +00:00
|
|
|
|
dialog_->bottomspaceUnit->setEnabled(!isReadonly
|
2006-08-17 09:00:54 +00:00
|
|
|
|
&& (dialog_->bottomspaceCO->currentIndex() == 2));
|
2006-07-03 19:13:56 +00:00
|
|
|
|
dialog_->bottomspaceCO->setEnabled(!isReadonly);
|
|
|
|
|
|
|
|
|
|
if (tabular.row_info[row].interline_space.empty()
|
|
|
|
|
&& !tabular.row_info[row].interline_space_default) {
|
2006-08-17 09:00:54 +00:00
|
|
|
|
dialog_->interlinespaceCO->setCurrentIndex(0);
|
2006-07-03 19:13:56 +00:00
|
|
|
|
} else if (tabular.row_info[row].interline_space_default) {
|
2006-08-17 09:00:54 +00:00
|
|
|
|
dialog_->interlinespaceCO->setCurrentIndex(1);
|
2006-07-03 19:13:56 +00:00
|
|
|
|
} else {
|
2006-08-17 09:00:54 +00:00
|
|
|
|
dialog_->interlinespaceCO->setCurrentIndex(2);
|
2007-05-28 22:27:45 +00:00
|
|
|
|
lengthToWidgets(dialog_->interlinespaceED,
|
2006-07-03 19:13:56 +00:00
|
|
|
|
dialog_->interlinespaceUnit,
|
|
|
|
|
tabular.row_info[row].interline_space.asString(),
|
|
|
|
|
default_unit);
|
|
|
|
|
}
|
2007-05-28 22:27:45 +00:00
|
|
|
|
dialog_->interlinespaceED->setEnabled(!isReadonly
|
2006-08-17 09:00:54 +00:00
|
|
|
|
&& (dialog_->interlinespaceCO->currentIndex() == 2));
|
2007-05-28 22:27:45 +00:00
|
|
|
|
dialog_->interlinespaceUnit->setEnabled(!isReadonly
|
2006-08-17 09:00:54 +00:00
|
|
|
|
&& (dialog_->interlinespaceCO->currentIndex() == 2));
|
2006-07-03 19:13:56 +00:00
|
|
|
|
dialog_->interlinespaceCO->setEnabled(!isReadonly);
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
string colwidth;
|
|
|
|
|
if (!pwidth.zero())
|
|
|
|
|
colwidth = pwidth.asString();
|
|
|
|
|
lengthToWidgets(dialog_->widthED, dialog_->widthUnit,
|
|
|
|
|
colwidth, default_unit);
|
|
|
|
|
|
|
|
|
|
dialog_->widthED->setEnabled(!isReadonly);
|
|
|
|
|
dialog_->widthUnit->setEnabled(!isReadonly);
|
|
|
|
|
|
|
|
|
|
dialog_->hAlignCB->clear();
|
2006-08-17 09:00:54 +00:00
|
|
|
|
dialog_->hAlignCB->addItem(qt_("Left"));
|
|
|
|
|
dialog_->hAlignCB->addItem(qt_("Center"));
|
|
|
|
|
dialog_->hAlignCB->addItem(qt_("Right"));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
if (!multicol && !pwidth.zero())
|
2007-04-01 21:51:17 +00:00
|
|
|
|
dialog_->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;
|
|
|
|
|
}
|
2006-08-17 09:00:54 +00:00
|
|
|
|
dialog_->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;
|
2006-08-17 09:00:54 +00:00
|
|
|
|
dialog_->vAlignCB->setCurrentIndex(valign);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
dialog_->hAlignCB->setEnabled(true);
|
|
|
|
|
dialog_->vAlignCB->setEnabled(!pwidth.zero());
|
|
|
|
|
|
|
|
|
|
if (!tabular.isLongTabular()) {
|
|
|
|
|
dialog_->headerStatusCB->setChecked(false);
|
|
|
|
|
dialog_->headerBorderAboveCB->setChecked(false);
|
|
|
|
|
dialog_->headerBorderBelowCB->setChecked(false);
|
|
|
|
|
dialog_->firstheaderStatusCB->setChecked(false);
|
|
|
|
|
dialog_->firstheaderBorderAboveCB->setChecked(false);
|
|
|
|
|
dialog_->firstheaderBorderBelowCB->setChecked(false);
|
|
|
|
|
dialog_->firstheaderNoContentsCB->setChecked(false);
|
|
|
|
|
dialog_->footerStatusCB->setChecked(false);
|
|
|
|
|
dialog_->footerBorderAboveCB->setChecked(false);
|
|
|
|
|
dialog_->footerBorderBelowCB->setChecked(false);
|
|
|
|
|
dialog_->lastfooterStatusCB->setChecked(false);
|
|
|
|
|
dialog_->lastfooterBorderAboveCB->setChecked(false);
|
|
|
|
|
dialog_->lastfooterBorderBelowCB->setChecked(false);
|
|
|
|
|
dialog_->lastfooterNoContentsCB->setChecked(false);
|
|
|
|
|
dialog_->newpageCB->setChecked(false);
|
|
|
|
|
dialog_->newpageCB->setEnabled(false);
|
|
|
|
|
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);
|
|
|
|
|
dialog_->headerStatusCB->setChecked(row_set);
|
|
|
|
|
if (ltt.set) {
|
|
|
|
|
dialog_->headerBorderAboveCB->setChecked(ltt.topDL);
|
|
|
|
|
dialog_->headerBorderBelowCB->setChecked(ltt.bottomDL);
|
|
|
|
|
use_empty = true;
|
|
|
|
|
} else {
|
|
|
|
|
dialog_->headerBorderAboveCB->setChecked(false);
|
|
|
|
|
dialog_->headerBorderBelowCB->setChecked(false);
|
|
|
|
|
dialog_->headerBorderAboveCB->setEnabled(false);
|
|
|
|
|
dialog_->headerBorderBelowCB->setEnabled(false);
|
|
|
|
|
dialog_->firstheaderNoContentsCB->setChecked(false);
|
|
|
|
|
dialog_->firstheaderNoContentsCB->setEnabled(false);
|
|
|
|
|
use_empty = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
row_set = tabular.getRowOfLTFirstHead(row, ltt);
|
|
|
|
|
dialog_->firstheaderStatusCB->setChecked(row_set);
|
|
|
|
|
if (ltt.set && (!ltt.empty || !use_empty)) {
|
|
|
|
|
dialog_->firstheaderBorderAboveCB->setChecked(ltt.topDL);
|
|
|
|
|
dialog_->firstheaderBorderBelowCB->setChecked(ltt.bottomDL);
|
|
|
|
|
} else {
|
|
|
|
|
dialog_->firstheaderBorderAboveCB->setEnabled(false);
|
|
|
|
|
dialog_->firstheaderBorderBelowCB->setEnabled(false);
|
|
|
|
|
dialog_->firstheaderBorderAboveCB->setChecked(false);
|
|
|
|
|
dialog_->firstheaderBorderBelowCB->setChecked(false);
|
|
|
|
|
if (use_empty) {
|
|
|
|
|
dialog_->firstheaderNoContentsCB->setChecked(ltt.empty);
|
|
|
|
|
if (ltt.empty)
|
|
|
|
|
dialog_->firstheaderStatusCB->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
row_set = tabular.getRowOfLTFoot(row, ltt);
|
|
|
|
|
dialog_->footerStatusCB->setChecked(row_set);
|
|
|
|
|
if (ltt.set) {
|
|
|
|
|
dialog_->footerBorderAboveCB->setChecked(ltt.topDL);
|
|
|
|
|
dialog_->footerBorderBelowCB->setChecked(ltt.bottomDL);
|
|
|
|
|
use_empty = true;
|
|
|
|
|
} else {
|
|
|
|
|
dialog_->footerBorderAboveCB->setChecked(false);
|
|
|
|
|
dialog_->footerBorderBelowCB->setChecked(false);
|
|
|
|
|
dialog_->footerBorderAboveCB->setEnabled(false);
|
|
|
|
|
dialog_->footerBorderBelowCB->setEnabled(false);
|
|
|
|
|
dialog_->lastfooterNoContentsCB->setChecked(false);
|
|
|
|
|
dialog_->lastfooterNoContentsCB->setEnabled(false);
|
|
|
|
|
use_empty = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
row_set = tabular.getRowOfLTLastFoot(row, ltt);
|
|
|
|
|
dialog_->lastfooterStatusCB->setChecked(row_set);
|
|
|
|
|
if (ltt.set && (!ltt.empty || !use_empty)) {
|
|
|
|
|
dialog_->lastfooterBorderAboveCB->setChecked(ltt.topDL);
|
|
|
|
|
dialog_->lastfooterBorderBelowCB->setChecked(ltt.bottomDL);
|
|
|
|
|
} else {
|
|
|
|
|
dialog_->lastfooterBorderAboveCB->setEnabled(false);
|
|
|
|
|
dialog_->lastfooterBorderBelowCB->setEnabled(false);
|
|
|
|
|
dialog_->lastfooterBorderAboveCB->setChecked(false);
|
|
|
|
|
dialog_->lastfooterBorderBelowCB->setChecked(false);
|
|
|
|
|
if (use_empty) {
|
|
|
|
|
dialog_->lastfooterNoContentsCB->setChecked(ltt.empty);
|
|
|
|
|
if (ltt.empty)
|
|
|
|
|
dialog_->lastfooterStatusCB->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dialog_->newpageCB->setChecked(tabular.getLTNewPage(row));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiTabular::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);
|
|
|
|
|
string width = widgetsToLength(dialog_->widthED, dialog_->widthUnit);
|
|
|
|
|
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-01-05 17:11:32 +00:00
|
|
|
|
docstring const sa1 = qstring_to_ucs4(dialog_->specialAlignmentED->text());
|
|
|
|
|
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?
|
2006-08-17 09:00:54 +00:00
|
|
|
|
switch (dialog_->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-05-28 22:27:45 +00:00
|
|
|
|
widgetsToLength(dialog_->topspaceED,
|
2006-07-03 19:13:56 +00:00
|
|
|
|
dialog_->topspaceUnit));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-08-17 09:00:54 +00:00
|
|
|
|
switch (dialog_->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-05-28 22:27:45 +00:00
|
|
|
|
widgetsToLength(dialog_->bottomspaceED,
|
2006-07-03 19:13:56 +00:00
|
|
|
|
dialog_->bottomspaceUnit));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-08-17 09:00:54 +00:00
|
|
|
|
switch (dialog_->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-05-28 22:27:45 +00:00
|
|
|
|
widgetsToLength(dialog_->interlinespaceED,
|
2006-07-03 19:13:56 +00:00
|
|
|
|
dialog_->interlinespaceUnit));
|
|
|
|
|
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"
|