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 shouldSave()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: get_HTML4()74 inline bool get_HTML4 () const { return m_exp_opt->bIs4; } get_PHTML()75 inline bool get_PHTML () const { return m_exp_opt->bIsAbiWebDoc; } get_Declare_XML()76 inline bool get_Declare_XML () const { return m_exp_opt->bDeclareXML; } get_Allow_AWML()77 inline bool get_Allow_AWML () const { return m_exp_opt->bAllowAWML; } get_Embed_CSS()78 inline bool get_Embed_CSS () const { return m_exp_opt->bEmbedCSS; } get_Link_CSS()79 inline bool get_Link_CSS () const { return m_exp_opt->bLinkCSS; } get_Class_Only()80 inline bool get_Class_Only() const { return m_exp_opt->bClassOnly; } get_Embed_Images()81 inline bool get_Embed_Images () const { return m_exp_opt->bEmbedImages; } get_Multipart()82 inline bool get_Multipart () const { return m_exp_opt->bMultipart; } get_Abs_Units()83 inline bool get_Abs_Units () const { return m_exp_opt->bAbsUnits; } get_Scale_Units()84 inline bool get_Scale_Units () const { return m_exp_opt->bScaleUnits; } get_MathML_Render_PNG()85 inline bool get_MathML_Render_PNG() const { return m_exp_opt->bMathMLRenderPNG; } get_Split_Document()86 inline bool get_Split_Document() const { return m_exp_opt->bSplitDocument; } get_Compact()87 inline UT_uint32 get_Compact () const { return m_exp_opt->iCompact; } 88 89 get_Link_CSS_File()90 UT_UTF8String & get_Link_CSS_File() const { return *m_pLinkCSS; } 91 can_set_Declare_XML()92 inline bool can_set_Declare_XML () const { return m_exp_opt->bIs4 ? false : true; } can_set_Allow_AWML()93 inline bool can_set_Allow_AWML () const { return m_exp_opt->bIs4 ? false : true; } can_set_Embed_CSS()94 inline bool can_set_Embed_CSS () const { return m_exp_opt->bIsAbiWebDoc ? false : true; } can_set_Link_CSS()95 inline bool can_set_Link_CSS () const { return true; } can_set_Class_Only()96 inline bool can_set_Class_Only () const { return true; } can_set_Abs_Units()97 inline bool can_set_Abs_Units () const { return true; } can_set_Scale_Units()98 inline bool can_set_Scale_Units () const { return true; } can_set_Embed_Images()99 inline bool can_set_Embed_Images () const { return m_exp_opt->bMultipart ? false : true; } can_set_MathML_Render_PNG()100 inline bool can_set_MathML_Render_PNG() const { return true; } can_set_Split_Document()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); set_Compact(UT_uint32 i)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 */ 131