]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormDocument.h
323b2ebc1b2aff6fb4c621de46065fc1eb85cacd
[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 "DialogBase.h"
17 #include "support/utility.hpp"
18 #include <vector>
19
20 #ifdef __GNUG_
21 #pragma interface
22 #endif
23
24 class LyXView;
25 class Dialogs;
26 class Combox;
27 class BufferParams;
28 class NoRepeatedApplyReadOnlyPolicy;
29 template <class x> class ButtonController;
30
31 struct FD_form_tabbed_document;
32 struct FD_form_doc_paper;
33 struct FD_form_doc_class;
34 struct FD_form_doc_language;
35 struct FD_form_doc_options;
36 struct FD_form_doc_bullet;
37
38 #ifdef SIGC_CXX_NAMESPACES
39 using SigC::Connection;
40 #endif
41
42 /** This class provides an XForms implementation of the FormDocument Popup.
43     The table-layout-form here changes values for latex-tabulars
44  */
45 class FormDocument : public DialogBase, public noncopyable {
46 public:
47     /// #FormDocument x(Communicator ..., Popups ...);#
48     FormDocument(LyXView *, Dialogs *);
49     ///
50     ~FormDocument();
51     ///
52     static  int WMHideCB(FL_FORM *, void *);
53     ///
54     static void OKCB(FL_OBJECT *, long);
55     ///
56     static void ApplyCB(FL_OBJECT *, long);
57     ///
58     static void CancelCB(FL_OBJECT *, long);
59     ///
60     static void RestoreCB(FL_OBJECT *, long);
61     ///
62     static void InputCB(FL_OBJECT *, long);
63     ///
64     static void ChoiceClassCB(FL_OBJECT *, long);
65     ///
66     static void ChoiceBulletSizeCB(FL_OBJECT * ob, long);
67     ///
68     static void InputBulletLaTeXCB(FL_OBJECT * ob, long);
69     ///
70     static void BulletDepthCB(FL_OBJECT * ob, long);
71     ///
72     static void BulletPanelCB(FL_OBJECT * ob, long);
73     ///
74     static void BulletBMTableCB(FL_OBJECT * ob, long);
75     ///
76     enum EnumPopupStatus {
77         ///
78         POPUP_UNMODIFIED,
79         ///
80         POPUP_MODIFIED,
81         ///
82         POPUP_READONLY
83     };
84
85 private:
86     ///
87     bool CheckDocumentInput(FL_OBJECT * ob, long);
88     ///
89     void ChoiceBulletSize(FL_OBJECT * ob, long);
90     ///
91     void InputBulletLaTeX(FL_OBJECT * ob, long);
92     ///
93     void BulletDepth(FL_OBJECT * ob, long);
94     ///
95     void BulletPanel(FL_OBJECT * ob, long);
96     ///
97     void BulletBMTable(FL_OBJECT * ob, long);
98     ///
99     void checkMarginValues();
100     ///
101     void checkReadOnly();
102     ///
103     void CheckChoiceClass(FL_OBJECT * ob, long);
104     ///
105     void UpdateLayoutDocument(BufferParams const & params);
106
107     /// Create the popup if necessary, update it and display it.
108     void show();
109     /// Hide the popup.
110     void hide();
111     /// Update the popup.
112     void update();
113     ///
114     void paper_update(BufferParams const &);
115     ///
116     void class_update(BufferParams const &);
117     ///
118     void language_update(BufferParams const &);
119     ///
120     void options_update(BufferParams const &);
121     ///
122     void bullets_update(BufferParams const &);
123     /// Apply from popup
124     void apply();
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     /// Cancel from popup
136     void cancel();
137     /// Build the popup
138     void build();
139     /// Explicitly free the popup.
140     void free();
141
142     /// Typedefinitions from the fdesign produced Header file
143     FD_form_tabbed_document * build_tabbed_document();
144     ///
145     FD_form_doc_paper * build_doc_paper();
146     ///
147     FD_form_doc_class * build_doc_class();
148     ///
149     FD_form_doc_language * build_doc_language();
150     ///
151     FD_form_doc_options * build_doc_options();
152     ///
153     FD_form_doc_bullet * build_doc_bullet();
154
155     /// Real GUI implementation.
156     FD_form_tabbed_document * dialog_;
157     ///
158     FD_form_doc_paper       * paper_;
159     ///
160     FD_form_doc_class       * class_;
161     ///
162     FD_form_doc_language    * language_;
163     ///
164     FD_form_doc_options     * options_;
165     ///
166     FD_form_doc_bullet      * bullets_;
167     /// Which LyXView do we belong to?
168     LyXView * lv_;
169     ///
170     Dialogs * d_;
171     /// Update connection.
172     Connection u_;
173     /// Hide connection.
174     Connection h_;
175     /// has form contents changed? Used to control OK/Apply
176     EnumPopupStatus status;
177     ///
178     int ActCell;
179     ///
180     int Confirmed;
181     ///
182     int current_bullet_panel;
183     ///
184     int current_bullet_depth;
185     ///
186     FL_OBJECT * fbullet;
187     ///
188     Combox * combo_language;
189     ///
190     ButtonController<NoRepeatedApplyReadOnlyPolicy> * bc_;
191 };
192
193 #endif