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

ie_imp_XHTML.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiWord
00004  * Copyright (C) 1998-2000 AbiSource, Inc.
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00019  * 02111-1307, USA.
00020  */
00021 
00022 #ifndef IE_IMP_XHTML_1_H
00023 #define IE_IMP_XHTML_1_H
00024 
00025 #include "ie_imp_XML.h"
00026 #include "ut_stack.h"
00027 
00028 /* NOTE: I'm trying to keep the code similar across versions,
00029  *       and therefore features are enabled/disabled here:
00030  */
00031 
00032 /* Define if the base unicode char is UCS-4
00033  */
00034 #define XHTML_UCS4
00035 
00036 /* Define if the sniffers need to pass export name to parent
00037  */
00038 #define XHTML_NAMED_CONSTRUCTORS
00039 
00040 /* Define if the tables are supported
00041  */
00042 #define XHTML_TABLES_SUPPORTED 1
00043 
00044 /* Define if meta information is supported
00045  */
00046 #define XHTML_META_SUPPORTED
00047 
00048 /* Define if meta information is supported
00049  */
00050 #define XHTML_RUBY_SUPPORTED
00051 
00052 class PD_Document;
00053 class FG_Graphic;
00054 class IE_Imp_TableHelperStack;
00055 
00056 // The importer/reader for XHTML 1.0
00057 
00058 class ABI_EXPORT IE_Imp_XHTML_Sniffer : public IE_ImpSniffer
00059 {
00060     friend class IE_Imp;
00061 
00062 public:
00063     IE_Imp_XHTML_Sniffer();
00064     virtual ~IE_Imp_XHTML_Sniffer() {}
00065 
00066     virtual const IE_SuffixConfidence * getSuffixConfidence ();
00067     virtual const IE_MimeConfidence * getMimeConfidence ();
00068     virtual UT_Confidence_t recognizeContents (const char * szBuf,
00069                                     UT_uint32 iNumbytes);
00070     virtual bool getDlgLabels (const char ** szDesc,
00071                                const char ** szSuffixList,
00072                                IEFileType * ft);
00073     virtual UT_Error constructImporter (PD_Document * pDocument,
00074                                         IE_Imp ** ppie);
00075 
00076 };
00077 
00078 class ABI_EXPORT IE_Imp_XHTML : public IE_Imp_XML
00079 {
00080 public:
00081     IE_Imp_XHTML (PD_Document * pDocument);
00082 
00083     virtual ~IE_Imp_XHTML ();
00084 
00085     void                    startElement (const gchar * name, const gchar ** atts);
00086     void                    endElement (const gchar * name);
00087 
00088     virtual void            charData (const gchar * buffer, int length);
00089 
00090     virtual bool        pasteFromBuffer(PD_DocumentRange * pDocRange,
00091                                         const unsigned char * pData,
00092                                         UT_uint32 lenData,
00093                                         const char * szEncoding = 0);
00094 
00095     virtual bool  appendStrux(PTStruxType pts, const gchar ** attributes);
00096     virtual bool  appendFmt( const gchar ** attributes);
00097     virtual bool  appendFmt(const UT_GenericVector<const gchar*> * pVecAttributes);
00098     virtual bool  appendSpan(const UT_UCSChar * p, UT_uint32 length);
00099     virtual bool  appendObject(PTObjectType pto, const gchar ** attributes);
00100 
00101 
00102 protected:
00103     virtual UT_Error        _loadFile (GsfInput * input);
00104     virtual FG_Graphic *    importImage (const gchar * szSrc);
00105 
00106 private:
00107     FG_Graphic *            importDataURLImage (const gchar * szData);
00108 
00109     bool                    pushInline (const char * props);
00110     bool                    newBlock (const char * style, const char * css, const char * align);
00111     bool                    requireBlock ();
00112     bool                    requireSection ();
00113     bool                    childOfSection ();
00114 
00115     IE_Imp_TableHelperStack *   m_TableHelperStack;
00116 
00117     enum listType {L_NONE = 0, L_OL = 1, L_UL = 2 } m_listType;
00118     UT_uint16   m_iListID;
00119     bool        m_bFirstDiv;
00120     bool        m_bUseTidy;
00121     UT_uint16   m_iNewListID;
00122     UT_uint16   m_iNewImage;
00123 
00124     UT_Stack    m_utsParents;
00125     gchar *  m_szBookMarkName;
00126 
00127     bool        m_addedPTXSection;
00128 
00129     UT_uint16   m_iPreCount;
00130 
00131     UT_Vector   m_divClasses;
00132     UT_GenericVector<UT_UTF8String *>   m_divStyles;
00133     bool        bInTable(void);
00134     bool        m_bFirstBlock;
00135     bool        m_bInMath;
00136     UT_ByteBuf* m_pMathBB;
00137     UT_UTF8String m_Title;
00138 };
00139 
00140 #endif /* IE_IMP_XHTML_H */

Generated on Sun May 27 2012 for AbiWord by  doxygen 1.7.1