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_MSWORD_97_H 00023 #define IE_EXP_MSWORD_97_H 00024 00025 #include "ie_exp.h" 00026 #include "ut_vector.h" 00027 #include "ut_misc.h" 00028 #include "pl_Listener.h" 00029 00030 // forward declarations 00031 // 00032 class PD_Document; 00033 class s_MsWord_97_Listener; 00034 00035 typedef struct _wvExporter wvExporter; 00036 00037 // The exporter/writer for the MsWord 97 format 00038 00039 class ABI_EXPORT IE_Exp_MsWord_97_Sniffer : public IE_ExpSniffer 00040 { 00041 friend class IE_Exp; 00042 00043 public: 00044 IE_Exp_MsWord_97_Sniffer (); 00045 virtual ~IE_Exp_MsWord_97_Sniffer () {} 00046 00047 UT_Confidence_t supportsMIME (const char * szMIME); 00048 00049 virtual bool recognizeSuffix (const char * szSuffix); 00050 virtual bool getDlgLabels (const char ** szDesc, 00051 const char ** szSuffixList, 00052 IEFileType * ft); 00053 virtual UT_Error constructExporter (PD_Document * pDocument, 00054 IE_Exp ** ppie); 00055 }; 00056 00057 class ABI_EXPORT IE_Exp_MsWord_97 : public IE_Exp 00058 { 00059 friend class s_MsWord_97_Listener; 00060 s_MsWord_97_Listener* m_pListener; 00061 00062 public: 00063 IE_Exp_MsWord_97(PD_Document * pDocument); 00064 ~IE_Exp_MsWord_97(); 00065 00066 void write(const char * sz); 00067 void write(const char * sz, UT_uint32 length); 00068 00069 private: 00070 char * fileName; 00071 00072 wvExporter *m_pExporter; 00073 00074 protected: 00075 // these are all overridden methods of the base class 00076 // see comments in ie_exp_MsWord_97.cpp for explanation 00077 00078 UT_Error _writeDocument(void); 00079 bool _openFile(const char * szFileName); 00080 UT_uint32 _writeBytes(const UT_Byte * pBytes, UT_uint32 length); 00081 bool _writeBytes(const UT_Byte * pBytes); 00082 bool _closeFile(void); 00083 void _abortFile(void); 00084 }; 00085 00086 #endif