00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiWord 00004 * Copyright (C) 2001 AbiSource, Inc. 00005 * Copyright (C) 2001 Petr Tomasek <tomasek@etf.cuni.cz> 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00020 * 02110-1301 USA. 00021 */ 00022 00023 00024 #ifndef IE_IMP_T602_H 00025 #define IE_IMP_T602_H 00026 00027 #include <stdio.h> 00028 #include "ie_imp.h" 00029 #include "ut_string_class.h" 00030 00031 // The importer for T602 documents. 00032 00033 class IE_Imp_T602_Sniffer : public IE_ImpSniffer 00034 { 00035 friend class IE_Imp; 00036 friend class IE_Imp_T602; 00037 00038 public: 00039 IE_Imp_T602_Sniffer(); 00040 virtual ~IE_Imp_T602_Sniffer() {} 00041 00042 virtual const IE_SuffixConfidence * getSuffixConfidence (); 00043 virtual const IE_MimeConfidence * getMimeConfidence () { return NULL; } 00044 virtual UT_Confidence_t recognizeContents (const char * szBuf, UT_uint32 iNumbytes); 00045 virtual bool getDlgLabels (const char ** szDesc, const char ** szSuffixList, IEFileType * ft); 00046 virtual UT_Error constructImporter (PD_Document * pDocument, IE_Imp ** ppie); 00047 }; 00048 00049 class IE_Imp_T602 : public IE_Imp 00050 { 00051 public: 00052 IE_Imp_T602(PD_Document * pDocument); 00053 ~IE_Imp_T602(); 00054 00055 protected: 00056 virtual UT_Error _loadFile(GsfInput * input); 00057 00058 UT_uint16 _conv(unsigned char c); 00059 bool _getbyte(unsigned char &c); 00060 UT_Error _writeheader(); 00061 UT_Error _writeTP(); 00062 UT_Error _writePP(); 00063 UT_Error _writeSP(); 00064 UT_Error _write_fh(UT_String & fh,UT_uint32 id, bool hea); 00065 UT_Error _ins(UT_uint16); 00066 UT_Error _dotcom(unsigned char ch); 00067 UT_Error _inschar(unsigned char c, bool eol); 00068 00069 private: 00070 GsfInput *m_importFile; 00071 // T602 Document attributes... 00072 int m_charset; 00073 UT_String m_family; 00074 UT_String m_basefamily; 00075 bool m_softcr; 00076 int m_basesize; 00077 int m_size; 00078 UT_String m_lmargin; 00079 UT_String m_rmargin; 00080 int m_bold; 00081 int m_italic; 00082 int m_underline; 00083 int m_tpos; 00084 int m_big; 00085 UT_String m_color; 00086 int m_sfont; 00087 // .dot commands 00088 bool m_eol; 00089 // paragraph attributes 00090 int m_lheight; // line height: 1==1, 2==1.5, 3==2 00091 // section attributes.. 00092 UT_uint32 m_footer; 00093 UT_uint32 m_header; 00094 UT_uint32 m_fhc; // footer/header counter... 00095 UT_String m_fbuff; 00096 UT_String m_hbuff; 00097 // write (section) headers.. 00098 bool m_writeheader; 00099 00100 }; 00101 00102 #endif /* IE_IMP_T602_H */