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 #ifndef IE_IMPGRAPHIC_H
00024 #define IE_IMPGRAPHIC_H
00025
00026 #include "ut_types.h"
00027 #include "ie_types.h"
00028 #include "ie_imp.h"
00029 #include <string>
00030 #include <vector>
00031
00032 class FG_Graphic;
00033 class UT_ByteBuf;
00034 class IE_ImpGraphic;
00035
00039 class ABI_EXPORT IE_ImpGraphicSniffer
00040 {
00041 friend class IE_ImpGraphic;
00042
00043 public:
00044 virtual ~IE_ImpGraphicSniffer() {}
00045
00046
00047 inline bool supportsType (IEGraphicFileType type) {return m_type == type;}
00048 inline IEGraphicFileType getType() const {return m_type;}
00049
00050
00051 virtual const IE_SuffixConfidence * getSuffixConfidence () = 0;
00052 virtual const IE_MimeConfidence * getMimeConfidence () = 0;
00053 virtual UT_Confidence_t recognizeContents (const char * szBuf,
00054 UT_uint32 iNumbytes);
00055 virtual UT_Confidence_t recognizeContents (GsfInput * input);
00056 virtual bool getDlgLabels (const char ** szDesc,
00057 const char ** szSuffixList,
00058 IEGraphicFileType * ft) = 0;
00059 virtual UT_Error constructImporter (IE_ImpGraphic ** ppieg) = 0;
00060
00061 protected:
00062 IE_ImpGraphicSniffer()
00063 :m_type(IEGFT_Unknown) {}
00064
00065 private:
00066
00067 IEGraphicFileType m_type;
00068 inline void setType (IEGraphicFileType type) {m_type = type;}
00069 };
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 class ABI_EXPORT IE_ImpGraphic
00084 {
00085 public:
00086
00087
00088
00089
00090
00091
00092 static IEGraphicFileType fileTypeForSuffix(const char * szSuffix);
00093 static IEGraphicFileType fileTypeForMimetype(const char * szMimetype);
00094 static IEGraphicFileType fileTypeForContents(const char * szBuf, UT_uint32 iNumbytes);
00095
00096 static bool enumerateDlgLabels(UT_uint32 ndx,
00097 const char ** pszDesc,
00098 const char ** pszSuffixList,
00099 IEGraphicFileType * ft);
00100 static UT_uint32 getImporterCount(void);
00101 static void registerImporter (IE_ImpGraphicSniffer * sniffer);
00102 static void unregisterImporter (IE_ImpGraphicSniffer * sniffer);
00103 static void unregisterAllImporters ();
00104 static std::vector<std::string> & getSupportedMimeTypes ();
00105 static std::vector<std::string> & getSupportedMimeClasses ();
00106 static std::vector<std::string> & getSupportedSuffixes ();
00107 static const char * getMimeTypeForSuffix (const char * suffix);
00108
00109 static UT_Error constructImporterWithDescription(const char * szDesc, IE_ImpGraphic ** ppieg);
00110
00111 static UT_Error constructImporter(const UT_ByteBuf & bytes,
00112 IEGraphicFileType ft,
00113 IE_ImpGraphic **ppieg);
00114 static UT_Error constructImporter(const char * szFilename,
00115 IEGraphicFileType ft,
00116 IE_ImpGraphic **ppieg);
00117 static UT_Error constructImporter(GsfInput * input,
00118 IEGraphicFileType ft,
00119 IE_ImpGraphic **ppieg);
00120
00121 virtual ~IE_ImpGraphic() {}
00122
00123 static UT_Error loadGraphic(const char * szFilename,
00124 IEGraphicFileType iegft,
00125 FG_Graphic ** ppfg);
00126 static UT_Error loadGraphic(GsfInput * input,
00127 IEGraphicFileType iegft,
00128 FG_Graphic ** ppfg);
00129 static UT_Error loadGraphic(const UT_ByteBuf &pBB,
00130 IEGraphicFileType iegft,
00131 FG_Graphic ** ppfg);
00132
00133
00134
00135
00136
00137 virtual UT_Error importGraphic(UT_ByteBuf* pBB,
00138 FG_Graphic ** ppfg);
00139 virtual UT_Error importGraphic(GsfInput * input,
00140 FG_Graphic ** ppfg);
00141
00142 UT_Error importGraphic(const char * szFilename,
00143 FG_Graphic ** ppfg);
00144
00145
00146
00147 private:
00148
00149 };
00150
00151 #endif