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 ChoiceClassCB(FL_OBJECT *, long);
66 static void ChoiceBulletSizeCB(FL_OBJECT * ob, long);
68 static void InputBulletLaTeXCB(FL_OBJECT * ob, long);
70 static void BulletDepthCB(FL_OBJECT * ob, long);
72 static void BulletPanelCB(FL_OBJECT * ob, long);
74 static void BulletBMTableCB(FL_OBJECT * ob, long);
76 enum EnumPopupStatus {
87 bool CheckDocumentInput(FL_OBJECT * ob, long);
89 void ChoiceBulletSize(FL_OBJECT * ob, long);
91 void InputBulletLaTeX(FL_OBJECT * ob, long);
93 void BulletDepth(FL_OBJECT * ob, long);
95 void BulletPanel(FL_OBJECT * ob, long);
97 void BulletBMTable(FL_OBJECT * ob, long);
99 void checkMarginValues();
101 void checkReadOnly();
103 void CheckChoiceClass(FL_OBJECT * ob, long);
105 void UpdateLayoutDocument(BufferParams const & params);
107 /// Create the popup if necessary, update it and display it.
111 /// Update the popup.
114 void paper_update(BufferParams const &);
116 void class_update(BufferParams const &);
118 void language_update(BufferParams const &);
120 void options_update(BufferParams const &);
122 void bullets_update(BufferParams const &);
130 bool language_apply();
132 bool options_apply();
134 void bullets_apply();
135 /// Cancel from popup
139 /// Explicitly free the popup.
142 /// Typedefinitions from the fdesign produced Header file
143 FD_form_tabbed_document * build_tabbed_document();
145 FD_form_doc_paper * build_doc_paper();
147 FD_form_doc_class * build_doc_class();
149 FD_form_doc_language * build_doc_language();
151 FD_form_doc_options * build_doc_options();
153 FD_form_doc_bullet * build_doc_bullet();
155 /// Real GUI implementation.
156 FD_form_tabbed_document * dialog_;
158 FD_form_doc_paper * paper_;
160 FD_form_doc_class * class_;
162 FD_form_doc_language * language_;
164 FD_form_doc_options * options_;
166 FD_form_doc_bullet * bullets_;
167 /// Which LyXView do we belong to?
171 /// Update connection.
175 /// has form contents changed? Used to control OK/Apply
176 EnumPopupStatus status;
182 int current_bullet_panel;
184 int current_bullet_depth;
188 Combox * combo_language;
190 ButtonController<NoRepeatedApplyReadOnlyPolicy> * bc_;