lyx_mirror/src/frontends/kde/paradlg.h
Lars Gullik Bjønnes d1182f17da LyX Drinkers Union: patch 1
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2141 a592a061-630c-0410-9148-cb99ea01b6c8
2001-06-25 00:06:33 +00:00

144 lines
3.2 KiB
C++

/**
* \file paradlg.h
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon
*/
#ifndef PARADLG_H
#define PARADLG_H
#include <config.h>
#include <gettext.h>
#include "parageneraldlg.h"
#include "paraextradlg.h"
#include "vspace.h"
#include "paragraph.h"
#include "debug.h"
#include "dlg/paradlgdata.h"
// to connect apply() and close()
#include "FormParagraph.h"
class ParaDialog : public ParaDialogData {
Q_OBJECT
public:
ParaDialog(FormParagraph * form, QWidget * parent=0, char const * name=0,
bool modal=false, WFlags f=0);
~ParaDialog();
void setReadOnly(bool);
void setLabelWidth(char const *);
void setAlign(int);
void setChecks(bool, bool, bool, bool, bool);
void setSpace(VSpace::vspace_kind, VSpace::vspace_kind, bool, bool);
void setAboveLength(float, float, float, LyXGlueLength::UNIT, LyXGlueLength::UNIT, LyXGlueLength::UNIT);
void setBelowLength(float, float, float, LyXGlueLength::UNIT, LyXGlueLength::UNIT, LyXGlueLength::UNIT);
char const * getLabelWidth() const {
return generalpage->line_labelwidth->text();
}
LyXAlignment getAlign() const {
switch (generalpage->combo_justification->currentItem()) {
case 0: return LYX_ALIGN_BLOCK;
case 1: return LYX_ALIGN_CENTER;
case 2: return LYX_ALIGN_LEFT;
case 3: return LYX_ALIGN_RIGHT;
}
return LYX_ALIGN_BLOCK;
}
bool getAboveKeep() const {
return generalpage->abovepage->check_keepabove->isChecked();
}
bool getBelowKeep() const {
return generalpage->belowpage->check_keepbelow->isChecked();
}
bool getLineAbove() const {
return generalpage->check_lineabove->isChecked();
}
bool getLineBelow() const {
return generalpage->check_linebelow->isChecked();
}
bool getPagebreakAbove() const {
return generalpage->abovepage->check_pagebreakabove->isChecked();
}
bool getPagebreakBelow() const {
return generalpage->belowpage->check_pagebreakbelow->isChecked();
}
bool getNoIndent() const {
return generalpage->check_noindent->isChecked();
}
VSpace::vspace_kind getSpaceAboveKind() const {
return getSpaceKind(generalpage->abovepage->combo_spaceabove->currentItem());
}
VSpace::vspace_kind getSpaceBelowKind() const {
return getSpaceKind(generalpage->belowpage->combo_spacebelow->currentItem());
}
LyXGlueLength getAboveLength() const;
LyXGlueLength getBelowLength() const;
protected:
void closeEvent(QCloseEvent * e);
private:
FormParagraph * form_;
/// the general tab page
ParaGeneralDialog * generalpage;
VSpace::vspace_kind getSpaceKind(int val) const {
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;
}
private slots:
void ok_adaptor(void) {
apply_adaptor();
form_->close();
hide();
}
void apply_adaptor(void) {
form_->apply();
}
void restore_adaptor(void) {
// this will reset to known values
form_->update();
}
void cancel_adaptor(void) {
form_->close();
hide();
}
};
#endif // PARADLG_H