| 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/fsdk_mgr.h" | 9 #include "../include/fsdk_mgr.h" |
| 10 #include "../include/formfiller/FFL_FormFiller.h" | 10 #include "../include/formfiller/FFL_FormFiller.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 m_pSysHandler = new CFX_SystemHandler(this); | 232 m_pSysHandler = new CFX_SystemHandler(this); |
| 233 | 233 |
| 234 | 234 |
| 235 m_pJSRuntimeFactory = NULL; | 235 m_pJSRuntimeFactory = NULL; |
| 236 m_pJSRuntimeFactory = GetJSRuntimeFactory(); | 236 m_pJSRuntimeFactory = GetJSRuntimeFactory(); |
| 237 m_pJSRuntimeFactory->AddRef(); | 237 m_pJSRuntimeFactory->AddRef(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 CPDFDoc_Environment::~CPDFDoc_Environment() | 240 CPDFDoc_Environment::~CPDFDoc_Environment() |
| 241 { | 241 { |
| 242 delete m_pIFormFiller; |
| 243 m_pIFormFiller = NULL; |
| 244 if (m_pJSRuntime && m_pJSRuntimeFactory) |
| 245 m_pJSRuntimeFactory->DeleteJSRuntime(m_pJSRuntime); |
| 246 m_pJSRuntimeFactory->Release(); |
| 242 | 247 |
| 243 » if ( m_pIFormFiller ) | 248 delete m_pSysHandler; |
| 244 » { | 249 m_pSysHandler = NULL; |
| 245 » » delete m_pIFormFiller; | |
| 246 » » m_pIFormFiller = NULL; | |
| 247 » } | |
| 248 » if(m_pJSRuntime && m_pJSRuntimeFactory) | |
| 249 » » m_pJSRuntimeFactory->DeleteJSRuntime(m_pJSRuntime); | |
| 250 » m_pJSRuntimeFactory->Release(); | |
| 251 | 250 |
| 252 » if(m_pSysHandler) | 251 delete m_pAnnotHandlerMgr; |
| 253 » { | 252 m_pAnnotHandlerMgr = NULL; |
| 254 » » delete m_pSysHandler; | 253 delete m_pActionHandler; |
| 255 » » m_pSysHandler = NULL; | 254 m_pActionHandler = NULL; |
| 256 » } | |
| 257 | |
| 258 » if(m_pAnnotHandlerMgr) | |
| 259 » { | |
| 260 » » delete m_pAnnotHandlerMgr; | |
| 261 » » m_pAnnotHandlerMgr = NULL; | |
| 262 » } | |
| 263 » if(m_pActionHandler) | |
| 264 » { | |
| 265 » » delete m_pActionHandler; | |
| 266 » » m_pActionHandler = NULL; | |
| 267 » } | |
| 268 | |
| 269 | |
| 270 } | 255 } |
| 271 | 256 |
| 272 | 257 |
| 273 IFXJS_Runtime* CPDFDoc_Environment::GetJSRuntime() | 258 IFXJS_Runtime* CPDFDoc_Environment::GetJSRuntime() |
| 274 { | 259 { |
| 275 if(!IsJSInitiated()) | 260 if(!IsJSInitiated()) |
| 276 return NULL; | 261 return NULL; |
| 277 assert(m_pJSRuntimeFactory); | 262 assert(m_pJSRuntimeFactory); |
| 278 if(!m_pJSRuntime) | 263 if(!m_pJSRuntime) |
| 279 m_pJSRuntime = m_pJSRuntimeFactory->NewJSRuntime(this); | 264 m_pJSRuntime = m_pJSRuntimeFactory->NewJSRuntime(this); |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 { | 617 { |
| 633 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); | 618 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); |
| 634 //if there is a focused annot on the page, we should kill the fo
cus first. | 619 //if there is a focused annot on the page, we should kill the fo
cus first. |
| 635 if(pAnnot == m_pSDKDoc->GetFocusAnnot()) | 620 if(pAnnot == m_pSDKDoc->GetFocusAnnot()) |
| 636 KillFocusAnnot(); | 621 KillFocusAnnot(); |
| 637 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandle
rMgr(); | 622 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandle
rMgr(); |
| 638 ASSERT(pAnnotHandlerMgr); | 623 ASSERT(pAnnotHandlerMgr); |
| 639 pAnnotHandlerMgr->ReleaseAnnot(pAnnot); | 624 pAnnotHandlerMgr->ReleaseAnnot(pAnnot); |
| 640 } | 625 } |
| 641 m_fxAnnotArray.RemoveAll(); | 626 m_fxAnnotArray.RemoveAll(); |
| 642 » if(m_pAnnotList) | 627 |
| 643 » { | 628 delete m_pAnnotList; |
| 644 » » delete m_pAnnotList; | 629 m_pAnnotList = NULL; |
| 645 » » m_pAnnotList = NULL; | 630 |
| 646 » } | |
| 647 m_page->RemovePrivateData((void*)m_page); | 631 m_page->RemovePrivateData((void*)m_page); |
| 648 if(m_bTakeOverPage) { | 632 if(m_bTakeOverPage) { |
| 649 delete m_page; | 633 delete m_page; |
| 650 } | 634 } |
| 651 } | 635 } |
| 652 | 636 |
| 653 void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* p
User2Device,CPDF_RenderOptions* pOptions) | 637 void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* p
User2Device,CPDF_RenderOptions* pOptions) |
| 654 { | 638 { |
| 655 m_curMatrix = *pUser2Device; | 639 m_curMatrix = *pUser2Device; |
| 656 | 640 |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 | 1039 |
| 1056 for(int i=0; i<m_fxAnnotArray.GetSize(); i++) | 1040 for(int i=0; i<m_fxAnnotArray.GetSize(); i++) |
| 1057 { | 1041 { |
| 1058 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); | 1042 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); |
| 1059 if(pAnnot == pFocusAnnot) | 1043 if(pAnnot == pFocusAnnot) |
| 1060 return pAnnot; | 1044 return pAnnot; |
| 1061 } | 1045 } |
| 1062 return NULL; | 1046 return NULL; |
| 1063 } | 1047 } |
| 1064 | 1048 |
| OLD | NEW |