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/include/cpdfsdk_environment.h" | 7 #include "fpdfsdk/include/cpdfsdk_environment.h" |
8 | 8 |
9 #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" | 9 #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" |
10 #include "fpdfsdk/include/cpdfsdk_annothandlermgr.h" | 10 #include "fpdfsdk/include/cpdfsdk_annothandlermgr.h" |
| 11 #include "fpdfsdk/include/cpdfsdk_document.h" |
11 #include "fpdfsdk/include/fsdk_actionhandler.h" | 12 #include "fpdfsdk/include/fsdk_actionhandler.h" |
12 #include "fpdfsdk/javascript/ijs_runtime.h" | 13 #include "fpdfsdk/javascript/ijs_runtime.h" |
13 | 14 |
14 #ifdef PDF_ENABLE_XFA | 15 #ifdef PDF_ENABLE_XFA |
15 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" | 16 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" |
16 #endif // PDF_ENABLE_XFA | 17 #endif // PDF_ENABLE_XFA |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 // NOTE: |bsUTF16LE| must outlive the use of the result. Care must be taken | 21 // NOTE: |bsUTF16LE| must outlive the use of the result. Care must be taken |
21 // since modifying the result would impact |bsUTF16LE|. | 22 // since modifying the result would impact |bsUTF16LE|. |
22 FPDF_WIDESTRING AsFPDFWideString(CFX_ByteString* bsUTF16LE) { | 23 FPDF_WIDESTRING AsFPDFWideString(CFX_ByteString* bsUTF16LE) { |
23 return reinterpret_cast<FPDF_WIDESTRING>( | 24 return reinterpret_cast<FPDF_WIDESTRING>( |
24 bsUTF16LE->GetBuffer(bsUTF16LE->GetLength())); | 25 bsUTF16LE->GetBuffer(bsUTF16LE->GetLength())); |
25 } | 26 } |
26 | 27 |
27 } // namespace | 28 } // namespace |
28 | 29 |
29 CPDFSDK_Environment::CPDFSDK_Environment(UnderlyingDocumentType* pDoc, | 30 CPDFSDK_Environment::CPDFSDK_Environment(UnderlyingDocumentType* pDoc, |
30 FPDF_FORMFILLINFO* pFFinfo) | 31 FPDF_FORMFILLINFO* pFFinfo) |
31 : m_pInfo(pFFinfo), m_pSDKDoc(nullptr), m_pUnderlyingDoc(pDoc) { | 32 : m_pInfo(pFFinfo), |
32 m_pSysHandler.reset(new CFX_SystemHandler(this)); | 33 m_pSDKDoc(new CPDFSDK_Document(pDoc, this)), |
33 } | 34 m_pUnderlyingDoc(pDoc), |
| 35 m_pSysHandler(new CFX_SystemHandler(this)) {} |
34 | 36 |
35 CPDFSDK_Environment::~CPDFSDK_Environment() { | 37 CPDFSDK_Environment::~CPDFSDK_Environment() { |
36 #ifdef PDF_ENABLE_XFA | 38 #ifdef PDF_ENABLE_XFA |
37 CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance(); | 39 CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance(); |
38 if (pProvider->m_pEnvList.GetSize() == 0) | 40 if (pProvider->m_pEnvList.GetSize() == 0) |
39 pProvider->SetJavaScriptInitialized(FALSE); | 41 pProvider->SetJavaScriptInitialized(FALSE); |
40 #endif // PDF_ENABLE_XFA | 42 #endif // PDF_ENABLE_XFA |
41 if (m_pInfo && m_pInfo->Release) | 43 if (m_pInfo && m_pInfo->Release) |
42 m_pInfo->Release(m_pInfo); | 44 m_pInfo->Release(m_pInfo); |
43 } | 45 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 if (!m_pActionHandler) | 207 if (!m_pActionHandler) |
206 m_pActionHandler.reset(new CPDFSDK_ActionHandler()); | 208 m_pActionHandler.reset(new CPDFSDK_ActionHandler()); |
207 return m_pActionHandler.get(); | 209 return m_pActionHandler.get(); |
208 } | 210 } |
209 | 211 |
210 CFFL_InteractiveFormFiller* CPDFSDK_Environment::GetInteractiveFormFiller() { | 212 CFFL_InteractiveFormFiller* CPDFSDK_Environment::GetInteractiveFormFiller() { |
211 if (!m_pFormFiller) | 213 if (!m_pFormFiller) |
212 m_pFormFiller.reset(new CFFL_InteractiveFormFiller(this)); | 214 m_pFormFiller.reset(new CFFL_InteractiveFormFiller(this)); |
213 return m_pFormFiller.get(); | 215 return m_pFormFiller.get(); |
214 } | 216 } |
OLD | NEW |