| 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 #include "fpdfsdk/cpdfsdk_document.h" | 7 #include "fpdfsdk/cpdfsdk_document.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/parser/cpdf_array.h" | 9 #include "core/fpdfapi/parser/cpdf_array.h" |
| 10 #include "core/fpdfapi/parser/cpdf_dictionary.h" | 10 #include "core/fpdfapi/parser/cpdf_dictionary.h" |
| 11 #include "core/fpdfapi/parser/cpdf_document.h" | 11 #include "core/fpdfapi/parser/cpdf_document.h" |
| 12 #include "core/fpdfapi/parser/cpdf_object.h" | 12 #include "core/fpdfapi/parser/cpdf_object.h" |
| 13 #include "core/fpdfdoc/cpdf_action.h" | 13 #include "core/fpdfdoc/cpdf_action.h" |
| 14 #include "core/fpdfdoc/cpdf_docjsactions.h" | 14 #include "core/fpdfdoc/cpdf_docjsactions.h" |
| 15 #include "core/fpdfdoc/cpdf_occontext.h" | 15 #include "core/fpdfdoc/cpdf_occontext.h" |
| 16 #include "fpdfsdk/cpdfsdk_annot.h" | 16 #include "fpdfsdk/cpdfsdk_annot.h" |
| 17 #include "fpdfsdk/cpdfsdk_annothandlermgr.h" | 17 #include "fpdfsdk/cpdfsdk_annothandlermgr.h" |
| 18 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" | 18 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
| 19 #include "fpdfsdk/cpdfsdk_interform.h" | 19 #include "fpdfsdk/cpdfsdk_interform.h" |
| 20 #include "fpdfsdk/cpdfsdk_pageview.h" | 20 #include "fpdfsdk/cpdfsdk_pageview.h" |
| 21 #include "fpdfsdk/cpdfsdk_widget.h" | 21 #include "fpdfsdk/cpdfsdk_widget.h" |
| 22 #include "fpdfsdk/fsdk_actionhandler.h" | 22 #include "fpdfsdk/fsdk_actionhandler.h" |
| 23 #include "third_party/base/ptr_util.h" | 23 #include "third_party/base/ptr_util.h" |
| 24 | 24 |
| 25 // static | |
| 26 CPDFSDK_Document* CPDFSDK_Document::FromFPDFFormHandle( | |
| 27 FPDF_FORMHANDLE hHandle) { | |
| 28 CPDFSDK_FormFillEnvironment* pEnv = | |
| 29 static_cast<CPDFSDK_FormFillEnvironment*>(hHandle); | |
| 30 return pEnv ? pEnv->GetSDKDocument() : nullptr; | |
| 31 } | |
| 32 | |
| 33 CPDFSDK_Document::CPDFSDK_Document(UnderlyingDocumentType* pDoc, | 25 CPDFSDK_Document::CPDFSDK_Document(UnderlyingDocumentType* pDoc, |
| 34 CPDFSDK_FormFillEnvironment* pEnv) | 26 CPDFSDK_FormFillEnvironment* pEnv) |
| 35 : m_pDoc(pDoc), | 27 : m_pDoc(pDoc), |
| 36 m_pEnv(pEnv), | 28 m_pEnv(pEnv), |
| 37 m_bChangeMask(FALSE), | 29 m_bChangeMask(FALSE), |
| 38 m_bBeingDestroyed(FALSE) {} | 30 m_bBeingDestroyed(FALSE) {} |
| 39 | 31 |
| 40 CPDFSDK_Document::~CPDFSDK_Document() { | 32 CPDFSDK_Document::~CPDFSDK_Document() { |
| 41 m_bBeingDestroyed = TRUE; | 33 m_bBeingDestroyed = TRUE; |
| 42 | 34 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 return GetPDFDocument()->GetUserPermissions() & nFlag; | 238 return GetPDFDocument()->GetUserPermissions() & nFlag; |
| 247 } | 239 } |
| 248 | 240 |
| 249 IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { | 241 IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { |
| 250 return m_pEnv->GetJSRuntime(); | 242 return m_pEnv->GetJSRuntime(); |
| 251 } | 243 } |
| 252 | 244 |
| 253 CFX_WideString CPDFSDK_Document::GetPath() { | 245 CFX_WideString CPDFSDK_Document::GetPath() { |
| 254 return m_pEnv->JS_docGetFilePath(); | 246 return m_pEnv->JS_docGetFilePath(); |
| 255 } | 247 } |
| OLD | NEW |