| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef _FPDF_MODULE_ | 7 #ifndef _FPDF_MODULE_ |
| 8 #define _FPDF_MODULE_ | 8 #define _FPDF_MODULE_ |
| 9 #ifndef _FXCRT_EXTENSION_ | 9 #ifndef _FXCRT_EXTENSION_ |
| 10 #include "../fxcrt/fx_ext.h" | 10 #include "../fxcrt/fx_ext.h" |
| 11 #endif | 11 #endif |
| 12 class CPDF_ModuleMgr; | 12 class CPDF_ModuleMgr; |
| 13 class CPDF_PageModuleDef; | 13 class CPDF_PageModuleDef; |
| 14 class CPDF_RenderModuleDef; | 14 class CPDF_RenderModuleDef; |
| 15 class CPDF_SecurityHandler; | 15 class CPDF_SecurityHandler; |
| 16 class CCodec_ModuleMgr; | 16 class CCodec_ModuleMgr; |
| 17 class CPDF_Dictionary; | 17 class CPDF_Dictionary; |
| 18 class ICodec_JpegModule; | 18 class ICodec_JpegModule; |
| 19 class ICodec_JpxModule; | 19 class ICodec_JpxModule; |
| 20 class ICodec_FaxModule; | 20 class ICodec_FaxModule; |
| 21 class ICodec_Jbig2Module; | 21 class ICodec_Jbig2Module; |
| 22 class ICodec_IccModule; | 22 class ICodec_IccModule; |
| 23 class ICodec_FlateModule; | 23 class ICodec_FlateModule; |
| 24 #define ADDIN_NAME_CJK» » » "Eastern Asian Language Support" | 24 #define ADDIN_NAME_CJK "Eastern Asian Language Support" |
| 25 #define ADDIN_NAME_DECODER» » "JPEG2000 and JBIG2 Image Decoders" | 25 #define ADDIN_NAME_DECODER "JPEG2000 and JBIG2 Image Decoders" |
| 26 class CPDF_ModuleMgr : public CFX_Object | 26 class CPDF_ModuleMgr : public CFX_Object { |
| 27 { | 27 public: |
| 28 public: | 28 static void Create(); |
| 29 | 29 |
| 30 static void»Create(); | 30 static CPDF_ModuleMgr* Get(); |
| 31 | 31 |
| 32 static CPDF_ModuleMgr*» Get(); | 32 static void Destroy(); |
| 33 | 33 |
| 34 static void»Destroy(); | 34 void SetCodecModule(CCodec_ModuleMgr* pModule) { m_pCodecModule = pModule; } |
| 35 CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; } |
| 35 | 36 |
| 37 void InitPageModule(); |
| 36 | 38 |
| 39 void InitRenderModule(); |
| 37 | 40 |
| 38 void» » SetCodecModule(CCodec_ModuleMgr* pModule) | 41 void SetModulePath(FX_LPCSTR module_name, FX_LPCSTR path); |
| 39 { | |
| 40 m_pCodecModule = pModule; | |
| 41 } | |
| 42 CCodec_ModuleMgr*» » GetCodecModule() | |
| 43 { | |
| 44 return m_pCodecModule; | |
| 45 } | |
| 46 | 42 |
| 47 void» » InitPageModule(); | 43 CFX_ByteString GetModuleFilePath(FX_LPCSTR module_name, FX_LPCSTR name); |
| 48 | 44 |
| 49 void» » InitRenderModule(); | 45 void SetDownloadCallback(FX_BOOL (*callback)(FX_LPCSTR module_name)); |
| 50 | 46 |
| 47 FX_BOOL DownloadModule(FX_LPCSTR module_name); |
| 51 | 48 |
| 52 void» » SetModulePath(FX_LPCSTR module_name, FX_LPCSTR path); | 49 void NotifyModuleAvailable(FX_LPCSTR module_name); |
| 53 | 50 |
| 54 CFX_ByteString GetModuleFilePath(FX_LPCSTR module_name, FX_LPCSTR name); | 51 CPDF_RenderModuleDef* GetRenderModule() const { return m_pRenderModule; } |
| 55 | 52 |
| 56 void» » SetDownloadCallback(FX_BOOL (*callback)(FX_LPCSTR module
_name)); | 53 CPDF_PageModuleDef* GetPageModule() const { return m_pPageModule; } |
| 57 | 54 |
| 58 FX_BOOL» » DownloadModule(FX_LPCSTR module_name); | 55 void LoadEmbeddedGB1CMaps(); |
| 59 | 56 |
| 60 void» » NotifyModuleAvailable(FX_LPCSTR module_name); | 57 void LoadEmbeddedCNS1CMaps(); |
| 61 | 58 |
| 59 void LoadEmbeddedJapan1CMaps(); |
| 62 | 60 |
| 61 void LoadEmbeddedKorea1CMaps(); |
| 63 | 62 |
| 64 CPDF_RenderModuleDef*» GetRenderModule() const | 63 ICodec_FaxModule* GetFaxModule(); |
| 65 { | 64 ICodec_JpegModule* GetJpegModule(); |
| 66 return m_pRenderModule; | 65 ICodec_JpxModule* GetJpxModule(); |
| 67 } | 66 ICodec_Jbig2Module* GetJbig2Module(); |
| 67 ICodec_IccModule* GetIccModule(); |
| 68 ICodec_FlateModule* GetFlateModule(); |
| 68 | 69 |
| 69 CPDF_PageModuleDef*»» GetPageModule() const | 70 void RegisterSecurityHandler( |
| 70 { | 71 FX_LPCSTR name, |
| 71 return m_pPageModule; | 72 CPDF_SecurityHandler* (*CreateHandler)(void* param), |
| 72 } | 73 void* param); |
| 73 | 74 |
| 75 CPDF_SecurityHandler* CreateSecurityHandler(FX_LPCSTR name); |
| 74 | 76 |
| 77 void SetPrivateData(FX_LPVOID module_id, |
| 78 FX_LPVOID pData, |
| 79 PD_CALLBACK_FREEDATA callback); |
| 75 | 80 |
| 81 FX_LPVOID GetPrivateData(FX_LPVOID module_id); |
| 76 | 82 |
| 77 void» » » » » LoadEmbeddedGB1CMaps(); | 83 int m_FileBufSize; |
| 78 | 84 |
| 79 void» » » » » LoadEmbeddedCNS1CMaps(); | 85 protected: |
| 86 CPDF_ModuleMgr(); |
| 80 | 87 |
| 81 void» » » » » LoadEmbeddedJapan1CMaps(); | 88 ~CPDF_ModuleMgr(); |
| 89 void Initialize(); |
| 82 | 90 |
| 83 void» » » » » LoadEmbeddedKorea1CMaps(); | 91 void InitModules(); |
| 84 | 92 |
| 85 ICodec_FaxModule*» » GetFaxModule(); | 93 CCodec_ModuleMgr* m_pCodecModule; |
| 86 ICodec_JpegModule*» » GetJpegModule(); | |
| 87 ICodec_JpxModule*» » GetJpxModule(); | |
| 88 ICodec_Jbig2Module*»» GetJbig2Module(); | |
| 89 ICodec_IccModule*» » GetIccModule(); | |
| 90 ICodec_FlateModule*»» GetFlateModule(); | |
| 91 | 94 |
| 92 void» » » » » RegisterSecurityHandler(FX_LPCST
R name, CPDF_SecurityHandler * (*CreateHandler)(void* param), void* param); | 95 CPDF_RenderModuleDef* m_pRenderModule; |
| 93 | 96 |
| 94 CPDF_SecurityHandler*» CreateSecurityHandler(FX_LPCSTR name); | 97 CPDF_PageModuleDef* m_pPageModule; |
| 95 | 98 |
| 96 void» » » » » SetPrivateData(FX_LPVOID module_
id, FX_LPVOID pData, PD_CALLBACK_FREEDATA callback); | 99 FX_BOOL (*m_pDownloadCallback)(FX_LPCSTR module_name); |
| 97 | 100 |
| 98 FX_LPVOID» » » » GetPrivateData(FX_LPVOID module_id); | 101 CFX_ByteString m_DefaultModulePath; |
| 99 | 102 |
| 100 int»» » » » » m_FileBufSize; | 103 CFX_CMapByteStringToPtr m_ModulePathList; |
| 101 protected: | |
| 102 | 104 |
| 103 CPDF_ModuleMgr(); | 105 CFX_MapByteStringToPtr m_SecurityHandlerMap; |
| 104 | 106 |
| 105 ~CPDF_ModuleMgr(); | 107 CFX_PrivateData m_privateData; |
| 106 void» » » » » Initialize(); | |
| 107 | |
| 108 void» » » » » InitModules(); | |
| 109 | |
| 110 | |
| 111 | |
| 112 CCodec_ModuleMgr*» » m_pCodecModule; | |
| 113 | |
| 114 CPDF_RenderModuleDef*» m_pRenderModule; | |
| 115 | |
| 116 CPDF_PageModuleDef*»» m_pPageModule; | |
| 117 | |
| 118 | |
| 119 FX_BOOL (*m_pDownloadCallback)(FX_LPCSTR module_name); | |
| 120 | |
| 121 CFX_ByteString» » » m_DefaultModulePath; | |
| 122 | |
| 123 CFX_CMapByteStringToPtr» m_ModulePathList; | |
| 124 | |
| 125 CFX_MapByteStringToPtr» m_SecurityHandlerMap; | |
| 126 | |
| 127 CFX_PrivateData» » » m_privateData; | |
| 128 }; | 108 }; |
| 129 class CPDF_Document; | 109 class CPDF_Document; |
| 130 class CPDF_DocPageData; | 110 class CPDF_DocPageData; |
| 131 class CPDF_FontGlobals; | 111 class CPDF_FontGlobals; |
| 132 class IPDF_FontMgr; | 112 class IPDF_FontMgr; |
| 133 class IPDF_FontMapper; | 113 class IPDF_FontMapper; |
| 134 class CPDF_ColorSpace; | 114 class CPDF_ColorSpace; |
| 135 class CPDF_PageModuleDef : public CFX_Object | 115 class CPDF_PageModuleDef : public CFX_Object { |
| 136 { | 116 public: |
| 137 public: | 117 virtual ~CPDF_PageModuleDef() {} |
| 138 virtual ~CPDF_PageModuleDef() {} | |
| 139 | 118 |
| 140 virtual CPDF_DocPageData*» CreateDocData(CPDF_Document* pDoc) | 119 virtual CPDF_DocPageData* CreateDocData(CPDF_Document* pDoc) { return NULL; } |
| 141 { | |
| 142 return NULL; | |
| 143 } | |
| 144 | 120 |
| 145 virtual void» » » » ReleaseDoc(CPDF_Document*) {} | 121 virtual void ReleaseDoc(CPDF_Document*) {} |
| 146 virtual void» » » » ClearDoc(CPDF_Document*) {} | 122 virtual void ClearDoc(CPDF_Document*) {} |
| 147 | 123 |
| 148 virtual CPDF_FontGlobals*» GetFontGlobals() | 124 virtual CPDF_FontGlobals* GetFontGlobals() { return NULL; } |
| 149 { | |
| 150 return NULL; | |
| 151 } | |
| 152 | 125 |
| 153 virtual void» » » » ClearStockFont(CPDF_Document* pD
oc) {} | 126 virtual void ClearStockFont(CPDF_Document* pDoc) {} |
| 154 | 127 |
| 155 virtual void» » » » NotifyCJKAvailable() {} | 128 virtual void NotifyCJKAvailable() {} |
| 156 | 129 |
| 157 virtual CPDF_ColorSpace*» GetStockCS(int family) | 130 virtual CPDF_ColorSpace* GetStockCS(int family) { return NULL; } |
| 158 { | |
| 159 return NULL; | |
| 160 } | |
| 161 }; | 131 }; |
| 162 class CPDF_PageObjects; | 132 class CPDF_PageObjects; |
| 163 class CFX_AffineMatrix; | 133 class CFX_AffineMatrix; |
| 164 class CPDF_RenderOptions; | 134 class CPDF_RenderOptions; |
| 165 class CPDF_Page; | 135 class CPDF_Page; |
| 166 class CPDF_DocRenderData; | 136 class CPDF_DocRenderData; |
| 167 class CPDF_PageRenderCache; | 137 class CPDF_PageRenderCache; |
| 168 class CFX_BitmapDevice; | 138 class CFX_BitmapDevice; |
| 169 class CPDF_Stream; | 139 class CPDF_Stream; |
| 170 class CFX_DIBSource; | 140 class CFX_DIBSource; |
| 171 class CPDF_RenderConfig; | 141 class CPDF_RenderConfig; |
| 172 class CPDF_Image; | 142 class CPDF_Image; |
| 173 class CPDF_RenderModuleDef : public CFX_Object | 143 class CPDF_RenderModuleDef : public CFX_Object { |
| 174 { | 144 public: |
| 175 public: | 145 virtual ~CPDF_RenderModuleDef() {} |
| 176 virtual ~CPDF_RenderModuleDef() {} | |
| 177 | 146 |
| 178 virtual CPDF_DocRenderData*»CreateDocData(CPDF_Document* pDoc) | 147 virtual CPDF_DocRenderData* CreateDocData(CPDF_Document* pDoc) { |
| 179 { | 148 return NULL; |
| 180 return NULL; | 149 } |
| 181 } | |
| 182 | 150 |
| 183 virtual void» DestroyDocData(CPDF_DocRenderData*) {} | 151 virtual void DestroyDocData(CPDF_DocRenderData*) {} |
| 184 virtual void» ClearDocData(CPDF_DocRenderData*) {} | 152 virtual void ClearDocData(CPDF_DocRenderData*) {} |
| 185 | 153 |
| 186 virtual CPDF_DocRenderData* GetRenderData() | 154 virtual CPDF_DocRenderData* GetRenderData() { return NULL; } |
| 187 { | |
| 188 return NULL; | |
| 189 } | |
| 190 | 155 |
| 191 virtual CPDF_PageRenderCache*» CreatePageCache(CPDF_Page* pPage) | 156 virtual CPDF_PageRenderCache* CreatePageCache(CPDF_Page* pPage) { |
| 192 { | 157 return NULL; |
| 193 return NULL; | 158 } |
| 194 } | |
| 195 | 159 |
| 196 virtual void» DestroyPageCache(CPDF_PageRenderCache*) {} | 160 virtual void DestroyPageCache(CPDF_PageRenderCache*) {} |
| 197 | 161 |
| 198 virtual void» NotifyDecoderAvailable() {} | 162 virtual void NotifyDecoderAvailable() {} |
| 199 | 163 |
| 200 virtual CPDF_RenderConfig* GetConfig() | 164 virtual CPDF_RenderConfig* GetConfig() { return NULL; } |
| 201 { | |
| 202 return NULL; | |
| 203 } | |
| 204 }; | 165 }; |
| 205 #endif | 166 #endif |
| OLD | NEW |