00001 /* -*- c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- */ 00002 /* AbiWord 00003 * Copyright (C) 2000 AbiSource, Inc. 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 * 02110-1301 USA. 00019 */ 00020 00021 00022 #ifndef IE_EXP_PALMDOC_H 00023 #define IE_EXP_PALMDOC_H 00024 00025 #include <stdio.h> 00026 #include "ie_exp.h" 00027 #include "ie_impexp_Palm.h" 00028 #include "ie_exp_Text.h" 00029 00030 // The exporter/writer for PalmDoc file format. 00031 00032 /*****************************************************************/ 00033 /*****************************************************************/ 00034 00035 class IE_Exp_PalmDoc_Sniffer : public IE_ExpSniffer 00036 { 00037 friend class IE_Exp; 00038 00039 public: 00040 IE_Exp_PalmDoc_Sniffer (const char * name); 00041 virtual ~IE_Exp_PalmDoc_Sniffer () {} 00042 00043 virtual bool recognizeSuffix (const char * szSuffix); 00044 virtual bool getDlgLabels (const char ** szDesc, 00045 const char ** szSuffixList, 00046 IEFileType * ft); 00047 virtual UT_Error constructExporter (PD_Document * pDocument, 00048 IE_Exp ** ppie); 00049 }; 00050 00051 class IE_Exp_PalmDoc : public IE_Exp_Text 00052 { 00053 public: 00054 IE_Exp_PalmDoc(PD_Document * pDocument); 00055 virtual ~IE_Exp_PalmDoc(); 00056 00057 protected: 00058 virtual UT_Error _writeDocument(void); 00059 virtual UT_uint32 _writeBytes(const UT_Byte * pBytes, UT_uint32 length); 00060 virtual bool _writeBytes(const UT_Byte * sz); 00061 00062 void _selectSwap(); 00063 void _compress( buffer* ); 00064 Byte* _mem_find( Byte *t, int t_len, Byte *m, int m_len ); 00065 Word _swap_Word( Word ); 00066 DWord _swap_DWord( DWord ); 00067 // void _uncompress( buffer* ); 00068 void _zero_fill( char*, int len ); 00069 00070 private: 00071 00072 pdb_header m_header; 00073 doc_record0 m_rec0; 00074 unsigned long m_index; 00075 DWord m_recOffset; 00076 UT_uint32 m_numRecords; 00077 DWord m_fileSize; 00078 buffer * m_buf; 00079 bool m_littlendian; 00080 00081 }; 00082 00083 #endif /* IE_EXP_PALMDOC */