2001-02-14 19:43:56 +00:00
|
|
|
/**
|
|
|
|
* \file paragraphdlgimpl.C
|
|
|
|
* Copyright 2001 LyX Team
|
|
|
|
* see the file COPYING
|
|
|
|
*
|
|
|
|
* \author John Levon, moz@compsoc.man.ac.uk
|
|
|
|
* \author Edwin Leuven, leuven@fee.uva.nl
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "paragraphdlg.h"
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <gettext.h>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "paragraphdlgimpl.h"
|
|
|
|
#include "FormParagraph.h"
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
#include "qlineedit.h"
|
|
|
|
#include "qcombobox.h"
|
|
|
|
#include "qcheckbox.h"
|
|
|
|
#include "qpushbutton.h"
|
|
|
|
#include "qtabwidget.h"
|
|
|
|
#include "qlabel.h"
|
|
|
|
#include "qgroupbox.h"
|
|
|
|
|
2001-03-05 12:04:43 +00:00
|
|
|
using std::endl;
|
2001-02-14 19:43:56 +00:00
|
|
|
|
|
|
|
ParagraphDlgImpl::ParagraphDlgImpl(FormParagraph *form, QWidget* parent, const char* name, bool modal, WFlags fl )
|
2001-06-05 17:05:51 +00:00
|
|
|
: ParagraphDlg( parent, name, modal, fl ), form_(form)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
setCaption(name);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
ParagraphDlgImpl::~ParagraphDlgImpl()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::setReadOnly(bool readonly)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
TabsParagraph->setEnabled(!readonly);
|
|
|
|
okPB->setEnabled(!readonly);
|
|
|
|
applyPB->setEnabled(!readonly);
|
|
|
|
defaultsPB->setEnabled(!readonly);
|
|
|
|
cancelPB->setText(readonly ? _("&Close") : _("&Cancel"));
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::setLabelWidth(const char *text)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
// FIXME: should be cleverer here
|
|
|
|
if (!strcmp(_("Senseless with this layout!"),text)) {
|
|
|
|
listOptions->setEnabled(false);
|
|
|
|
labelWidth->setText("");
|
|
|
|
} else {
|
|
|
|
listOptions->setEnabled(true);
|
|
|
|
labelWidth->setText(text);
|
|
|
|
}
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::setAlign(int type)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
int item=0;
|
|
|
|
switch (type) {
|
|
|
|
case LYX_ALIGN_BLOCK : item=0; break;
|
|
|
|
case LYX_ALIGN_LEFT : item=1; break;
|
|
|
|
case LYX_ALIGN_RIGHT : item=2; break;
|
|
|
|
case LYX_ALIGN_CENTER : item=3; break;
|
|
|
|
default:
|
|
|
|
item=0;
|
|
|
|
}
|
|
|
|
alignment->setCurrentItem(item);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::setChecks(bool labove, bool lbelow, bool pabove, bool pbelow, bool noindent)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
lineAbove->setChecked(labove);
|
|
|
|
lineBelow->setChecked(lbelow);
|
|
|
|
pagebreakAbove->setChecked(pabove);
|
|
|
|
pagebreakBelow->setChecked(pbelow);
|
|
|
|
noIndent->setChecked(noindent);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::setSpace(VSpace::vspace_kind kindabove, VSpace::vspace_kind kindbelow, bool keepabove, bool keepbelow)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
int item=0;
|
|
|
|
|
|
|
|
switch (kindabove) {
|
|
|
|
case VSpace::NONE: item = 0; break;
|
|
|
|
case VSpace::DEFSKIP: item = 1; break;
|
|
|
|
case VSpace::SMALLSKIP: item = 2; break;
|
|
|
|
case VSpace::MEDSKIP: item = 3; break;
|
|
|
|
case VSpace::BIGSKIP: item = 4; break;
|
|
|
|
case VSpace::VFILL: item = 5; break;
|
|
|
|
case VSpace::LENGTH: item = 6; break;
|
|
|
|
}
|
|
|
|
spacingAbove->setCurrentItem(item);
|
|
|
|
|
|
|
|
switch (kindbelow) {
|
|
|
|
case VSpace::NONE: item = 0; break;
|
|
|
|
case VSpace::DEFSKIP: item = 1; break;
|
|
|
|
case VSpace::SMALLSKIP: item = 2; break;
|
|
|
|
case VSpace::MEDSKIP: item = 3; break;
|
|
|
|
case VSpace::BIGSKIP: item = 4; break;
|
|
|
|
case VSpace::VFILL: item = 5; break;
|
|
|
|
case VSpace::LENGTH: item = 6; break;
|
|
|
|
}
|
|
|
|
spacingBelow->setCurrentItem(item);
|
|
|
|
|
|
|
|
spacingAboveValue->setEnabled(kindabove == VSpace::LENGTH);
|
|
|
|
spacingAbovePlus->setEnabled(kindabove == VSpace::LENGTH);
|
|
|
|
spacingAboveMinus->setEnabled(kindabove == VSpace::LENGTH);
|
|
|
|
spacingBelowValue->setEnabled(kindbelow == VSpace::LENGTH);
|
|
|
|
spacingBelowPlus->setEnabled(kindbelow == VSpace::LENGTH);
|
|
|
|
spacingBelowMinus->setEnabled(kindbelow == VSpace::LENGTH);
|
|
|
|
|
|
|
|
spacingAboveKeep->setChecked(keepabove);
|
|
|
|
spacingBelowKeep->setChecked(keepbelow);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::setAboveLength(float val, float plus, float minus,
|
|
|
|
LyXLength::UNIT vunit, LyXLength::UNIT punit, LyXLength::UNIT munit)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
if (vunit==LyXLength::UNIT_NONE) {
|
|
|
|
spacingAboveValue->setText("");
|
|
|
|
spacingAbovePlus->setText("");
|
|
|
|
spacingAboveMinus->setText("");
|
|
|
|
} else {
|
|
|
|
spacingAboveValue->setText(tostr(val).c_str());
|
|
|
|
spacingAbovePlus->setText(tostr(plus).c_str());
|
|
|
|
spacingAboveMinus->setText(tostr(minus).c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
spacingAboveValueUnit->setCurrentItem(getItem(vunit));
|
|
|
|
spacingAbovePlusUnit->setCurrentItem(getItem(punit));
|
|
|
|
spacingAboveMinusUnit->setCurrentItem(getItem(munit));
|
2001-02-14 19:43:56 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::setBelowLength(float val, float plus, float minus,
|
|
|
|
LyXLength::UNIT vunit, LyXLength::UNIT punit, LyXLength::UNIT munit)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
if (vunit==LyXLength::UNIT_NONE) {
|
|
|
|
spacingBelowValue->setText("");
|
|
|
|
spacingBelowPlus->setText("");
|
|
|
|
spacingBelowMinus->setText("");
|
|
|
|
} else {
|
|
|
|
spacingBelowValue->setText(tostr(val).c_str());
|
|
|
|
spacingBelowPlus->setText(tostr(plus).c_str());
|
|
|
|
spacingBelowMinus->setText(tostr(minus).c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
spacingBelowValueUnit->setCurrentItem(getItem(vunit));
|
|
|
|
spacingBelowPlusUnit->setCurrentItem(getItem(punit));
|
|
|
|
spacingBelowMinusUnit->setCurrentItem(getItem(munit));
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-03-16 00:09:53 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::setExtra(float widthval, LyXLength::UNIT units, const string percent, int align,
|
|
|
|
bool hfill, bool startminipage, LyXParagraph::PEXTRA_TYPE type)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
if (type!=LyXParagraph::PEXTRA_NONE) {
|
|
|
|
lyxerr[Debug::GUI] << "percent : $" << percent << "$ widthval " << widthval << " unit " << long(units) << endl;
|
|
|
|
if (percent != "") {
|
|
|
|
extraWidth->setText(percent.c_str());
|
|
|
|
extraUnit->setCurrentItem(11);
|
|
|
|
} else {
|
|
|
|
extraWidth->setText(tostr(widthval).c_str());
|
|
|
|
extraUnit->setCurrentItem(getItem(units));
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
extraWidth->setText("");
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case LyXParagraph::PEXTRA_NONE:
|
|
|
|
extraType->setCurrentItem(0);
|
|
|
|
break;
|
|
|
|
case LyXParagraph::PEXTRA_MINIPAGE:
|
|
|
|
extraType->setCurrentItem(1);
|
|
|
|
enable_extraOptions(1);
|
|
|
|
enable_minipageOptions(1);
|
|
|
|
break;
|
|
|
|
case LyXParagraph::PEXTRA_FLOATFLT:
|
|
|
|
extraType->setCurrentItem(2);
|
|
|
|
enable_extraOptions(2);
|
|
|
|
break;
|
|
|
|
case LyXParagraph::PEXTRA_INDENT:
|
|
|
|
extraType->setCurrentItem(3);
|
|
|
|
enable_extraOptions(3);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (align) {
|
|
|
|
case LyXParagraph::MINIPAGE_ALIGN_TOP:
|
|
|
|
minipageValign->setCurrentItem(0);
|
|
|
|
break;
|
|
|
|
case LyXParagraph::MINIPAGE_ALIGN_MIDDLE:
|
|
|
|
minipageValign->setCurrentItem(1);
|
|
|
|
break;
|
|
|
|
case LyXParagraph::MINIPAGE_ALIGN_BOTTOM:
|
|
|
|
minipageValign->setCurrentItem(2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
minipageHfill->setChecked(hfill);
|
|
|
|
minipageStart->setChecked(startminipage);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-03-16 00:09:53 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
LyXGlueLength ParagraphDlgImpl::getAboveLength() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
LyXGlueLength len(
|
|
|
|
spacingAboveValue->text().toFloat(),
|
|
|
|
getLyXLength( spacingAboveValueUnit->currentItem() ),
|
|
|
|
spacingAbovePlus->text().toFloat(),
|
|
|
|
getLyXLength( spacingAbovePlusUnit->currentItem() ),
|
|
|
|
spacingAboveMinus->text().toFloat(),
|
|
|
|
getLyXLength( spacingAboveMinusUnit->currentItem() )
|
|
|
|
);
|
|
|
|
return len;
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
LyXGlueLength ParagraphDlgImpl::getBelowLength() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
LyXGlueLength len(
|
|
|
|
spacingBelowValue->text().toFloat(),
|
|
|
|
getLyXLength( spacingBelowValueUnit->currentItem() ),
|
|
|
|
spacingBelowPlus->text().toFloat(),
|
|
|
|
getLyXLength( spacingBelowPlusUnit->currentItem() ),
|
|
|
|
spacingBelowMinus->text().toFloat(),
|
|
|
|
getLyXLength( spacingBelowMinusUnit->currentItem() )
|
2001-02-14 19:43:56 +00:00
|
|
|
);
|
2001-06-05 17:05:51 +00:00
|
|
|
return len;
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
LyXLength ParagraphDlgImpl::getExtraWidth() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
if (extraUnit->currentItem()!=11) {
|
|
|
|
LyXLength len(
|
|
|
|
(extraWidth->text()).toDouble(),
|
|
|
|
getLyXLength(extraUnit->currentItem())
|
|
|
|
);
|
|
|
|
return len;
|
|
|
|
} else {
|
|
|
|
LyXLength len(0.0, LyXLength::UNIT_NONE);
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
string ParagraphDlgImpl::getExtraWidthPercent() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
double val = (extraWidth->text()).toDouble();
|
|
|
|
if (val > 100.0)
|
|
|
|
val = 100.0;
|
|
|
|
if (val < 0.0)
|
|
|
|
val = 0.0;
|
|
|
|
return tostr(val);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
const char * ParagraphDlgImpl::getLabelWidth() const {
|
|
|
|
return labelWidth->text();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
LyXAlignment ParagraphDlgImpl::getAlign() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
switch (alignment->currentItem()) {
|
|
|
|
case 0: return LYX_ALIGN_BLOCK;
|
|
|
|
case 1: return LYX_ALIGN_LEFT;
|
|
|
|
case 2: return LYX_ALIGN_RIGHT;
|
|
|
|
case 3: return LYX_ALIGN_CENTER;
|
|
|
|
default: return LYX_ALIGN_CENTER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
bool ParagraphDlgImpl::getAboveKeep() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
return spacingAboveKeep->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
bool ParagraphDlgImpl::getBelowKeep() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
return spacingBelowKeep->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
bool ParagraphDlgImpl::getLineAbove() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
return lineAbove->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
bool ParagraphDlgImpl::getLineBelow() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
return lineBelow->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
bool ParagraphDlgImpl::getPagebreakAbove() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
return pagebreakAbove->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
bool ParagraphDlgImpl::getPagebreakBelow() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
return pagebreakBelow->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
bool ParagraphDlgImpl::getNoIndent() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
return noIndent->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
VSpace::vspace_kind ParagraphDlgImpl::getSpaceAboveKind() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
return getSpaceKind(spacingAbove->currentItem());
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
VSpace::vspace_kind ParagraphDlgImpl::getSpaceBelowKind() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
return getSpaceKind(spacingBelow->currentItem());
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-03-16 00:09:53 +00:00
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
LyXParagraph::PEXTRA_TYPE ParagraphDlgImpl::getExtraType() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
switch (extraType->currentItem()) {
|
|
|
|
case 0: return LyXParagraph::PEXTRA_NONE;
|
|
|
|
case 1: return LyXParagraph::PEXTRA_MINIPAGE;
|
|
|
|
case 2: return LyXParagraph::PEXTRA_FLOATFLT;
|
|
|
|
case 3: return LyXParagraph::PEXTRA_INDENT;
|
|
|
|
}
|
|
|
|
return LyXParagraph::PEXTRA_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
LyXParagraph::MINIPAGE_ALIGNMENT ParagraphDlgImpl::getExtraAlign() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
switch (minipageValign->currentItem()) {
|
|
|
|
case 0: return LyXParagraph::MINIPAGE_ALIGN_TOP;
|
|
|
|
case 1: return LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
|
|
|
|
case 2: return LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
|
|
|
|
default: return LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
bool ParagraphDlgImpl::getHfillBetween() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
return minipageHfill->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
bool ParagraphDlgImpl::getStartNewMinipage() const {
|
2001-06-05 17:05:51 +00:00
|
|
|
return minipageStart->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-03-16 00:09:53 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
VSpace::vspace_kind ParagraphDlgImpl::getSpaceKind(int val) const {
|
2001-06-05 17:05:51 +00:00
|
|
|
switch (val) {
|
|
|
|
case 0: return VSpace::NONE;
|
|
|
|
case 1: return VSpace::DEFSKIP;
|
|
|
|
case 2: return VSpace::SMALLSKIP;
|
|
|
|
case 3: return VSpace::MEDSKIP;
|
|
|
|
case 4: return VSpace::BIGSKIP;
|
|
|
|
case 5: return VSpace::VFILL;
|
|
|
|
case 6: return VSpace::LENGTH;
|
|
|
|
default:
|
|
|
|
lyxerr[Debug::GUI] << "Unknown kind combo entry " << val << std::endl;
|
|
|
|
}
|
|
|
|
return VSpace::NONE;
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
LyXLength::UNIT ParagraphDlgImpl::getLyXLength(int val) const {
|
2001-06-05 17:05:51 +00:00
|
|
|
switch (val) {
|
|
|
|
case 0: return LyXLength::CM;
|
|
|
|
case 1: return LyXLength::IN;
|
|
|
|
case 2: return LyXLength::PT;
|
|
|
|
case 3: return LyXLength::MM;
|
|
|
|
case 4: return LyXLength::PC;
|
|
|
|
case 5: return LyXLength::EX;
|
|
|
|
case 6: return LyXLength::EM;
|
|
|
|
case 7: return LyXLength::SP;
|
|
|
|
case 8: return LyXLength::BP;
|
|
|
|
case 9: return LyXLength::DD;
|
|
|
|
case 10: return LyXLength::CC;
|
|
|
|
default:
|
|
|
|
lyxerr[Debug::GUI] << "Unknown kind combo entry " << val << std::endl;
|
|
|
|
}
|
|
|
|
return LyXLength::UNIT_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
int ParagraphDlgImpl::getItem(LyXLength::UNIT unit) const {
|
2001-06-05 17:05:51 +00:00
|
|
|
int item=0;
|
|
|
|
switch (unit) {
|
|
|
|
case LyXLength::CM: item = 0; break;
|
|
|
|
case LyXLength::IN: item = 1; break;
|
|
|
|
case LyXLength::PT: item = 2; break;
|
|
|
|
case LyXLength::MM: item = 3; break;
|
|
|
|
case LyXLength::PC: item = 4; break;
|
|
|
|
case LyXLength::EX: item = 5; break;
|
|
|
|
case LyXLength::EM: item = 6; break;
|
|
|
|
case LyXLength::SP: item = 7; break;
|
|
|
|
case LyXLength::BP: item = 8; break;
|
|
|
|
case LyXLength::DD: item = 9; break;
|
|
|
|
case LyXLength::CC: item = 10; break;
|
|
|
|
case LyXLength::MU: item = 0; break;
|
|
|
|
case LyXLength::UNIT_NONE: item = 0; break;
|
|
|
|
default:
|
|
|
|
lyxerr[Debug::GUI] << "Unknown unit " << long(unit) << endl;
|
|
|
|
}
|
|
|
|
return item;
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::enable_extraOptions(int item)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
bool enable = (item!=0);
|
|
|
|
extraWidth->setEnabled(enable);
|
|
|
|
extraWidthL->setEnabled(enable);
|
|
|
|
extraUnit->setEnabled(enable);
|
|
|
|
extraUnitL->setEnabled(enable);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::enable_minipageOptions(int item)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
minipageOptions->setEnabled( item==1 );
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::enable_spacingAbove(int item)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
bool enable = (item==6);
|
|
|
|
spacingAboveValue->setEnabled(enable);
|
|
|
|
spacingAbovePlus->setEnabled(enable);
|
|
|
|
spacingAboveMinus->setEnabled(enable);
|
|
|
|
spacingAboveValueUnit->setEnabled(enable);
|
|
|
|
spacingAbovePlusUnit->setEnabled(enable);
|
|
|
|
spacingAboveMinusUnit->setEnabled(enable);
|
|
|
|
spacingAboveUnitsL->setEnabled(enable);
|
|
|
|
bool enablel = ( (item==6) || (item!=6 && spacingBelow->currentItem()==6) );
|
|
|
|
spacingValueL->setEnabled(enablel);
|
|
|
|
spacingPlusL->setEnabled(enablel);
|
|
|
|
spacingMinusL->setEnabled(enablel);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::enable_spacingBelow(int item)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
bool enable = (item==6);
|
|
|
|
spacingBelowValue->setEnabled(enable);
|
|
|
|
spacingBelowPlus->setEnabled(enable);
|
|
|
|
spacingBelowMinus->setEnabled(enable);
|
|
|
|
spacingBelowValueUnit->setEnabled(enable);
|
|
|
|
spacingBelowPlusUnit->setEnabled(enable);
|
|
|
|
spacingBelowMinusUnit->setEnabled(enable);
|
|
|
|
spacingBelowUnitsL->setEnabled(enable);
|
|
|
|
bool enablel = ( (item==6) || (item!=6 && spacingAbove->currentItem()==6) );
|
|
|
|
spacingValueL->setEnabled(enablel);
|
|
|
|
spacingPlusL->setEnabled(enablel);
|
|
|
|
spacingMinusL->setEnabled(enablel);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::closeEvent(QCloseEvent * e)
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
form_->close();
|
|
|
|
e->accept();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::apply_adaptor()
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
form_->apply();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::cancel_adaptor()
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
form_->close();
|
|
|
|
hide();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::ok_adaptor()
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
apply_adaptor();
|
|
|
|
form_->close();
|
|
|
|
hide();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-02-14 19:43:56 +00:00
|
|
|
void ParagraphDlgImpl::restore_adaptor()
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
form_->update();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|