| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "core/fpdfapi/parser/cpdf_document.h" | 13 #include "core/fpdfapi/parser/cpdf_document.h" |
| 14 #include "core/fxcrt/cfx_observable.h" | 14 #include "core/fxcrt/cfx_observable.h" |
| 15 #include "fpdfsdk/cpdfsdk_annot.h" | 15 #include "fpdfsdk/cpdfsdk_annot.h" |
| 16 #include "fpdfsdk/fsdk_define.h" | 16 #include "fpdfsdk/fsdk_define.h" |
| 17 #include "public/fpdf_formfill.h" | 17 #include "public/fpdf_formfill.h" |
| 18 | 18 |
| 19 class CPDF_OCContext; | 19 class CPDF_OCContext; |
| 20 class CPDFSDK_Environment; | 20 class CPDFSDK_FormFillEnvironment; |
| 21 class CPDFSDK_InterForm; | 21 class CPDFSDK_InterForm; |
| 22 class CPDFSDK_PageView; | 22 class CPDFSDK_PageView; |
| 23 class IJS_Runtime; | 23 class IJS_Runtime; |
| 24 | 24 |
| 25 class CPDFSDK_Document : public CFX_Observable<CPDFSDK_Document> { | 25 class CPDFSDK_Document : public CFX_Observable<CPDFSDK_Document> { |
| 26 public: | 26 public: |
| 27 static CPDFSDK_Document* FromFPDFFormHandle(FPDF_FORMHANDLE hHandle); | 27 static CPDFSDK_Document* FromFPDFFormHandle(FPDF_FORMHANDLE hHandle); |
| 28 | 28 |
| 29 CPDFSDK_Document(UnderlyingDocumentType* pDoc, CPDFSDK_Environment* pEnv); | 29 CPDFSDK_Document(UnderlyingDocumentType* pDoc, |
| 30 CPDFSDK_FormFillEnvironment* pEnv); |
| 30 ~CPDFSDK_Document(); | 31 ~CPDFSDK_Document(); |
| 31 | 32 |
| 32 CPDFSDK_InterForm* GetInterForm(); | 33 CPDFSDK_InterForm* GetInterForm(); |
| 33 | 34 |
| 34 // Gets the document object for the next layer down; for master this is | 35 // 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. | 36 // a CPDF_Document, but for XFA it is a CPDFXFA_Document. |
| 36 UnderlyingDocumentType* GetUnderlyingDocument() const { | 37 UnderlyingDocumentType* GetUnderlyingDocument() const { |
| 37 #ifdef PDF_ENABLE_XFA | 38 #ifdef PDF_ENABLE_XFA |
| 38 return GetXFADocument(); | 39 return GetXFADocument(); |
| 39 #else // PDF_ENABLE_XFA | 40 #else // PDF_ENABLE_XFA |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 83 |
| 83 void OnCloseDocument(); | 84 void OnCloseDocument(); |
| 84 | 85 |
| 85 int GetPageCount() { return m_pDoc->GetPageCount(); } | 86 int GetPageCount() { return m_pDoc->GetPageCount(); } |
| 86 FX_BOOL GetPermissions(int nFlag); | 87 FX_BOOL GetPermissions(int nFlag); |
| 87 FX_BOOL GetChangeMark() { return m_bChangeMask; } | 88 FX_BOOL GetChangeMark() { return m_bChangeMask; } |
| 88 void SetChangeMark() { m_bChangeMask = TRUE; } | 89 void SetChangeMark() { m_bChangeMask = TRUE; } |
| 89 void ClearChangeMark() { m_bChangeMask = FALSE; } | 90 void ClearChangeMark() { m_bChangeMask = FALSE; } |
| 90 CFX_WideString GetPath(); | 91 CFX_WideString GetPath(); |
| 91 UnderlyingPageType* GetPage(int nIndex); | 92 UnderlyingPageType* GetPage(int nIndex); |
| 92 CPDFSDK_Environment* GetEnv() { return m_pEnv; } | 93 CPDFSDK_FormFillEnvironment* GetEnv() { return m_pEnv; } |
| 93 void ProcJavascriptFun(); | 94 void ProcJavascriptFun(); |
| 94 FX_BOOL ProcOpenAction(); | 95 FX_BOOL ProcOpenAction(); |
| 95 CPDF_OCContext* GetOCContext(); | 96 CPDF_OCContext* GetOCContext(); |
| 96 | 97 |
| 97 private: | 98 private: |
| 98 std::map<UnderlyingPageType*, CPDFSDK_PageView*> m_pageMap; | 99 std::map<UnderlyingPageType*, CPDFSDK_PageView*> m_pageMap; |
| 99 UnderlyingDocumentType* m_pDoc; | 100 UnderlyingDocumentType* m_pDoc; |
| 100 std::unique_ptr<CPDFSDK_InterForm> m_pInterForm; | 101 std::unique_ptr<CPDFSDK_InterForm> m_pInterForm; |
| 101 CPDFSDK_Annot::ObservedPtr m_pFocusAnnot; | 102 CPDFSDK_Annot::ObservedPtr m_pFocusAnnot; |
| 102 CPDFSDK_Environment* m_pEnv; | 103 CPDFSDK_FormFillEnvironment* m_pEnv; |
| 103 std::unique_ptr<CPDF_OCContext> m_pOccontent; | 104 std::unique_ptr<CPDF_OCContext> m_pOccontent; |
| 104 FX_BOOL m_bChangeMask; | 105 FX_BOOL m_bChangeMask; |
| 105 FX_BOOL m_bBeingDestroyed; | 106 FX_BOOL m_bBeingDestroyed; |
| 106 }; | 107 }; |
| 107 | 108 |
| 108 #endif // FPDFSDK_CPDFSDK_DOCUMENT_H_ | 109 #endif // FPDFSDK_CPDFSDK_DOCUMENT_H_ |
| OLD | NEW |