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 #ifndef IE_EXP_HTML_UTILLISTENERS_H 00022 #define IE_EXP_HTML_UTILLISTENERS_H 00023 00024 // HTML exporter includes 00025 #include "ie_exp_HTML.h" 00026 #include "ie_exp_HTML_Listener.h" 00027 #include "ie_exp_HTML_DocumentWriter.h" 00028 00029 00030 // Abiword includes 00031 #include <pd_Document.h> 00032 #include <pl_Listener.h> 00033 00034 //#include "ie_exp_HTML_MainListener.h" 00035 //#include "ie_exp_HTML_Writer.h" 00036 // 00037 //class IE_Exp_HTML_DocumentWriter; 00038 // 00039 //class ABI_EXPORT IE_Exp_HTML_TemplateHandler : public UT_XML::ExpertListener 00040 //{ 00041 //public: 00042 // IE_Exp_HTML_TemplateHandler(PD_Document * pDocument, IE_Exp_HTML * pie); 00043 // 00044 // ~IE_Exp_HTML_TemplateHandler(); 00045 // 00046 // /* Implementation of ExpertListener 00047 // */ 00048 // void StartElement(const gchar * name, const gchar ** atts); 00049 // void EndElement(const gchar * name); 00050 // void CharData(const gchar * buffer, int length); 00051 // void ProcessingInstruction(const gchar * target, const gchar * data); 00052 // void Comment(const gchar * data); 00053 // void StartCdataSection(); 00054 // void EndCdataSection(); 00055 // void Default(const gchar * buffer, int length); 00056 // 00057 //private: 00058 // void _handleMetaTag(const gchar * key, UT_UTF8String & value); 00059 // void _handleMeta(); 00060 // 00061 // bool echo() const; 00062 // bool condition(const gchar * data) const; 00063 // 00064 // PD_Document * m_pDocument; 00065 // IE_Exp_HTML * m_pie; 00066 // 00067 // bool m_cdata; 00068 // bool m_empty; 00069 // 00070 // UT_UTF8String m_utf8; 00071 // UT_UTF8String m_root; 00072 // typedef std::map<std::string, std::string> hash_type; 00073 // hash_type m_hash; 00074 // UT_NumberStack m_mode; 00075 //}; 00076 // 00077 00078 class IE_Exp_HTML_DocumentWriter; 00079 class IE_Exp_HTML_Listener; 00080 class ABI_EXPORT IE_Exp_HTML_HeaderFooterListener : public PL_Listener { 00081 public: 00082 IE_Exp_HTML_HeaderFooterListener(PD_Document * pDocument, 00083 IE_Exp_HTML_DocumentWriter *pDocumentWriter, 00084 IE_Exp_HTML_Listener *pListener); 00085 00086 ~IE_Exp_HTML_HeaderFooterListener(); 00087 00088 bool populate(fl_ContainerLayout* sfh, 00089 const PX_ChangeRecord * pcr); 00090 00091 bool populateStrux(pf_Frag_Strux* sdh, 00092 const PX_ChangeRecord * pcr, 00093 fl_ContainerLayout* * psfh); 00094 00095 //See note in _writeDocument 00096 //bool startOfDocument (); 00097 bool endOfDocument(); 00098 00099 bool change(fl_ContainerLayout* sfh, 00100 const PX_ChangeRecord * pcr); 00101 00102 bool insertStrux(fl_ContainerLayout* sfh, 00103 const PX_ChangeRecord * pcr, 00104 pf_Frag_Strux* sdh, 00105 PL_ListenerId lid, 00106 void (*pfnBindHandles) (pf_Frag_Strux* sdhNew, 00107 PL_ListenerId lid, 00108 fl_ContainerLayout* sfhNew)); 00109 00110 bool signal(UT_uint32 iSignal); 00111 void doHdrFtr(bool bHeader); 00112 private: 00113 PD_DocumentRange * m_pHdrDocRange; 00114 PD_DocumentRange * m_pFtrDocRange; 00115 PD_Document * m_pDocument; 00116 IE_Exp_HTML_DocumentWriter *m_pDocumentWriter; 00117 IE_Exp_HTML_Listener *m_pListener; 00118 00119 bool m_bHaveHeader; 00120 bool m_bHaveFooter; 00121 }; 00122 00123 #endif /* IE_EXP_HTML_UTILLISTENERS_H */ 00124