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

ie_exp_WordPerfect.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 2001 AbiSource, Inc.
00003  * Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
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 /* See bug 1764
00022  * This product is not manufactured, approved, or supported by
00023  * Corel Corporation or Corel Corporation Limited."
00024  */
00025 
00026 #ifndef IE_EXP_WP_H
00027 #define IE_EXP_WP_H
00028 
00029 #include <stdio.h>
00030 #include <stdlib.h>
00031 #include <string.h>
00032 #include <math.h>
00033 
00034 #include "ut_types.h"
00035 #include "ut_string.h"
00036 #include "ut_string_class.h"
00037 #include "ut_units.h"
00038 #include "ut_assert.h"
00039 #include "ut_debugmsg.h"
00040 #include "ie_exp.h"
00041 #include "ut_growbuf.h"
00042 #include "ut_wctomb.h"
00043 #include "pl_Listener.h"
00044 #include "px_ChangeRecord.h"
00045 #include "px_CR_Span.h"
00046 #include "px_CR_Strux.h"
00047 #include "pp_AttrProp.h"
00048 #include "pd_Document.h"
00049 #include "pt_Types.h"
00050 #include "ut_locale.h"
00051 
00052 #include "xap_Frame.h"
00053 #include "xap_EncodingManager.h"
00054 
00055 #define MY_MB_LEN_MAX 6
00056 
00057 #define PTR_TO_DOCUMENT_INDEX 4
00058 #define PTR_TO_FILESIZE_INDEX 20
00059 
00060 // The exporter for WordPerfect 6/7/8/9 documents.
00061 
00062 class IE_Exp_WordPerfect_Sniffer : public IE_ExpSniffer
00063 {
00064     friend class IE_Exp;
00065     friend class IE_Exp_WordPerfect;
00066 
00067 public:
00068     IE_Exp_WordPerfect_Sniffer();
00069     virtual ~IE_Exp_WordPerfect_Sniffer();
00070 
00071     virtual bool            recognizeSuffix (const char * szSuffix);
00072     virtual bool            getDlgLabels (const char ** szDesc,
00073                                           const char ** szSuffixList,
00074                                           IEFileType * ft);
00075     virtual UT_Error        constructExporter (PD_Document * pDocument,
00076                                                IE_Exp ** ppie);
00077 };
00078 
00079 class IE_Exp_WordPerfect : public IE_Exp
00080 {
00081     friend class WordPerfect_Listener;
00082 
00083 public:
00084     IE_Exp_WordPerfect(PD_Document * pDocument);
00085     ~IE_Exp_WordPerfect();
00086 protected:
00087     virtual PL_Listener *   _constructListener(void);
00088     virtual UT_Error        _writeDocument(void);
00089     UT_String *             m_buffer;
00090     UT_uint16               m_desiredFontUseCount;
00091 private:
00092     UT_Error                _writeHeader();
00093     void                    _UT_String_add(UT_String &s, int i);
00094     void                    _UT_String_add(UT_String &s, short i);
00095     void                    _UT_String_overwrite(UT_String &s, int pos, int i);
00096     void                    _UT_String_add_chars(UT_String &s, char *c, int count);
00097 
00098     void                    _handleGlobalOn();
00099     void                    _handleGlobalOff();
00100 
00101     PL_Listener *           m_pListener;
00102     int                     m_ptrToDocument;
00103     int                     m_ptrDesiredFontUseCount;
00104 };
00105 
00106 class WordPerfect_Listener : public PL_Listener
00107 {
00108 public:
00109     WordPerfect_Listener(PD_Document * pDocument,
00110                          IE_Exp_WordPerfect * pie);
00111     virtual ~WordPerfect_Listener(){};
00112 
00113     virtual bool            populate(fl_ContainerLayout* sfh,
00114                                      const PX_ChangeRecord * pcr);
00115 
00116     virtual bool            populateStrux(pf_Frag_Strux* sdh,
00117                                           const PX_ChangeRecord * pcr,
00118                                           fl_ContainerLayout* * psfh);
00119 
00120     virtual bool            change(fl_ContainerLayout* sfh,
00121                                    const PX_ChangeRecord * pcr);
00122 
00123     virtual bool            insertStrux(fl_ContainerLayout* sfh,
00124                                         const PX_ChangeRecord * pcr,
00125                                         pf_Frag_Strux* sdh,
00126                                         PL_ListenerId lid,
00127                                         void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
00128                                                                 PL_ListenerId lid,
00129                                                                 fl_ContainerLayout* sfhNew));
00130 
00131     virtual bool            signal(UT_uint32 iSignal);
00132 protected:
00133     virtual int             _wctomb(char * pC, int & length, UT_UCS4Char wc) { return m_wctomb.wctomb(pC,length,wc); }
00134     virtual void            _outputData(const UT_UCSChar * p, UT_uint32 length);
00135     void                    _closeBlock();
00136     void                    _openBlock(PT_AttrPropIndex api);
00137     void                    _openSpan(PT_AttrPropIndex api);
00138     void                    _closeSpan();
00139     void                    _handleVariableGroup(char group, char subgroup, char flags, short sizeNonDelData, char * nonDelData);
00140     void                    _handleTabGroup(char tabDef);
00141     void                    _handleAttributeOn(char attribute);
00142     void                    _handleAttributeOff(char attribute);
00143     void                    _handleFontSizeChange(double points);
00144     void                    _handleParagraphJustification(char mode);
00145 private:
00146     PD_Document *           m_pDocument;
00147     IE_Exp_WordPerfect *    m_pie;
00148     UT_Wctomb               m_wctomb;
00149     const PP_AttrProp*      m_pAP_Span;
00150 
00151     bool                    m_bInBlock;
00152     char                    m_paragraphJustification;
00153 };
00154 
00155 #endif /* IE_EXP_WP_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1