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 CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_ |
8 #define CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_ |
9 | 9 |
10 #include "../../../third_party/base/nonstd_unique_ptr.h" | 10 #include "../../../third_party/base/nonstd_unique_ptr.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 class ICodec_FaxModule; | 32 class ICodec_FaxModule; |
33 class ICodec_FlateModule; | 33 class ICodec_FlateModule; |
34 class ICodec_IccModule; | 34 class ICodec_IccModule; |
35 class ICodec_Jbig2Module; | 35 class ICodec_Jbig2Module; |
36 class ICodec_JpegModule; | 36 class ICodec_JpegModule; |
37 class ICodec_JpxModule; | 37 class ICodec_JpxModule; |
38 class IPDF_FontMapper; | 38 class IPDF_FontMapper; |
39 class IPDF_PageModule; | 39 class IPDF_PageModule; |
40 class IPDF_RenderModule; | 40 class IPDF_RenderModule; |
41 | 41 |
42 class CPDF_ModuleMgr | 42 class CPDF_ModuleMgr { |
43 { | 43 public: |
44 public: | 44 static CPDF_ModuleMgr* Get(); |
45 static CPDF_ModuleMgr* Get(); | 45 static void Create(); |
46 static void Create(); | 46 static void Destroy(); |
47 static void Destroy(); | 47 static const int kFileBufSize = 512; |
48 static const int kFileBufSize = 512; | |
49 | 48 |
50 void SetCodecModule(CCodec_ModuleMgr* pModule) | 49 void SetCodecModule(CCodec_ModuleMgr* pModule) { m_pCodecModule = pModule; } |
51 { | 50 CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; } |
52 m_pCodecModule = pModule; | |
53 } | |
54 CCodec_ModuleMgr* GetCodecModule() | |
55 { | |
56 return m_pCodecModule; | |
57 } | |
58 | 51 |
59 void InitPageModule(); | 52 void InitPageModule(); |
60 | 53 |
61 void InitRenderModule(); | 54 void InitRenderModule(); |
62 | 55 |
63 void SetDownloadCallback(FX_BOOL (*callback)(const FX_CHAR* module_name)); | 56 void SetDownloadCallback(FX_BOOL (*callback)(const FX_CHAR* module_name)); |
64 | 57 |
65 FX_BOOL DownloadModule(const FX_CHAR* module_name); | 58 FX_BOOL DownloadModule(const FX_CHAR* module_name); |
66 | 59 |
67 void NotifyModuleAvailable(const FX_CHAR* module_name); | 60 void NotifyModuleAvailable(const FX_CHAR* module_name); |
68 | 61 |
69 IPDF_RenderModule* GetRenderModule() const | 62 IPDF_RenderModule* GetRenderModule() const { return m_pRenderModule.get(); } |
70 { | |
71 return m_pRenderModule.get(); | |
72 } | |
73 | 63 |
74 IPDF_PageModule* GetPageModule() const | 64 IPDF_PageModule* GetPageModule() const { return m_pPageModule.get(); } |
75 { | |
76 return m_pPageModule.get(); | |
77 } | |
78 | 65 |
79 void LoadEmbeddedGB1CMaps(); | 66 void LoadEmbeddedGB1CMaps(); |
80 void LoadEmbeddedCNS1CMaps(); | 67 void LoadEmbeddedCNS1CMaps(); |
81 void LoadEmbeddedJapan1CMaps(); | 68 void LoadEmbeddedJapan1CMaps(); |
82 void LoadEmbeddedKorea1CMaps(); | 69 void LoadEmbeddedKorea1CMaps(); |
83 | 70 |
84 ICodec_FaxModule* GetFaxModule(); | 71 ICodec_FaxModule* GetFaxModule(); |
85 ICodec_JpegModule* GetJpegModule(); | 72 ICodec_JpegModule* GetJpegModule(); |
86 ICodec_JpxModule* GetJpxModule(); | 73 ICodec_JpxModule* GetJpxModule(); |
87 ICodec_Jbig2Module* GetJbig2Module(); | 74 ICodec_Jbig2Module* GetJbig2Module(); |
88 ICodec_IccModule* GetIccModule(); | 75 ICodec_IccModule* GetIccModule(); |
89 ICodec_FlateModule* GetFlateModule(); | 76 ICodec_FlateModule* GetFlateModule(); |
90 | 77 |
91 void RegisterSecurityHandler( | 78 void RegisterSecurityHandler( |
92 const FX_CHAR* name, | 79 const FX_CHAR* name, |
93 CPDF_SecurityHandler* (*CreateHandler)(void* param), | 80 CPDF_SecurityHandler* (*CreateHandler)(void* param), |
94 void* param); | 81 void* param); |
95 | 82 |
96 CPDF_SecurityHandler* CreateSecurityHandler(const FX_CHAR* name); | 83 CPDF_SecurityHandler* CreateSecurityHandler(const FX_CHAR* name); |
97 | 84 |
98 void SetPrivateData(void* module_id, | 85 void SetPrivateData(void* module_id, |
99 void* pData, | 86 void* pData, |
100 PD_CALLBACK_FREEDATA callback); | 87 PD_CALLBACK_FREEDATA callback); |
101 | 88 |
102 void* GetPrivateData(void* module_id); | 89 void* GetPrivateData(void* module_id); |
103 | 90 |
104 private: | 91 private: |
105 CPDF_ModuleMgr(); | 92 CPDF_ModuleMgr(); |
106 ~CPDF_ModuleMgr(); | 93 ~CPDF_ModuleMgr(); |
107 | 94 |
108 CCodec_ModuleMgr* m_pCodecModule; | 95 CCodec_ModuleMgr* m_pCodecModule; |
109 | 96 |
110 nonstd::unique_ptr<IPDF_RenderModule> m_pRenderModule; | 97 nonstd::unique_ptr<IPDF_RenderModule> m_pRenderModule; |
111 nonstd::unique_ptr<IPDF_PageModule> m_pPageModule; | 98 nonstd::unique_ptr<IPDF_PageModule> m_pPageModule; |
112 | 99 |
113 FX_BOOL (*m_pDownloadCallback)(const FX_CHAR* module_name); | 100 FX_BOOL (*m_pDownloadCallback)(const FX_CHAR* module_name); |
114 | 101 |
115 CFX_MapByteStringToPtr m_SecurityHandlerMap; | 102 CFX_MapByteStringToPtr m_SecurityHandlerMap; |
116 | 103 |
117 CFX_PrivateData m_privateData; | 104 CFX_PrivateData m_privateData; |
118 }; | 105 }; |
119 | 106 |
120 class IPDF_PageModule | 107 class IPDF_PageModule { |
121 { | 108 public: |
122 public: | 109 virtual ~IPDF_PageModule() {} |
123 virtual ~IPDF_PageModule() {} | |
124 | 110 |
125 virtual CPDF_DocPageData* CreateDocData(CPDF_Document* pDoc) = 0; | 111 virtual CPDF_DocPageData* CreateDocData(CPDF_Document* pDoc) = 0; |
126 virtual void ReleaseDoc(CPDF_Document*) = 0; | 112 virtual void ReleaseDoc(CPDF_Document*) = 0; |
127 virtual void ClearDoc(CPDF_Document*) = 0; | 113 virtual void ClearDoc(CPDF_Document*) = 0; |
128 virtual CPDF_FontGlobals* GetFontGlobals() = 0; | 114 virtual CPDF_FontGlobals* GetFontGlobals() = 0; |
129 virtual void ClearStockFont(CPDF_Document* pDoc) = 0; | 115 virtual void ClearStockFont(CPDF_Document* pDoc) = 0; |
130 virtual void NotifyCJKAvailable() = 0; | 116 virtual void NotifyCJKAvailable() = 0; |
131 virtual CPDF_ColorSpace* GetStockCS(int family) = 0; | 117 virtual CPDF_ColorSpace* GetStockCS(int family) = 0; |
132 }; | 118 }; |
133 | 119 |
134 class IPDF_RenderModule | 120 class IPDF_RenderModule { |
135 { | 121 public: |
136 public: | 122 virtual ~IPDF_RenderModule() {} |
137 virtual ~IPDF_RenderModule() {} | |
138 | 123 |
139 virtual CPDF_DocRenderData* CreateDocData(CPDF_Document* pDoc) = 0; | 124 virtual CPDF_DocRenderData* CreateDocData(CPDF_Document* pDoc) = 0; |
140 virtual void DestroyDocData(CPDF_DocRenderData*) = 0; | 125 virtual void DestroyDocData(CPDF_DocRenderData*) = 0; |
141 virtual void ClearDocData(CPDF_DocRenderData*) = 0; | 126 virtual void ClearDocData(CPDF_DocRenderData*) = 0; |
142 virtual CPDF_DocRenderData* GetRenderData() = 0; | 127 virtual CPDF_DocRenderData* GetRenderData() = 0; |
143 virtual CPDF_PageRenderCache* CreatePageCache(CPDF_Page* pPage) = 0; | 128 virtual CPDF_PageRenderCache* CreatePageCache(CPDF_Page* pPage) = 0; |
144 virtual void DestroyPageCache(CPDF_PageRenderCache*) = 0; | 129 virtual void DestroyPageCache(CPDF_PageRenderCache*) = 0; |
145 virtual CPDF_RenderConfig* GetConfig() = 0; | 130 virtual CPDF_RenderConfig* GetConfig() = 0; |
146 }; | 131 }; |
147 | 132 |
148 #endif // CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_ | 133 #endif // CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_ |
OLD | NEW |