| 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 CPDFSDK_Document::CPDFSDK_Document(UnderlyingDocumentType* pDoc, | 32 CPDFSDK_Document::CPDFSDK_Document(UnderlyingDocumentType* pDoc, |
| 33 CPDFSDK_Environment* pEnv) | 33 CPDFSDK_Environment* pEnv) |
| 34 : m_pDoc(pDoc), | 34 : m_pDoc(pDoc), |
| 35 m_pEnv(pEnv), | 35 m_pEnv(pEnv), |
| 36 m_bChangeMask(FALSE), | 36 m_bChangeMask(FALSE), |
| 37 m_bBeingDestroyed(FALSE) {} | 37 m_bBeingDestroyed(FALSE) {} |
| 38 | 38 |
| 39 CPDFSDK_Document::~CPDFSDK_Document() { | 39 CPDFSDK_Document::~CPDFSDK_Document() { |
| 40 m_bBeingDestroyed = TRUE; | 40 m_bBeingDestroyed = TRUE; |
| 41 | 41 |
| 42 for (auto& it : m_pageMap) { | 42 ClearAllFocusedAnnots(); |
| 43 if (it.second->IsValidSDKAnnot(GetFocusAnnot())) | |
| 44 KillFocusAnnot(0); | |
| 45 } | |
| 46 | |
| 47 for (auto& it : m_pageMap) | 43 for (auto& it : m_pageMap) |
| 48 delete it.second; | 44 delete it.second; |
| 49 m_pageMap.clear(); | 45 m_pageMap.clear(); |
| 50 } | 46 } |
| 51 | 47 |
| 48 void CPDFSDK_Document::ClearAllFocusedAnnots() { |
| 49 for (auto& it : m_pageMap) { |
| 50 if (it.second->IsValidSDKAnnot(GetFocusAnnot())) |
| 51 KillFocusAnnot(0); |
| 52 } |
| 53 } |
| 54 |
| 52 CPDFSDK_PageView* CPDFSDK_Document::GetPageView( | 55 CPDFSDK_PageView* CPDFSDK_Document::GetPageView( |
| 53 UnderlyingPageType* pUnderlyingPage, | 56 UnderlyingPageType* pUnderlyingPage, |
| 54 bool ReNew) { | 57 bool ReNew) { |
| 55 auto it = m_pageMap.find(pUnderlyingPage); | 58 auto it = m_pageMap.find(pUnderlyingPage); |
| 56 if (it != m_pageMap.end()) | 59 if (it != m_pageMap.end()) |
| 57 return it->second; | 60 return it->second; |
| 58 | 61 |
| 59 if (!ReNew) | 62 if (!ReNew) |
| 60 return nullptr; | 63 return nullptr; |
| 61 | 64 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 return GetPDFDocument()->GetUserPermissions() & nFlag; | 253 return GetPDFDocument()->GetUserPermissions() & nFlag; |
| 251 } | 254 } |
| 252 | 255 |
| 253 IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { | 256 IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { |
| 254 return m_pEnv->GetJSRuntime(); | 257 return m_pEnv->GetJSRuntime(); |
| 255 } | 258 } |
| 256 | 259 |
| 257 CFX_WideString CPDFSDK_Document::GetPath() { | 260 CFX_WideString CPDFSDK_Document::GetPath() { |
| 258 return m_pEnv->JS_docGetFilePath(); | 261 return m_pEnv->JS_docGetFilePath(); |
| 259 } | 262 } |
| OLD | NEW |