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/include/cpdfsdk_environment.h" | 7 #include "fpdfsdk/include/cpdfsdk_environment.h" |
8 | 8 |
| 9 #include <memory> |
| 10 |
9 #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" | 11 #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" |
10 #include "fpdfsdk/include/cpdfsdk_annothandlermgr.h" | 12 #include "fpdfsdk/include/cpdfsdk_annothandlermgr.h" |
11 #include "fpdfsdk/include/cpdfsdk_document.h" | 13 #include "fpdfsdk/include/cpdfsdk_document.h" |
12 #include "fpdfsdk/include/fsdk_actionhandler.h" | 14 #include "fpdfsdk/include/fsdk_actionhandler.h" |
13 #include "fpdfsdk/javascript/ijs_runtime.h" | 15 #include "fpdfsdk/javascript/ijs_runtime.h" |
14 | 16 |
15 #ifdef PDF_ENABLE_XFA | 17 #ifdef PDF_ENABLE_XFA |
16 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" | 18 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" |
17 #endif // PDF_ENABLE_XFA | 19 #endif // PDF_ENABLE_XFA |
18 | 20 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 IJS_Runtime* CPDFSDK_Environment::GetJSRuntime() { | 194 IJS_Runtime* CPDFSDK_Environment::GetJSRuntime() { |
193 if (!IsJSInitiated()) | 195 if (!IsJSInitiated()) |
194 return nullptr; | 196 return nullptr; |
195 if (!m_pJSRuntime) | 197 if (!m_pJSRuntime) |
196 m_pJSRuntime.reset(IJS_Runtime::Create(this)); | 198 m_pJSRuntime.reset(IJS_Runtime::Create(this)); |
197 return m_pJSRuntime.get(); | 199 return m_pJSRuntime.get(); |
198 } | 200 } |
199 | 201 |
200 CPDFSDK_AnnotHandlerMgr* CPDFSDK_Environment::GetAnnotHandlerMgr() { | 202 CPDFSDK_AnnotHandlerMgr* CPDFSDK_Environment::GetAnnotHandlerMgr() { |
201 if (!m_pAnnotHandlerMgr) | 203 if (!m_pAnnotHandlerMgr) |
202 m_pAnnotHandlerMgr.reset(new CPDFSDK_AnnotHandlerMgr(this)); | 204 m_pAnnotHandlerMgr = WrapUnique(new CPDFSDK_AnnotHandlerMgr(this)); |
203 return m_pAnnotHandlerMgr.get(); | 205 return m_pAnnotHandlerMgr.get(); |
204 } | 206 } |
205 | 207 |
206 CPDFSDK_ActionHandler* CPDFSDK_Environment::GetActionHander() { | 208 CPDFSDK_ActionHandler* CPDFSDK_Environment::GetActionHander() { |
207 if (!m_pActionHandler) | 209 if (!m_pActionHandler) |
208 m_pActionHandler.reset(new CPDFSDK_ActionHandler()); | 210 m_pActionHandler = WrapUnique(new CPDFSDK_ActionHandler()); |
209 return m_pActionHandler.get(); | 211 return m_pActionHandler.get(); |
210 } | 212 } |
211 | 213 |
212 CFFL_InteractiveFormFiller* CPDFSDK_Environment::GetInteractiveFormFiller() { | 214 CFFL_InteractiveFormFiller* CPDFSDK_Environment::GetInteractiveFormFiller() { |
213 if (!m_pFormFiller) | 215 if (!m_pFormFiller) |
214 m_pFormFiller.reset(new CFFL_InteractiveFormFiller(this)); | 216 m_pFormFiller = WrapUnique(new CFFL_InteractiveFormFiller(this)); |
215 return m_pFormFiller.get(); | 217 return m_pFormFiller.get(); |
216 } | 218 } |
217 | 219 |
218 void CPDFSDK_Environment::Invalidate(FPDF_PAGE page, | 220 void CPDFSDK_Environment::Invalidate(FPDF_PAGE page, |
219 double left, | 221 double left, |
220 double top, | 222 double top, |
221 double right, | 223 double right, |
222 double bottom) { | 224 double bottom) { |
223 if (m_pInfo && m_pInfo->FFI_Invalidate) | 225 if (m_pInfo && m_pInfo->FFI_Invalidate) |
224 m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom); | 226 m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 delete[] pbuff; | 535 delete[] pbuff; |
534 return wsRet; | 536 return wsRet; |
535 } | 537 } |
536 | 538 |
537 void CPDFSDK_Environment::PageEvent(int iPageCount, | 539 void CPDFSDK_Environment::PageEvent(int iPageCount, |
538 uint32_t dwEventType) const { | 540 uint32_t dwEventType) const { |
539 if (m_pInfo && m_pInfo->FFI_PageEvent) | 541 if (m_pInfo && m_pInfo->FFI_PageEvent) |
540 m_pInfo->FFI_PageEvent(m_pInfo, iPageCount, dwEventType); | 542 m_pInfo->FFI_PageEvent(m_pInfo, iPageCount, dwEventType); |
541 } | 543 } |
542 #endif // PDF_ENABLE_XFA | 544 #endif // PDF_ENABLE_XFA |
OLD | NEW |