OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_ | |
8 #define CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_ | |
9 | |
10 #include <memory> | |
11 | |
12 #include "core/include/fxcrt/fx_coordinates.h" | |
13 #include "core/include/fxcrt/fx_system.h" | |
14 | |
15 class CCodec_ModuleMgr; | |
16 class CPDF_ColorSpace; | |
17 class CPDF_DocPageData; | |
18 class CPDF_DocRenderData; | |
19 class CPDF_Document; | |
20 class CPDF_FontGlobals; | |
21 class CPDF_Page; | |
22 class CPDF_PageRenderCache; | |
23 class ICodec_FaxModule; | |
24 class ICodec_FlateModule; | |
25 class ICodec_IccModule; | |
26 class ICodec_Jbig2Module; | |
27 class ICodec_JpegModule; | |
28 class ICodec_JpxModule; | |
29 class IPDF_PageModule; | |
30 class IPDF_RenderModule; | |
31 | |
32 class CPDF_ModuleMgr { | |
33 public: | |
34 static CPDF_ModuleMgr* Get(); | |
35 static void Create(); | |
36 static void Destroy(); | |
37 static const int kFileBufSize = 512; | |
38 | |
39 void SetCodecModule(CCodec_ModuleMgr* pModule) { m_pCodecModule = pModule; } | |
40 CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; } | |
41 | |
42 void InitPageModule(); | |
43 void InitRenderModule(); | |
44 | |
45 IPDF_RenderModule* GetRenderModule() const { return m_pRenderModule.get(); } | |
46 IPDF_PageModule* GetPageModule() const { return m_pPageModule.get(); } | |
47 | |
48 void LoadEmbeddedGB1CMaps(); | |
49 void LoadEmbeddedCNS1CMaps(); | |
50 void LoadEmbeddedJapan1CMaps(); | |
51 void LoadEmbeddedKorea1CMaps(); | |
52 | |
53 ICodec_FaxModule* GetFaxModule(); | |
54 ICodec_JpegModule* GetJpegModule(); | |
55 ICodec_JpxModule* GetJpxModule(); | |
56 ICodec_Jbig2Module* GetJbig2Module(); | |
57 ICodec_IccModule* GetIccModule(); | |
58 ICodec_FlateModule* GetFlateModule(); | |
59 | |
60 void SetPrivateData(void* module_id, | |
61 void* pData, | |
62 PD_CALLBACK_FREEDATA callback); | |
63 | |
64 void* GetPrivateData(void* module_id); | |
65 | |
66 private: | |
67 CPDF_ModuleMgr(); | |
68 ~CPDF_ModuleMgr(); | |
69 | |
70 CCodec_ModuleMgr* m_pCodecModule; | |
71 std::unique_ptr<IPDF_RenderModule> m_pRenderModule; | |
72 std::unique_ptr<IPDF_PageModule> m_pPageModule; | |
73 CFX_PrivateData m_privateData; | |
74 }; | |
75 | |
76 class IPDF_PageModule { | |
77 public: | |
78 virtual ~IPDF_PageModule() {} | |
79 | |
80 virtual CPDF_DocPageData* CreateDocData(CPDF_Document* pDoc) = 0; | |
81 virtual void ReleaseDoc(CPDF_Document* pDoc) = 0; | |
82 virtual void ClearDoc(CPDF_Document* pDoc) = 0; | |
83 virtual CPDF_FontGlobals* GetFontGlobals() = 0; | |
84 virtual void ClearStockFont(CPDF_Document* pDoc) = 0; | |
85 virtual void NotifyCJKAvailable() = 0; | |
86 virtual CPDF_ColorSpace* GetStockCS(int family) = 0; | |
87 }; | |
88 | |
89 class IPDF_RenderModule { | |
90 public: | |
91 virtual ~IPDF_RenderModule() {} | |
92 | |
93 virtual CPDF_DocRenderData* CreateDocData(CPDF_Document* pDoc) = 0; | |
94 virtual void DestroyDocData(CPDF_DocRenderData* pDocRenderData) = 0; | |
95 virtual void ClearDocData(CPDF_DocRenderData* pDocRenderData) = 0; | |
96 virtual CPDF_DocRenderData* GetRenderData() = 0; | |
97 virtual CPDF_PageRenderCache* CreatePageCache(CPDF_Page* pPage) = 0; | |
98 virtual void DestroyPageCache(CPDF_PageRenderCache* pCache) = 0; | |
99 }; | |
100 | |
101 #endif // CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_ | |
OLD | NEW |