• 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; indent-tabs-mode: t -*- */
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., 51 Franklin Street, Fifth Floor, Boston, MA
00019  * 02110-1301 USA.
00020  */
00021 
00022 #ifndef IE_IMP_XHTML_1_H
00023 #define IE_IMP_XHTML_1_H
00024 
00025 #include <stack>
00026 
00027 #include "ie_imp_XML.h"
00028 #include "fg_Graphic.h"
00029 
00030 /* NOTE: I'm trying to keep the code similar across versions,
00031  *       and therefore features are enabled/disabled here:
00032  */
00033 
00034 /* Define if the base unicode char is UCS-4
00035  */
00036 #define XHTML_UCS4
00037 
00038 /* Define if the sniffers need to pass export name to parent
00039  */
00040 #define XHTML_NAMED_CONSTRUCTORS
00041 
00042 /* Define if the tables are supported
00043  */
00044 #define XHTML_TABLES_SUPPORTED 1
00045 
00046 /* Define if meta information is supported
00047  */
00048 #define XHTML_META_SUPPORTED
00049 
00050 /* Define if meta information is supported
00051  */
00052 #define XHTML_RUBY_SUPPORTED
00053 
00054 class PD_Document;
00055 class IE_Imp_TableHelperStack;
00056 
00057 // The importer/reader for XHTML 1.0
00058 
00059 class ABI_EXPORT IE_Imp_XHTML_Sniffer : public IE_ImpSniffer
00060 {
00061     friend class IE_Imp;
00062 
00063 public:
00064     IE_Imp_XHTML_Sniffer();
00065     virtual ~IE_Imp_XHTML_Sniffer() {}
00066 
00067     virtual const IE_SuffixConfidence * getSuffixConfidence ();
00068     virtual const IE_MimeConfidence * getMimeConfidence ();
00069     virtual UT_Confidence_t recognizeContents (const char * szBuf,
00070                                     UT_uint32 iNumbytes);
00071     virtual bool getDlgLabels (const char ** szDesc,
00072                                const char ** szSuffixList,
00073                                IEFileType * ft);
00074     virtual UT_Error constructImporter (PD_Document * pDocument,
00075                                         IE_Imp ** ppie);
00076 
00077 };
00078 
00079 class ABI_EXPORT IE_Imp_XHTML : public IE_Imp_XML
00080 {
00081 public:
00082     IE_Imp_XHTML (PD_Document * pDocument);
00083 
00084     virtual ~IE_Imp_XHTML ();
00085 
00086     void                    startElement (const gchar * name, const gchar ** atts);
00087     void                    endElement (const gchar * name);
00088 
00089     virtual void            charData (const gchar * buffer, int length);
00090 
00091     virtual bool        pasteFromBuffer(PD_DocumentRange * pDocRange,
00092                                         const unsigned char * pData,
00093                                         UT_uint32 lenData,
00094                                         const char * szEncoding = 0);
00095 
00096     virtual bool  appendStrux(PTStruxType pts, const PP_PropertyVector & attributes);
00097     virtual bool  appendFmt(const PP_PropertyVector & vecAttributes);
00098     virtual bool  appendSpan(const UT_UCSChar * p, UT_uint32 length);
00099     virtual bool  appendObject(PTObjectType pto, const PP_PropertyVector & attributes);
00100 
00101 
00102 protected:
00103     virtual UT_Error        _loadFile (GsfInput * input);
00104     virtual FG_ConstGraphicPtr  importImage(const gchar * szSrc);
00105 
00106 private:
00107     FG_ConstGraphicPtr  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     UT_uint16   m_iNewListID;
00120     UT_uint16   m_iNewImage;
00121 
00122     std::stack<UT_uint16>   m_utsParents;
00123     std::string m_szBookMarkName;
00124 
00125     bool        m_addedPTXSection;
00126 
00127     UT_uint16   m_iPreCount;
00128 
00129     UT_Vector   m_divClasses;
00130     UT_GenericVector<UT_UTF8String *>   m_divStyles;
00131     bool        bInTable(void);
00132     bool        m_bFirstBlock;
00133     bool        m_bInMath;
00134     UT_ByteBufPtr m_pMathBB;
00135     std::string m_Title;
00136 };
00137 
00138 #endif /* IE_IMP_XHTML_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1