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 "ie_imp_XML.h"
00026 #include "ut_stack.h"
00027
00028
00029
00030
00031
00032
00033
00034 #define XHTML_UCS4
00035
00036
00037
00038 #define XHTML_NAMED_CONSTRUCTORS
00039
00040
00041
00042 #define XHTML_TABLES_SUPPORTED 1
00043
00044
00045
00046 #define XHTML_META_SUPPORTED
00047
00048
00049
00050 #define XHTML_RUBY_SUPPORTED
00051
00052 class PD_Document;
00053 class FG_Graphic;
00054 class IE_Imp_TableHelperStack;
00055
00056
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