]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormDocument.h
Merging BRANCH_MVC back into HEAD.
[lyx.git] / src / frontends / xforms / 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 Jürgen Vigna
10  *
11  *======================================================*/
12
13 #ifndef FORM_DOCUMENT_H
14 #define FORM_DOCUMENT_H
15
16 #include <vector>
17 #include <boost/smart_ptr.hpp>
18 #include "FormBaseDeprecated.h"
19 #include "xformsBC.h"
20
21 #ifdef __GNUG_
22 #pragma interface
23 #endif
24
25 class LyXView;
26 class Dialogs;
27 class Combox;
28 class BufferParams;
29
30 struct FD_form_tabbed_document;
31 struct FD_form_doc_paper;
32 struct FD_form_doc_class;
33 struct FD_form_doc_language;
34 struct FD_form_doc_options;
35 struct FD_form_doc_bullet;
36
37 /** This class provides an XForms implementation of the FormDocument Popup.
38     The table-layout-form here changes values for latex-tabulars
39     @author Jürgen Vigna
40  */
41 class FormDocument : public FormBaseBD {
42 public:
43         /// #FormDocument x(Communicator ..., Popups ...);#
44         FormDocument(LyXView *, Dialogs *);
45         ///
46         static void ComboInputCB(int, void *, Combox *);
47 private:
48         ///
49         enum State {
50                 ///
51                 INPUT,
52                 ///
53                 CHECKCHOICECLASS,
54                 ///
55                 CHOICEBULLETSIZE,
56                 ///
57                 INPUTBULLETLATEX,
58                 ///
59                 BULLETDEPTH1,
60                 ///
61                 BULLETDEPTH2,
62                 ///
63                 BULLETDEPTH3,
64                 ///
65                 BULLETDEPTH4,
66                 ///
67                 BULLETPANEL1,
68                 ///
69                 BULLETPANEL2,
70                 ///
71                 BULLETPANEL3,
72                 ///
73                 BULLETPANEL4,
74                 ///
75                 BULLETPANEL5,
76                 ///
77                 BULLETPANEL6,
78                 ///
79                 BULLETBMTABLE
80         };
81         /// Pointer to the actual instantiation of the ButtonController.
82         virtual xformsBC & bc();
83         /** Redraw the form (on receipt of a Signal indicating, for example,
84             that the xforms colours have been re-mapped). */
85         virtual void redraw();
86         /// Build the dialog
87         virtual void build();
88         /// Filter the inputs
89         virtual bool input( FL_OBJECT *, long );
90         /// Update the popup.
91         virtual void update();
92         /// Apply from popup
93         virtual void apply();
94         /// Cancel from popup
95         virtual void cancel();
96
97         ///
98         virtual FL_FORM * form() const;
99
100         ///
101         bool CheckDocumentInput(FL_OBJECT * ob, long);
102         ///
103         void ChoiceBulletSize(FL_OBJECT * ob, long);
104         ///
105         void InputBulletLaTeX(FL_OBJECT * ob, long);
106         ///
107         void BulletDepth(FL_OBJECT * ob, State);
108         ///
109         void BulletPanel(FL_OBJECT * ob, State);
110         ///
111         void BulletBMTable(FL_OBJECT * ob, long);
112         ///
113         void checkMarginValues();
114         ///
115         void checkReadOnly();
116         ///
117         void CheckChoiceClass(FL_OBJECT * ob, long);
118         ///
119         void UpdateLayoutDocument(BufferParams const & params);
120
121         ///
122         void paper_update(BufferParams const &);
123         ///
124         void class_update(BufferParams const &);
125         ///
126         void language_update(BufferParams const &);
127         ///
128         void options_update(BufferParams const &);
129         ///
130         void bullets_update(BufferParams const &);
131
132         ///
133         void paper_apply();
134         ///
135         bool class_apply();
136         ///
137         bool language_apply();
138         ///
139         bool options_apply();
140         ///
141         void bullets_apply();
142
143         /// Typedefinitions from the fdesign produced Header file
144         FD_form_tabbed_document * build_tabbed_document();
145         ///
146         FD_form_doc_paper * build_doc_paper();
147         ///
148         FD_form_doc_class * build_doc_class();
149         ///
150         FD_form_doc_language * build_doc_language();
151         ///
152         FD_form_doc_options * build_doc_options();
153         ///
154         FD_form_doc_bullet * build_doc_bullet();
155
156         /// Real GUI implementation.
157         boost::scoped_ptr<FD_form_tabbed_document> dialog_;
158         ///
159         boost::scoped_ptr<FD_form_doc_paper>       paper_;
160         ///
161         boost::scoped_ptr<FD_form_doc_class>       class_;
162         ///
163         boost::scoped_ptr<FD_form_doc_language>    language_;
164         ///
165         boost::scoped_ptr<FD_form_doc_options>     options_;
166         ///
167         boost::scoped_ptr<FD_form_doc_bullet>      bullets_;
168         ///
169         int ActCell;
170         ///
171         int Confirmed;
172         ///
173         int current_bullet_panel;
174         ///
175         int current_bullet_depth;
176         ///
177         FL_OBJECT * fbullet;
178         ///
179         boost::scoped_ptr<Combox> combo_language;
180         ///
181         boost::scoped_ptr<Combox> combo_doc_class;
182         /// The ButtonController
183         ButtonController<NoRepeatedApplyReadOnlyPolicy, xformsBC> bc_;
184 };
185
186
187 inline
188 xformsBC & FormDocument::bc()
189 {
190         return bc_;
191 }
192
193 #endif