]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/paradlg.h
small cleanup, doxygen, formatting changes
[lyx.git] / src / frontends / kde / paradlg.h
1 /**
2  * \file paradlg.h
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon
7  */
8
9 #ifndef PARADLG_H
10 #define PARADLG_H
11
12 #include <config.h>
13 #include <gettext.h>
14
15 #include  "parageneraldlg.h"
16 #include  "paraextradlg.h"
17
18 #include "vspace.h"
19 #include "lyxparagraph.h"
20 #include "debug.h"
21
22 #include "dlg/paradlgdata.h"
23
24 // to connect apply() and close()
25 #include "FormParagraph.h"
26
27 class ParaDialog : public ParaDialogData  {
28         Q_OBJECT
29 public:
30         ParaDialog(FormParagraph * form, QWidget * parent=0, char const * name=0,
31                             bool modal=false, WFlags f=0);
32         ~ParaDialog();
33
34         void setReadOnly(bool);
35         void setLabelWidth(char const *);
36         void setAlign(int);
37         void setChecks(bool, bool, bool, bool, bool);
38         void setSpace(VSpace::vspace_kind, VSpace::vspace_kind, bool, bool);
39         void setAboveLength(float, float, float, LyXGlueLength::UNIT, LyXGlueLength::UNIT, LyXGlueLength::UNIT);
40         void setBelowLength(float, float, float, LyXGlueLength::UNIT, LyXGlueLength::UNIT, LyXGlueLength::UNIT);
41         void setExtra(float, LyXGlueLength::UNIT, const string, int, bool, bool, LyXParagraph::PEXTRA_TYPE);
42
43         char const * getLabelWidth() const {
44                 return generalpage->labelwidth->text();
45         }
46
47         LyXAlignment getAlign() const {
48                 switch (generalpage->justification->currentItem()) { 
49                         case 0: return LYX_ALIGN_BLOCK;
50                         case 1: return LYX_ALIGN_CENTER;
51                         case 2: return LYX_ALIGN_LEFT;
52                         case 3: return LYX_ALIGN_RIGHT;
53                 }
54                 return LYX_ALIGN_BLOCK;
55         }
56
57         bool getAboveKeep() const {
58                 return generalpage->abovepage->keepabove->isChecked();
59         }
60
61         bool getBelowKeep() const {
62                 return generalpage->belowpage->keepbelow->isChecked();
63         }
64
65         bool getLineAbove() const {
66                 return generalpage->lineabove->isChecked();
67         }
68
69         bool getLineBelow() const {
70                 return generalpage->linebelow->isChecked();
71         }
72
73         bool getPagebreakAbove() const {
74                 return generalpage->abovepage->pagebreakabove->isChecked();
75         }
76
77         bool getPagebreakBelow() const {
78                 return generalpage->belowpage->pagebreakbelow->isChecked();
79         }
80
81         bool getNoIndent() const {
82                 return generalpage->noindent->isChecked();
83         }
84
85         VSpace::vspace_kind getSpaceAboveKind() const {
86                 return getSpaceKind(generalpage->abovepage->spaceabove->currentItem());
87         }
88
89         VSpace::vspace_kind getSpaceBelowKind() const {
90                 return getSpaceKind(generalpage->belowpage->spacebelow->currentItem());
91         }
92         
93         LyXGlueLength getAboveLength() const;
94
95         LyXGlueLength getBelowLength() const;
96
97         LyXLength getExtraWidth() const;
98
99         string getExtraWidthPercent() const;
100
101         LyXParagraph::PEXTRA_TYPE getExtraType() const {
102                 switch (extrapage->type->currentItem()) {
103                         case 0: return LyXParagraph::PEXTRA_NONE;
104                         case 1: return LyXParagraph::PEXTRA_INDENT;
105                         case 2: return LyXParagraph::PEXTRA_MINIPAGE;
106                         case 3: return LyXParagraph::PEXTRA_FLOATFLT;
107                 }
108                 return LyXParagraph::PEXTRA_NONE;
109         }
110
111         LyXParagraph::MINIPAGE_ALIGNMENT getExtraAlign() const {
112                 if (extrapage->top->isChecked())
113                         return LyXParagraph::MINIPAGE_ALIGN_TOP;
114                 if (extrapage->middle->isChecked())
115                         return LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
116                 return LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
117         }
118
119         bool getHfillBetween() const {
120                 return extrapage->hfillbetween->isChecked();
121         }
122
123         bool getStartNewMinipage() const {
124                 return extrapage->startnewminipage->isChecked();
125         }
126
127 protected:
128         void closeEvent(QCloseEvent * e);
129
130 private:
131         FormParagraph * form_;
132
133         /// the general tab page
134         ParaGeneralDialog * generalpage;
135         /// the extra options tab page
136         ParaExtraDialog * extrapage;
137
138         VSpace::vspace_kind getSpaceKind(int val) const {
139                 switch (val) {
140                         case 0: return VSpace::NONE;
141                         case 1: return VSpace::DEFSKIP;
142                         case 2: return VSpace::SMALLSKIP;
143                         case 3: return VSpace::MEDSKIP;
144                         case 4: return VSpace::BIGSKIP;
145                         case 5: return VSpace::VFILL;
146                         case 6: return VSpace::LENGTH;
147                         default:
148                                 lyxerr[Debug::GUI] << "Unknown kind combo entry " << val << std::endl;
149                 }
150                 return VSpace::NONE;
151         }
152
153 private slots:
154
155         void ok_adaptor(void) {
156                 apply_adaptor();
157                 form_->close();
158                 hide();
159         }
160
161         void apply_adaptor(void) {
162                 form_->apply();
163         }
164
165         void restore_adaptor(void) {
166                 // this will reset to known values
167                 form_->update();
168         }
169         
170         void cancel_adaptor(void) {
171                 form_->close();
172                 hide();
173         }
174
175 };
176
177 #endif // PARADLG_H