| 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 "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
| 8 #include "../../include/javascript/IJavaScript.h" | 8 #include "../../include/javascript/IJavaScript.h" |
| 9 #include "../../include/javascript/JS_Define.h" | 9 #include "../../include/javascript/JS_Define.h" |
| 10 #include "../../include/javascript/JS_Object.h" | 10 #include "../../include/javascript/JS_Object.h" |
| 11 // #include "../../include/javascript/JS_MsgBox.h" | 11 // #include "../../include/javascript/JS_MsgBox.h" |
| 12 // #include "../../include/javascript/JS_ResMgr.h" | 12 // #include "../../include/javascript/JS_ResMgr.h" |
| 13 #include "../../include/javascript/JS_Context.h" | 13 #include "../../include/javascript/JS_Context.h" |
| 14 | 14 |
| 15 JS_TIMER_MAPARRAY& GetTimeMap() | 15 JS_TIMER_MAPARRAY& GetTimeMap() |
| 16 { | 16 { |
| 17 // Leak the timer array at shutdown. | 17 // Leak the timer array at shutdown. |
| 18 static auto* timeMap = new JS_TIMER_MAPARRAY; | 18 static auto* timeMap = new JS_TIMER_MAPARRAY; |
| 19 return *timeMap; | 19 return *timeMap; |
| 20 } | 20 } |
| 21 | 21 |
| 22 int FXJS_MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, FX_LPCWS
TR swMsg, FX_LPCWSTR swTitle, FX_UINT nType, FX_UINT nIcon) | 22 int FXJS_MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, const FX
_WCHAR* swMsg, const FX_WCHAR* swTitle, FX_UINT nType, FX_UINT nIcon) |
| 23 { | 23 { |
| 24 int nRet = 0; | 24 int nRet = 0; |
| 25 | 25 |
| 26 if(pApp) | 26 if(pApp) |
| 27 { | 27 { |
| 28 CPDFSDK_Document* pDoc = pApp->GetCurrentDoc(); | 28 CPDFSDK_Document* pDoc = pApp->GetCurrentDoc(); |
| 29 if(pDoc) | 29 if(pDoc) |
| 30 pDoc->KillFocusAnnot(); | 30 pDoc->KillFocusAnnot(); |
| 31 nRet = pApp->JS_appAlert(swMsg, swTitle, nType, nIcon); | 31 nRet = pApp->JS_appAlert(swMsg, swTitle, nType, nIcon); |
| 32 } | 32 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 55 { | 55 { |
| 56 m_pJSObject = NULL; | 56 m_pJSObject = NULL; |
| 57 | 57 |
| 58 } | 58 } |
| 59 | 59 |
| 60 CPDFSDK_PageView* CJS_EmbedObj::JSGetPageView(IFXJS_Context* cc) | 60 CPDFSDK_PageView* CJS_EmbedObj::JSGetPageView(IFXJS_Context* cc) |
| 61 { | 61 { |
| 62 return FXJS_GetPageView(cc); | 62 return FXJS_GetPageView(cc); |
| 63 } | 63 } |
| 64 | 64 |
| 65 int CJS_EmbedObj::MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView,
FX_LPCWSTR swMsg,FX_LPCWSTR swTitle,FX_UINT nType,FX_UINT nIcon) | 65 int CJS_EmbedObj::MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView,
const FX_WCHAR* swMsg,const FX_WCHAR* swTitle,FX_UINT nType,FX_UINT nIcon) |
| 66 { | 66 { |
| 67 return FXJS_MsgBox(pApp, pPageView, swMsg, swTitle, nType, nIcon); | 67 return FXJS_MsgBox(pApp, pPageView, swMsg, swTitle, nType, nIcon); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void CJS_EmbedObj::Alert(CJS_Context* pContext, FX_LPCWSTR swMsg) | 70 void CJS_EmbedObj::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) |
| 71 { | 71 { |
| 72 CJS_Object::Alert(pContext, swMsg); | 72 CJS_Object::Alert(pContext, swMsg); |
| 73 } | 73 } |
| 74 | 74 |
| 75 CJS_Timer* CJS_EmbedObj::BeginTimer(CPDFDoc_Environment * pApp,FX_UINT nElapse) | 75 CJS_Timer* CJS_EmbedObj::BeginTimer(CPDFDoc_Environment * pApp,FX_UINT nElapse) |
| 76 { | 76 { |
| 77 CJS_Timer* pTimer = new CJS_Timer(this,pApp); | 77 CJS_Timer* pTimer = new CJS_Timer(this,pApp); |
| 78 pTimer->SetJSTimer(nElapse); | 78 pTimer->SetJSTimer(nElapse); |
| 79 | 79 |
| 80 return pTimer; | 80 return pTimer; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 void CJS_Object::Dispose() | 127 void CJS_Object::Dispose() |
| 128 { | 128 { |
| 129 m_pObject.Reset(); | 129 m_pObject.Reset(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 CPDFSDK_PageView* CJS_Object::JSGetPageView(IFXJS_Context* cc) | 132 CPDFSDK_PageView* CJS_Object::JSGetPageView(IFXJS_Context* cc) |
| 133 { | 133 { |
| 134 return FXJS_GetPageView(cc); | 134 return FXJS_GetPageView(cc); |
| 135 } | 135 } |
| 136 | 136 |
| 137 int CJS_Object::MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, F
X_LPCWSTR swMsg, FX_LPCWSTR swTitle, FX_UINT nType, FX_UINT nIcon) | 137 int CJS_Object::MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, c
onst FX_WCHAR* swMsg, const FX_WCHAR* swTitle, FX_UINT nType, FX_UINT nIcon) |
| 138 { | 138 { |
| 139 return FXJS_MsgBox(pApp, pPageView, swMsg, swTitle, nType, nIcon); | 139 return FXJS_MsgBox(pApp, pPageView, swMsg, swTitle, nType, nIcon); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void CJS_Object::Alert(CJS_Context* pContext, FX_LPCWSTR swMsg) | 142 void CJS_Object::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) |
| 143 { | 143 { |
| 144 ASSERT(pContext != NULL); | 144 ASSERT(pContext != NULL); |
| 145 | 145 |
| 146 if (pContext->IsMsgBoxEnabled()) | 146 if (pContext->IsMsgBoxEnabled()) |
| 147 { | 147 { |
| 148 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); | 148 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); |
| 149 if(pApp) | 149 if(pApp) |
| 150 pApp->JS_appAlert(swMsg, NULL, 0, 3); | 150 pApp->JS_appAlert(swMsg, NULL, 0, 3); |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 | 154 |
| OLD | NEW |