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