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