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 #include "dlg/paradlgdata.h"
34 // to connect apply() and close()
35 #include "FormParagraph.h"
37 class ParaDialog : public ParaDialogData {
40 ParaDialog(FormParagraph *form, QWidget *parent=0, const char *name=0,
41 bool modal=false, WFlags f=0);
44 void setReadOnly(bool);
45 void setLabelWidth(const char *);
47 void setChecks(bool, bool, bool, bool, bool);
48 void setSpace(VSpace::vspace_kind, VSpace::vspace_kind, bool, bool);
49 void setAboveLength(float, float, float, LyXGlueLength::UNIT, LyXGlueLength::UNIT, LyXGlueLength::UNIT);
50 void setBelowLength(float, float, float, LyXGlueLength::UNIT, LyXGlueLength::UNIT, LyXGlueLength::UNIT);
51 void setExtra(float, LyXGlueLength::UNIT, const string, int, bool, bool, LyXParagraph::PEXTRA_TYPE);
53 const char *getLabelWidth() const {
54 return generalpage->labelwidth->text();
57 LyXAlignment getAlign() const {
58 if (generalpage->right->isChecked())
59 return LYX_ALIGN_RIGHT;
60 else if (generalpage->left->isChecked())
61 return LYX_ALIGN_LEFT;
62 else if (generalpage->center->isChecked())
63 return LYX_ALIGN_CENTER;
65 return LYX_ALIGN_BLOCK;
68 bool getAboveKeep() const {
69 return generalpage->abovepage->keepabove->isChecked();
72 bool getBelowKeep() const {
73 return generalpage->belowpage->keepbelow->isChecked();
76 bool getLineAbove() const {
77 return generalpage->lineabove->isChecked();
80 bool getLineBelow() const {
81 return generalpage->linebelow->isChecked();
84 bool getPagebreakAbove() const {
85 return generalpage->abovepage->pagebreakabove->isChecked();
88 bool getPagebreakBelow() const {
89 return generalpage->belowpage->pagebreakbelow->isChecked();
92 bool getNoIndent() const {
93 return generalpage->noindent->isChecked();
96 VSpace::vspace_kind getSpaceAboveKind() const {
97 return getSpaceKind(generalpage->abovepage->spaceabove->currentItem());
100 VSpace::vspace_kind getSpaceBelowKind() const {
101 return getSpaceKind(generalpage->belowpage->spacebelow->currentItem());
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 << std::endl;
164 void setUnits(QComboBox *box, LyXGlueLength::UNIT unit);
166 LyXLength::UNIT getUnits(QComboBox *box) const;
170 void ok_adaptor(void) {
176 void apply_adaptor(void) {
180 void restore_adaptor(void) {
181 // this will reset to known values
185 void cancel_adaptor(void) {