4 * John Levon, moz@compsoc.man.ac.uk
7 /***************************************************************************
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
14 ***************************************************************************/
23 #include "parageneraldlg.h"
24 #include "paraextradlg.h"
26 #include <qtabdialog.h>
29 #include "lyxparagraph.h"
32 // to connect apply() and close()
33 #include "FormParagraph.h"
35 class ParaDialog : public QTabDialog {
38 ParaDialog(FormParagraph *form, QWidget *parent=0, const char *name=0,
39 bool modal=false, WFlags f=0);
42 void setReadOnly(bool);
43 void setLabelWidth(const char *);
45 void setChecks(bool, bool, bool, bool, bool);
46 void setSpace(VSpace::vspace_kind, VSpace::vspace_kind, bool, bool);
47 void setAboveLength(float, float, float, LyXGlueLength::UNIT, LyXGlueLength::UNIT, LyXGlueLength::UNIT);
48 void setBelowLength(float, float, float, LyXGlueLength::UNIT, LyXGlueLength::UNIT, LyXGlueLength::UNIT);
49 void setExtra(float, LyXGlueLength::UNIT, const string, int, bool, bool, LyXParagraph::PEXTRA_TYPE);
51 const char *getLabelWidth() const {
52 return generalpage->labelwidth->text();
55 LyXAlignment getAlign() const {
56 if (generalpage->right->isChecked())
57 return LYX_ALIGN_RIGHT;
58 else if (generalpage->left->isChecked())
59 return LYX_ALIGN_LEFT;
60 else if (generalpage->center->isChecked())
61 return LYX_ALIGN_CENTER;
63 return LYX_ALIGN_BLOCK;
66 bool getLineAbove() const {
67 return generalpage->lineabove->isChecked();
70 bool getLineBelow() const {
71 return generalpage->linebelow->isChecked();
74 bool getPagebreakAbove() const {
75 return generalpage->pagebreakabove->isChecked();
78 bool getPagebreakBelow() const {
79 return generalpage->pagebreakbelow->isChecked();
82 bool getNoIndent() const {
83 return generalpage->noindent->isChecked();
86 VSpace::vspace_kind getSpaceAboveKind() const {
87 return getSpaceKind(generalpage->spaceabove->currentItem());
90 VSpace::vspace_kind getSpaceBelowKind() const {
91 return getSpaceKind(generalpage->spacebelow->currentItem());
94 bool getSpaceAboveKeep() const {
99 bool getSpaceBelowKeep() const {
104 LyXGlueLength getAboveLength() const;
106 LyXGlueLength getBelowLength() const;
108 LyXLength getExtraWidth() const;
110 string getExtraWidthPercent() const;
112 LyXParagraph::PEXTRA_TYPE getExtraType() const {
113 switch (extrapage->type->currentItem()) {
114 case 0: return LyXParagraph::PEXTRA_NONE;
115 case 1: return LyXParagraph::PEXTRA_INDENT;
116 case 2: return LyXParagraph::PEXTRA_MINIPAGE;
117 case 3: return LyXParagraph::PEXTRA_FLOATFLT;
119 return LyXParagraph::PEXTRA_NONE;
122 LyXParagraph::MINIPAGE_ALIGNMENT getExtraAlign() const {
123 if (extrapage->top->isChecked())
124 return LyXParagraph::MINIPAGE_ALIGN_TOP;
125 if (extrapage->middle->isChecked())
126 return LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
127 return LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
130 bool getHfillBetween() const {
131 return extrapage->hfillbetween->isChecked();
134 bool getStartNewMinipage() const {
135 return extrapage->startnewminipage->isChecked();
139 void closeEvent(QCloseEvent *e);
142 FormParagraph *form_;
144 /// the general tab page
145 ParaGeneralDialog *generalpage;
146 /// the extra options tab page
147 ParaExtraDialog *extrapage;
149 VSpace::vspace_kind getSpaceKind(int val) const {
151 case 0: return VSpace::NONE;
152 case 1: return VSpace::DEFSKIP;
153 case 2: return VSpace::SMALLSKIP;
154 case 3: return VSpace::MEDSKIP;
155 case 4: return VSpace::BIGSKIP;
156 case 5: return VSpace::VFILL;
157 case 6: return VSpace::LENGTH;
159 lyxerr[Debug::GUI] << "Unknown kind combo entry " << val << endl;
164 void setUnits(QComboBox *box, LyXGlueLength::UNIT unit);
166 LyXLength::UNIT getUnits(QComboBox *box) const;
169 void apply_adaptor(void) {
175 void close_adaptor(void) {