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