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

ie_exp_Psion.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 2000 AbiSource, Inc.
00003  * Copyright (C) 2000,2001,2004 Frodo Looijaard <frodol@dds.nl>
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 /* This exporter is written by Frodo Looijaard <frodol@dds.nl> */
00022 
00023 #ifndef IE_EXP_PSION_H
00024 #define IE_EXP_PSION_H
00025 
00026 #include "ie_exp.h"
00027 #include "ie_impexp_Psion.h"
00028 #include "pl_Listener.h"
00029 #include "pd_Document.h"
00030 #include "psiconv/data.h"
00031 
00032 // The exporter/writer for Psion Files.
00033 
00034 
00041 class IE_Exp_Psion_Word_Sniffer : public IE_ExpSniffer
00042 {
00043 public:
00044     IE_Exp_Psion_Word_Sniffer (const char * _name): IE_ExpSniffer(_name) {}
00045     virtual ~IE_Exp_Psion_Word_Sniffer () {}
00046 
00047     virtual bool recognizeSuffix (const char * szSuffix);
00048     virtual bool getDlgLabels (const char ** szDesc,
00049                                const char ** szSuffixList,
00050                                IEFileType * ft);
00051     virtual UT_Error constructExporter (PD_Document * pDocument,
00052                                         IE_Exp ** ppie);
00053 };
00054 
00061 class IE_Exp_Psion_TextEd_Sniffer : public IE_ExpSniffer
00062 {
00063 public:
00064     IE_Exp_Psion_TextEd_Sniffer (const char * _name): IE_ExpSniffer(_name) {}
00065     virtual ~IE_Exp_Psion_TextEd_Sniffer () {}
00066 
00067     virtual bool recognizeSuffix (const char * szSuffix);
00068     virtual bool getDlgLabels (const char ** szDesc,
00069                                const char ** szSuffixList,
00070                                IEFileType * ft);
00071     virtual UT_Error constructExporter (PD_Document * pDocument,
00072                                         IE_Exp ** ppie);
00073 };
00074 
00075 
00086 class PL_Psion_Listener : public PL_Listener
00087 {
00088 public:
00089     // Constructors and destructor
00090     PL_Psion_Listener(PD_Document * pDocument);
00091     virtual ~PL_Psion_Listener(void);
00092 
00093     // Overriding methods from the base class
00094     virtual bool populate(fl_ContainerLayout* sfh,
00095                           const PX_ChangeRecord * pcr);
00096     virtual bool populateStrux(pf_Frag_Strux* sdh,
00097                                const PX_ChangeRecord * pcr,
00098                                fl_ContainerLayout* * psfh);
00099 
00100     // New public methods
00101     bool startDocument(void);
00102     bool finishDocument(void);
00103     virtual psiconv_file createPsionFile(void) = 0;
00104 
00105 protected:
00106     // New data
00107     PD_Document *m_pDocument;
00108     psiconv_text_and_layout m_paragraphs;
00109     psiconv_word_styles_section m_styles;
00110     psiconv_page_header m_header,m_footer;
00111 
00112 private:
00113     // New data
00114     bool m_inParagraph;
00115     enum sectionType { section_none,section_header,section_footer,
00116                        section_main };
00117     sectionType m_sectionType;
00118 
00119     psiconv_list m_currentParagraphText /* of psiconv_ucs2 */;
00120     psiconv_paragraph_layout m_currentParagraphPLayout;
00121     psiconv_character_layout m_currentParagraphCLayout;
00122     psiconv_in_line_layouts m_currentParagraphInLines;
00123     psiconv_s16 m_currentParagraphStyle;
00124 
00125     // New methods
00126     bool _writeText(const UT_UCSChar *p, UT_uint32 inlength,
00127                     UT_uint32 &outlength);
00128     bool _openParagraph(const PT_AttrPropIndex api);
00129     bool _closeParagraph(void);
00130     bool _addInLine(const PT_AttrPropIndex api,UT_uint32 textlen);
00131     bool _processStyles(void);
00132     bool _setStyleLayout(PD_Style *style,
00133                          psiconv_paragraph_layout para_layout,
00134                          psiconv_character_layout char_layout);
00135     bool _insertImage(const PT_AttrPropIndex api);
00136 
00137 public:
00138     // The following three base class methods should never be called.
00139     virtual bool change(fl_ContainerLayout* /*sfh*/,
00140                         const PX_ChangeRecord * /*pcr*/)
00141                              { UT_ASSERT(UT_SHOULD_NOT_HAPPEN); return false; }
00142     virtual bool insertStrux(fl_ContainerLayout* /*sfh*/,
00143                              const PX_ChangeRecord * /*pcr*/,
00144                              pf_Frag_Strux* /*sdh*/,
00145                              PL_ListenerId /*lid*/,
00146                              void (* /*pfnBindHandles*/)
00147                                                 (pf_Frag_Strux* sdhNew,
00148                                                  PL_ListenerId lid,
00149                                                  fl_ContainerLayout* sfhNew))
00150                              { UT_ASSERT(UT_SHOULD_NOT_HAPPEN); return false; }
00151     virtual bool signal(UT_uint32 /*iSignal*/)
00152                              { UT_ASSERT(UT_SHOULD_NOT_HAPPEN); return false; }
00153 
00154 };
00155 
00156 
00163 class PL_Psion_Word_Listener: public PL_Psion_Listener
00164 {
00165 public:
00166     // Constructors and destructor
00167     PL_Psion_Word_Listener(PD_Document * pDocument): PL_Psion_Listener(pDocument) {}
00168     virtual ~PL_Psion_Word_Listener(void) { }
00169 
00170     // Public functions
00171     virtual psiconv_file createPsionFile(void);
00172 };
00173 
00174 
00181 class PL_Psion_TextEd_Listener: public PL_Psion_Listener
00182 {
00183 public:
00184     // Constructors and destructor
00185     PL_Psion_TextEd_Listener(PD_Document * pDocument): PL_Psion_Listener(pDocument) {}
00186     virtual ~PL_Psion_TextEd_Listener(void) { }
00187 
00188     // Public functions
00189     virtual psiconv_file createPsionFile(void);
00190 };
00191 
00192 
00205 class IE_Exp_Psion: public IE_Exp
00206 {
00207 public:
00208     // Constructors and destructor
00209     IE_Exp_Psion(PD_Document * pDocument): IE_Exp(pDocument) { }
00210     virtual ~IE_Exp_Psion(void) { }
00211 
00212 protected:
00213     // Overriding methods from the base class
00214     virtual UT_Error _writeDocument(void);
00215 
00216     // New methods.
00217     virtual PL_Psion_Listener *_constructListener(void) = 0;
00218 };
00219 
00220 
00227 class IE_Exp_Psion_TextEd : public IE_Exp_Psion
00228 {
00229 public:
00230     // Constructors and destructor
00231     IE_Exp_Psion_TextEd(PD_Document * pDocument): IE_Exp_Psion(pDocument) {}
00232     virtual ~IE_Exp_Psion_TextEd(void) { }
00233 
00234 protected:
00235     // Overriding methods from the base class
00236     virtual PL_Psion_Listener *_constructListener(void);
00237 };
00238 
00239 
00246 class IE_Exp_Psion_Word : public IE_Exp_Psion
00247 {
00248 public:
00249     // Constructors and destructor
00250     IE_Exp_Psion_Word(PD_Document * pDocument): IE_Exp_Psion(pDocument) { }
00251     virtual ~IE_Exp_Psion_Word(void) { }
00252 
00253 protected:
00254     // Overriding methods from the base class
00255     virtual PL_Psion_Listener *_constructListener(void);
00256 };
00257 
00258 
00259 #endif /* IE_EXP_PSION_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1