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 FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_ | 7 #ifndef FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_ |
8 #define FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_ | 8 #define FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h" | 12 #include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h" |
13 #include "xfa/fxfa/xfa_ffdoc.h" | 13 #include "xfa/fxfa/xfa_ffdoc.h" |
14 | 14 |
15 class CPDFSDK_Document; | |
16 class CPDFSDK_FormFillEnvironment; | 15 class CPDFSDK_FormFillEnvironment; |
17 class CPDFXFA_App; | 16 class CPDFXFA_App; |
18 class CPDFXFA_Page; | 17 class CPDFXFA_Page; |
19 class CXFA_FFDocHandler; | 18 class CXFA_FFDocHandler; |
20 class IJS_Runtime; | 19 class IJS_Runtime; |
21 class IJS_Context; | 20 class IJS_Context; |
22 | 21 |
23 enum LoadStatus { | 22 enum LoadStatus { |
24 FXFA_LOADSTATUS_PRELOAD = 0, | 23 FXFA_LOADSTATUS_PRELOAD = 0, |
25 FXFA_LOADSTATUS_LOADING, | 24 FXFA_LOADSTATUS_LOADING, |
26 FXFA_LOADSTATUS_LOADED, | 25 FXFA_LOADSTATUS_LOADED, |
27 FXFA_LOADSTATUS_CLOSING, | 26 FXFA_LOADSTATUS_CLOSING, |
28 FXFA_LOADSTATUS_CLOSED | 27 FXFA_LOADSTATUS_CLOSED |
29 }; | 28 }; |
30 | 29 |
31 class CPDFXFA_Document { | 30 class CPDFXFA_Document { |
32 public: | 31 public: |
33 CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc, | 32 CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc, |
34 CPDFXFA_App* pProvider); | 33 CPDFXFA_App* pProvider); |
35 ~CPDFXFA_Document(); | 34 ~CPDFXFA_Document(); |
36 | 35 |
37 FX_BOOL LoadXFADoc(); | 36 FX_BOOL LoadXFADoc(); |
38 CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); } | 37 CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); } |
39 CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); } | 38 CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); } |
40 CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } | 39 CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } |
41 int GetDocType() const { return m_iDocType; } | 40 int GetDocType() const { return m_iDocType; } |
42 | 41 |
43 CPDFSDK_Document* GetSDKDoc() const { return m_pSDKDoc; } | 42 CPDFSDK_FormFillEnvironment* GetFormFillEnv() const { return m_pFormFillEnv; } |
44 void SetSDKDoc(CPDFSDK_Document* pSDKDoc) { m_pSDKDoc = pSDKDoc; } | 43 void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
| 44 m_pFormFillEnv = pFormFillEnv; |
| 45 } |
45 | 46 |
46 void DeletePage(int page_index); | 47 void DeletePage(int page_index); |
47 int GetPageCount() const; | 48 int GetPageCount() const; |
48 | 49 |
49 CPDFXFA_Page* GetXFAPage(int page_index); | 50 CPDFXFA_Page* GetXFAPage(int page_index); |
50 CPDFXFA_Page* GetXFAPage(CXFA_FFPageView* pPage) const; | 51 CPDFXFA_Page* GetXFAPage(CXFA_FFPageView* pPage) const; |
51 | 52 |
52 void RemovePage(CPDFXFA_Page* page); | 53 void RemovePage(CPDFXFA_Page* page); |
53 | 54 |
54 void ClearChangeMark(); | 55 void ClearChangeMark(); |
(...skipping 17 matching lines...) Expand all Loading... |
72 m_pXFADoc->CloseDoc(); | 73 m_pXFADoc->CloseDoc(); |
73 m_pXFADoc.reset(); | 74 m_pXFADoc.reset(); |
74 m_pXFADocView = nullptr; | 75 m_pXFADocView = nullptr; |
75 } | 76 } |
76 } | 77 } |
77 | 78 |
78 int m_iDocType; | 79 int m_iDocType; |
79 | 80 |
80 std::unique_ptr<CPDF_Document> m_pPDFDoc; | 81 std::unique_ptr<CPDF_Document> m_pPDFDoc; |
81 std::unique_ptr<CXFA_FFDoc> m_pXFADoc; | 82 std::unique_ptr<CXFA_FFDoc> m_pXFADoc; |
82 CPDFSDK_Document* m_pSDKDoc; // not owned. | 83 CPDFSDK_FormFillEnvironment* m_pFormFillEnv; // not owned. |
83 CXFA_FFDocView* m_pXFADocView; // not owned. | 84 CXFA_FFDocView* m_pXFADocView; // not owned. |
84 CPDFXFA_App* const m_pApp; | 85 CPDFXFA_App* const m_pApp; |
85 CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList; | 86 CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList; |
86 LoadStatus m_nLoadStatus; | 87 LoadStatus m_nLoadStatus; |
87 int m_nPageCount; | 88 int m_nPageCount; |
88 | 89 |
89 // Must be destroy before |m_pSDKDoc|. | 90 // Must be destroyed before |m_pFormFillEnv|. |
90 CPDFXFA_DocEnvironment m_DocEnv; | 91 CPDFXFA_DocEnvironment m_DocEnv; |
91 }; | 92 }; |
92 | 93 |
93 #endif // FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_ | 94 #endif // FPDFSDK_FPDFXFA_CPDFXFA_DOCUMENT_H_ |
OLD | NEW |