mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-04 22:32:19 +00:00
d6546c2bf4
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6863 a592a061-630c-0410-9148-cb99ea01b6c8
350 lines
7.4 KiB
C
350 lines
7.4 KiB
C
/**
|
|
* \file QTabularDialog.C
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author John Levon
|
|
* \author Juergen Spitzmueller
|
|
* \author Herbert Voss
|
|
*
|
|
* Full author contact details are available in file CREDITS
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
|
|
#include "ControlTabular.h"
|
|
|
|
#include "QTabular.h"
|
|
#include "QTabularDialog.h"
|
|
#include "tabular.h"
|
|
#include "lengthcombo.h"
|
|
#include "qsetborder.h"
|
|
#include "qt_helpers.h"
|
|
#include "debug.h"
|
|
|
|
#include <qcheckbox.h>
|
|
#include <qpushbutton.h>
|
|
#include <qlineedit.h>
|
|
|
|
using std::endl;
|
|
|
|
QTabularDialog::QTabularDialog(QTabular * form)
|
|
: QTabularDialogBase(0, 0, false, 0),
|
|
form_(form)
|
|
{
|
|
connect(closePB, SIGNAL(clicked()),
|
|
form, SLOT(slotClose()));
|
|
}
|
|
|
|
|
|
void QTabularDialog::change_adaptor()
|
|
{
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::closeEvent(QCloseEvent * e)
|
|
{
|
|
form_->slotWMHide();
|
|
e->accept();
|
|
}
|
|
|
|
|
|
void QTabularDialog::close_clicked()
|
|
{
|
|
form_->closeGUI();
|
|
}
|
|
|
|
|
|
void QTabularDialog::borderSet_clicked()
|
|
{
|
|
form_->controller().set(LyXTabular::SET_ALL_LINES);
|
|
form_->update_borders();
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::borderUnset_clicked()
|
|
{
|
|
form_->controller().set(LyXTabular::UNSET_ALL_LINES);
|
|
form_->update_borders();
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::leftBorder_changed()
|
|
{
|
|
form_->controller().toggleLeftLine();
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::rightBorder_changed()
|
|
{
|
|
form_->controller().toggleRightLine();
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::topBorder_changed()
|
|
{
|
|
form_->controller().toggleTopLine();
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::bottomBorder_changed()
|
|
{
|
|
form_->controller().toggleBottomLine();
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::specialAlignment_changed()
|
|
{
|
|
string special = fromqstr(specialAlignmentED->text());
|
|
form_->controller().setSpecial(special);
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::width_changed()
|
|
{
|
|
form_->changed();
|
|
string const width =
|
|
LyXLength(widthED->text().toDouble(),
|
|
widthUnit->currentLengthItem()).asString();
|
|
form_->controller().setWidth(width);
|
|
}
|
|
|
|
|
|
void QTabularDialog::multicolumn_clicked()
|
|
{
|
|
form_->controller().toggleMultiColumn();
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::rotateTabular()
|
|
{
|
|
form_->controller().rotateTabular(rotateTabularCB->isChecked());
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::rotateCell()
|
|
{
|
|
form_->controller().rotateCell(rotateCellCB->isChecked());
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::hAlign_changed(int align)
|
|
{
|
|
ControlTabular::HALIGN h;
|
|
|
|
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);
|
|
}
|
|
|
|
|
|
void QTabularDialog::vAlign_changed(int align)
|
|
{
|
|
ControlTabular::VALIGN v;
|
|
|
|
switch (align) {
|
|
case 0: v = ControlTabular::TOP; break;
|
|
case 1: v = ControlTabular::VCENTER; break;
|
|
case 2: v = ControlTabular::BOTTOM; break;
|
|
}
|
|
|
|
form_->controller().valign(v);
|
|
}
|
|
|
|
|
|
void QTabularDialog::longTabular()
|
|
{
|
|
form_->controller().longTabular(longTabularCB->isChecked());
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltNewpage_clicked()
|
|
{
|
|
form_->controller().set(LyXTabular::SET_LTNEWPAGE);
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltHeaderStatus_clicked()
|
|
{
|
|
bool enable(headerStatusCB->isChecked());
|
|
if (enable)
|
|
form_->controller().set(LyXTabular::SET_LTHEAD, "");
|
|
else
|
|
form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
|
|
headerBorderAboveCB->setEnabled(enable);
|
|
headerBorderBelowCB->setEnabled(enable);
|
|
firstheaderNoContentsCB->setEnabled(enable);
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltHeaderBorderAbove_clicked()
|
|
{
|
|
if (headerBorderAboveCB->isChecked())
|
|
form_->controller().set(LyXTabular::SET_LTHEAD, "dl_above");
|
|
else
|
|
form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltHeaderBorderBelow_clicked()
|
|
{
|
|
if (headerBorderBelowCB->isChecked())
|
|
form_->controller().set(LyXTabular::SET_LTHEAD, "dl_below");
|
|
else
|
|
form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltFirstHeaderBorderAbove_clicked()
|
|
{
|
|
if (firstheaderBorderAboveCB->isChecked())
|
|
form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_above");
|
|
else
|
|
form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltFirstHeaderBorderBelow_clicked()
|
|
{
|
|
if (firstheaderBorderBelowCB->isChecked())
|
|
form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_below");
|
|
else
|
|
form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltFirstHeaderStatus_clicked()
|
|
{
|
|
bool enable(firstheaderStatusCB->isChecked());
|
|
if (enable)
|
|
form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "");
|
|
else
|
|
form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
|
|
firstheaderBorderAboveCB->setEnabled(enable);
|
|
firstheaderBorderBelowCB->setEnabled(enable);
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltFirstHeaderEmpty_clicked()
|
|
{
|
|
bool enable(firstheaderNoContentsCB->isChecked());
|
|
if (enable)
|
|
form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "empty");
|
|
else {
|
|
ltFirstHeaderBorderBelow_clicked();
|
|
ltFirstHeaderBorderAbove_clicked();
|
|
}
|
|
firstheaderStatusCB->setEnabled(!enable);
|
|
firstheaderBorderAboveCB->setEnabled(!enable);
|
|
firstheaderBorderBelowCB->setEnabled(!enable);
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltFooterStatus_clicked()
|
|
{
|
|
bool enable(footerStatusCB->isChecked());
|
|
if (enable)
|
|
form_->controller().set(LyXTabular::SET_LTFOOT, "");
|
|
else
|
|
form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
|
|
footerBorderAboveCB->setEnabled(enable);
|
|
footerBorderBelowCB->setEnabled(enable);
|
|
lastfooterNoContentsCB->setEnabled(enable);
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltFooterBorderAbove_clicked()
|
|
{
|
|
if (footerBorderAboveCB->isChecked())
|
|
form_->controller().set(LyXTabular::SET_LTFOOT, "dl_above");
|
|
else
|
|
form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltFooterBorderBelow_clicked()
|
|
{
|
|
if (footerBorderBelowCB->isChecked())
|
|
form_->controller().set(LyXTabular::SET_LTFOOT, "dl_below");
|
|
else
|
|
form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltLastFooterStatus_clicked()
|
|
{
|
|
bool enable(lastfooterStatusCB->isChecked());
|
|
if (enable)
|
|
form_->controller().set(LyXTabular::SET_LTLASTFOOT, "");
|
|
else
|
|
form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
|
|
lastfooterBorderAboveCB->setEnabled(enable);
|
|
lastfooterBorderBelowCB->setEnabled(enable);
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltLastFooterBorderAbove_clicked()
|
|
{
|
|
if (lastfooterBorderAboveCB->isChecked())
|
|
form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_above");
|
|
else
|
|
form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltLastFooterBorderBelow_clicked()
|
|
{
|
|
if (lastfooterBorderBelowCB->isChecked())
|
|
form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_below");
|
|
else
|
|
form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
|
|
form_->changed();
|
|
}
|
|
|
|
|
|
void QTabularDialog::ltLastFooterEmpty_clicked()
|
|
{
|
|
bool enable(lastfooterNoContentsCB->isChecked());
|
|
if (enable)
|
|
form_->controller().set(LyXTabular::SET_LTLASTFOOT, "empty");
|
|
else {
|
|
ltLastFooterBorderBelow_clicked();
|
|
ltLastFooterBorderAbove_clicked();
|
|
}
|
|
lastfooterStatusCB->setEnabled(!enable);
|
|
lastfooterBorderAboveCB->setEnabled(!enable);
|
|
lastfooterBorderBelowCB->setEnabled(!enable);
|
|
form_->changed();
|
|
}
|