| 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" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 126 } |
| 127 | 127 |
| 128 app::~app(void) | 128 app::~app(void) |
| 129 { | 129 { |
| 130 for (int i=0,sz=m_aTimer.GetSize(); i<sz; i++) | 130 for (int i=0,sz=m_aTimer.GetSize(); i<sz; i++) |
| 131 delete m_aTimer[i]; | 131 delete m_aTimer[i]; |
| 132 | 132 |
| 133 m_aTimer.RemoveAll(); | 133 m_aTimer.RemoveAll(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 FX_BOOL app::activeDocs(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sE
rror) | 136 FX_BOOL app::activeDocs(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) |
| 137 { | 137 { |
| 138 if (vp.IsGetting()) | 138 if (vp.IsGetting()) |
| 139 { | 139 { |
| 140 | 140 |
| 141 CJS_Context* pContext = (CJS_Context *)cc; | 141 CJS_Context* pContext = (CJS_Context *)cc; |
| 142 ASSERT(pContext != NULL); | 142 ASSERT(pContext != NULL); |
| 143 | 143 |
| 144 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); | 144 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); |
| 145 ASSERT(pApp != NULL); | 145 ASSERT(pApp != NULL); |
| 146 | 146 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 if (aDocs.GetLength() > 0) | 185 if (aDocs.GetLength() > 0) |
| 186 vp << aDocs; | 186 vp << aDocs; |
| 187 else | 187 else |
| 188 vp.SetNull(); | 188 vp.SetNull(); |
| 189 return TRUE; | 189 return TRUE; |
| 190 } | 190 } |
| 191 return FALSE; | 191 return FALSE; |
| 192 } | 192 } |
| 193 | 193 |
| 194 FX_BOOL app::calculate(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sEr
ror) | 194 FX_BOOL app::calculate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror) |
| 195 { | 195 { |
| 196 if (vp.IsSetting()) | 196 if (vp.IsSetting()) |
| 197 { | 197 { |
| 198 bool bVP; | 198 bool bVP; |
| 199 vp >> bVP; | 199 vp >> bVP; |
| 200 m_bCalculate = (FX_BOOL)bVP; | 200 m_bCalculate = (FX_BOOL)bVP; |
| 201 | 201 |
| 202 CJS_Context* pContext = (CJS_Context*)cc; | 202 CJS_Context* pContext = (CJS_Context*)cc; |
| 203 ASSERT(pContext != NULL); | 203 ASSERT(pContext != NULL); |
| 204 | 204 |
| 205 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); | 205 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); |
| 206 ASSERT(pApp != NULL); | 206 ASSERT(pApp != NULL); |
| 207 | 207 |
| 208 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 208 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 209 ASSERT(pRuntime != NULL); | 209 ASSERT(pRuntime != NULL); |
| 210 | 210 |
| 211 CJS_Array aDocs(pRuntime->GetIsolate()); | 211 CJS_Array aDocs(pRuntime->GetIsolate()); |
| 212 // » » int iNumDocs = pApp->CountDocuments(); | 212 » » if (CPDFSDK_Document* pDoc = pApp->GetCurrentDoc()) |
| 213 // | 213 » » { |
| 214 // » » for (int iIndex = 0;iIndex < iNumDocs; iIndex++) | 214 » » » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDoc
->GetInterForm(); |
| 215 // » » { | 215 » » » ASSERT(pInterForm != NULL); |
| 216 » » » if (CPDFSDK_Document* pDoc = pApp->GetCurrentDoc()) | 216 » » » pInterForm->EnableCalculate((FX_BOOL)m_bCalculate); |
| 217 » » » { | 217 » » } |
| 218 » » » » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterFo
rm*)pDoc->GetInterForm(); | |
| 219 » » » » ASSERT(pInterForm != NULL); | |
| 220 » » » » pInterForm->EnableCalculate((FX_BOOL)m_bCalculat
e); | |
| 221 » » » } | |
| 222 //» » } | |
| 223 } | 218 } |
| 224 else | 219 else |
| 225 { | 220 { |
| 226 vp << (bool)m_bCalculate; | 221 vp << (bool)m_bCalculate; |
| 227 } | 222 } |
| 228 | 223 |
| 229 return TRUE; | 224 return TRUE; |
| 230 } | 225 } |
| 231 | 226 |
| 232 FX_BOOL app::formsVersion(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 227 FX_BOOL app::formsVersion(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
| 233 { | 228 { |
| 234 if (vp.IsGetting()) | 229 if (vp.IsGetting()) |
| 235 { | 230 { |
| 236 vp << JS_NUM_FORMSVERSION; | 231 vp << JS_NUM_FORMSVERSION; |
| 237 return TRUE; | 232 return TRUE; |
| 238 } | 233 } |
| 239 | 234 |
| 240 return FALSE; | 235 return FALSE; |
| 241 } | 236 } |
| 242 | 237 |
| 243 FX_BOOL app::viewerType(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sE
rror) | 238 FX_BOOL app::viewerType(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) |
| 244 { | 239 { |
| 245 if (vp.IsGetting()) | 240 if (vp.IsGetting()) |
| 246 { | 241 { |
| 247 vp << L"unknown"; | 242 vp << L"unknown"; |
| 248 return TRUE; | 243 return TRUE; |
| 249 } | 244 } |
| 250 | 245 |
| 251 return FALSE; | 246 return FALSE; |
| 252 } | 247 } |
| 253 | 248 |
| 254 FX_BOOL app::viewerVariation(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorStrin
g& sError) | 249 FX_BOOL app::viewerVariation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStrin
g& sError) |
| 255 { | 250 { |
| 256 if (vp.IsGetting()) | 251 if (vp.IsGetting()) |
| 257 { | 252 { |
| 258 vp << JS_STR_VIEWERVARIATION; | 253 vp << JS_STR_VIEWERVARIATION; |
| 259 return TRUE; | 254 return TRUE; |
| 260 } | 255 } |
| 261 | 256 |
| 262 return FALSE; | 257 return FALSE; |
| 263 } | 258 } |
| 264 | 259 |
| 265 FX_BOOL app::viewerVersion(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 260 FX_BOOL app::viewerVersion(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
| 266 { | 261 { |
| 267 if (vp.IsGetting()) | 262 if (vp.IsGetting()) |
| 268 { | 263 { |
| 269 vp << JS_STR_VIEWERVERSION; | 264 vp << JS_STR_VIEWERVERSION; |
| 270 return TRUE; | 265 return TRUE; |
| 271 } | 266 } |
| 272 | 267 |
| 273 return FALSE; | 268 return FALSE; |
| 274 } | 269 } |
| 275 | 270 |
| 276 FX_BOOL app::platform(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sErr
or) | 271 FX_BOOL app::platform(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or) |
| 277 { | 272 { |
| 278 if (vp.IsGetting()) | 273 if (vp.IsGetting()) |
| 279 { | 274 { |
| 280 vp << JS_STR_PLATFORM; | 275 vp << JS_STR_PLATFORM; |
| 281 return TRUE; | 276 return TRUE; |
| 282 } | 277 } |
| 283 | 278 |
| 284 return FALSE; | 279 return FALSE; |
| 285 } | 280 } |
| 286 | 281 |
| 287 FX_BOOL app::language(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sErr
or) | 282 FX_BOOL app::language(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or) |
| 288 { | 283 { |
| 289 if (vp.IsGetting()) | 284 if (vp.IsGetting()) |
| 290 { | 285 { |
| 291 vp << JS_STR_LANGUANGE; | 286 vp << JS_STR_LANGUANGE; |
| 292 return TRUE; | 287 return TRUE; |
| 293 } | 288 } |
| 294 | 289 |
| 295 return FALSE; | 290 return FALSE; |
| 296 } | 291 } |
| 297 | 292 |
| 298 //creates a new fdf object that contains no data | 293 //creates a new fdf object that contains no data |
| 299 //comment: need reader support | 294 //comment: need reader support |
| 300 //note: | 295 //note: |
| 301 //CFDF_Document * CPDFDoc_Environment::NewFDF(); | 296 //CFDF_Document * CPDFDoc_Environment::NewFDF(); |
| 302 FX_BOOL app::newFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, JS_ErrorString& sError) | 297 FX_BOOL app::newFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, CFX_WideString& sError) |
| 303 { | 298 { |
| 304 return TRUE; | 299 return TRUE; |
| 305 } | 300 } |
| 306 //opens a specified pdf document and returns its document object | 301 //opens a specified pdf document and returns its document object |
| 307 //comment:need reader support | 302 //comment:need reader support |
| 308 //note: as defined in js reference, the proto of this function's fourth parmeter
s, how old an fdf document while do not show it. | 303 //note: as defined in js reference, the proto of this function's fourth parmeter
s, how old an fdf document while do not show it. |
| 309 //CFDF_Document * CPDFDoc_Environment::OpenFDF(string strPath,bool bUserConv); | 304 //CFDF_Document * CPDFDoc_Environment::OpenFDF(string strPath,bool bUserConv); |
| 310 | 305 |
| 311 FX_BOOL app::openFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, JS_ErrorString& sError) | 306 FX_BOOL app::openFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, CFX_WideString& sError) |
| 312 { | 307 { |
| 313 return TRUE; | 308 return TRUE; |
| 314 } | 309 } |
| 315 | 310 |
| 316 FX_BOOL app::alert(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& v
Ret, JS_ErrorString& sError) | 311 FX_BOOL app::alert(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& v
Ret, CFX_WideString& sError) |
| 317 { | 312 { |
| 318 int iSize = params.size(); | 313 int iSize = params.size(); |
| 319 if (iSize < 1) | 314 if (iSize < 1) |
| 320 return FALSE; | 315 return FALSE; |
| 321 | 316 |
| 322 CFX_WideString swMsg = L""; | 317 CFX_WideString swMsg = L""; |
| 323 CFX_WideString swTitle = L""; | 318 CFX_WideString swTitle = L""; |
| 324 int iIcon = 0; | 319 int iIcon = 0; |
| 325 int iType = 0; | 320 int iType = 0; |
| 326 | 321 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 426 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 432 ASSERT(pRuntime != NULL); | 427 ASSERT(pRuntime != NULL); |
| 433 pRuntime->BeginBlock(); | 428 pRuntime->BeginBlock(); |
| 434 vRet = MsgBox(pRuntime->GetReaderApp(), JSGetPageView(cc),swMsg,swTitle,
iType,iIcon); | 429 vRet = MsgBox(pRuntime->GetReaderApp(), JSGetPageView(cc),swMsg,swTitle,
iType,iIcon); |
| 435 pRuntime->EndBlock(); | 430 pRuntime->EndBlock(); |
| 436 | 431 |
| 437 return TRUE; | 432 return TRUE; |
| 438 } | 433 } |
| 439 | 434 |
| 440 | 435 |
| 441 FX_BOOL app::beep(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vR
et, JS_ErrorString& sError) | 436 FX_BOOL app::beep(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vR
et, CFX_WideString& sError) |
| 442 { | 437 { |
| 443 if (params.size() == 1) | 438 if (params.size() == 1) |
| 444 { | 439 { |
| 445 CJS_Context* pContext = (CJS_Context*)cc; | 440 CJS_Context* pContext = (CJS_Context*)cc; |
| 446 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 441 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 447 CPDFDoc_Environment * pEnv = pRuntime->GetReaderApp(); | 442 CPDFDoc_Environment * pEnv = pRuntime->GetReaderApp(); |
| 448 pEnv->JS_appBeep((int)params[0]); | 443 pEnv->JS_appBeep((int)params[0]); |
| 449 | 444 |
| 450 return TRUE; | 445 return TRUE; |
| 451 } | 446 } |
| 452 else | 447 else |
| 453 { | 448 { |
| 454 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME
RROR); | 449 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME
RROR); |
| 455 return FALSE; | 450 return FALSE; |
| 456 } | 451 } |
| 457 } | 452 } |
| 458 | 453 |
| 459 FX_BOOL app::findComponent(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, JS_ErrorString& sError) | 454 FX_BOOL app::findComponent(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError) |
| 460 { | 455 { |
| 461 return TRUE; | 456 return TRUE; |
| 462 } | 457 } |
| 463 | 458 |
| 464 FX_BOOL app::popUpMenuEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, JS_ErrorString& sError) | 459 FX_BOOL app::popUpMenuEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError) |
| 465 { | 460 { |
| 466 return FALSE; | 461 return FALSE; |
| 467 } | 462 } |
| 468 | 463 |
| 469 FX_BOOL app::fs(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sError) | 464 FX_BOOL app::fs(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
| 470 { | 465 { |
| 471 return FALSE; | 466 return FALSE; |
| 472 } | 467 } |
| 473 | 468 |
| 474 FX_BOOL app::setInterval(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, JS_ErrorString& sError) | 469 FX_BOOL app::setInterval(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError) |
| 475 { | 470 { |
| 476 if (params.size() > 2 || params.size() == 0) | 471 if (params.size() > 2 || params.size() == 0) |
| 477 { | 472 { |
| 478 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME
RROR); | 473 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME
RROR); |
| 479 return FALSE; | 474 return FALSE; |
| 480 } | 475 } |
| 481 | 476 |
| 482 CJS_Context* pContext = (CJS_Context*)cc; | 477 CJS_Context* pContext = (CJS_Context*)cc; |
| 483 ASSERT(pContext != NULL); | 478 ASSERT(pContext != NULL); |
| 484 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 479 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 513 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); | 508 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); |
| 514 ASSERT(pTimerObj != NULL); | 509 ASSERT(pTimerObj != NULL); |
| 515 | 510 |
| 516 pTimerObj->SetTimer(pTimer); | 511 pTimerObj->SetTimer(pTimer); |
| 517 | 512 |
| 518 vRet = pRetObj; | 513 vRet = pRetObj; |
| 519 | 514 |
| 520 return TRUE; | 515 return TRUE; |
| 521 } | 516 } |
| 522 | 517 |
| 523 FX_BOOL app::setTimeOut(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, JS_ErrorString& sError) | 518 FX_BOOL app::setTimeOut(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, CFX_WideString& sError) |
| 524 { | 519 { |
| 525 if (params.size() > 2 || params.size() == 0) | 520 if (params.size() > 2 || params.size() == 0) |
| 526 { | 521 { |
| 527 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME
RROR); | 522 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME
RROR); |
| 528 return FALSE; | 523 return FALSE; |
| 529 } | 524 } |
| 530 | 525 |
| 531 CJS_Context* pContext = (CJS_Context*)cc; | 526 CJS_Context* pContext = (CJS_Context*)cc; |
| 532 ASSERT(pContext != NULL); | 527 ASSERT(pContext != NULL); |
| 533 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 528 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 564 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); | 559 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); |
| 565 ASSERT(pTimerObj != NULL); | 560 ASSERT(pTimerObj != NULL); |
| 566 | 561 |
| 567 pTimerObj->SetTimer(pTimer); | 562 pTimerObj->SetTimer(pTimer); |
| 568 | 563 |
| 569 vRet = pRetObj; | 564 vRet = pRetObj; |
| 570 | 565 |
| 571 return TRUE; | 566 return TRUE; |
| 572 } | 567 } |
| 573 | 568 |
| 574 FX_BOOL app::clearTimeOut(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, JS_ErrorString& sError) | 569 FX_BOOL app::clearTimeOut(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) |
| 575 { | 570 { |
| 576 CJS_Context* pContext = (CJS_Context*)cc; | 571 CJS_Context* pContext = (CJS_Context*)cc; |
| 577 ASSERT(pContext != NULL); | 572 ASSERT(pContext != NULL); |
| 578 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 573 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 579 ASSERT(pRuntime != NULL); | 574 ASSERT(pRuntime != NULL); |
| 580 | 575 |
| 581 if (params.size() != 1) | 576 if (params.size() != 1) |
| 582 { | 577 { |
| 583 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME
RROR); | 578 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME
RROR); |
| 584 return FALSE; | 579 return FALSE; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 612 } | 607 } |
| 613 } | 608 } |
| 614 } | 609 } |
| 615 } | 610 } |
| 616 } | 611 } |
| 617 } | 612 } |
| 618 | 613 |
| 619 return TRUE; | 614 return TRUE; |
| 620 } | 615 } |
| 621 | 616 |
| 622 FX_BOOL app::clearInterval(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, JS_ErrorString& sError) | 617 FX_BOOL app::clearInterval(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError) |
| 623 { | 618 { |
| 624 CJS_Context* pContext = (CJS_Context*)cc; | 619 CJS_Context* pContext = (CJS_Context*)cc; |
| 625 ASSERT(pContext != NULL); | 620 ASSERT(pContext != NULL); |
| 626 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 621 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 627 ASSERT(pRuntime != NULL); | 622 ASSERT(pRuntime != NULL); |
| 628 | 623 |
| 629 if (params.size() != 1) | 624 if (params.size() != 1) |
| 630 { | 625 { |
| 631 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME
RROR); | 626 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME
RROR); |
| 632 return FALSE; | 627 return FALSE; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 660 } | 655 } |
| 661 } | 656 } |
| 662 } | 657 } |
| 663 } | 658 } |
| 664 } | 659 } |
| 665 } | 660 } |
| 666 | 661 |
| 667 return TRUE; | 662 return TRUE; |
| 668 } | 663 } |
| 669 | 664 |
| 670 FX_BOOL app::execMenuItem(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, JS_ErrorString& sError) | 665 FX_BOOL app::execMenuItem(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) |
| 671 { | 666 { |
| 672 return FALSE; | 667 return FALSE; |
| 673 } | 668 } |
| 674 | 669 |
| 675 void app::TimerProc(CJS_Timer* pTimer) | 670 void app::TimerProc(CJS_Timer* pTimer) |
| 676 { | 671 { |
| 677 ASSERT(pTimer != NULL); | 672 ASSERT(pTimer != NULL); |
| 678 | 673 |
| 679 switch (pTimer->GetType()) | 674 switch (pTimer->GetType()) |
| 680 { | 675 { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 700 { | 695 { |
| 701 IFXJS_Context* pContext = pRuntime->NewContext(); | 696 IFXJS_Context* pContext = pRuntime->NewContext(); |
| 702 ASSERT(pContext != NULL); | 697 ASSERT(pContext != NULL); |
| 703 pContext->OnExternal_Exec(); | 698 pContext->OnExternal_Exec(); |
| 704 CFX_WideString wtInfo; | 699 CFX_WideString wtInfo; |
| 705 pContext->RunScript(wsScript,wtInfo); | 700 pContext->RunScript(wsScript,wtInfo); |
| 706 pRuntime->ReleaseContext(pContext); | 701 pRuntime->ReleaseContext(pContext); |
| 707 } | 702 } |
| 708 } | 703 } |
| 709 | 704 |
| 710 FX_BOOL app::goBack(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, JS_ErrorString& sError) | 705 FX_BOOL app::goBack(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, CFX_WideString& sError) |
| 711 { | 706 { |
| 712 // Not supported. | 707 // Not supported. |
| 713 return TRUE; | 708 return TRUE; |
| 714 } | 709 } |
| 715 | 710 |
| 716 FX_BOOL app::goForward(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu
e& vRet, JS_ErrorString& sError) | 711 FX_BOOL app::goForward(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu
e& vRet, CFX_WideString& sError) |
| 717 { | 712 { |
| 718 // Not supported. | 713 // Not supported. |
| 719 return TRUE; | 714 return TRUE; |
| 720 } | 715 } |
| 721 | 716 |
| 722 FX_BOOL app::mailMsg(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, JS_ErrorString& sError) | 717 FX_BOOL app::mailMsg(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, CFX_WideString& sError) |
| 723 { | 718 { |
| 724 CJS_Context* pContext = (CJS_Context*)cc; | 719 CJS_Context* pContext = (CJS_Context*)cc; |
| 725 ASSERT(pContext != NULL); | 720 ASSERT(pContext != NULL); |
| 726 | 721 |
| 727 v8::Isolate* isolate = GetIsolate(cc); | 722 v8::Isolate* isolate = GetIsolate(cc); |
| 728 | 723 |
| 729 FX_BOOL bUI = TRUE; | 724 FX_BOOL bUI = TRUE; |
| 730 CFX_WideString cTo = L""; | 725 CFX_WideString cTo = L""; |
| 731 CFX_WideString cCc = L""; | 726 CFX_WideString cCc = L""; |
| 732 CFX_WideString cBcc = L""; | 727 CFX_WideString cBcc = L""; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 | 771 |
| 777 pRuntime->BeginBlock(); | 772 pRuntime->BeginBlock(); |
| 778 pApp->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_
str(), cBcc.c_str(), cMsg.c_str()); | 773 pApp->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_
str(), cBcc.c_str(), cMsg.c_str()); |
| 779 ////////////////////////////////////////////////////////////////////////
/////////////////////// | 774 ////////////////////////////////////////////////////////////////////////
/////////////////////// |
| 780 pRuntime->EndBlock(); | 775 pRuntime->EndBlock(); |
| 781 | 776 |
| 782 //return bRet; | 777 //return bRet; |
| 783 return FALSE; | 778 return FALSE; |
| 784 } | 779 } |
| 785 | 780 |
| 786 FX_BOOL app::launchURL(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu
e& vRet, JS_ErrorString& sError) | 781 FX_BOOL app::launchURL(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu
e& vRet, CFX_WideString& sError) |
| 787 { | 782 { |
| 788 // Unsafe, not supported. | 783 // Unsafe, not supported. |
| 789 return TRUE; | 784 return TRUE; |
| 790 } | 785 } |
| 791 | 786 |
| 792 FX_BOOL app::runtimeHighlight(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorStri
ng& sError) | 787 FX_BOOL app::runtimeHighlight(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri
ng& sError) |
| 793 { | 788 { |
| 794 if (vp.IsSetting()) | 789 if (vp.IsSetting()) |
| 795 { | 790 { |
| 796 vp>>m_bRuntimeHighLight; | 791 vp>>m_bRuntimeHighLight; |
| 797 } | 792 } |
| 798 else | 793 else |
| 799 { | 794 { |
| 800 vp<<m_bRuntimeHighLight; | 795 vp<<m_bRuntimeHighLight; |
| 801 } | 796 } |
| 802 | 797 |
| 803 return TRUE; | 798 return TRUE; |
| 804 } | 799 } |
| 805 | 800 |
| 806 FX_BOOL app::fullscreen(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sE
rror) | 801 FX_BOOL app::fullscreen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) |
| 807 { | 802 { |
| 808 return FALSE; | 803 return FALSE; |
| 809 } | 804 } |
| 810 | 805 |
| 811 FX_BOOL app::popUpMenu(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu
e& vRet, JS_ErrorString& sError) | 806 FX_BOOL app::popUpMenu(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu
e& vRet, CFX_WideString& sError) |
| 812 { | 807 { |
| 813 return FALSE; | 808 return FALSE; |
| 814 } | 809 } |
| 815 | 810 |
| 816 | 811 |
| 817 FX_BOOL app::browseForDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, JS_ErrorString& sError) | 812 FX_BOOL app::browseForDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) |
| 818 { | 813 { |
| 819 // Unsafe, not supported. | 814 // Unsafe, not supported. |
| 820 return TRUE; | 815 return TRUE; |
| 821 } | 816 } |
| 822 | 817 |
| 823 CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath) | 818 CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath) |
| 824 { | 819 { |
| 825 CFX_WideString sRet = L"/"; | 820 CFX_WideString sRet = L"/"; |
| 826 | 821 |
| 827 for (int i=0,sz=sOldPath.GetLength(); i<sz; i++) | 822 for (int i=0,sz=sOldPath.GetLength(); i<sz; i++) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 839 else | 834 else |
| 840 { | 835 { |
| 841 sRet += c; | 836 sRet += c; |
| 842 } | 837 } |
| 843 } | 838 } |
| 844 } | 839 } |
| 845 | 840 |
| 846 return sRet; | 841 return sRet; |
| 847 } | 842 } |
| 848 | 843 |
| 849 FX_BOOL app::newDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, JS_ErrorString& sError) | 844 FX_BOOL app::newDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, CFX_WideString& sError) |
| 850 { | 845 { |
| 851 return FALSE; | 846 return FALSE; |
| 852 } | 847 } |
| 853 | 848 |
| 854 FX_BOOL app::openDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, JS_ErrorString& sError) | 849 FX_BOOL app::openDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, CFX_WideString& sError) |
| 855 { | 850 { |
| 856 return FALSE; | 851 return FALSE; |
| 857 } | 852 } |
| 858 | 853 |
| 859 FX_BOOL app::response(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value
& vRet, JS_ErrorString& sError) | 854 FX_BOOL app::response(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value
& vRet, CFX_WideString& sError) |
| 860 { | 855 { |
| 861 CFX_WideString swQuestion = L""; | 856 CFX_WideString swQuestion = L""; |
| 862 CFX_WideString swLabel = L""; | 857 CFX_WideString swLabel = L""; |
| 863 CFX_WideString swTitle = L"PDF"; | 858 CFX_WideString swTitle = L"PDF"; |
| 864 CFX_WideString swDefault = L""; | 859 CFX_WideString swDefault = L""; |
| 865 bool bPassWord = false; | 860 bool bPassWord = false; |
| 866 | 861 |
| 867 v8::Isolate* isolate = GetIsolate(cc); | 862 v8::Isolate* isolate = GetIsolate(cc); |
| 868 | 863 |
| 869 int iLength = params.size(); | 864 int iLength = params.size(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 return FALSE; | 924 return FALSE; |
| 930 } | 925 } |
| 931 if (nLengthBytes > MAX_INPUT_BYTES) | 926 if (nLengthBytes > MAX_INPUT_BYTES) |
| 932 nLengthBytes = MAX_INPUT_BYTES; | 927 nLengthBytes = MAX_INPUT_BYTES; |
| 933 | 928 |
| 934 vRet = CFX_WideString::FromUTF16LE((unsigned short*)pBuff, nLengthBytes
/ sizeof(unsigned short)); | 929 vRet = CFX_WideString::FromUTF16LE((unsigned short*)pBuff, nLengthBytes
/ sizeof(unsigned short)); |
| 935 delete[] pBuff; | 930 delete[] pBuff; |
| 936 return TRUE; | 931 return TRUE; |
| 937 } | 932 } |
| 938 | 933 |
| 939 FX_BOOL app::media(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sError) | 934 FX_BOOL app::media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
| 940 { | 935 { |
| 941 return FALSE; | 936 return FALSE; |
| 942 } | 937 } |
| 943 | 938 |
| 944 FX_BOOL app::execDialog(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, JS_ErrorString& sError) | 939 FX_BOOL app::execDialog(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, CFX_WideString& sError) |
| 945 { | 940 { |
| 946 return TRUE; | 941 return TRUE; |
| 947 } | 942 } |
| OLD | NEW |