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 XFA_FXFA_INCLUDE_XFA_FFDOC_H_ | 7 #ifndef XFA_FXFA_INCLUDE_XFA_FFDOC_H_ |
8 #define XFA_FXFA_INCLUDE_XFA_FFDOC_H_ | 8 #define XFA_FXFA_INCLUDE_XFA_FFDOC_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "xfa/fxfa/include/fxfa.h" | 13 #include "xfa/fxfa/include/fxfa.h" |
14 #include "xfa/fxfa/parser/cxfa_document.h" | 14 #include "xfa/fxfa/parser/cxfa_document.h" |
15 #include "xfa/fxfa/parser/cxfa_document_parser.h" | 15 #include "xfa/fxfa/parser/cxfa_document_parser.h" |
16 | 16 |
17 class CXFA_ChecksumContext; | 17 class CXFA_ChecksumContext; |
18 class CXFA_FFApp; | 18 class CXFA_FFApp; |
19 class CXFA_FFNotify; | 19 class CXFA_FFNotify; |
20 class CXFA_FFDocView; | 20 class CXFA_FFDocView; |
21 | 21 |
22 struct FX_IMAGEDIB_AND_DPI { | 22 struct FX_IMAGEDIB_AND_DPI { |
23 CFX_DIBSource* pDibSource; | 23 CFX_DIBSource* pDibSource; |
24 int32_t iImageXDpi; | 24 int32_t iImageXDpi; |
25 int32_t iImageYDpi; | 25 int32_t iImageYDpi; |
26 }; | 26 }; |
27 | 27 |
28 class CXFA_FFDoc { | 28 class CXFA_FFDoc { |
29 public: | 29 public: |
30 CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider); | 30 CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocEnvironment* pDocEnvironment); |
31 ~CXFA_FFDoc(); | 31 ~CXFA_FFDoc(); |
32 IXFA_DocProvider* GetDocProvider() { return m_pDocProvider; } | 32 IXFA_DocEnvironment* GetDocEnvironment() const { return m_pDocEnvironment; } |
33 uint32_t GetDocType(); | 33 uint32_t GetDocType(); |
34 int32_t StartLoad(); | 34 int32_t StartLoad(); |
35 int32_t DoLoad(IFX_Pause* pPause = nullptr); | 35 int32_t DoLoad(IFX_Pause* pPause = nullptr); |
36 void StopLoad(); | 36 void StopLoad(); |
37 CXFA_FFDocView* CreateDocView(uint32_t dwView = 0); | 37 CXFA_FFDocView* CreateDocView(uint32_t dwView = 0); |
38 FX_BOOL OpenDoc(IFX_FileRead* pStream, FX_BOOL bTakeOverFile); | 38 FX_BOOL OpenDoc(IFX_FileRead* pStream, FX_BOOL bTakeOverFile); |
39 FX_BOOL OpenDoc(CPDF_Document* pPDFDoc); | 39 FX_BOOL OpenDoc(CPDF_Document* pPDFDoc); |
40 FX_BOOL CloseDoc(); | 40 FX_BOOL CloseDoc(); |
41 void SetDocType(uint32_t dwType); | 41 void SetDocType(uint32_t dwType); |
42 CXFA_Document* GetXFADoc() { return m_pDocumentParser->GetDocument(); } | 42 CXFA_Document* GetXFADoc() { return m_pDocumentParser->GetDocument(); } |
43 CXFA_FFApp* GetApp() { return m_pApp; } | 43 CXFA_FFApp* GetApp() { return m_pApp; } |
44 CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout); | 44 CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout); |
45 CXFA_FFDocView* GetDocView(); | 45 CXFA_FFDocView* GetDocView(); |
46 CPDF_Document* GetPDFDoc(); | 46 CPDF_Document* GetPDFDoc(); |
47 CFX_DIBitmap* GetPDFNamedImage(const CFX_WideStringC& wsName, | 47 CFX_DIBitmap* GetPDFNamedImage(const CFX_WideStringC& wsName, |
48 int32_t& iImageXDpi, | 48 int32_t& iImageXDpi, |
49 int32_t& iImageYDpi); | 49 int32_t& iImageYDpi); |
50 | 50 |
51 bool SavePackage(XFA_HashCode code, | 51 bool SavePackage(XFA_HashCode code, |
52 IFX_FileWrite* pFile, | 52 IFX_FileWrite* pFile, |
53 CXFA_ChecksumContext* pCSContext); | 53 CXFA_ChecksumContext* pCSContext); |
54 FX_BOOL ImportData(IFX_FileRead* pStream, FX_BOOL bXDP = TRUE); | 54 FX_BOOL ImportData(IFX_FileRead* pStream, FX_BOOL bXDP = TRUE); |
55 | 55 |
56 protected: | 56 protected: |
57 IXFA_DocProvider* m_pDocProvider; | 57 IXFA_DocEnvironment* const m_pDocEnvironment; |
58 std::unique_ptr<CXFA_DocumentParser> m_pDocumentParser; | 58 std::unique_ptr<CXFA_DocumentParser> m_pDocumentParser; |
59 IFX_FileRead* m_pStream; | 59 IFX_FileRead* m_pStream; |
60 CXFA_FFApp* m_pApp; | 60 CXFA_FFApp* m_pApp; |
61 std::unique_ptr<CXFA_FFNotify> m_pNotify; | 61 std::unique_ptr<CXFA_FFNotify> m_pNotify; |
62 CPDF_Document* m_pPDFDoc; | 62 CPDF_Document* m_pPDFDoc; |
63 std::map<uint32_t, FX_IMAGEDIB_AND_DPI> m_HashToDibDpiMap; | 63 std::map<uint32_t, FX_IMAGEDIB_AND_DPI> m_HashToDibDpiMap; |
64 std::map<uint32_t, std::unique_ptr<CXFA_FFDocView>> m_TypeToDocViewMap; | 64 std::map<uint32_t, std::unique_ptr<CXFA_FFDocView>> m_TypeToDocViewMap; |
65 uint32_t m_dwDocType; | 65 uint32_t m_dwDocType; |
66 FX_BOOL m_bOwnStream; | 66 FX_BOOL m_bOwnStream; |
67 }; | 67 }; |
68 | 68 |
69 #endif // XFA_FXFA_INCLUDE_XFA_FFDOC_H_ | 69 #endif // XFA_FXFA_INCLUDE_XFA_FFDOC_H_ |
OLD | NEW |