00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiSource Application Framework 00004 * Copyright (C) 2002 AbiSource, Inc. 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 * 02110-1301 USA. 00020 */ 00021 00022 #ifndef XAP_DIALOG_HTMLOPTIONS_H 00023 #define XAP_DIALOG_HTMLOPTIONS_H 00024 00025 /* pre-emptive dismissal; ut_types.h is needed by just about everything, 00026 * so even if it's commented out in-file that's still a lot of work for 00027 * the preprocessor to do... 00028 */ 00029 #ifndef UT_TYPES_H 00030 #include "ut_types.h" 00031 #endif 00032 00033 #include "xap_Dialog.h" 00034 00035 class XAP_App; 00036 class UT_UTF8String; 00037 00038 struct XAP_Exp_HTMLOptions 00039 { 00040 bool bIs4; 00041 bool bIsAbiWebDoc; 00042 bool bDeclareXML; 00043 bool bAllowAWML; 00044 bool bEmbedCSS; 00045 bool bLinkCSS; 00046 bool bEmbedImages; 00047 bool bClassOnly; 00048 bool bAbsUnits; 00049 bool bScaleUnits; 00050 bool bMathMLRenderPNG; 00051 bool bSplitDocument; 00052 UT_uint32 iCompact; 00053 /* other options, not set/saved/restore by options dialog 00054 */ 00055 bool bMultipart; 00056 bool bAddIdentifiers; 00057 }; 00058 00059 class ABI_EXPORT XAP_Dialog_HTMLOptions : public XAP_Dialog_NonPersistent 00060 { 00061 public: 00062 XAP_Dialog_HTMLOptions (XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 00063 00064 virtual ~XAP_Dialog_HTMLOptions (void); 00065 00066 virtual void runModal (XAP_Frame * pFrame) = 0; 00067 00068 bool shouldSave () const { return m_bShouldSave; } 00069 00070 void setHTMLOptions (XAP_Exp_HTMLOptions * exp_opt, XAP_App * app); 00071 static void getHTMLDefaults (XAP_Exp_HTMLOptions * exp_opt, XAP_App * app); 00072 00073 protected: 00074 inline bool get_HTML4 () const { return m_exp_opt->bIs4; } 00075 inline bool get_PHTML () const { return m_exp_opt->bIsAbiWebDoc; } 00076 inline bool get_Declare_XML () const { return m_exp_opt->bDeclareXML; } 00077 inline bool get_Allow_AWML () const { return m_exp_opt->bAllowAWML; } 00078 inline bool get_Embed_CSS () const { return m_exp_opt->bEmbedCSS; } 00079 inline bool get_Link_CSS () const { return m_exp_opt->bLinkCSS; } 00080 inline bool get_Class_Only() const { return m_exp_opt->bClassOnly; } 00081 inline bool get_Embed_Images () const { return m_exp_opt->bEmbedImages; } 00082 inline bool get_Multipart () const { return m_exp_opt->bMultipart; } 00083 inline bool get_Abs_Units () const { return m_exp_opt->bAbsUnits; } 00084 inline bool get_Scale_Units () const { return m_exp_opt->bScaleUnits; } 00085 inline bool get_MathML_Render_PNG() const { return m_exp_opt->bMathMLRenderPNG; } 00086 inline bool get_Split_Document() const { return m_exp_opt->bSplitDocument; } 00087 inline UT_uint32 get_Compact () const { return m_exp_opt->iCompact; } 00088 00089 00090 UT_UTF8String & get_Link_CSS_File() const { return *m_pLinkCSS; } 00091 00092 inline bool can_set_Declare_XML () const { return m_exp_opt->bIs4 ? false : true; } 00093 inline bool can_set_Allow_AWML () const { return m_exp_opt->bIs4 ? false : true; } 00094 inline bool can_set_Embed_CSS () const { return m_exp_opt->bIsAbiWebDoc ? false : true; } 00095 inline bool can_set_Link_CSS () const { return true; } 00096 inline bool can_set_Class_Only () const { return true; } 00097 inline bool can_set_Abs_Units () const { return true; } 00098 inline bool can_set_Scale_Units () const { return true; } 00099 inline bool can_set_Embed_Images () const { return m_exp_opt->bMultipart ? false : true; } 00100 inline bool can_set_MathML_Render_PNG() const { return true; } 00101 inline bool can_set_Split_Document() const { return m_exp_opt->bMultipart ? false : true; } 00102 00103 void set_HTML4 (bool enable); 00104 void set_PHTML (bool enable); 00105 void set_Declare_XML (bool enable); 00106 void set_Allow_AWML (bool enable); 00107 void set_Embed_CSS (bool enable); 00108 void set_Link_CSS (bool enable); 00109 void set_Class_Only (bool enable); 00110 void set_Embed_Images (bool enable); 00111 void set_MathML_Render_PNG (bool enable); 00112 void set_Split_Document(bool enable); 00113 00114 void set_Link_CSS_File (const char * file); 00115 void set_Abs_Units (bool enable); 00116 void set_Scale_Units (bool enable); 00117 void set_Compact (UT_uint32 i) {m_exp_opt->iCompact = i;} 00118 00119 void saveDefaults (); 00120 void restoreDefaults (); 00121 00122 bool m_bShouldSave; 00123 00124 private: 00125 XAP_Exp_HTMLOptions * m_exp_opt; 00126 XAP_App * m_app; 00127 UT_UTF8String * m_pLinkCSS; 00128 }; 00129 00130 #endif /* XAP_DIALOG_HTMLOPTIONS_H */