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_ext.h" | 7 #include "../../public/fpdf_ext.h" |
8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
9 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 9 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
10 #include "../include/fpdfxfa/fpdfxfa_page.h" | 10 #include "../include/fpdfxfa/fpdfxfa_page.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 void CFX_SystemHandler::KillTimer(FX_INT32 nID) | 208 void CFX_SystemHandler::KillTimer(FX_INT32 nID) |
209 { | 209 { |
210 m_pEnv->FFI_KillTimer(nID); | 210 m_pEnv->FFI_KillTimer(nID); |
211 } | 211 } |
212 | 212 |
213 FX_SYSTEMTIME CFX_SystemHandler::GetLocalTime() | 213 FX_SYSTEMTIME CFX_SystemHandler::GetLocalTime() |
214 { | 214 { |
215 return m_pEnv->FFI_GetLocalTime(); | 215 return m_pEnv->FFI_GetLocalTime(); |
216 } | 216 } |
217 | 217 |
218 | |
219 | |
220 CPDFDoc_Environment::CPDFDoc_Environment(CPDFXFA_Document* pDoc) : | 218 CPDFDoc_Environment::CPDFDoc_Environment(CPDFXFA_Document* pDoc) : |
221 m_pAnnotHandlerMgr(NULL), | 219 m_pAnnotHandlerMgr(NULL), |
222 m_pActionHandler(NULL), | 220 m_pActionHandler(NULL), |
223 m_pJSRuntime(NULL), | 221 m_pJSRuntime(NULL), |
224 m_pInfo(NULL), | 222 m_pInfo(NULL), |
225 m_pSDKDoc(NULL), | 223 m_pSDKDoc(NULL), |
226 m_pDoc(pDoc), | 224 m_pDoc(pDoc), |
227 m_pIFormFiller(NULL) | 225 m_pIFormFiller(NULL) |
228 { | 226 { |
229 | |
230 m_pSysHandler = NULL; | 227 m_pSysHandler = NULL; |
231 m_pSysHandler = new CFX_SystemHandler(this); | 228 m_pSysHandler = new CFX_SystemHandler(this); |
232 | |
233 //m_pJSRuntimeFactory = pDoc->GetApp()->GetRuntimeFactory(); | |
234 | |
235 } | 229 } |
236 | 230 |
237 CPDFDoc_Environment::~CPDFDoc_Environment() | 231 CPDFDoc_Environment::~CPDFDoc_Environment() |
238 { | 232 { |
239 | 233 |
240 » if ( m_pIFormFiller ) | 234 delete m_pIFormFiller; |
241 » { | 235 m_pIFormFiller = NULL; |
242 » » delete m_pIFormFiller; | |
243 » » m_pIFormFiller = NULL; | |
244 » } | |
245 | 236 |
246 » if (m_pJSRuntime && FPDFXFA_GetApp()->GetRuntimeFactory()) | 237 CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance(); |
247 » » FPDFXFA_GetApp()->GetRuntimeFactory()->DeleteJSRuntime(m_pJSRunt
ime); | 238 if (m_pJSRuntime && pProvider->GetRuntimeFactory()) |
| 239 pProvider->GetRuntimeFactory()->DeleteJSRuntime(m_pJSRuntime); |
248 | 240 |
249 » if (FPDFXFA_GetApp()->m_pEnvList.GetSize() == 0) | 241 if (pProvider->m_pEnvList.GetSize() == 0) |
250 » { | 242 { |
251 » » FPDFXFA_GetApp()->ReleaseRuntime(); | 243 pProvider->ReleaseRuntime(); |
252 » » FPDFXFA_GetApp()->InitRuntime(TRUE); | 244 pProvider->InitRuntime(TRUE); |
253 » } | 245 } |
254 | 246 |
255 » if(m_pSysHandler) | 247 delete m_pSysHandler; |
256 » { | 248 m_pSysHandler = NULL; |
257 » » delete m_pSysHandler; | |
258 » » m_pSysHandler = NULL; | |
259 » } | |
260 | 249 |
261 » if(m_pAnnotHandlerMgr) | 250 delete m_pAnnotHandlerMgr; |
262 » { | 251 m_pAnnotHandlerMgr = NULL; |
263 » » delete m_pAnnotHandlerMgr; | |
264 » » m_pAnnotHandlerMgr = NULL; | |
265 » } | |
266 » if(m_pActionHandler) | |
267 » { | |
268 » » delete m_pActionHandler; | |
269 » » m_pActionHandler = NULL; | |
270 » } | |
271 | 252 |
272 | 253 delete m_pActionHandler; |
| 254 m_pActionHandler = NULL; |
273 } | 255 } |
274 | 256 |
275 | 257 |
276 IFXJS_Runtime* CPDFDoc_Environment::GetJSRuntime() | 258 IFXJS_Runtime* CPDFDoc_Environment::GetJSRuntime() |
277 { | 259 { |
278 if(!IsJSInitiated()) | 260 if(!IsJSInitiated()) |
279 return NULL; | 261 return NULL; |
280 if(!m_pJSRuntime) | 262 if(!m_pJSRuntime) |
281 » » m_pJSRuntime = FPDFXFA_GetApp()->GetRuntimeFactory()->NewJSRunti
me(this); | 263 » » m_pJSRuntime = CPDFXFA_App::GetInstance()->GetRuntimeFactory()->
NewJSRuntime(this); |
282 return m_pJSRuntime; | 264 return m_pJSRuntime; |
283 } | 265 } |
284 | 266 |
285 CPDFSDK_AnnotHandlerMgr* CPDFDoc_Environment::GetAnnotHandlerMgr() | 267 CPDFSDK_AnnotHandlerMgr* CPDFDoc_Environment::GetAnnotHandlerMgr() |
286 { | 268 { |
287 if(!m_pAnnotHandlerMgr) | 269 if(!m_pAnnotHandlerMgr) |
288 m_pAnnotHandlerMgr = new CPDFSDK_AnnotHandlerMgr(this); | 270 m_pAnnotHandlerMgr = new CPDFSDK_AnnotHandlerMgr(this); |
289 return m_pAnnotHandlerMgr; | 271 return m_pAnnotHandlerMgr; |
290 } | 272 } |
291 | 273 |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 | 1233 |
1252 for(int i=0; i<m_fxAnnotArray.GetSize(); i++) | 1234 for(int i=0; i<m_fxAnnotArray.GetSize(); i++) |
1253 { | 1235 { |
1254 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); | 1236 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); |
1255 if(pAnnot == pFocusAnnot) | 1237 if(pAnnot == pFocusAnnot) |
1256 return pAnnot; | 1238 return pAnnot; |
1257 } | 1239 } |
1258 return NULL; | 1240 return NULL; |
1259 } | 1241 } |
1260 | 1242 |
OLD | NEW |