• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ie_exp_HTML.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiWord
00004  * Copyright (C) 1998 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 IE_EXP_HTML_H
00023 #define IE_EXP_HTML_H
00024 
00025 // External includes
00026 #include <gsf/gsf-output.h>
00027 
00028 class IE_Exp_HTML;
00029 
00030 // HTML exporter includes
00031 #include "ie_impexp_HTML.h"
00032 #include "ie_exp_HTML_util.h"
00033 #include "ie_exp_HTML_UtilListeners.h"
00034 #include "ie_exp_HTML_NavigationHelper.h"
00035 #include "ie_exp_HTML_StyleTree.h"
00036 #include "ie_exp_HTML_DocumentWriter.h"
00037 #include "ie_exp_HTML_Listener.h"
00038 #include "xap_Dlg_HTMLOptions.h"
00039 
00040 // Abiword includes
00041 #include <ut_debugmsg.h>
00042 #include <ut_assert.h>
00043 #include <ut_string_class.h>
00044 #include <ut_go_file.h>
00045 #include <xap_App.h>
00046 #include <ie_types.h>
00047 #include <ie_TOC.h>
00048 #include <ap_Strings.h>
00049 #include <xap_Dialog_Id.h>
00050 #include <xap_DialogFactory.h>
00051 #include <xap_Frame.h>
00052 #include <xav_View.h>
00053 #include <ie_exp.h>
00054 #include <pt_Types.h>
00055 #include <ut_path.h>
00056 
00057 /* Define if the base unicode char is UCS-4
00058  */
00059 #define HTML_UCS4
00060 
00061 
00062 // The exporter/writer for HTML
00063 class ABI_EXPORT IE_Exp_HTML_Sniffer : public IE_ExpSniffer
00064 {
00065     friend class IE_Exp;
00066 
00067 public:
00068     IE_Exp_HTML_Sniffer ();
00069     virtual ~IE_Exp_HTML_Sniffer () {}
00070 
00071     virtual bool recognizeSuffix (const gchar * szSuffix);
00072     virtual bool getDlgLabels (const gchar ** szDesc,
00073                                const gchar ** szSuffixList,
00074                                IEFileType * ft);
00075     virtual UT_Error constructExporter (PD_Document * pDocument,
00076                                         IE_Exp ** ppie);
00077 
00078     virtual UT_Confidence_t supportsMIME (const gchar * szMimeType);
00079 };
00080 
00081 class IE_Exp_HTML_NavigationHelper;
00082 class IE_Exp_HTML_WriterFactory;
00083 
00084 class ABI_EXPORT IE_Exp_HTML : public IE_Exp
00085 {
00086 public:
00087     IE_Exp_HTML (PD_Document * pDocument);
00088     virtual ~IE_Exp_HTML ();
00089 
00090     virtual UT_Error copyToBuffer(PD_DocumentRange * pDocRange,UT_ByteBuf *  bufHTML);
00091 
00092     static bool         RecognizeSuffix (const gchar * szSuffix);
00093     static UT_Error     StaticConstructor (PD_Document * pDocument,
00094                                            IE_Exp ** ppie);
00095     static bool         GetDlgLabels (const gchar ** pszDesc,
00096                                       const gchar ** pszSuffixList,
00097                                       IEFileType * ft);
00098     static bool         SupportsFileType (IEFileType ft);
00099 
00100     inline void         suppressDialog (bool disable = true) { m_bSuppressDialog = disable; }
00101     inline void         set_HTML4 (bool enable = true) { m_exp_opt.bIs4 = enable; }
00102     inline void         set_PHTML (bool enable = true) { m_exp_opt.bIsAbiWebDoc = enable; }
00103     inline void         set_MHTML (bool enable = true) { m_exp_opt.bMultipart = enable; }
00104     inline void         set_AddIdentifiers(bool enable = true) { m_exp_opt.bAddIdentifiers = enable; }
00105     inline void         set_MathMLRenderPNG ( bool enable = true) { m_exp_opt.bMathMLRenderPNG = enable; }
00106     inline void         set_SplitDocument ( bool enable = true) { m_exp_opt.bSplitDocument = enable; }
00107 
00108     inline const UT_UTF8String & getSuffix() const { return m_suffix; }
00109     inline IE_Exp_HTML_NavigationHelper *getNavigationHelper() { return m_pNavigationHelper; }
00110     void setWriterFactory(IE_Exp_HTML_WriterFactory *pWriterFactory);
00111 
00112 private:
00113     UT_Error            _doOptions ();
00114     void _buildStyleTree();
00115 
00116 protected:
00117     virtual UT_Error    _writeDocument ();
00118     void                _createChapter(PD_DocumentRange *range, const std::string &title, bool isIndex);
00119     void _createMultipart();
00120 public:
00121     virtual UT_Error    _writeDocument (bool bClipBoard, bool bTemplateBody);
00122     bool hasMathML(const std::string &file);
00123     static void printStyleTree(PD_Document *pDocument, UT_ByteBuf& sink);
00124 private:
00125     // Returns document writer depending on settings
00126     IE_Exp_HTML_StyleTree *     m_style_tree;
00127     IE_Exp_HTML_StyleListener *m_styleListener;
00128     bool            m_bSuppressDialog;
00129     bool m_bDefaultWriterFactory;
00130     XAP_Exp_HTMLOptions m_exp_opt;
00131     UT_UTF8String       m_sLinkCSS;
00132     UT_UTF8String       m_sTitle;
00133     IE_Exp_HTML_WriterFactory *m_pWriterFactory;
00134     // We need to know file suffix to create chapters with the same suffix as the main file
00135     UT_UTF8String m_suffix;
00136     std::map<std::string, bool> m_mathmlFlags;
00137     IE_Exp_HTML_NavigationHelper *m_pNavigationHelper;
00138 };
00139 
00140 #endif /* IE_EXP_HTML_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1