• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ie_imp_Psion.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiWord
00004  * Copyright (C) 2000 AbiSource, Inc.
00005  * Copyright (C) 2000,2004 Frodo Looijaard <frodol@dds.nl>
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 /* This importer is written by Frodo Looijaard <frodol@dds.nl> */
00024 
00025 #ifndef IE_IMP_PSION_H
00026 #define IE_IMP_PSION_H
00027 
00028 #include "ie_imp.h"
00029 #include "ie_impexp_Psion.h"
00030 #include "pd_Document.h"
00031 
00032 #include <psiconv/data.h>
00033 
00034 
00035 // The importer/reader for Psion Word and TextEd Files.
00036 
00037 
00038 class IE_Imp_Psion_Sniffer : public IE_ImpSniffer
00039 {
00040 public:
00041     IE_Imp_Psion_Sniffer(const char * _name): IE_ImpSniffer(_name) {}
00042     virtual ~IE_Imp_Psion_Sniffer() {}
00043 protected:
00044     UT_Confidence_t checkContents (const char *szBuf, UT_uint32 iNumbytes,
00045                                    psiconv_file_type_t filetype);
00046 };
00047 
00048 class IE_Imp_Psion_Word_Sniffer : public IE_Imp_Psion_Sniffer
00049 {
00050 public:
00051     IE_Imp_Psion_Word_Sniffer(const char * _name): IE_Imp_Psion_Sniffer(_name) {}
00052     virtual ~IE_Imp_Psion_Word_Sniffer() {}
00053 
00054     virtual const IE_SuffixConfidence * getSuffixConfidence ();
00055     virtual const IE_MimeConfidence * getMimeConfidence () { return NULL; }
00056     virtual UT_Confidence_t recognizeContents (const char * szBuf,
00057                                                UT_uint32 iNumbytes);
00058     virtual bool getDlgLabels (const char ** szDesc,
00059                                const char ** szSuffixList,
00060                                IEFileType * ft);
00061     virtual UT_Error constructImporter (PD_Document * pDocument,
00062                                         IE_Imp ** ppie);
00063 };
00064 
00065 class IE_Imp_Psion_TextEd_Sniffer :
00066                                                     public IE_Imp_Psion_Sniffer
00067 {
00068 public:
00069     IE_Imp_Psion_TextEd_Sniffer(const char * _name):
00070                                                   IE_Imp_Psion_Sniffer(_name) {}
00071     virtual ~IE_Imp_Psion_TextEd_Sniffer() {}
00072 
00073     virtual const IE_SuffixConfidence * getSuffixConfidence ();
00074     virtual const IE_MimeConfidence * getMimeConfidence () { return NULL; }
00075     virtual UT_Confidence_t recognizeContents (const char * szBuf,
00076                                                UT_uint32 iNumbytes);
00077     virtual bool getDlgLabels (const char ** szDesc,
00078                                const char ** szSuffixList,
00079                                IEFileType * ft);
00080     virtual UT_Error constructImporter (PD_Document * pDocument,
00081                                         IE_Imp ** ppie);
00082 };
00083 
00084 class IE_Imp_Psion : public IE_Imp
00085 {
00086 public:
00087     IE_Imp_Psion(PD_Document * pDocument): IE_Imp(pDocument),list(false) {}
00088     ~IE_Imp_Psion() {}
00089 
00090 protected:
00091     virtual UT_Error _loadFile(GsfInput * input);
00092 
00093     UT_Error getCharacterAttributes(const psiconv_character_layout layout,
00094                                 UT_UTF8String &props);
00095     UT_Error getParagraphAttributes(const psiconv_paragraph_layout layout,
00096                                 UT_UTF8String &props);
00097     UT_Error applyCharacterAttributes(const psiconv_character_layout layout);
00098     UT_Error applyParagraphAttributes(const psiconv_paragraph_layout layout,
00099                                   const gchar *stylename);
00100     UT_Error applyPageAttributes(const psiconv_page_layout_section layout,
00101                                  bool &with_header, bool &with_footer);
00102     UT_Error prepareCharacters(const psiconv_ucs2 *input, int length,
00103                            UT_UCS4String &text);
00104     UT_Error readParagraphs(const psiconv_text_and_layout psiontext,
00105                             const psiconv_word_styles_section style_sec);
00106     UT_Error applyStyles(const psiconv_word_styles_section style_sec);
00107     UT_Error processHeaderFooter(const psiconv_page_layout_section layout,
00108                                            bool with_header, bool with_footer);
00109     UT_Error insertImage(const psiconv_in_line_layout in_line);
00110     UT_Error insertObject(const psiconv_in_line_layout in_line);
00111 
00112     virtual UT_Error parseFile(const psiconv_file psionfile) = 0;
00113 
00114  private:
00115     bool list;
00116 };
00117 
00118 class IE_Imp_Psion_Word : public IE_Imp_Psion
00119 {
00120 public:
00121     IE_Imp_Psion_Word(PD_Document * pDocument): IE_Imp_Psion(pDocument) {}
00122     ~IE_Imp_Psion_Word() {}
00123 
00124 protected:
00125     virtual UT_Error parseFile(const psiconv_file psionfile);
00126 };
00127 
00128 class IE_Imp_Psion_TextEd : public IE_Imp_Psion
00129 {
00130 public:
00131     IE_Imp_Psion_TextEd(PD_Document * pDocument): IE_Imp_Psion(pDocument) {}
00132     ~IE_Imp_Psion_TextEd() {}
00133 
00134 protected:
00135     virtual UT_Error parseFile(const psiconv_file psionfile);
00136 };
00137 
00138 #endif /* IE_IMP_PSION_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1