| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 CPDFSDK_PageView* CPDFSDK_Document::GetPageView( | 56 CPDFSDK_PageView* CPDFSDK_Document::GetPageView( |
| 57 UnderlyingPageType* pUnderlyingPage, | 57 UnderlyingPageType* pUnderlyingPage, |
| 58 bool ReNew) { | 58 bool ReNew) { |
| 59 auto it = m_pageMap.find(pUnderlyingPage); | 59 auto it = m_pageMap.find(pUnderlyingPage); |
| 60 if (it != m_pageMap.end()) | 60 if (it != m_pageMap.end()) |
| 61 return it->second; | 61 return it->second; |
| 62 | 62 |
| 63 if (!ReNew) | 63 if (!ReNew) |
| 64 return nullptr; | 64 return nullptr; |
| 65 | 65 |
| 66 CPDFSDK_PageView* pPageView = new CPDFSDK_PageView(this, pUnderlyingPage); | 66 CPDFSDK_PageView* pPageView = new CPDFSDK_PageView(GetEnv(), pUnderlyingPage); |
| 67 m_pageMap[pUnderlyingPage] = pPageView; | 67 m_pageMap[pUnderlyingPage] = pPageView; |
| 68 // Delay to load all the annotations, to avoid endless loop. | 68 // Delay to load all the annotations, to avoid endless loop. |
| 69 pPageView->LoadFXAnnots(); | 69 pPageView->LoadFXAnnots(); |
| 70 return pPageView; | 70 return pPageView; |
| 71 } | 71 } |
| 72 | 72 |
| 73 CPDFSDK_PageView* CPDFSDK_Document::GetCurrentView() { | 73 CPDFSDK_PageView* CPDFSDK_Document::GetCurrentView() { |
| 74 UnderlyingPageType* pPage = | 74 UnderlyingPageType* pPage = |
| 75 UnderlyingFromFPDFPage(m_pEnv->GetCurrentPage(m_pDoc)); | 75 UnderlyingFromFPDFPage(m_pEnv->GetCurrentPage(m_pDoc)); |
| 76 return pPage ? GetPageView(pPage, true) : nullptr; | 76 return pPage ? GetPageView(pPage, true) : nullptr; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 return GetPDFDocument()->GetUserPermissions() & nFlag; | 246 return GetPDFDocument()->GetUserPermissions() & nFlag; |
| 247 } | 247 } |
| 248 | 248 |
| 249 IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { | 249 IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { |
| 250 return m_pEnv->GetJSRuntime(); | 250 return m_pEnv->GetJSRuntime(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 CFX_WideString CPDFSDK_Document::GetPath() { | 253 CFX_WideString CPDFSDK_Document::GetPath() { |
| 254 return m_pEnv->JS_docGetFilePath(); | 254 return m_pEnv->JS_docGetFilePath(); |
| 255 } | 255 } |
| OLD | NEW |