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 #include "../../../public/fpdf_formfill.h" | 7 #include "../../../public/fpdf_formfill.h" |
8 #include "../../include/fsdk_define.h" | 8 #include "../../include/fsdk_define.h" |
9 #include "../../include/fsdk_mgr.h" | 9 #include "../../include/fsdk_mgr.h" |
10 #include "../../include/fpdfxfa/fpdfxfa_doc.h" | 10 #include "../../include/fpdfxfa/fpdfxfa_doc.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 return g_pApp; | 22 return g_pApp; |
23 } | 23 } |
24 | 24 |
25 void CPDFXFA_App::ReleaseInstance() { | 25 void CPDFXFA_App::ReleaseInstance() { |
26 delete g_pApp; | 26 delete g_pApp; |
27 g_pApp = NULL; | 27 g_pApp = NULL; |
28 } | 28 } |
29 | 29 |
30 CPDFXFA_App::CPDFXFA_App() | 30 CPDFXFA_App::CPDFXFA_App() |
31 : m_bInitRuntime(FALSE), | 31 : m_bJavaScriptInitialized(FALSE), |
32 m_pXFAApp(NULL), | 32 m_pXFAApp(NULL), |
33 m_pFontMgr(NULL), | 33 m_pFontMgr(NULL), |
34 m_hJSERuntime(NULL), | 34 m_hJSERuntime(NULL), |
35 m_csAppType(JS_STR_VIEWERTYPE_STANDARD) { | 35 m_csAppType(JS_STR_VIEWERTYPE_STANDARD) { |
36 m_pEnvList.RemoveAll(); | 36 m_pEnvList.RemoveAll(); |
37 } | 37 } |
38 | 38 |
39 CPDFXFA_App::~CPDFXFA_App() { | 39 CPDFXFA_App::~CPDFXFA_App() { |
40 delete m_pFontMgr; | 40 delete m_pFontMgr; |
41 m_pFontMgr = NULL; | 41 m_pFontMgr = NULL; |
(...skipping 21 matching lines...) Expand all Loading... |
63 return FALSE; | 63 return FALSE; |
64 | 64 |
65 m_pFontMgr = IXFA_FontMgr::CreateDefault(); | 65 m_pFontMgr = IXFA_FontMgr::CreateDefault(); |
66 if (!m_pFontMgr) | 66 if (!m_pFontMgr) |
67 return FALSE; | 67 return FALSE; |
68 | 68 |
69 m_pXFAApp->SetDefaultFontMgr(m_pFontMgr); | 69 m_pXFAApp->SetDefaultFontMgr(m_pFontMgr); |
70 return TRUE; | 70 return TRUE; |
71 } | 71 } |
72 | 72 |
73 FX_BOOL CPDFXFA_App::InitRuntime(FX_BOOL bReset) { | |
74 if (bReset) { | |
75 m_bInitRuntime = FALSE; | |
76 return TRUE; | |
77 } | |
78 if (m_bInitRuntime) { | |
79 return TRUE; | |
80 } | |
81 m_bInitRuntime = TRUE; | |
82 return FALSE; | |
83 } | |
84 | |
85 FX_BOOL CPDFXFA_App::AddFormFillEnv(CPDFDoc_Environment* pEnv) { | 73 FX_BOOL CPDFXFA_App::AddFormFillEnv(CPDFDoc_Environment* pEnv) { |
86 if (!pEnv) | 74 if (!pEnv) |
87 return FALSE; | 75 return FALSE; |
88 | 76 |
89 m_pEnvList.Add(pEnv); | 77 m_pEnvList.Add(pEnv); |
90 return TRUE; | 78 return TRUE; |
91 } | 79 } |
92 | 80 |
93 FX_BOOL CPDFXFA_App::RemoveFormFillEnv(CPDFDoc_Environment* pEnv) { | 81 FX_BOOL CPDFXFA_App::RemoveFormFillEnv(CPDFDoc_Environment* pEnv) { |
94 if (!pEnv) | 82 if (!pEnv) |
95 return FALSE; | 83 return FALSE; |
96 | 84 |
97 int nFind = m_pEnvList.Find(pEnv); | 85 int nFind = m_pEnvList.Find(pEnv); |
98 if (nFind != -1) { | 86 if (nFind != -1) { |
99 m_pEnvList.RemoveAt(nFind); | 87 m_pEnvList.RemoveAt(nFind); |
100 return TRUE; | 88 return TRUE; |
101 } | 89 } |
102 | 90 |
103 return FALSE; | 91 return FALSE; |
104 } | 92 } |
105 void CPDFXFA_App::ReleaseRuntime() { | |
106 v8::Global<v8::Context> context; | |
107 FXJS_ReleaseRuntime((v8::Isolate*)m_hJSERuntime, context); | |
108 } | |
109 | 93 |
110 void CPDFXFA_App::GetAppType(CFX_WideString& wsAppType) { | 94 void CPDFXFA_App::GetAppType(CFX_WideString& wsAppType) { |
111 wsAppType = m_csAppType; | 95 wsAppType = m_csAppType; |
112 } | 96 } |
113 | 97 |
114 void CPDFXFA_App::GetAppName(CFX_WideString& wsName) { | 98 void CPDFXFA_App::GetAppName(CFX_WideString& wsName) { |
115 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); | 99 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
116 if (pEnv) { | 100 if (pEnv) { |
117 wsName = pEnv->FFI_GetAppName(); | 101 wsName = pEnv->FFI_GetAppName(); |
118 } | 102 } |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 return FALSE; | 523 return FALSE; |
540 } | 524 } |
541 | 525 |
542 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { | 526 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { |
543 CXFA_FWLAdapterTimerMgr* pAdapter = NULL; | 527 CXFA_FWLAdapterTimerMgr* pAdapter = NULL; |
544 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); | 528 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
545 if (pEnv) | 529 if (pEnv) |
546 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); | 530 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); |
547 return pAdapter; | 531 return pAdapter; |
548 } | 532 } |
OLD | NEW |