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

Side by Side Diff: xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp

Issue 1830323006: Remove FX_DWORD from XFA. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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 | « xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp ('k') | xfa/fxfa/parser/xfa_script_imp.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 "xfa/fxfa/parser/xfa_script_hostpseudomodel.h" 7 #include "xfa/fxfa/parser/xfa_script_hostpseudomodel.h"
8 8
9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" 9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
10 #include "xfa/fxfa/parser/xfa_docdata.h" 10 #include "xfa/fxfa/parser/xfa_docdata.h"
11 #include "xfa/fxfa/parser/xfa_doclayout.h" 11 #include "xfa/fxfa/parser/xfa_doclayout.h"
12 #include "xfa/fxfa/parser/xfa_document.h" 12 #include "xfa/fxfa/parser/xfa_document.h"
13 #include "xfa/fxfa/parser/xfa_localemgr.h" 13 #include "xfa/fxfa/parser/xfa_localemgr.h"
14 #include "xfa/fxfa/parser/xfa_object.h" 14 #include "xfa/fxfa/parser/xfa_object.h"
15 #include "xfa/fxfa/parser/xfa_parser.h" 15 #include "xfa/fxfa/parser/xfa_parser.h"
16 #include "xfa/fxfa/parser/xfa_script.h" 16 #include "xfa/fxfa/parser/xfa_script.h"
17 #include "xfa/fxfa/parser/xfa_utils.h" 17 #include "xfa/fxfa/parser/xfa_utils.h"
18 #include "xfa/fxjse/cfxjse_arguments.h" 18 #include "xfa/fxjse/cfxjse_arguments.h"
19 19
20 CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument) 20 CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument)
21 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_HostPseudoModel) { 21 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_HostPseudoModel) {
22 m_uScriptHash = XFA_HASHCODE_Host; 22 m_uScriptHash = XFA_HASHCODE_Host;
23 } 23 }
24 CScript_HostPseudoModel::~CScript_HostPseudoModel() {} 24 CScript_HostPseudoModel::~CScript_HostPseudoModel() {}
25 void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString( 25 void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString(
26 FXJSE_HVALUE hValue, 26 FXJSE_HVALUE hValue,
27 IXFA_Notify* pNotify, 27 IXFA_Notify* pNotify,
28 FX_DWORD dwFlag) { 28 uint32_t dwFlag) {
29 CFX_WideString wsValue; 29 CFX_WideString wsValue;
30 pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); 30 pNotify->GetAppProvider()->LoadString(dwFlag, wsValue);
31 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue)); 31 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue));
32 } 32 }
33 void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( 33 void CScript_HostPseudoModel::Script_HostPseudoModel_AppType(
34 FXJSE_HVALUE hValue, 34 FXJSE_HVALUE hValue,
35 FX_BOOL bSetting, 35 FX_BOOL bSetting,
36 XFA_ATTRIBUTE eAttribute) { 36 XFA_ATTRIBUTE eAttribute) {
37 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 37 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify();
38 if (!pNotify) { 38 if (!pNotify) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 316 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
317 if (!pScriptContext) { 317 if (!pScriptContext) {
318 FXJSE_Value_Release(hValue); 318 FXJSE_Value_Release(hValue);
319 return; 319 return;
320 } 320 }
321 CXFA_Object* pObject = pScriptContext->GetThisObject(); 321 CXFA_Object* pObject = pScriptContext->GetThisObject();
322 if (!pObject) { 322 if (!pObject) {
323 FXJSE_Value_Release(hValue); 323 FXJSE_Value_Release(hValue);
324 return; 324 return;
325 } 325 }
326 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | 326 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
327 XFA_RESOLVENODE_Siblings; 327 XFA_RESOLVENODE_Siblings;
328 XFA_RESOLVENODE_RS resoveNodeRS; 328 XFA_RESOLVENODE_RS resoveNodeRS;
329 int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression, 329 int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression,
330 resoveNodeRS, dwFlag); 330 resoveNodeRS, dwFlag);
331 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { 331 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) {
332 FXJSE_Value_Release(hValue); 332 FXJSE_Value_Release(hValue);
333 return; 333 return;
334 } 334 }
335 pNode = resoveNodeRS.nodes[0]->AsNode(); 335 pNode = resoveNodeRS.nodes[0]->AsNode();
336 } 336 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 while (iStart < iExpLength) { 450 while (iStart < iExpLength) {
451 iStart = XFA_FilterName(wsExpression, iStart, wsName); 451 iStart = XFA_FilterName(wsExpression, iStart, wsName);
452 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 452 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
453 if (!pScriptContext) { 453 if (!pScriptContext) {
454 return; 454 return;
455 } 455 }
456 CXFA_Object* pObject = pScriptContext->GetThisObject(); 456 CXFA_Object* pObject = pScriptContext->GetThisObject();
457 if (!pObject) { 457 if (!pObject) {
458 return; 458 return;
459 } 459 }
460 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | 460 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
461 XFA_RESOLVENODE_Siblings; 461 XFA_RESOLVENODE_Siblings;
462 XFA_RESOLVENODE_RS resoveNodeRS; 462 XFA_RESOLVENODE_RS resoveNodeRS;
463 int32_t iRet = 463 int32_t iRet =
464 pScriptContext->ResolveObjects(pObject, wsName, resoveNodeRS, dwFlag); 464 pScriptContext->ResolveObjects(pObject, wsName, resoveNodeRS, dwFlag);
465 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { 465 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) {
466 continue; 466 continue;
467 } 467 }
468 pNode = resoveNodeRS.nodes[0]->AsNode(); 468 pNode = resoveNodeRS.nodes[0]->AsNode();
469 pNotify->ResetData(pNode->GetWidgetData()); 469 pNotify->ResetData(pNode->GetWidgetData());
470 } 470 }
471 if (!pNode) { 471 if (!pNode) {
472 pNotify->ResetData(); 472 pNotify->ResetData();
473 } 473 }
474 } 474 }
475 void CScript_HostPseudoModel::Script_HostPseudoModel_Beep( 475 void CScript_HostPseudoModel::Script_HostPseudoModel_Beep(
476 CFXJSE_Arguments* pArguments) { 476 CFXJSE_Arguments* pArguments) {
477 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 477 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
478 return; 478 return;
479 } 479 }
480 int32_t iLength = pArguments->GetLength(); 480 int32_t iLength = pArguments->GetLength();
481 if (iLength < 0 || iLength > 1) { 481 if (iLength < 0 || iLength > 1) {
482 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep"); 482 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep");
483 return; 483 return;
484 } 484 }
485 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 485 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify();
486 if (!pNotify) { 486 if (!pNotify) {
487 return; 487 return;
488 } 488 }
489 FX_DWORD dwType = 4; 489 uint32_t dwType = 4;
490 if (iLength >= 1) { 490 if (iLength >= 1) {
491 dwType = pArguments->GetInt32(0); 491 dwType = pArguments->GetInt32(0);
492 } 492 }
493 pNotify->GetAppProvider()->Beep(dwType); 493 pNotify->GetAppProvider()->Beep(dwType);
494 } 494 }
495 void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( 495 void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus(
496 CFXJSE_Arguments* pArguments) { 496 CFXJSE_Arguments* pArguments) {
497 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { 497 if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
498 return; 498 return;
499 } 499 }
(...skipping 19 matching lines...) Expand all
519 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 519 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
520 if (!pScriptContext) { 520 if (!pScriptContext) {
521 FXJSE_Value_Release(hValue); 521 FXJSE_Value_Release(hValue);
522 return; 522 return;
523 } 523 }
524 CXFA_Object* pObject = pScriptContext->GetThisObject(); 524 CXFA_Object* pObject = pScriptContext->GetThisObject();
525 if (!pObject) { 525 if (!pObject) {
526 FXJSE_Value_Release(hValue); 526 FXJSE_Value_Release(hValue);
527 return; 527 return;
528 } 528 }
529 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | 529 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent |
530 XFA_RESOLVENODE_Siblings; 530 XFA_RESOLVENODE_Siblings;
531 XFA_RESOLVENODE_RS resoveNodeRS; 531 XFA_RESOLVENODE_RS resoveNodeRS;
532 int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression, 532 int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression,
533 resoveNodeRS, dwFlag); 533 resoveNodeRS, dwFlag);
534 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { 534 if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) {
535 FXJSE_Value_Release(hValue); 535 FXJSE_Value_Release(hValue);
536 return; 536 return;
537 } 537 }
538 pNode = resoveNodeRS.nodes[0]->AsNode(); 538 pNode = resoveNodeRS.nodes[0]->AsNode();
539 } 539 }
(...skipping 23 matching lines...) Expand all
563 if (iLength < 1 || iLength > 4) { 563 if (iLength < 1 || iLength > 4) {
564 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox"); 564 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox");
565 return; 565 return;
566 } 566 }
567 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 567 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify();
568 if (!pNotify) { 568 if (!pNotify) {
569 return; 569 return;
570 } 570 }
571 CFX_WideString wsMessage; 571 CFX_WideString wsMessage;
572 CFX_WideString bsTitle; 572 CFX_WideString bsTitle;
573 FX_DWORD dwMessageType = XFA_MBICON_Error; 573 uint32_t dwMessageType = XFA_MBICON_Error;
574 FX_DWORD dwButtonType = XFA_MB_OK; 574 uint32_t dwButtonType = XFA_MB_OK;
575 if (iLength >= 1) { 575 if (iLength >= 1) {
576 if (!Script_HostPseudoModel_ValidateArgsForMsg(pArguments, 0, wsMessage)) { 576 if (!Script_HostPseudoModel_ValidateArgsForMsg(pArguments, 0, wsMessage)) {
577 return; 577 return;
578 } 578 }
579 } 579 }
580 if (iLength >= 2) { 580 if (iLength >= 2) {
581 if (!Script_HostPseudoModel_ValidateArgsForMsg(pArguments, 1, bsTitle)) { 581 if (!Script_HostPseudoModel_ValidateArgsForMsg(pArguments, 1, bsTitle)) {
582 return; 582 return;
583 } 583 }
584 } 584 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 int32_t iLength = pArguments->GetLength(); 649 int32_t iLength = pArguments->GetLength();
650 if (iLength != 8) { 650 if (iLength != 8) {
651 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print"); 651 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print");
652 return; 652 return;
653 } 653 }
654 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 654 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify();
655 if (!pNotify) { 655 if (!pNotify) {
656 return; 656 return;
657 } 657 }
658 IXFA_Doc* hDoc = pNotify->GetHDOC(); 658 IXFA_Doc* hDoc = pNotify->GetHDOC();
659 FX_DWORD dwOptions = 0; 659 uint32_t dwOptions = 0;
660 FX_BOOL bShowDialog = TRUE; 660 FX_BOOL bShowDialog = TRUE;
661 if (iLength >= 1) { 661 if (iLength >= 1) {
662 bShowDialog = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; 662 bShowDialog = pArguments->GetInt32(0) == 0 ? FALSE : TRUE;
663 } 663 }
664 if (bShowDialog) { 664 if (bShowDialog) {
665 dwOptions |= XFA_PRINTOPT_ShowDialog; 665 dwOptions |= XFA_PRINTOPT_ShowDialog;
666 } 666 }
667 int32_t nStartPage = 0; 667 int32_t nStartPage = 0;
668 if (iLength >= 2) { 668 if (iLength >= 2) {
669 nStartPage = pArguments->GetInt32(1); 669 nStartPage = pArguments->GetInt32(1);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 792 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify();
793 if (!pNotify) { 793 if (!pNotify) {
794 return; 794 return;
795 } 795 }
796 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); 796 CFX_WideString wsDataTime = pNotify->GetCurrentDateTime();
797 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 797 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
798 if (hValue) { 798 if (hValue) {
799 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsDataTime)); 799 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsDataTime));
800 } 800 }
801 } 801 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp ('k') | xfa/fxfa/parser/xfa_script_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698