Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00031
00032
00033
00034
00035
00036 #define XHTML_UCS4
00037
00038
00039
00040 #define XHTML_NAMED_CONSTRUCTORS
00041
00042
00043
00044 #define XHTML_TABLES_SUPPORTED 1
00045
00046
00047
00048 #define XHTML_META_SUPPORTED
00049
00050
00051
00052 #define XHTML_RUBY_SUPPORTED
00053
00054 class PD_Document;
00055 class IE_Imp_TableHelperStack;
00056
00057
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