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