OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_CPDFSDK_DOCUMENT_H_ | 7 #ifndef FPDFSDK_CPDFSDK_DOCUMENT_H_ |
8 #define FPDFSDK_CPDFSDK_DOCUMENT_H_ | 8 #define FPDFSDK_CPDFSDK_DOCUMENT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 11 matching lines...) Expand all Loading... |
22 class IJS_Runtime; | 22 class IJS_Runtime; |
23 | 23 |
24 class CPDFSDK_Document : public CFX_Observable<CPDFSDK_Document> { | 24 class CPDFSDK_Document : public CFX_Observable<CPDFSDK_Document> { |
25 public: | 25 public: |
26 static CPDFSDK_Document* FromFPDFFormHandle(FPDF_FORMHANDLE hHandle); | 26 static CPDFSDK_Document* FromFPDFFormHandle(FPDF_FORMHANDLE hHandle); |
27 | 27 |
28 CPDFSDK_Document(UnderlyingDocumentType* pDoc, | 28 CPDFSDK_Document(UnderlyingDocumentType* pDoc, |
29 CPDFSDK_FormFillEnvironment* pEnv); | 29 CPDFSDK_FormFillEnvironment* pEnv); |
30 ~CPDFSDK_Document(); | 30 ~CPDFSDK_Document(); |
31 | 31 |
32 CPDFSDK_InterForm* GetInterForm(); | |
33 | |
34 // Gets the document object for the next layer down; for master this is | 32 // Gets the document object for the next layer down; for master this is |
35 // a CPDF_Document, but for XFA it is a CPDFXFA_Document. | 33 // a CPDF_Document, but for XFA it is a CPDFXFA_Document. |
36 UnderlyingDocumentType* GetUnderlyingDocument() const { | 34 UnderlyingDocumentType* GetUnderlyingDocument() const { |
37 #ifdef PDF_ENABLE_XFA | 35 #ifdef PDF_ENABLE_XFA |
38 return GetXFADocument(); | 36 return GetXFADocument(); |
39 #else // PDF_ENABLE_XFA | 37 #else // PDF_ENABLE_XFA |
40 return GetPDFDocument(); | 38 return GetPDFDocument(); |
41 #endif // PDF_ENABLE_XFA | 39 #endif // PDF_ENABLE_XFA |
42 } | 40 } |
43 | 41 |
44 // Gets the CPDF_Document, either directly in master, or from the | 42 // Gets the CPDF_Document, either directly in master, or from the |
45 // CPDFXFA_Document for XFA. | 43 // CPDFXFA_Document for XFA. |
46 CPDF_Document* GetPDFDocument() const { | 44 CPDF_Document* GetPDFDocument() const { |
47 #ifdef PDF_ENABLE_XFA | 45 #ifdef PDF_ENABLE_XFA |
48 return m_pDoc ? m_pDoc->GetPDFDoc() : nullptr; | 46 return m_pDoc ? m_pDoc->GetPDFDoc() : nullptr; |
49 #else // PDF_ENABLE_XFA | 47 #else // PDF_ENABLE_XFA |
50 return m_pDoc; | 48 return m_pDoc; |
51 #endif // PDF_ENABLE_XFA | 49 #endif // PDF_ENABLE_XFA |
52 } | 50 } |
53 | 51 |
54 #ifdef PDF_ENABLE_XFA | 52 #ifdef PDF_ENABLE_XFA |
55 // Gets the XFA document directly (XFA-only). | |
56 CPDFXFA_Document* GetXFADocument() const { return m_pDoc; } | |
57 | |
58 int GetPageViewCount() const { return m_pageMap.size(); } | 53 int GetPageViewCount() const { return m_pageMap.size(); } |
59 #endif // PDF_ENABLE_XFA | 54 #endif // PDF_ENABLE_XFA |
60 | 55 |
61 CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, bool ReNew); | 56 CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, bool ReNew); |
62 CPDFSDK_PageView* GetPageView(int nIndex); | 57 CPDFSDK_PageView* GetPageView(int nIndex); |
63 CPDFSDK_PageView* GetCurrentView(); | 58 CPDFSDK_PageView* GetCurrentView(); |
64 void RemovePageView(UnderlyingPageType* pPage); | 59 void RemovePageView(UnderlyingPageType* pPage); |
65 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); | 60 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); |
66 | 61 |
67 IJS_Runtime* GetJsRuntime(); | 62 IJS_Runtime* GetJsRuntime(); |
(...skipping 19 matching lines...) Expand all Loading... |
87 FX_BOOL GetChangeMark() { return m_bChangeMask; } | 82 FX_BOOL GetChangeMark() { return m_bChangeMask; } |
88 void SetChangeMark() { m_bChangeMask = TRUE; } | 83 void SetChangeMark() { m_bChangeMask = TRUE; } |
89 void ClearChangeMark() { m_bChangeMask = FALSE; } | 84 void ClearChangeMark() { m_bChangeMask = FALSE; } |
90 CFX_WideString GetPath(); | 85 CFX_WideString GetPath(); |
91 UnderlyingPageType* GetPage(int nIndex); | 86 UnderlyingPageType* GetPage(int nIndex); |
92 CPDFSDK_FormFillEnvironment* GetEnv() { return m_pEnv; } | 87 CPDFSDK_FormFillEnvironment* GetEnv() { return m_pEnv; } |
93 void ProcJavascriptFun(); | 88 void ProcJavascriptFun(); |
94 FX_BOOL ProcOpenAction(); | 89 FX_BOOL ProcOpenAction(); |
95 | 90 |
96 private: | 91 private: |
| 92 friend class CPDFSDK_FormFillEnvironment; |
| 93 |
| 94 CPDFSDK_InterForm* GetInterForm(); |
| 95 |
| 96 #ifdef PDF_ENABLE_XFA |
| 97 // Gets the XFA document directly (XFA-only). |
| 98 CPDFXFA_Document* GetXFADocument() const { return m_pDoc; } |
| 99 #endif // PDF_ENABLE_XFA |
| 100 |
97 std::map<UnderlyingPageType*, CPDFSDK_PageView*> m_pageMap; | 101 std::map<UnderlyingPageType*, CPDFSDK_PageView*> m_pageMap; |
98 UnderlyingDocumentType* m_pDoc; | 102 UnderlyingDocumentType* m_pDoc; |
99 std::unique_ptr<CPDFSDK_InterForm> m_pInterForm; | 103 std::unique_ptr<CPDFSDK_InterForm> m_pInterForm; |
100 CPDFSDK_Annot::ObservedPtr m_pFocusAnnot; | 104 CPDFSDK_Annot::ObservedPtr m_pFocusAnnot; |
101 CPDFSDK_FormFillEnvironment* m_pEnv; | 105 CPDFSDK_FormFillEnvironment* m_pEnv; |
102 FX_BOOL m_bChangeMask; | 106 FX_BOOL m_bChangeMask; |
103 FX_BOOL m_bBeingDestroyed; | 107 FX_BOOL m_bBeingDestroyed; |
104 }; | 108 }; |
105 | 109 |
106 #endif // FPDFSDK_CPDFSDK_DOCUMENT_H_ | 110 #endif // FPDFSDK_CPDFSDK_DOCUMENT_H_ |
OLD | NEW |