Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: fpdfsdk/src/javascript/app.cpp

Issue 969203002: Merge to XFA: Kill off JS_ErrorString type. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/javascript/PublicMethods.cpp ('k') | fpdfsdk/src/javascript/color.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 app::~app(void) 129 app::~app(void)
130 { 130 {
131 for (int i=0,sz=m_aTimer.GetSize(); i<sz; i++) 131 for (int i=0,sz=m_aTimer.GetSize(); i<sz; i++)
132 delete m_aTimer[i]; 132 delete m_aTimer[i];
133 133
134 m_aTimer.RemoveAll(); 134 m_aTimer.RemoveAll();
135 } 135 }
136 136
137 FX_BOOL app::activeDocs(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sE rror) 137 FX_BOOL app::activeDocs(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror)
138 { 138 {
139 if (vp.IsGetting()) 139 if (vp.IsGetting())
140 { 140 {
141 141
142 CJS_Context* pContext = (CJS_Context *)cc; 142 CJS_Context* pContext = (CJS_Context *)cc;
143 ASSERT(pContext != NULL); 143 ASSERT(pContext != NULL);
144 144
145 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); 145 CPDFDoc_Environment* pApp = pContext->GetReaderApp();
146 ASSERT(pApp != NULL); 146 ASSERT(pApp != NULL);
147 147
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 if (aDocs.GetLength() > 0) 186 if (aDocs.GetLength() > 0)
187 vp << aDocs; 187 vp << aDocs;
188 else 188 else
189 vp.SetNull(); 189 vp.SetNull();
190 return TRUE; 190 return TRUE;
191 } 191 }
192 return FALSE; 192 return FALSE;
193 } 193 }
194 194
195 FX_BOOL app::calculate(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sEr ror) 195 FX_BOOL app::calculate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr ror)
196 { 196 {
197 if (vp.IsSetting()) 197 if (vp.IsSetting())
198 { 198 {
199 bool bVP; 199 bool bVP;
200 vp >> bVP; 200 vp >> bVP;
201 m_bCalculate = (FX_BOOL)bVP; 201 m_bCalculate = (FX_BOOL)bVP;
202 202
203 CJS_Context* pContext = (CJS_Context*)cc; 203 CJS_Context* pContext = (CJS_Context*)cc;
204 ASSERT(pContext != NULL); 204 ASSERT(pContext != NULL);
205 205
206 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); 206 CPDFDoc_Environment* pApp = pContext->GetReaderApp();
207 ASSERT(pApp != NULL); 207 ASSERT(pApp != NULL);
208 208
209 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 209 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
210 ASSERT(pRuntime != NULL); 210 ASSERT(pRuntime != NULL);
211 211
212 CJS_Array aDocs(pRuntime->GetIsolate()); 212 CJS_Array aDocs(pRuntime->GetIsolate());
213 // » » int iNumDocs = pApp->CountDocuments(); 213 » » if (CPDFSDK_Document* pDoc = pApp->GetCurrentDoc())
214 // 214 » » {
215 // » » for (int iIndex = 0;iIndex < iNumDocs; iIndex++) 215 » » » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDoc ->GetInterForm();
216 // » » { 216 » » » ASSERT(pInterForm != NULL);
217 » » » if (CPDFSDK_Document* pDoc = pApp->GetCurrentDoc()) 217 » » » pInterForm->EnableCalculate((FX_BOOL)m_bCalculate);
218 » » » { 218 » » }
219 » » » » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterFo rm*)pDoc->GetInterForm();
220 » » » » ASSERT(pInterForm != NULL);
221 » » » » pInterForm->EnableCalculate((FX_BOOL)m_bCalculat e);
222 » » » }
223 //» » }
224 } 219 }
225 else 220 else
226 { 221 {
227 vp << (bool)m_bCalculate; 222 vp << (bool)m_bCalculate;
228 } 223 }
229 224
230 return TRUE; 225 return TRUE;
231 } 226 }
232 227
233 FX_BOOL app::formsVersion(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sError) 228 FX_BOOL app::formsVersion(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
234 { 229 {
235 if (vp.IsGetting()) 230 if (vp.IsGetting())
236 { 231 {
237 vp << JS_NUM_FORMSVERSION; 232 vp << JS_NUM_FORMSVERSION;
238 return TRUE; 233 return TRUE;
239 } 234 }
240 235
241 return FALSE; 236 return FALSE;
242 } 237 }
243 238
244 FX_BOOL app::viewerType(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sE rror) 239 FX_BOOL app::viewerType(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror)
245 { 240 {
246 if (vp.IsGetting()) 241 if (vp.IsGetting())
247 { 242 {
248 vp << L"unknown"; 243 vp << L"unknown";
249 return TRUE; 244 return TRUE;
250 } 245 }
251 246
252 return FALSE; 247 return FALSE;
253 } 248 }
254 249
255 FX_BOOL app::viewerVariation(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorStrin g& sError) 250 FX_BOOL app::viewerVariation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStrin g& sError)
256 { 251 {
257 if (vp.IsGetting()) 252 if (vp.IsGetting())
258 { 253 {
259 vp << JS_STR_VIEWERVARIATION; 254 vp << JS_STR_VIEWERVARIATION;
260 return TRUE; 255 return TRUE;
261 } 256 }
262 257
263 return FALSE; 258 return FALSE;
264 } 259 }
265 260
266 FX_BOOL app::viewerVersion(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sError) 261 FX_BOOL app::viewerVersion(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
267 { 262 {
268 if (vp.IsGetting()) 263 if (vp.IsGetting())
269 { 264 {
270 CJS_Context* pContext = (CJS_Context *)cc; 265 CJS_Context* pContext = (CJS_Context *)cc;
271 ASSERT(pContext != NULL); 266 ASSERT(pContext != NULL);
272 267
273 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); 268 CPDFDoc_Environment* pApp = pContext->GetReaderApp();
274 ASSERT(pApp != NULL); 269 ASSERT(pApp != NULL);
275 270
276 CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); 271 CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument();
277 272
278 CPDFXFA_Document* pDoc = pCurDoc->GetDocument(); 273 CPDFXFA_Document* pDoc = pCurDoc->GetDocument();
279 if (pDoc->GetDocType() == 1 || pDoc->GetDocType() == 2) 274 if (pDoc->GetDocType() == 1 || pDoc->GetDocType() == 2)
280 vp << JS_STR_VIEWERVERSION_XFA; 275 vp << JS_STR_VIEWERVERSION_XFA;
281 else 276 else
282 vp << JS_STR_VIEWERVERSION; 277 vp << JS_STR_VIEWERVERSION;
283 return TRUE; 278 return TRUE;
284 } 279 }
285 280
286 return FALSE; 281 return FALSE;
287 } 282 }
288 283
289 FX_BOOL app::platform(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sErr or) 284 FX_BOOL app::platform(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr or)
290 { 285 {
291 if (vp.IsGetting()) 286 if (vp.IsGetting())
292 { 287 {
293 vp << JS_STR_PLATFORM; 288 vp << JS_STR_PLATFORM;
294 return TRUE; 289 return TRUE;
295 } 290 }
296 291
297 return FALSE; 292 return FALSE;
298 } 293 }
299 294
300 FX_BOOL app::language(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sErr or) 295 FX_BOOL app::language(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr or)
301 { 296 {
302 if (vp.IsGetting()) 297 if (vp.IsGetting())
303 { 298 {
304 vp << JS_STR_LANGUANGE; 299 vp << JS_STR_LANGUANGE;
305 return TRUE; 300 return TRUE;
306 } 301 }
307 302
308 return FALSE; 303 return FALSE;
309 } 304 }
310 305
311 //creates a new fdf object that contains no data 306 //creates a new fdf object that contains no data
312 //comment: need reader support 307 //comment: need reader support
313 //note: 308 //note:
314 //CFDF_Document * CPDFDoc_Environment::NewFDF(); 309 //CFDF_Document * CPDFDoc_Environment::NewFDF();
315 FX_BOOL app::newFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, JS_ErrorString& sError) 310 FX_BOOL app::newFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
316 { 311 {
317 return TRUE; 312 return TRUE;
318 } 313 }
319 //opens a specified pdf document and returns its document object 314 //opens a specified pdf document and returns its document object
320 //comment:need reader support 315 //comment:need reader support
321 //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. 316 //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.
322 //CFDF_Document * CPDFDoc_Environment::OpenFDF(string strPath,bool bUserConv); 317 //CFDF_Document * CPDFDoc_Environment::OpenFDF(string strPath,bool bUserConv);
323 318
324 FX_BOOL app::openFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, JS_ErrorString& sError) 319 FX_BOOL app::openFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
325 { 320 {
326 return TRUE; 321 return TRUE;
327 } 322 }
328 323
329 FX_BOOL app::alert(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& v Ret, JS_ErrorString& sError) 324 FX_BOOL app::alert(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& v Ret, CFX_WideString& sError)
330 { 325 {
331 int iSize = params.size(); 326 int iSize = params.size();
332 if (iSize < 1) 327 if (iSize < 1)
333 return FALSE; 328 return FALSE;
334 329
335 CFX_WideString swMsg = L""; 330 CFX_WideString swMsg = L"";
336 CFX_WideString swTitle = L""; 331 CFX_WideString swTitle = L"";
337 int iIcon = 0; 332 int iIcon = 0;
338 int iType = 0; 333 int iType = 0;
339 334
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 439 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
445 ASSERT(pRuntime != NULL); 440 ASSERT(pRuntime != NULL);
446 pRuntime->BeginBlock(); 441 pRuntime->BeginBlock();
447 vRet = MsgBox(pRuntime->GetReaderApp(), JSGetPageView(cc),swMsg,swTitle, iType,iIcon); 442 vRet = MsgBox(pRuntime->GetReaderApp(), JSGetPageView(cc),swMsg,swTitle, iType,iIcon);
448 pRuntime->EndBlock(); 443 pRuntime->EndBlock();
449 444
450 return TRUE; 445 return TRUE;
451 } 446 }
452 447
453 448
454 FX_BOOL app::beep(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vR et, JS_ErrorString& sError) 449 FX_BOOL app::beep(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vR et, CFX_WideString& sError)
455 { 450 {
456 if (params.size() == 1) 451 if (params.size() == 1)
457 { 452 {
458 CJS_Context* pContext = (CJS_Context*)cc; 453 CJS_Context* pContext = (CJS_Context*)cc;
459 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 454 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
460 CPDFDoc_Environment * pEnv = pRuntime->GetReaderApp(); 455 CPDFDoc_Environment * pEnv = pRuntime->GetReaderApp();
461 pEnv->JS_appBeep((int)params[0]); 456 pEnv->JS_appBeep((int)params[0]);
462 457
463 return TRUE; 458 return TRUE;
464 } 459 }
465 else 460 else
466 { 461 {
467 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME RROR); 462 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME RROR);
468 return FALSE; 463 return FALSE;
469 } 464 }
470 } 465 }
471 466
472 FX_BOOL app::findComponent(IFXJS_Context* cc, const CJS_Parameters& params, CJS_ Value& vRet, JS_ErrorString& sError) 467 FX_BOOL app::findComponent(IFXJS_Context* cc, const CJS_Parameters& params, CJS_ Value& vRet, CFX_WideString& sError)
473 { 468 {
474 return TRUE; 469 return TRUE;
475 } 470 }
476 471
477 FX_BOOL app::popUpMenuEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va lue& vRet, JS_ErrorString& sError) 472 FX_BOOL app::popUpMenuEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va lue& vRet, CFX_WideString& sError)
478 { 473 {
479 return FALSE; 474 return FALSE;
480 } 475 }
481 476
482 FX_BOOL app::fs(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sError) 477 FX_BOOL app::fs(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
483 { 478 {
484 return FALSE; 479 return FALSE;
485 } 480 }
486 481
487 FX_BOOL app::setInterval(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va lue& vRet, JS_ErrorString& sError) 482 FX_BOOL app::setInterval(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va lue& vRet, CFX_WideString& sError)
488 { 483 {
489 if (params.size() > 2 || params.size() == 0) 484 if (params.size() > 2 || params.size() == 0)
490 { 485 {
491 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME RROR); 486 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME RROR);
492 return FALSE; 487 return FALSE;
493 } 488 }
494 489
495 CJS_Context* pContext = (CJS_Context*)cc; 490 CJS_Context* pContext = (CJS_Context*)cc;
496 ASSERT(pContext != NULL); 491 ASSERT(pContext != NULL);
497 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 492 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
(...skipping 28 matching lines...) Expand all
526 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); 521 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject();
527 ASSERT(pTimerObj != NULL); 522 ASSERT(pTimerObj != NULL);
528 523
529 pTimerObj->SetTimer(pTimer); 524 pTimerObj->SetTimer(pTimer);
530 525
531 vRet = pRetObj; 526 vRet = pRetObj;
532 527
533 return TRUE; 528 return TRUE;
534 } 529 }
535 530
536 FX_BOOL app::setTimeOut(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val ue& vRet, JS_ErrorString& sError) 531 FX_BOOL app::setTimeOut(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val ue& vRet, CFX_WideString& sError)
537 { 532 {
538 if (params.size() > 2 || params.size() == 0) 533 if (params.size() > 2 || params.size() == 0)
539 { 534 {
540 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME RROR); 535 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME RROR);
541 return FALSE; 536 return FALSE;
542 } 537 }
543 538
544 CJS_Context* pContext = (CJS_Context*)cc; 539 CJS_Context* pContext = (CJS_Context*)cc;
545 ASSERT(pContext != NULL); 540 ASSERT(pContext != NULL);
546 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 541 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
(...skipping 30 matching lines...) Expand all
577 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); 572 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject();
578 ASSERT(pTimerObj != NULL); 573 ASSERT(pTimerObj != NULL);
579 574
580 pTimerObj->SetTimer(pTimer); 575 pTimerObj->SetTimer(pTimer);
581 576
582 vRet = pRetObj; 577 vRet = pRetObj;
583 578
584 return TRUE; 579 return TRUE;
585 } 580 }
586 581
587 FX_BOOL app::clearTimeOut(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, JS_ErrorString& sError) 582 FX_BOOL app::clearTimeOut(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, CFX_WideString& sError)
588 { 583 {
589 CJS_Context* pContext = (CJS_Context*)cc; 584 CJS_Context* pContext = (CJS_Context*)cc;
590 ASSERT(pContext != NULL); 585 ASSERT(pContext != NULL);
591 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 586 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
592 ASSERT(pRuntime != NULL); 587 ASSERT(pRuntime != NULL);
593 588
594 if (params.size() != 1) 589 if (params.size() != 1)
595 { 590 {
596 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME RROR); 591 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME RROR);
597 return FALSE; 592 return FALSE;
(...skipping 27 matching lines...) Expand all
625 } 620 }
626 } 621 }
627 } 622 }
628 } 623 }
629 } 624 }
630 } 625 }
631 626
632 return TRUE; 627 return TRUE;
633 } 628 }
634 629
635 FX_BOOL app::clearInterval(IFXJS_Context* cc, const CJS_Parameters& params, CJS_ Value& vRet, JS_ErrorString& sError) 630 FX_BOOL app::clearInterval(IFXJS_Context* cc, const CJS_Parameters& params, CJS_ Value& vRet, CFX_WideString& sError)
636 { 631 {
637 CJS_Context* pContext = (CJS_Context*)cc; 632 CJS_Context* pContext = (CJS_Context*)cc;
638 ASSERT(pContext != NULL); 633 ASSERT(pContext != NULL);
639 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 634 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
640 ASSERT(pRuntime != NULL); 635 ASSERT(pRuntime != NULL);
641 636
642 if (params.size() != 1) 637 if (params.size() != 1)
643 { 638 {
644 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME RROR); 639 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAME RROR);
645 return FALSE; 640 return FALSE;
(...skipping 27 matching lines...) Expand all
673 } 668 }
674 } 669 }
675 } 670 }
676 } 671 }
677 } 672 }
678 } 673 }
679 674
680 return TRUE; 675 return TRUE;
681 } 676 }
682 677
683 FX_BOOL app::execMenuItem(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, JS_ErrorString& sError) 678 FX_BOOL app::execMenuItem(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, CFX_WideString& sError)
684 { 679 {
685 return FALSE; 680 return FALSE;
686 } 681 }
687 682
688 void app::TimerProc(CJS_Timer* pTimer) 683 void app::TimerProc(CJS_Timer* pTimer)
689 { 684 {
690 ASSERT(pTimer != NULL); 685 ASSERT(pTimer != NULL);
691 686
692 switch (pTimer->GetType()) 687 switch (pTimer->GetType())
693 { 688 {
(...skipping 19 matching lines...) Expand all
713 { 708 {
714 IFXJS_Context* pContext = pRuntime->NewContext(); 709 IFXJS_Context* pContext = pRuntime->NewContext();
715 ASSERT(pContext != NULL); 710 ASSERT(pContext != NULL);
716 pContext->OnExternal_Exec(); 711 pContext->OnExternal_Exec();
717 CFX_WideString wtInfo; 712 CFX_WideString wtInfo;
718 pContext->RunScript(wsScript,wtInfo); 713 pContext->RunScript(wsScript,wtInfo);
719 pRuntime->ReleaseContext(pContext); 714 pRuntime->ReleaseContext(pContext);
720 } 715 }
721 } 716 }
722 717
723 FX_BOOL app::goBack(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, JS_ErrorString& sError) 718 FX_BOOL app::goBack(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
724 { 719 {
725 // Not supported. 720 // Not supported.
726 return TRUE; 721 return TRUE;
727 } 722 }
728 723
729 FX_BOOL app::goForward(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu e& vRet, JS_ErrorString& sError) 724 FX_BOOL app::goForward(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu e& vRet, CFX_WideString& sError)
730 { 725 {
731 // Not supported. 726 // Not supported.
732 return TRUE; 727 return TRUE;
733 } 728 }
734 729
735 FX_BOOL app::mailMsg(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, JS_ErrorString& sError) 730 FX_BOOL app::mailMsg(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
736 { 731 {
737 CJS_Context* pContext = (CJS_Context*)cc; 732 CJS_Context* pContext = (CJS_Context*)cc;
738 ASSERT(pContext != NULL); 733 ASSERT(pContext != NULL);
739 734
740 v8::Isolate* isolate = GetIsolate(cc); 735 v8::Isolate* isolate = GetIsolate(cc);
741 736
742 FX_BOOL bUI = TRUE; 737 FX_BOOL bUI = TRUE;
743 CFX_WideString cTo = L""; 738 CFX_WideString cTo = L"";
744 CFX_WideString cCc = L""; 739 CFX_WideString cCc = L"";
745 CFX_WideString cBcc = L""; 740 CFX_WideString cBcc = L"";
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 784
790 pRuntime->BeginBlock(); 785 pRuntime->BeginBlock();
791 pApp->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_ str(), cBcc.c_str(), cMsg.c_str()); 786 pApp->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_ str(), cBcc.c_str(), cMsg.c_str());
792 //////////////////////////////////////////////////////////////////////// /////////////////////// 787 //////////////////////////////////////////////////////////////////////// ///////////////////////
793 pRuntime->EndBlock(); 788 pRuntime->EndBlock();
794 789
795 //return bRet; 790 //return bRet;
796 return FALSE; 791 return FALSE;
797 } 792 }
798 793
799 FX_BOOL app::launchURL(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu e& vRet, JS_ErrorString& sError) 794 FX_BOOL app::launchURL(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu e& vRet, CFX_WideString& sError)
800 { 795 {
801 // Unsafe, not supported. 796 // Unsafe, not supported.
802 return TRUE; 797 return TRUE;
803 } 798 }
804 799
805 FX_BOOL app::runtimeHighlight(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorStri ng& sError) 800 FX_BOOL app::runtimeHighlight(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri ng& sError)
806 { 801 {
807 if (vp.IsSetting()) 802 if (vp.IsSetting())
808 { 803 {
809 vp>>m_bRuntimeHighLight; 804 vp>>m_bRuntimeHighLight;
810 } 805 }
811 else 806 else
812 { 807 {
813 vp<<m_bRuntimeHighLight; 808 vp<<m_bRuntimeHighLight;
814 } 809 }
815 810
816 return TRUE; 811 return TRUE;
817 } 812 }
818 813
819 FX_BOOL app::fullscreen(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sE rror) 814 FX_BOOL app::fullscreen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror)
820 { 815 {
821 return FALSE; 816 return FALSE;
822 } 817 }
823 818
824 FX_BOOL app::popUpMenu(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu e& vRet, JS_ErrorString& sError) 819 FX_BOOL app::popUpMenu(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu e& vRet, CFX_WideString& sError)
825 { 820 {
826 return FALSE; 821 return FALSE;
827 } 822 }
828 823
829 824
830 FX_BOOL app::browseForDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, JS_ErrorString& sError) 825 FX_BOOL app::browseForDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, CFX_WideString& sError)
831 { 826 {
832 // Unsafe, not supported. 827 // Unsafe, not supported.
833 return TRUE; 828 return TRUE;
834 } 829 }
835 830
836 CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath) 831 CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath)
837 { 832 {
838 CFX_WideString sRet = L"/"; 833 CFX_WideString sRet = L"/";
839 834
840 for (int i=0,sz=sOldPath.GetLength(); i<sz; i++) 835 for (int i=0,sz=sOldPath.GetLength(); i<sz; i++)
(...skipping 11 matching lines...) Expand all
852 else 847 else
853 { 848 {
854 sRet += c; 849 sRet += c;
855 } 850 }
856 } 851 }
857 } 852 }
858 853
859 return sRet; 854 return sRet;
860 } 855 }
861 856
862 FX_BOOL app::newDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, JS_ErrorString& sError) 857 FX_BOOL app::newDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
863 { 858 {
864 return FALSE; 859 return FALSE;
865 } 860 }
866 861
867 FX_BOOL app::openDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, JS_ErrorString& sError) 862 FX_BOOL app::openDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
868 { 863 {
869 return FALSE; 864 return FALSE;
870 } 865 }
871 866
872 FX_BOOL app::response(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value & vRet, JS_ErrorString& sError) 867 FX_BOOL app::response(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value & vRet, CFX_WideString& sError)
873 { 868 {
874 CFX_WideString swQuestion = L""; 869 CFX_WideString swQuestion = L"";
875 CFX_WideString swLabel = L""; 870 CFX_WideString swLabel = L"";
876 CFX_WideString swTitle = L"PDF"; 871 CFX_WideString swTitle = L"PDF";
877 CFX_WideString swDefault = L""; 872 CFX_WideString swDefault = L"";
878 bool bPassWord = false; 873 bool bPassWord = false;
879 874
880 v8::Isolate* isolate = GetIsolate(cc); 875 v8::Isolate* isolate = GetIsolate(cc);
881 876
882 int iLength = params.size(); 877 int iLength = params.size();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 return FALSE; 937 return FALSE;
943 } 938 }
944 if (nLengthBytes > MAX_INPUT_BYTES) 939 if (nLengthBytes > MAX_INPUT_BYTES)
945 nLengthBytes = MAX_INPUT_BYTES; 940 nLengthBytes = MAX_INPUT_BYTES;
946 941
947 vRet = CFX_WideString::FromUTF16LE((unsigned short*)pBuff, nLengthBytes / sizeof(unsigned short)); 942 vRet = CFX_WideString::FromUTF16LE((unsigned short*)pBuff, nLengthBytes / sizeof(unsigned short));
948 delete[] pBuff; 943 delete[] pBuff;
949 return TRUE; 944 return TRUE;
950 } 945 }
951 946
952 FX_BOOL app::media(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sError) 947 FX_BOOL app::media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
953 { 948 {
954 return FALSE; 949 return FALSE;
955 } 950 }
956 951
957 FX_BOOL app::execDialog(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val ue& vRet, JS_ErrorString& sError) 952 FX_BOOL app::execDialog(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val ue& vRet, CFX_WideString& sError)
958 { 953 {
959 return TRUE; 954 return TRUE;
960 } 955 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/PublicMethods.cpp ('k') | fpdfsdk/src/javascript/color.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698