2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright (C) 2000 The LyX Team.
11 *======================================================*/
13 #ifndef FORM_DOCUMENT_H
14 #define FORM_DOCUMENT_H
16 #include "DialogBase.h"
17 #include "support/utility.hpp"
28 class NoRepeatedApplyReadOnlyPolicy;
29 template <class x> class ButtonController;
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;
38 #ifdef SIGC_CXX_NAMESPACES
39 using SigC::Connection;
42 /** This class provides an XForms implementation of the FormDocument Popup.
43 The table-layout-form here changes values for latex-tabulars
45 class FormDocument : public DialogBase, public noncopyable {
47 /// #FormDocument x(Communicator ..., Popups ...);#
48 FormDocument(LyXView *, Dialogs *);
52 static int WMHideCB(FL_FORM *, void *);
54 static void OKCB(FL_OBJECT *, long);
56 static void ApplyCB(FL_OBJECT *, long);
58 static void CancelCB(FL_OBJECT *, long);
60 static void RestoreCB(FL_OBJECT *, long);
62 static void InputCB(FL_OBJECT *, long);
64 static void ComboInputCB(int, void *);
66 static void ChoiceClassCB(FL_OBJECT *, long);
68 static void ChoiceBulletSizeCB(FL_OBJECT * ob, long);
70 static void InputBulletLaTeXCB(FL_OBJECT * ob, long);
72 static void BulletDepthCB(FL_OBJECT * ob, long);
74 static void BulletPanelCB(FL_OBJECT * ob, long);
76 static void BulletBMTableCB(FL_OBJECT * ob, long);
78 enum EnumPopupStatus {
89 bool CheckDocumentInput(FL_OBJECT * ob, long);
91 void ChoiceBulletSize(FL_OBJECT * ob, long);
93 void InputBulletLaTeX(FL_OBJECT * ob, long);
95 void BulletDepth(FL_OBJECT * ob, long);
97 void BulletPanel(FL_OBJECT * ob, long);
99 void BulletBMTable(FL_OBJECT * ob, long);
101 void checkMarginValues();
103 void checkReadOnly();
105 void CheckChoiceClass(FL_OBJECT * ob, long);
107 void UpdateLayoutDocument(BufferParams const & params);
109 /// Create the popup if necessary, update it and display it.
113 /// Update the popup.
116 void paper_update(BufferParams const &);
118 void class_update(BufferParams const &);
120 void language_update(BufferParams const &);
122 void options_update(BufferParams const &);
124 void bullets_update(BufferParams const &);
132 bool language_apply();
134 bool options_apply();
136 void bullets_apply();
137 /// Cancel from popup
141 /// Explicitly free the popup.
144 /// Typedefinitions from the fdesign produced Header file
145 FD_form_tabbed_document * build_tabbed_document();
147 FD_form_doc_paper * build_doc_paper();
149 FD_form_doc_class * build_doc_class();
151 FD_form_doc_language * build_doc_language();
153 FD_form_doc_options * build_doc_options();
155 FD_form_doc_bullet * build_doc_bullet();
157 /// Real GUI implementation.
158 FD_form_tabbed_document * dialog_;
160 FD_form_doc_paper * paper_;
162 FD_form_doc_class * class_;
164 FD_form_doc_language * language_;
166 FD_form_doc_options * options_;
168 FD_form_doc_bullet * bullets_;
169 /// Which LyXView do we belong to?
173 /// Update connection.
177 /// has form contents changed? Used to control OK/Apply
178 EnumPopupStatus status;
184 int current_bullet_panel;
186 int current_bullet_depth;
190 Combox * combo_language;
192 Combox * combo_doc_class;
194 ButtonController<NoRepeatedApplyReadOnlyPolicy> * bc_;