2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiTabular.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Jürgen Spitzmüller
|
|
|
|
* \author Herbert Voß
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiTabular.h"
|
2007-08-31 22:16:11 +00:00
|
|
|
|
|
|
|
#include "GuiSetBorder.h"
|
2008-04-21 13:33:39 +00:00
|
|
|
#include "GuiView.h"
|
2007-04-26 03:53:02 +00:00
|
|
|
#include "LengthCombo.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
2007-10-06 09:19:53 +00:00
|
|
|
#include "Validator.h"
|
|
|
|
|
2008-04-21 13:33:39 +00:00
|
|
|
#include "BufferView.h"
|
|
|
|
#include "Cursor.h"
|
|
|
|
#include "FuncRequest.h"
|
2009-02-10 18:08:09 +00:00
|
|
|
#include "FuncStatus.h"
|
|
|
|
#include "LyXFunc.h"
|
2008-04-21 13:33:39 +00:00
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
#include "insets/InsetTabular.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-04-24 17:46:08 +00:00
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QRadioButton>
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
GuiTabular::GuiTabular(GuiView & lv)
|
2008-04-21 13:33:39 +00:00
|
|
|
: GuiDialog(lv, "tabular", qt_("Table Settings")),
|
|
|
|
// tabular_ is initialised at dialog construction in initialiseParams()
|
|
|
|
tabular_(*lv.buffer(), 0, 0)
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
active_cell_ = Tabular::npos;
|
|
|
|
|
2007-04-24 17:46:08 +00:00
|
|
|
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()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(topspaceCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(topspace_changed()));
|
2007-04-24 17:46:08 +00:00
|
|
|
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()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(bottomspaceCO, SIGNAL(activated(int)),
|
|
|
|
this, SLOT(bottomspace_changed()));
|
2007-04-24 17:46:08 +00:00
|
|
|
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()));
|
2009-05-17 09:36:07 +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(editingFinished()),
|
|
|
|
this, SLOT(width_changed()));
|
|
|
|
connect(widthUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
|
|
|
this, SLOT(width_changed()));
|
|
|
|
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()),
|
2009-05-17 11:36:16 +00:00
|
|
|
this, SLOT(rotateCell()));
|
2009-05-17 09:36:07 +00:00
|
|
|
connect(longTabularCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(longTabular()));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2008-11-17 11:58:14 +00:00
|
|
|
bc().setPolicy(ButtonPolicy::IgnorantPolicy);
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
GuiTabular::~GuiTabular()
|
2007-09-05 20:33:29 +00:00
|
|
|
{
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::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-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::booktabsChanged(bool)
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-10-06 09:19:53 +00:00
|
|
|
booktabs(booktabsRB->isChecked());
|
2007-09-05 20:33:29 +00:00
|
|
|
update_borders();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::topspace_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
switch (topspaceCO->currentIndex()) {
|
2007-04-24 17:46:08 +00:00
|
|
|
case 0: {
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_TOP_SPACE, "");
|
|
|
|
topspaceED->setEnabled(false);
|
|
|
|
topspaceUnit->setEnabled(false);
|
2007-04-24 17:46:08 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1: {
|
2007-10-06 09:19:53 +00:00
|
|
|
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-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_TOP_SPACE,
|
2009-05-17 09:36:07 +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-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::bottomspace_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
switch (bottomspaceCO->currentIndex()) {
|
2007-04-24 17:46:08 +00:00
|
|
|
case 0: {
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_BOTTOM_SPACE, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
bottomspaceED->setEnabled(false);
|
|
|
|
bottomspaceUnit->setEnabled(false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1: {
|
2007-10-06 09:19:53 +00:00
|
|
|
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-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_BOTTOM_SPACE,
|
2009-05-17 09:36:07 +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-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::interlinespace_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
switch (interlinespaceCO->currentIndex()) {
|
2007-04-24 17:46:08 +00:00
|
|
|
case 0: {
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_INTERLINE_SPACE, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
interlinespaceED->setEnabled(false);
|
|
|
|
interlinespaceUnit->setEnabled(false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1: {
|
2007-10-06 09:19:53 +00:00
|
|
|
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-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_INTERLINE_SPACE,
|
2009-05-17 09:36:07 +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-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::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-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::borderSet_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_ALL_LINES);
|
2007-09-05 20:33:29 +00:00
|
|
|
update_borders();
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::borderUnset_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_ALL_LINES);
|
2007-09-05 20:33:29 +00:00
|
|
|
update_borders();
|
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::leftBorder_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2008-03-18 18:08:32 +00:00
|
|
|
set(Tabular::TOGGLE_LINE_LEFT);
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::rightBorder_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2008-03-18 18:08:32 +00:00
|
|
|
set(Tabular::TOGGLE_LINE_RIGHT);
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::topBorder_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2008-03-18 18:08:32 +00:00
|
|
|
set(Tabular::TOGGLE_LINE_TOP);
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::bottomBorder_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2008-03-18 18:08:32 +00:00
|
|
|
set(Tabular::TOGGLE_LINE_BOTTOM);
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::specialAlignment_changed()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
|
|
|
string special = fromqstr(specialAlignmentED->text());
|
2007-10-06 09:19:53 +00:00
|
|
|
setSpecial(special);
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::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-10-06 09:19:53 +00:00
|
|
|
setWidth(width);
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::multicolumn_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
toggleMultiColumn();
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::rotateTabular()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
rotateTabular(rotateTabularCB->isChecked());
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::rotateCell()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
rotateCell(rotateCellCB->isChecked());
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::hAlign_changed(int align)
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
GuiTabular::HALIGN h = GuiTabular::LEFT;
|
2007-04-24 17:46:08 +00:00
|
|
|
|
|
|
|
switch (align) {
|
2007-10-06 09:19:53 +00:00
|
|
|
case 0: h = GuiTabular::LEFT; break;
|
|
|
|
case 1: h = GuiTabular::CENTER; break;
|
|
|
|
case 2: h = GuiTabular::RIGHT; break;
|
|
|
|
case 3: h = GuiTabular::BLOCK; break;
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
halign(h);
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::vAlign_changed(int align)
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
GuiTabular::VALIGN v = GuiTabular::TOP;
|
2007-04-24 17:46:08 +00:00
|
|
|
|
|
|
|
switch (align) {
|
2007-10-06 09:19:53 +00:00
|
|
|
case 0: v = GuiTabular::TOP; break;
|
|
|
|
case 1: v = GuiTabular::MIDDLE; break;
|
|
|
|
case 2: v = GuiTabular::BOTTOM; break;
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
valign(v);
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::longTabular()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
longTabular(longTabularCB->isChecked());
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltNewpage_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTNEWPAGE);
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-04 07:51:50 +00:00
|
|
|
void GuiTabular::on_captionStatusCB_toggled()
|
|
|
|
{
|
|
|
|
set(Tabular::TOGGLE_LTCAPTION);
|
|
|
|
changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltHeaderStatus_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
bool enable = headerStatusCB->isChecked();
|
2007-04-24 17:46:08 +00:00
|
|
|
if (enable)
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTHEAD, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTHEAD, "");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltHeaderBorderAbove_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
|
|
|
if (headerBorderAboveCB->isChecked())
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTHEAD, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTHEAD, "dl_above");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltHeaderBorderBelow_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
|
|
|
if (headerBorderBelowCB->isChecked())
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTHEAD, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTHEAD, "dl_below");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltFirstHeaderBorderAbove_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
|
|
|
if (firstheaderBorderAboveCB->isChecked())
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTFIRSTHEAD, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTFIRSTHEAD, "dl_above");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltFirstHeaderBorderBelow_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
|
|
|
if (firstheaderBorderBelowCB->isChecked())
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTFIRSTHEAD, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTFIRSTHEAD, "dl_below");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltFirstHeaderStatus_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
bool enable = firstheaderStatusCB->isChecked();
|
2007-04-24 17:46:08 +00:00
|
|
|
if (enable)
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTFIRSTHEAD, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTFIRSTHEAD, "");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltFirstHeaderEmpty_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
bool enable = firstheaderNoContentsCB->isChecked();
|
2007-04-24 17:46:08 +00:00
|
|
|
if (enable)
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTFIRSTHEAD, "empty");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTFIRSTHEAD, "empty");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltFooterStatus_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
bool enable = footerStatusCB->isChecked();
|
2007-04-24 17:46:08 +00:00
|
|
|
if (enable)
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTFOOT, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTFOOT, "");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltFooterBorderAbove_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
|
|
|
if (footerBorderAboveCB->isChecked())
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTFOOT, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTFOOT, "dl_above");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltFooterBorderBelow_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
|
|
|
if (footerBorderBelowCB->isChecked())
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTFOOT, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTFOOT, "dl_below");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltLastFooterStatus_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
bool enable = lastfooterStatusCB->isChecked();
|
2007-04-24 17:46:08 +00:00
|
|
|
if (enable)
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTLASTFOOT, "");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTLASTFOOT, "");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltLastFooterBorderAbove_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
|
|
|
if (lastfooterBorderAboveCB->isChecked())
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTLASTFOOT, "dl_above");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTLASTFOOT, "dl_above");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltLastFooterBorderBelow_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
|
|
|
if (lastfooterBorderBelowCB->isChecked())
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTLASTFOOT, "dl_below");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTLASTFOOT, "dl_below");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::ltLastFooterEmpty_clicked()
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
bool enable = lastfooterNoContentsCB->isChecked();
|
2007-04-24 17:46:08 +00:00
|
|
|
if (enable)
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_LTLASTFOOT, "empty");
|
2007-04-24 17:46:08 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::UNSET_LTLASTFOOT, "empty");
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::update_borders()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
Tabular::idx_type const cell = getActiveCell();
|
|
|
|
borders->setTop(tabular_.topLine(cell));
|
|
|
|
borders->setBottom(tabular_.bottomLine(cell));
|
2008-03-18 18:08:32 +00:00
|
|
|
borders->setLeft(tabular_.leftLine(cell));
|
|
|
|
borders->setRight(tabular_.rightLine(cell));
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-21 13:47:01 +00:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
Length getColumnPWidth(Tabular const & t, size_t cell)
|
|
|
|
{
|
|
|
|
return t.column_info[t.cellColumn(cell)].p_width;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Length getMColumnPWidth(Tabular const & t, size_t cell)
|
|
|
|
{
|
|
|
|
if (t.isMultiColumn(cell))
|
|
|
|
return t.cellInfo(cell).p_width;
|
|
|
|
return Length();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
docstring getAlignSpecial(Tabular const & t, size_t cell, int what)
|
|
|
|
{
|
|
|
|
if (what == Tabular::SET_SPECIAL_MULTI)
|
|
|
|
return t.cellInfo(cell).align_special;
|
|
|
|
return t.column_info[t.cellColumn(cell)].align_special;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
void GuiTabular::updateContents()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-06 09:19:53 +00:00
|
|
|
initialiseParams(string());
|
2007-07-18 09:55:33 +00:00
|
|
|
|
2008-04-21 13:47:01 +00:00
|
|
|
size_t const cell = getActiveCell();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
Tabular::row_type const row = tabular_.cellRow(cell);
|
|
|
|
Tabular::col_type const col = tabular_.cellColumn(cell);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-11 21:27:57 +00:00
|
|
|
tabularRowED->setText(QString::number(row + 1));
|
|
|
|
tabularColumnED->setText(QString::number(col + 1));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
bool const multicol(tabular_.isMultiColumn(cell));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
multicolumnCB->setChecked(multicol);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
rotateCellCB->setChecked(tabular_.getRotateCell(cell));
|
2008-04-21 13:33:39 +00:00
|
|
|
rotateTabularCB->setChecked(tabular_.rotate);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2008-04-21 13:33:39 +00:00
|
|
|
longTabularCB->setChecked(tabular_.is_long_tabular);
|
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) {
|
2009-05-17 09:36:07 +00:00
|
|
|
special = getAlignSpecial(tabular_, cell,
|
|
|
|
Tabular::SET_SPECIAL_MULTI);
|
2008-04-21 13:47:01 +00:00
|
|
|
pwidth = getMColumnPWidth(tabular_, cell);
|
2006-03-05 17:24:44 +00:00
|
|
|
} else {
|
2009-05-17 09:36:07 +00:00
|
|
|
special = getAlignSpecial(tabular_, cell,
|
|
|
|
Tabular::SET_SPECIAL_COLUMN);
|
2008-04-21 13:47:01 +00:00
|
|
|
pwidth = getColumnPWidth(tabular_, cell);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2009-02-06 21:24:13 +00:00
|
|
|
Length::UNIT const default_unit = Length::defaultUnit();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2008-04-21 13:33:39 +00:00
|
|
|
borderDefaultRB->setChecked(!tabular_.use_booktabs);
|
|
|
|
booktabsRB->setChecked(tabular_.use_booktabs);
|
2006-07-03 19:13:56 +00:00
|
|
|
|
2007-10-06 09:19:53 +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);
|
2007-10-06 09:19:53 +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,
|
2007-10-06 09:19:53 +00:00
|
|
|
tabular_.row_info[row].top_space.asString(),
|
2006-07-03 19:13:56 +00:00
|
|
|
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
|
|
|
|
2007-10-06 09:19:53 +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);
|
2007-10-06 09:19:53 +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,
|
2007-10-06 09:19:53 +00:00
|
|
|
tabular_.row_info[row].bottom_space.asString(),
|
2006-07-03 19:13:56 +00:00
|
|
|
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
|
|
|
|
2007-10-06 09:19:53 +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);
|
2007-10-06 09:19:53 +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,
|
2007-10-06 09:19:53 +00:00
|
|
|
tabular_.row_info[row].interline_space.asString(),
|
2006-07-03 19:13:56 +00:00
|
|
|
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;
|
2007-10-06 09:19:53 +00:00
|
|
|
switch (tabular_.getAlignment(cell)) {
|
2006-03-05 17:24:44 +00:00
|
|
|
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;
|
2007-10-06 09:19:53 +00:00
|
|
|
switch (tabular_.getVAlignment(cell)) {
|
2007-04-26 13:39:14 +00:00
|
|
|
case Tabular::LYX_VALIGN_TOP:
|
2006-03-05 17:24:44 +00:00
|
|
|
valign = 0;
|
|
|
|
break;
|
2007-04-26 13:39:14 +00:00
|
|
|
case Tabular::LYX_VALIGN_MIDDLE:
|
2006-03-05 17:24:44 +00:00
|
|
|
valign = 1;
|
|
|
|
break;
|
2007-04-26 13:39:14 +00:00
|
|
|
case Tabular::LYX_VALIGN_BOTTOM:
|
2006-03-05 17:24:44 +00:00
|
|
|
valign = 2;
|
|
|
|
break;
|
|
|
|
default:
|
2008-11-17 11:58:14 +00:00
|
|
|
valign = 0;
|
2006-03-05 17:24:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (pwidth.zero())
|
2008-11-17 11:58:14 +00:00
|
|
|
valign = 0;
|
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
|
|
|
|
2008-04-21 13:33:39 +00:00
|
|
|
if (!tabular_.is_long_tabular) {
|
2007-09-05 20:33:29 +00:00
|
|
|
headerStatusCB->setChecked(false);
|
|
|
|
headerBorderAboveCB->setChecked(false);
|
|
|
|
headerBorderBelowCB->setChecked(false);
|
|
|
|
firstheaderStatusCB->setChecked(false);
|
|
|
|
firstheaderBorderAboveCB->setChecked(false);
|
|
|
|
firstheaderBorderBelowCB->setChecked(false);
|
|
|
|
firstheaderNoContentsCB->setChecked(false);
|
|
|
|
footerStatusCB->setChecked(false);
|
|
|
|
footerBorderAboveCB->setChecked(false);
|
|
|
|
footerBorderBelowCB->setChecked(false);
|
|
|
|
lastfooterStatusCB->setChecked(false);
|
|
|
|
lastfooterBorderAboveCB->setChecked(false);
|
|
|
|
lastfooterBorderBelowCB->setChecked(false);
|
|
|
|
lastfooterNoContentsCB->setChecked(false);
|
|
|
|
newpageCB->setChecked(false);
|
|
|
|
newpageCB->setEnabled(false);
|
2008-05-04 07:51:50 +00:00
|
|
|
captionStatusCB->blockSignals(true);
|
|
|
|
captionStatusCB->setChecked(false);
|
|
|
|
captionStatusCB->blockSignals(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-05-04 07:51:50 +00:00
|
|
|
captionStatusCB->blockSignals(true);
|
|
|
|
captionStatusCB->setChecked(tabular_.ltCaption(row));
|
|
|
|
captionStatusCB->blockSignals(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2009-02-10 18:08:09 +00:00
|
|
|
// FIXME: shouldn't this be handled by GuiDialog?
|
|
|
|
// FIXME: Some of them should be handled directly in TabularUI.ui
|
2009-05-17 09:36:07 +00:00
|
|
|
firstheaderBorderAboveCB->setEnabled(
|
|
|
|
funcEnabled(Tabular::SET_LTFIRSTHEAD));
|
|
|
|
firstheaderBorderBelowCB->setEnabled(
|
|
|
|
funcEnabled(Tabular::SET_LTFIRSTHEAD));
|
2009-02-10 18:08:09 +00:00
|
|
|
// first header can only be suppressed when there is a header
|
|
|
|
firstheaderNoContentsCB->setEnabled(tabular_.haveLTHead()
|
|
|
|
&& !tabular_.haveLTFirstHead());
|
2009-05-17 18:27:39 +00:00
|
|
|
|
2009-05-17 09:36:07 +00:00
|
|
|
//firstheaderStatusCB->setEnabled(
|
|
|
|
// !firstheaderNoContentsCB->isChecked());
|
2009-02-10 18:08:09 +00:00
|
|
|
headerBorderAboveCB->setEnabled(funcEnabled(Tabular::SET_LTHEAD));
|
|
|
|
headerBorderBelowCB->setEnabled(funcEnabled(Tabular::SET_LTHEAD));
|
|
|
|
headerStatusCB->setEnabled(funcEnabled(Tabular::SET_LTHEAD));
|
|
|
|
footerBorderAboveCB->setEnabled(funcEnabled(Tabular::SET_LTFOOT));
|
|
|
|
footerBorderBelowCB->setEnabled(funcEnabled(Tabular::SET_LTFOOT));
|
|
|
|
footerStatusCB->setEnabled(funcEnabled(Tabular::SET_LTFOOT));
|
2009-05-17 09:36:07 +00:00
|
|
|
lastfooterBorderAboveCB->setEnabled(
|
|
|
|
funcEnabled(Tabular::SET_LTLASTFOOT));
|
|
|
|
lastfooterBorderBelowCB->setEnabled(
|
|
|
|
funcEnabled(Tabular::SET_LTLASTFOOT));
|
2009-02-10 18:08:09 +00:00
|
|
|
// last footer can only be suppressed when there is a footer
|
|
|
|
lastfooterNoContentsCB->setEnabled(tabular_.haveLTFoot()
|
|
|
|
&& !tabular_.haveLTLastFoot());
|
2009-05-17 18:27:39 +00:00
|
|
|
|
2009-05-17 09:36:07 +00:00
|
|
|
captionStatusCB->setEnabled(
|
|
|
|
funcEnabled(Tabular::TOGGLE_LTCAPTION));
|
|
|
|
// When a row is set as longtable caption, it must not be allowed
|
|
|
|
// to unset that this row is a multicolumn.
|
2009-02-12 03:02:34 +00:00
|
|
|
multicolumnCB->setEnabled(funcEnabled(Tabular::MULTICOLUMN));
|
2009-02-10 18:08:09 +00:00
|
|
|
|
2007-04-26 13:39:14 +00:00
|
|
|
Tabular::ltType ltt;
|
2006-03-05 17:24:44 +00:00
|
|
|
bool use_empty;
|
2007-10-06 09:19:53 +00:00
|
|
|
bool row_set = tabular_.getRowOfLTHead(row, ltt);
|
2007-09-05 20:33:29 +00:00
|
|
|
headerStatusCB->setChecked(row_set);
|
2006-03-05 17:24:44 +00:00
|
|
|
if (ltt.set) {
|
2007-09-05 20:33:29 +00:00
|
|
|
headerBorderAboveCB->setChecked(ltt.topDL);
|
|
|
|
headerBorderBelowCB->setChecked(ltt.bottomDL);
|
2006-03-05 17:24:44 +00:00
|
|
|
use_empty = true;
|
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
headerBorderAboveCB->setChecked(false);
|
|
|
|
headerBorderBelowCB->setChecked(false);
|
|
|
|
headerBorderAboveCB->setEnabled(false);
|
|
|
|
headerBorderBelowCB->setEnabled(false);
|
|
|
|
firstheaderNoContentsCB->setChecked(false);
|
|
|
|
firstheaderNoContentsCB->setEnabled(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
use_empty = false;
|
|
|
|
}
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
row_set = tabular_.getRowOfLTFirstHead(row, ltt);
|
2009-05-17 18:27:39 +00:00
|
|
|
// check if setting a first header is allowed
|
|
|
|
// additionally check firstheaderStatusCB because when this is the
|
|
|
|
// case a first header makes no sense
|
|
|
|
firstheaderStatusCB->setEnabled(
|
|
|
|
funcEnabled(Tabular::SET_LTFIRSTHEAD)
|
|
|
|
&& !firstheaderNoContentsCB->isChecked());
|
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) {
|
|
|
|
if (ltt.empty)
|
2007-09-05 20:33:29 +00:00
|
|
|
firstheaderStatusCB->setEnabled(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-06 09:19:53 +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;
|
|
|
|
}
|
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
row_set = tabular_.getRowOfLTLastFoot(row, ltt);
|
2009-05-17 18:27:39 +00:00
|
|
|
// check if setting a last footer is allowed
|
|
|
|
// additionally check lastfooterNoContentsCB because when this is
|
|
|
|
// the case a last footer makes no sense
|
|
|
|
lastfooterStatusCB->setEnabled(
|
|
|
|
funcEnabled(Tabular::SET_LTLASTFOOT)
|
|
|
|
&& !lastfooterNoContentsCB->isChecked());
|
2009-02-09 00:06:32 +00:00
|
|
|
lastfooterStatusCB->setChecked(row_set);
|
2006-03-05 17:24:44 +00:00
|
|
|
if (ltt.set && (!ltt.empty || !use_empty)) {
|
2007-09-05 20:33:29 +00:00
|
|
|
lastfooterBorderAboveCB->setChecked(ltt.topDL);
|
|
|
|
lastfooterBorderBelowCB->setChecked(ltt.bottomDL);
|
2006-03-05 17:24:44 +00:00
|
|
|
} else {
|
2007-09-05 20:33:29 +00:00
|
|
|
lastfooterBorderAboveCB->setEnabled(false);
|
|
|
|
lastfooterBorderBelowCB->setEnabled(false);
|
|
|
|
lastfooterBorderAboveCB->setChecked(false);
|
|
|
|
lastfooterBorderBelowCB->setChecked(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
if (use_empty) {
|
|
|
|
if (ltt.empty)
|
2007-09-05 20:33:29 +00:00
|
|
|
lastfooterStatusCB->setEnabled(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
}
|
2007-10-06 09:19:53 +00:00
|
|
|
newpageCB->setChecked(tabular_.getLTNewPage(row));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:19:53 +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
|
2007-10-06 09:19:53 +00:00
|
|
|
// since the changes update the actual tabular_
|
|
|
|
//
|
2006-03-05 17:24:44 +00:00
|
|
|
// apply the fixed width values
|
2008-04-21 13:47:01 +00:00
|
|
|
size_t const cell = getActiveCell();
|
2007-10-06 09:19:53 +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;
|
|
|
|
|
2008-04-21 13:47:01 +00:00
|
|
|
Length llen = getColumnPWidth(tabular_, cell);
|
|
|
|
Length llenMulti = getMColumnPWidth(tabular_, cell);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
if (multicol && !llenMulti.zero())
|
2007-10-06 09:19:53 +00:00
|
|
|
width2 = llenMulti.asString();
|
2006-03-05 17:24:44 +00:00
|
|
|
else if (!multicol && !llen.zero())
|
2007-10-06 09:19:53 +00:00
|
|
|
width2 = llen.asString();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
// 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)
|
2009-05-17 09:36:07 +00:00
|
|
|
sa2 = getAlignSpecial(tabular_, cell,
|
|
|
|
Tabular::SET_SPECIAL_MULTI);
|
2006-03-05 17:24:44 +00:00
|
|
|
else
|
2009-05-17 09:36:07 +00:00
|
|
|
sa2 = getAlignSpecial(tabular_, cell,
|
|
|
|
Tabular::SET_SPECIAL_COLUMN);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
if (sa1 != sa2) {
|
|
|
|
if (multicol)
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_SPECIAL_MULTI, to_utf8(sa1));
|
2006-03-05 17:24:44 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_SPECIAL_COLUMN, to_utf8(sa1));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (width != width2) {
|
|
|
|
if (multicol)
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_MPWIDTH, width);
|
2006-03-05 17:24:44 +00:00
|
|
|
else
|
2007-10-06 09:19:53 +00:00
|
|
|
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-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_TOP_SPACE, "");
|
2006-07-03 19:13:56 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_TOP_SPACE, "default");
|
2006-07-03 19:13:56 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_TOP_SPACE,
|
2009-05-17 09:36:07 +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-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_BOTTOM_SPACE, "");
|
2006-07-03 19:13:56 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_BOTTOM_SPACE, "default");
|
2006-07-03 19:13:56 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_BOTTOM_SPACE,
|
2009-05-17 09:36:07 +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-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_INTERLINE_SPACE, "");
|
2006-07-03 19:13:56 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_INTERLINE_SPACE, "default");
|
2006-07-03 19:13:56 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2007-10-06 09:19:53 +00:00
|
|
|
set(Tabular::SET_INTERLINE_SPACE,
|
2009-05-17 09:36:07 +00:00
|
|
|
widgetsToLength(interlinespaceED,
|
|
|
|
interlinespaceUnit));
|
2006-07-03 19:13:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
*/
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
2007-10-09 21:21:01 +00:00
|
|
|
|
2007-10-06 09:19:53 +00:00
|
|
|
bool GuiTabular::initialiseParams(string const & data)
|
|
|
|
{
|
|
|
|
// try to get the current cell
|
|
|
|
BufferView const * const bv = bufferview();
|
|
|
|
InsetTabular const * current_inset = 0;
|
|
|
|
if (bv) {
|
|
|
|
Cursor const & cur = bv->cursor();
|
|
|
|
// get the innermost tabular inset;
|
|
|
|
// assume that it is "ours"
|
|
|
|
for (int i = cur.depth() - 1; i >= 0; --i)
|
2007-10-13 09:04:52 +00:00
|
|
|
if (cur[i].inset().lyxCode() == TABULAR_CODE) {
|
2009-05-17 09:36:07 +00:00
|
|
|
current_inset =
|
|
|
|
static_cast<InsetTabular const *>(&cur[i].inset());
|
2007-10-06 09:19:53 +00:00
|
|
|
active_cell_ = cur[i].idx();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (current_inset && data.empty()) {
|
|
|
|
tabular_ = Tabular(current_inset->tabular);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-09-29 10:52:17 +00:00
|
|
|
InsetTabular tmp(const_cast<Buffer &>(buffer()));
|
2008-03-27 22:26:24 +00:00
|
|
|
InsetTabular::string2params(data, tmp);
|
2007-10-06 09:19:53 +00:00
|
|
|
tabular_ = Tabular(tmp.tabular);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::clearParams()
|
|
|
|
{
|
2009-05-17 09:36:07 +00:00
|
|
|
// This function is also called when LyX is closing and the dialog
|
|
|
|
// is still open. At that time, the buffer might not be available
|
|
|
|
// anymore.
|
2009-02-08 19:44:53 +00:00
|
|
|
if (isBufferAvailable()) {
|
|
|
|
InsetTabular tmp(const_cast<Buffer &>(buffer()));
|
|
|
|
tabular_ = tmp.tabular;
|
|
|
|
}
|
2007-10-06 09:19:53 +00:00
|
|
|
active_cell_ = Tabular::npos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Tabular::idx_type GuiTabular::getActiveCell() const
|
|
|
|
{
|
|
|
|
return active_cell_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::set(Tabular::Feature f, string const & arg)
|
|
|
|
{
|
|
|
|
string const data = featureAsString(f) + ' ' + arg;
|
|
|
|
dispatch(FuncRequest(getLfun(), data));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::setSpecial(string const & special)
|
|
|
|
{
|
|
|
|
if (tabular_.isMultiColumn(getActiveCell()))
|
|
|
|
set(Tabular::SET_SPECIAL_MULTI, special);
|
|
|
|
else
|
|
|
|
set(Tabular::SET_SPECIAL_COLUMN, special);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::setWidth(string const & width)
|
|
|
|
{
|
|
|
|
if (tabular_.isMultiColumn(getActiveCell()))
|
|
|
|
set(Tabular::SET_MPWIDTH, width);
|
|
|
|
else
|
|
|
|
set(Tabular::SET_PWIDTH, width);
|
|
|
|
|
2007-10-09 21:21:01 +00:00
|
|
|
updateView();
|
2007-10-06 09:19:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::toggleMultiColumn()
|
|
|
|
{
|
|
|
|
set(Tabular::MULTICOLUMN);
|
2007-10-09 21:21:01 +00:00
|
|
|
updateView();
|
2007-10-06 09:19:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::rotateTabular(bool yes)
|
|
|
|
{
|
|
|
|
if (yes)
|
|
|
|
set(Tabular::SET_ROTATE_TABULAR);
|
|
|
|
else
|
|
|
|
set(Tabular::UNSET_ROTATE_TABULAR);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::rotateCell(bool yes)
|
|
|
|
{
|
|
|
|
if (yes)
|
|
|
|
set(Tabular::SET_ROTATE_CELL);
|
|
|
|
else
|
|
|
|
set(Tabular::UNSET_ROTATE_CELL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::halign(GuiTabular::HALIGN h)
|
|
|
|
{
|
|
|
|
Tabular::Feature num = Tabular::ALIGN_LEFT;
|
|
|
|
Tabular::Feature multi_num = Tabular::M_ALIGN_LEFT;
|
|
|
|
|
|
|
|
switch (h) {
|
|
|
|
case LEFT:
|
|
|
|
num = Tabular::ALIGN_LEFT;
|
|
|
|
multi_num = Tabular::M_ALIGN_LEFT;
|
|
|
|
break;
|
|
|
|
case CENTER:
|
|
|
|
num = Tabular::ALIGN_CENTER;
|
|
|
|
multi_num = Tabular::M_ALIGN_CENTER;
|
|
|
|
break;
|
|
|
|
case RIGHT:
|
|
|
|
num = Tabular::ALIGN_RIGHT;
|
|
|
|
multi_num = Tabular::M_ALIGN_RIGHT;
|
|
|
|
break;
|
|
|
|
case BLOCK:
|
|
|
|
num = Tabular::ALIGN_BLOCK;
|
|
|
|
//multi_num: no equivalent
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tabular_.isMultiColumn(getActiveCell()))
|
|
|
|
set(multi_num);
|
|
|
|
else
|
|
|
|
set(num);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::valign(GuiTabular::VALIGN v)
|
|
|
|
{
|
|
|
|
Tabular::Feature num = Tabular::VALIGN_MIDDLE;
|
|
|
|
Tabular::Feature multi_num = Tabular::M_VALIGN_MIDDLE;
|
|
|
|
|
|
|
|
switch (v) {
|
|
|
|
case TOP:
|
|
|
|
num = Tabular::VALIGN_TOP;
|
|
|
|
multi_num = Tabular::M_VALIGN_TOP;
|
|
|
|
break;
|
|
|
|
case MIDDLE:
|
|
|
|
num = Tabular::VALIGN_MIDDLE;
|
|
|
|
multi_num = Tabular::M_VALIGN_MIDDLE;
|
|
|
|
break;
|
|
|
|
case BOTTOM:
|
|
|
|
num = Tabular::VALIGN_BOTTOM;
|
|
|
|
multi_num = Tabular::M_VALIGN_BOTTOM;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tabular_.isMultiColumn(getActiveCell()))
|
|
|
|
set(multi_num);
|
|
|
|
else
|
|
|
|
set(num);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::booktabs(bool yes)
|
|
|
|
{
|
|
|
|
if (yes)
|
|
|
|
set(Tabular::SET_BOOKTABS);
|
|
|
|
else
|
|
|
|
set(Tabular::UNSET_BOOKTABS);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabular::longTabular(bool yes)
|
|
|
|
{
|
|
|
|
if (yes)
|
|
|
|
set(Tabular::SET_LONGTABULAR);
|
|
|
|
else
|
|
|
|
set(Tabular::UNSET_LONGTABULAR);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-10 18:08:09 +00:00
|
|
|
// to get the status of the longtable row settings
|
|
|
|
bool GuiTabular::funcEnabled(Tabular::Feature f) const
|
|
|
|
{
|
2009-05-17 09:36:07 +00:00
|
|
|
return getStatus(
|
|
|
|
FuncRequest(getLfun(), featureAsString(f))).enabled();
|
2009-02-10 18:08:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
Dialog * createGuiTabular(GuiView & lv) { return new GuiTabular(lv); }
|
2007-10-06 09:19:53 +00:00
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-24 17:46:08 +00:00
|
|
|
|
2008-11-14 14:28:50 +00:00
|
|
|
#include "moc_GuiTabular.cpp"
|