]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormDocument.h
1aa8be27e6dfe31db74cc9980f0de6d59e26f111
[lyx.git] / src / frontends / xforms / FormDocument.h
1 // -*- C++ -*-
2 /* form_document.h
3  * FormDocument Interface Class
4  */
5
6 #ifndef FORM_DOCUMENT_H
7 #define FORM_DOCUMENT_H
8
9 #include "DialogBase.h"
10 #include "support/utility.hpp"
11 #include <vector>
12
13 #ifdef __GNUG_
14 #pragma interface
15 #endif
16
17 class LyXView;
18 class Dialogs;
19 class Combox;
20
21 struct FD_form_tabbed_document;
22 struct FD_form_doc_paper;
23 struct FD_form_doc_class;
24 struct FD_form_doc_language;
25 struct FD_form_doc_options;
26 struct FD_form_doc_bullet;
27
28 #ifdef SIGC_CXX_NAMESPACES
29 using SigC::Connection;
30 #endif
31
32 /** This class provides an XForms implementation of the FormDocument Popup.
33     The table-layout-form here changes values for latex-tabulars
34  */
35 class FormDocument : public DialogBase, public noncopyable {
36 public:
37     /**@name Constructors and Destructors */
38     //@{
39     /// #FormDocument x(Communicator ..., Popups ...);#
40     FormDocument(LyXView *, Dialogs *);
41     ///
42     ~FormDocument();
43     void SetDocumentClassChoice(vector<string> const & choices);
44     //@}
45
46     /**@name Real per-instance Callback Methods */
47     //@{
48     static  int WMHideCB(FL_FORM *, void *);
49     static void OKCB(FL_OBJECT *, long);
50     static void CancelCB(FL_OBJECT *, long);
51     static void ApplyCB(FL_OBJECT *, long);
52     static void InputCB(FL_OBJECT *, long);
53     //@}
54
55     enum EnumPopupStatus {
56         POPUP_UNMODIFIED,
57         POPUP_MODIFIED,
58         POPUP_READONLY
59     };
60
61 private:
62     void DeactivateDocumentButtons();
63     void ActivateDocumentButtons();
64     void EnableDocumentLayout();
65     void DisableDocumentLayout();
66     void CheckDocumentInput(FL_OBJECT * ob, long);
67     void ChoiceBulletSize(FL_OBJECT * ob, long);
68     void InputBulletLaTeX(FL_OBJECT * ob, long);
69     void BulletDepth(FL_OBJECT * ob, long);
70     void BulletPanel(FL_OBJECT * ob, long);
71     void BulletBMTable(FL_OBJECT * ob, long);
72     void checkMarginValues();
73
74     /**@name Real per-instance Callback Methods */
75     //@{
76     static void DocumentInputCB(FL_OBJECT * ob, long);
77     static void ChoiceBulletSizeCB(FL_OBJECT * ob, long);
78     static void InputBulletLaTeXCB(FL_OBJECT * ob, long);
79     static void BulletDepthCB(FL_OBJECT * ob, long);
80     static void BulletPanelCB(FL_OBJECT * ob, long);
81     static void BulletBMTableCB(FL_OBJECT * ob, long);
82     //@}
83         
84     /**@name Slot Methods */
85     //@{
86     /// Create the popup if necessary, update it and display it.
87     void show();
88     /// Hide the popup.
89     void hide();
90     /// Update the popup.
91     void update();
92     void paper_update();
93     void class_update();
94     void language_update();
95     void options_update();
96     void bullets_update();
97     /// Apply from popup
98     void apply();
99     void paper_apply();
100     bool class_apply();
101     bool language_apply();
102     bool options_apply();
103     void bullets_apply();
104     /// Cancel from popup
105     void cancel();
106     //@}
107     /// Build the popup
108     void build();
109     ///
110     /// Explicitly free the popup.
111     void free();
112
113     /// Typedefinitions from the fdesign produced Header file
114     FD_form_tabbed_document * build_tabbed_document();
115     FD_form_doc_paper * build_doc_paper();
116     FD_form_doc_class * build_doc_class();
117     FD_form_doc_language * build_doc_language();
118     FD_form_doc_options * build_doc_options();
119     FD_form_doc_bullet * build_doc_bullet();
120
121     /**@name Private Data */
122     //@{
123     /// Real GUI implementation.
124     FD_form_tabbed_document * dialog_;
125     FD_form_doc_paper       * paper_;
126     FD_form_doc_class       * class_;
127     FD_form_doc_language    * language_;
128     FD_form_doc_options     * options_;
129     FD_form_doc_bullet      * bullets_;
130     /// Which LyXView do we belong to?
131     LyXView * lv_;
132     Dialogs * d_;
133     /// Update connection.
134     Connection u_;
135     /// Hide connection.
136     Connection h_;
137     /// has form contents changed? Used to control OK/Apply
138     EnumPopupStatus status;
139     //@}
140     int
141         ActCell, Confirmed,
142         current_bullet_panel, current_bullet_depth;
143     ///
144     FL_OBJECT * fbullet;
145     ///
146     Combox * combo_language;
147 };
148
149 #endif