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
00023
00024 #ifndef IE_IMP_GOComponent_H
00025 #define IE_IMP_GOComponent_H
00026
00027 #include <stdio.h>
00028 #include "ie_imp.h"
00029 #include "ut_mbtowc.h"
00030 #include "pd_Document.h"
00031 #include <glib.h>
00032 class UT_ByteBuf;
00033 class ImportStream;
00034
00035 extern GSList *mime_types;
00036
00037
00038
00039 class IE_Imp_Component_Sniffer : public IE_ImpSniffer
00040 {
00041 friend class IE_Imp;
00042 friend class IE_Imp_Component;
00043
00044 public:
00045 IE_Imp_Component_Sniffer();
00046 virtual ~IE_Imp_Component_Sniffer();
00047
00048 virtual const IE_SuffixConfidence * getSuffixConfidence ();
00049 virtual const IE_MimeConfidence * getMimeConfidence ();
00050 virtual UT_Confidence_t recognizeContents (const char * szBuf,
00051 UT_uint32 iNumbytes);
00052 const char * recognizeContentsType (const char * szBuf,
00053 UT_uint32 iNumbytes);
00054 virtual bool getDlgLabels (const char ** szDesc,
00055 const char ** szSuffixList,
00056 IEFileType * ft);
00057 virtual UT_Error constructImporter (PD_Document * pDocument,
00058 IE_Imp ** ppie);
00059
00060 protected:
00061 enum UCS2_Endian { UE_BigEnd = -1, UE_NotUCS = 0, UE_LittleEnd };
00062
00063 static bool _recognizeUTF8 (const char * szBuf,
00064 UT_uint32 iNumbytes);
00065 static UCS2_Endian _recognizeUCS2 (const char * szBuf,
00066 UT_uint32 iNumbytes,
00067 bool bDeep);
00068 };
00069
00070
00071
00072 class IE_Imp_Component : public IE_Imp
00073 {
00074 public:
00075 IE_Imp_Component(PD_Document * pDocument, char *mime_type = NULL);
00076 virtual ~IE_Imp_Component();
00077
00078 virtual bool pasteFromBuffer(PD_DocumentRange * pDocRange,
00079 const unsigned char * pData, UT_uint32 lenData, const char * szEncoding = 0);
00080 const UT_ByteBufPtr & getByteBuf(void) const {return m_pByteBuf;}
00081
00082 protected:
00083 virtual UT_Error _loadFile(GsfInput * input);
00084 UT_Error _parseStream(ImportStream * pStream);
00085
00086 private:
00087 UT_ByteBufPtr m_pByteBuf;
00088 std::string m_MimeType;
00089 };
00090
00091 #endif