Debian Codegraph @

src/af/xap/xp/xap_Dlg_HTMLOptions.h

raw
1 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
2
3 /* AbiSource Application Framework
4 * Copyright (C) 2002 AbiSource, Inc.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301 USA.
20 */
21
22 #ifndef XAP_DIALOG_HTMLOPTIONS_H
23 #define XAP_DIALOG_HTMLOPTIONS_H
24
25 /* pre-emptive dismissal; ut_types.h is needed by just about everything,
26 * so even if it's commented out in-file that's still a lot of work for
27 * the preprocessor to do...
28 */
29 #ifndef UT_TYPES_H
30 #include "ut_types.h"
31 #endif
32
33 #include "xap_Dialog.h"
34
35 class XAP_App;
36 class UT_UTF8String;
37
38 struct XAP_Exp_HTMLOptions
39 {
40 bool bIs4;
41 bool bIsAbiWebDoc;
42 bool bDeclareXML;
43 bool bAllowAWML;
44 bool bEmbedCSS;
45 bool bLinkCSS;
46 bool bEmbedImages;
47 bool bClassOnly;
48 bool bAbsUnits;
49 bool bScaleUnits;
50 bool bMathMLRenderPNG;
51 bool bSplitDocument;
52 UT_uint32 iCompact;
53 /* other options, not set/saved/restore by options dialog
54 */
55 bool bMultipart;
56 bool bAddIdentifiers;
57 };
58
59 class ABI_EXPORT XAP_Dialog_HTMLOptions : public XAP_Dialog_NonPersistent
60 {
61 public:
62 XAP_Dialog_HTMLOptions (XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
63
64 virtual ~XAP_Dialog_HTMLOptions (void);
65
66 virtual void runModal (XAP_Frame * pFrame) = 0;
67
68 bool shouldSave () const { return m_bShouldSave; }
69
70 void setHTMLOptions (XAP_Exp_HTMLOptions * exp_opt, XAP_App * app);
71 static void getHTMLDefaults (XAP_Exp_HTMLOptions * exp_opt, XAP_App * app);
72
73 protected:
74 inline bool get_HTML4 () const { return m_exp_opt->bIs4; }
75 inline bool get_PHTML () const { return m_exp_opt->bIsAbiWebDoc; }
76 inline bool get_Declare_XML () const { return m_exp_opt->bDeclareXML; }
77 inline bool get_Allow_AWML () const { return m_exp_opt->bAllowAWML; }
78 inline bool get_Embed_CSS () const { return m_exp_opt->bEmbedCSS; }
79 inline bool get_Link_CSS () const { return m_exp_opt->bLinkCSS; }
80 inline bool get_Class_Only() const { return m_exp_opt->bClassOnly; }
81 inline bool get_Embed_Images () const { return m_exp_opt->bEmbedImages; }
82 inline bool get_Multipart () const { return m_exp_opt->bMultipart; }
83 inline bool get_Abs_Units () const { return m_exp_opt->bAbsUnits; }
84 inline bool get_Scale_Units () const { return m_exp_opt->bScaleUnits; }
85 inline bool get_MathML_Render_PNG() const { return m_exp_opt->bMathMLRenderPNG; }
86 inline bool get_Split_Document() const { return m_exp_opt->bSplitDocument; }
87 inline UT_uint32 get_Compact () const { return m_exp_opt->iCompact; }
88
89
90 UT_UTF8String & get_Link_CSS_File() const { return *m_pLinkCSS; }
91
92 inline bool can_set_Declare_XML () const { return m_exp_opt->bIs4 ? false : true; }
93 inline bool can_set_Allow_AWML () const { return m_exp_opt->bIs4 ? false : true; }
94 inline bool can_set_Embed_CSS () const { return m_exp_opt->bIsAbiWebDoc ? false : true; }
95 inline bool can_set_Link_CSS () const { return true; }
96 inline bool can_set_Class_Only () const { return true; }
97 inline bool can_set_Abs_Units () const { return true; }
98 inline bool can_set_Scale_Units () const { return true; }
99 inline bool can_set_Embed_Images () const { return m_exp_opt->bMultipart ? false : true; }
100 inline bool can_set_MathML_Render_PNG() const { return true; }
101 inline bool can_set_Split_Document() const { return m_exp_opt->bMultipart ? false : true; }
102
103 void set_HTML4 (bool enable);
104 void set_PHTML (bool enable);
105 void set_Declare_XML (bool enable);
106 void set_Allow_AWML (bool enable);
107 void set_Embed_CSS (bool enable);
108 void set_Link_CSS (bool enable);
109 void set_Class_Only (bool enable);
110 void set_Embed_Images (bool enable);
111 void set_MathML_Render_PNG (bool enable);
112 void set_Split_Document(bool enable);
113
114 void set_Link_CSS_File (const char * file);
115 void set_Abs_Units (bool enable);
116 void set_Scale_Units (bool enable);
117 void set_Compact (UT_uint32 i) {m_exp_opt->iCompact = i;}
118
119 void saveDefaults ();
120 void restoreDefaults ();
121
122 bool m_bShouldSave;
123
124 private:
125 XAP_Exp_HTMLOptions * m_exp_opt;
126 XAP_App * m_app;
127 UT_UTF8String * m_pLinkCSS;
128 };
129
130 #endif /* XAP_DIALOG_HTMLOPTIONS_H */