]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/FormDocument.h
Fixed connections. There is still a bug somewhere.
[lyx.git] / src / frontends / qt2 / FormDocument.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright (C) 2000 The LyX Team.
8  *
9  *           @author Kalle Dalheimer
10  *
11  *======================================================*/
12
13 #ifndef FORM_DOCUMENT_H
14 #define FORM_DOCUMENT_H
15
16 #include <vector>
17 #include <boost/smart_ptr.hpp>
18
19 #include "Qt2Base.h"
20 #include "qt2BC.h"
21 #undef emit
22
23 #ifdef __GNUG_
24 #pragma interface
25 #endif
26
27 class ControlDocument;
28 class FormDocumentDialogImpl;
29 class BufferParams;
30 class LyXView;
31 class Dialogs;
32
33 /** This class provides an Qt2 implementation of the FormDocument Popup.
34     The table-layout-form here changes values for latex-tabulars
35     @author Kalle Dalheimer
36  */
37 class FormDocument
38   : public Qt2CB<ControlDocument, Qt2DB<FormDocumentDialogImpl> >
39 {
40 public:
41         /// #FormDocument x(Communicator ..., Popups ...);#
42         FormDocument(LyXView *, Dialogs *);
43 private:
44         ///
45         enum State {
46                 ///
47                 INPUT,
48                 ///
49                 CHECKCHOICECLASS,
50                 ///
51                 CHOICEBULLETSIZE,
52                 ///
53                 INPUTBULLETLATEX,
54                 ///
55                 BULLETDEPTH1,
56                 ///
57                 BULLETDEPTH2,
58                 ///
59                 BULLETDEPTH3,
60                 ///
61                 BULLETDEPTH4,
62                 ///
63                 BULLETPANEL1,
64                 ///
65                 BULLETPANEL2,
66                 ///
67                 BULLETPANEL3,
68                 ///
69                 BULLETPANEL4,
70                 ///
71                 BULLETPANEL5,
72                 ///
73                 BULLETPANEL6,
74                 ///
75                 BULLETBMTABLE
76         };
77         /// Pointer to the actual instantiation of the ButtonController.
78         virtual qt2BC & bc();
79         /// Build the dialog
80         virtual void build();
81 //      /// Filter the inputs
82 //      virtual bool input( FL_OBJECT *, long );
83         /// Update the popup.
84         virtual void update();
85         /// Apply from popup
86         virtual void apply();
87         /// Cancel from popup
88         virtual void cancel();
89
90 //      ///
91 //      virtual QDialog* form() const;
92
93         ///
94         bool CheckDocumentInput(QWidget* ob, long);
95         ///
96         void ChoiceBulletSize(QWidget* ob, long);
97         ///
98         void InputBulletLaTeX(QWidget* ob, long);
99         ///
100         void BulletDepth(QWidget* ob, State);
101         ///
102         void BulletPanel(QWidget* ob, State);
103         ///
104         void BulletBMTable(QWidget* ob, long);
105         ///
106         void checkMarginValues();
107         ///
108         void checkReadOnly();
109         ///
110         void CheckChoiceClass(QWidget* ob, long);
111         ///
112         void UpdateLayoutDocument(BufferParams const & params);
113
114         ///
115         void paper_update(BufferParams const &);
116         ///
117         void class_update(BufferParams const &);
118         ///
119         void language_update(BufferParams const &);
120         ///
121         void options_update(BufferParams const &);
122         ///
123         void bullets_update(BufferParams const &);
124
125         ///
126         void paper_apply();
127         ///
128         bool class_apply();
129         ///
130         bool language_apply();
131         ///
132         bool options_apply();
133         ///
134         void bullets_apply();
135
136         /// Fdesign generated methods
137         QDialog* build_tabbed_document();
138         ///
139         QDialog* build_doc_paper();
140         ///
141         QDialog* build_doc_class();
142         ///
143         QDialog* build_doc_language();
144         ///
145         QDialog* build_doc_options();
146         ///
147         QDialog* build_doc_bullet();
148
149         /// Real GUI implementation.
150         boost::scoped_ptr<FormDocumentDialogImpl> dialog_;
151         ///
152         int ActCell;
153         ///
154         int Confirmed;
155         ///
156         int current_bullet_panel;
157         ///
158         int current_bullet_depth;
159 //      ///
160 //      FL_OBJECT * fbullet;
161 //      ///
162 //      boost::scoped_ptr<Combox> combo_language;
163 //      ///
164 //      boost::scoped_ptr<Combox> combo_doc_class;
165         /// The ButtonController
166         ButtonController<NoRepeatedApplyReadOnlyPolicy, qt2BC> bc_;
167 };
168
169
170 inline
171 qt2BC & FormDocument::bc()
172 {
173         return bc_;
174 }
175
176 #endif