1 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 2 3 /* AbiWord 4 * Copyright (C) 2001 AbiSource, Inc. 5 * Copyright (C) 2001 Petr Tomasek <tomasek@etf.cuni.cz> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 20 * 02110-1301 USA. 21 */ 22 23 24 #ifndef IE_IMP_T602_H 25 #define IE_IMP_T602_H 26 27 #include <stdio.h> 28 #include "ie_imp.h" 29 #include "ut_string_class.h" 30 31 // The importer for T602 documents. 32 33 class IE_Imp_T602_Sniffer : public IE_ImpSniffer 34 { 35 friend class IE_Imp; 36 friend class IE_Imp_T602; 37 38 public: 39 IE_Imp_T602_Sniffer(); ~IE_Imp_T602_Sniffer()40 virtual ~IE_Imp_T602_Sniffer() {} 41 42 virtual const IE_SuffixConfidence * getSuffixConfidence (); getMimeConfidence()43 virtual const IE_MimeConfidence * getMimeConfidence () { return NULL; } 44 virtual UT_Confidence_t recognizeContents (const char * szBuf, UT_uint32 iNumbytes); 45 virtual bool getDlgLabels (const char ** szDesc, const char ** szSuffixList, IEFileType * ft); 46 virtual UT_Error constructImporter (PD_Document * pDocument, IE_Imp ** ppie); 47 }; 48 49 class IE_Imp_T602 : public IE_Imp 50 { 51 public: 52 IE_Imp_T602(PD_Document * pDocument); 53 ~IE_Imp_T602(); 54 55 protected: 56 virtual UT_Error _loadFile(GsfInput * input); 57 58 UT_uint16 _conv(unsigned char c); 59 bool _getbyte(unsigned char &c); 60 UT_Error _writeheader(); 61 UT_Error _writeTP(); 62 UT_Error _writePP(); 63 UT_Error _writeSP(); 64 UT_Error _write_fh(UT_String & fh,UT_uint32 id, bool hea); 65 UT_Error _ins(UT_uint16); 66 UT_Error _dotcom(unsigned char ch); 67 UT_Error _inschar(unsigned char c, bool eol); 68 69 private: 70 GsfInput *m_importFile; 71 // T602 Document attributes... 72 int m_charset; 73 UT_String m_family; 74 UT_String m_basefamily; 75 bool m_softcr; 76 int m_basesize; 77 int m_size; 78 UT_String m_lmargin; 79 UT_String m_rmargin; 80 int m_bold; 81 int m_italic; 82 int m_underline; 83 int m_tpos; 84 int m_big; 85 UT_String m_color; 86 int m_sfont; 87 // .dot commands 88 bool m_eol; 89 // paragraph attributes 90 int m_lheight; // line height: 1==1, 2==1.5, 3==2 91 // section attributes.. 92 UT_uint32 m_footer; 93 UT_uint32 m_header; 94 UT_uint32 m_fhc; // footer/header counter... 95 UT_String m_fbuff; 96 UT_String m_hbuff; 97 // write (section) headers.. 98 bool m_writeheader; 99 100 }; 101 102 #endif /* IE_IMP_T602_H */ 103