]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/paradlg.h
implement getLabelList
[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->line_labelwidth->text();
45         }
46
47         LyXAlignment getAlign() const {
48                 switch (generalpage->combo_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->check_keepabove->isChecked();
59         }
60
61         bool getBelowKeep() const {
62                 return generalpage->belowpage->check_keepbelow->isChecked();
63         }
64
65         bool getLineAbove() const {
66                 return generalpage->check_lineabove->isChecked();
67         }
68
69         bool getLineBelow() const {
70                 return generalpage->check_linebelow->isChecked();
71         }
72
73         bool getPagebreakAbove() const {
74                 return generalpage->abovepage->check_pagebreakabove->isChecked();
75         }
76
77         bool getPagebreakBelow() const {
78                 return generalpage->belowpage->check_pagebreakbelow->isChecked();
79         }
80
81         bool getNoIndent() const {
82                 return generalpage->check_noindent->isChecked();
83         }
84
85         VSpace::vspace_kind getSpaceAboveKind() const {
86                 return getSpaceKind(generalpage->abovepage->combo_spaceabove->currentItem());
87         }
88
89         VSpace::vspace_kind getSpaceBelowKind() const {
90                 return getSpaceKind(generalpage->belowpage->combo_spacebelow->currentItem());
91         }
92         
93         LyXGlueLength getAboveLength() const;
94
95         LyXGlueLength getBelowLength() const;
96         LyXLength getExtraWidth() const;
97
98         string getExtraWidthPercent() const;
99
100         LyXParagraph::PEXTRA_TYPE getExtraType() const {
101                 switch (extrapage->combo_type->currentItem()) {
102                         case 0: return LyXParagraph::PEXTRA_NONE;
103                         case 1: return LyXParagraph::PEXTRA_INDENT;
104                         case 2: return LyXParagraph::PEXTRA_MINIPAGE;
105                         case 3: return LyXParagraph::PEXTRA_FLOATFLT;
106                 }
107                 return LyXParagraph::PEXTRA_NONE;
108         }
109
110         LyXParagraph::MINIPAGE_ALIGNMENT getExtraAlign() const {
111                 if (extrapage->radio_top->isChecked())
112                         return LyXParagraph::MINIPAGE_ALIGN_TOP;
113                 if (extrapage->radio_middle->isChecked())
114                         return LyXParagraph::MINIPAGE_ALIGN_MIDDLE;
115                 return LyXParagraph::MINIPAGE_ALIGN_BOTTOM;
116         }
117
118         bool getHfillBetween() const {
119                 return extrapage->check_hfillbetween->isChecked();
120         }
121
122         bool getStartNewMinipage() const {
123                 return extrapage->check_startnewminipage->isChecked();
124         }
125 protected:
126         void closeEvent(QCloseEvent * e);
127
128 private:
129         FormParagraph * form_;
130
131         /// the general tab page
132         ParaGeneralDialog * generalpage;
133         /// the extra options tab page
134         ParaExtraDialog * extrapage;
135  
136         VSpace::vspace_kind getSpaceKind(int val) const {
137                 switch (val) {
138                         case 0: return VSpace::NONE;
139                         case 1: return VSpace::DEFSKIP;
140                         case 2: return VSpace::SMALLSKIP;
141                         case 3: return VSpace::MEDSKIP;
142                         case 4: return VSpace::BIGSKIP;
143                         case 5: return VSpace::VFILL;
144                         case 6: return VSpace::LENGTH;
145                         default:
146                                 lyxerr[Debug::GUI] << "Unknown kind combo entry " << val << std::endl;
147                 }
148                 return VSpace::NONE;
149         }
150
151 private slots:
152
153         void ok_adaptor(void) {
154                 apply_adaptor();
155                 form_->close();
156                 hide();
157         }
158
159         void apply_adaptor(void) {
160                 form_->apply();
161         }
162
163         void restore_adaptor(void) {
164                 // this will reset to known values
165                 form_->update();
166         }
167         
168         void cancel_adaptor(void) {
169                 form_->close();
170                 hide();
171         }
172
173 };
174
175 #endif // PARADLG_H