| 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 "xfa/fxfa/app/xfa_ffwidgetacc.h" | 7 #include "xfa/fxfa/app/xfa_ffwidgetacc.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 validate.GetScriptMessageText(wsScriptMsg); | 382 validate.GetScriptMessageText(wsScriptMsg); |
| 383 int32_t eScriptTest = validate.GetScriptTest(); | 383 int32_t eScriptTest = validate.GetScriptTest(); |
| 384 if (eScriptTest == XFA_ATTRIBUTEENUM_Warning) { | 384 if (eScriptTest == XFA_ATTRIBUTEENUM_Warning) { |
| 385 if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { | 385 if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { |
| 386 return; | 386 return; |
| 387 } | 387 } |
| 388 if (wsScriptMsg.IsEmpty()) { | 388 if (wsScriptMsg.IsEmpty()) { |
| 389 GetValidateMessage(pAppProvider, wsScriptMsg, FALSE, bVersionFlag); | 389 GetValidateMessage(pAppProvider, wsScriptMsg, FALSE, bVersionFlag); |
| 390 } | 390 } |
| 391 if (bVersionFlag) { | 391 if (bVersionFlag) { |
| 392 pAppProvider->MsgBox(wsScriptMsg.AsStringC(), wsTitle.AsStringC(), | 392 pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning, |
| 393 XFA_MBICON_Warning, XFA_MB_OK); | 393 XFA_MB_OK); |
| 394 return; | 394 return; |
| 395 } | 395 } |
| 396 if (pAppProvider->MsgBox(wsScriptMsg.AsStringC(), wsTitle.AsStringC(), | 396 if (pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning, |
| 397 XFA_MBICON_Warning, | |
| 398 XFA_MB_YesNo) == XFA_IDYes) { | 397 XFA_MB_YesNo) == XFA_IDYes) { |
| 399 GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false); | 398 GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false); |
| 400 } | 399 } |
| 401 } else { | 400 } else { |
| 402 if (wsScriptMsg.IsEmpty()) { | 401 if (wsScriptMsg.IsEmpty()) { |
| 403 GetValidateMessage(pAppProvider, wsScriptMsg, TRUE, bVersionFlag); | 402 GetValidateMessage(pAppProvider, wsScriptMsg, TRUE, bVersionFlag); |
| 404 } | 403 } |
| 405 pAppProvider->MsgBox(wsScriptMsg.AsStringC(), wsTitle.AsStringC(), | 404 pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); |
| 406 XFA_MBICON_Error, XFA_MB_OK); | |
| 407 } | 405 } |
| 408 } | 406 } |
| 409 } | 407 } |
| 410 } | 408 } |
| 411 int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, | 409 int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, |
| 412 FX_BOOL bVersionFlag) { | 410 FX_BOOL bVersionFlag) { |
| 413 CFX_WideString wsRawValue = GetRawValue(); | 411 CFX_WideString wsRawValue = GetRawValue(); |
| 414 if (!wsRawValue.IsEmpty()) { | 412 if (!wsRawValue.IsEmpty()) { |
| 415 CFX_WideString wsPicture; | 413 CFX_WideString wsPicture; |
| 416 validate.GetPicture(wsPicture); | 414 validate.GetPicture(wsPicture); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 429 } | 427 } |
| 430 CFX_WideString wsFormatMsg; | 428 CFX_WideString wsFormatMsg; |
| 431 validate.GetFormatMessageText(wsFormatMsg); | 429 validate.GetFormatMessageText(wsFormatMsg); |
| 432 CFX_WideString wsTitle; | 430 CFX_WideString wsTitle; |
| 433 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); | 431 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); |
| 434 int32_t eFormatTest = validate.GetFormatTest(); | 432 int32_t eFormatTest = validate.GetFormatTest(); |
| 435 if (eFormatTest == XFA_ATTRIBUTEENUM_Error) { | 433 if (eFormatTest == XFA_ATTRIBUTEENUM_Error) { |
| 436 if (wsFormatMsg.IsEmpty()) { | 434 if (wsFormatMsg.IsEmpty()) { |
| 437 GetValidateMessage(pAppProvider, wsFormatMsg, TRUE, bVersionFlag); | 435 GetValidateMessage(pAppProvider, wsFormatMsg, TRUE, bVersionFlag); |
| 438 } | 436 } |
| 439 pAppProvider->MsgBox(wsFormatMsg.AsStringC(), wsTitle.AsStringC(), | 437 pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); |
| 440 XFA_MBICON_Error, XFA_MB_OK); | |
| 441 return XFA_EVENTERROR_Success; | 438 return XFA_EVENTERROR_Success; |
| 442 } | 439 } |
| 443 if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { | 440 if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { |
| 444 return XFA_EVENTERROR_NotExist; | 441 return XFA_EVENTERROR_NotExist; |
| 445 } | 442 } |
| 446 if (wsFormatMsg.IsEmpty()) { | 443 if (wsFormatMsg.IsEmpty()) { |
| 447 GetValidateMessage(pAppProvider, wsFormatMsg, FALSE, bVersionFlag); | 444 GetValidateMessage(pAppProvider, wsFormatMsg, FALSE, bVersionFlag); |
| 448 } | 445 } |
| 449 if (bVersionFlag) { | 446 if (bVersionFlag) { |
| 450 pAppProvider->MsgBox(wsFormatMsg.AsStringC(), wsTitle.AsStringC(), | 447 pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning, |
| 451 XFA_MBICON_Warning, XFA_MB_OK); | 448 XFA_MB_OK); |
| 452 return XFA_EVENTERROR_Success; | 449 return XFA_EVENTERROR_Success; |
| 453 } | 450 } |
| 454 if (pAppProvider->MsgBox(wsFormatMsg.AsStringC(), wsTitle.AsStringC(), | 451 if (pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning, |
| 455 XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { | 452 XFA_MB_YesNo) == XFA_IDYes) { |
| 456 GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false); | 453 GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false); |
| 457 } | 454 } |
| 458 return XFA_EVENTERROR_Success; | 455 return XFA_EVENTERROR_Success; |
| 459 } | 456 } |
| 460 } | 457 } |
| 461 return XFA_EVENTERROR_NotExist; | 458 return XFA_EVENTERROR_NotExist; |
| 462 } | 459 } |
| 463 int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, | 460 int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, |
| 464 int32_t iFlags, | 461 int32_t iFlags, |
| 465 FX_BOOL bVersionFlag) { | 462 FX_BOOL bVersionFlag) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 CFX_WideString wsTitle; | 497 CFX_WideString wsTitle; |
| 501 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); | 498 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); |
| 502 switch (eNullTest) { | 499 switch (eNullTest) { |
| 503 case XFA_ATTRIBUTEENUM_Error: { | 500 case XFA_ATTRIBUTEENUM_Error: { |
| 504 if (wsNullMsg.IsEmpty()) { | 501 if (wsNullMsg.IsEmpty()) { |
| 505 GetValidateCaptionName(wsCaptionName, bVersionFlag); | 502 GetValidateCaptionName(wsCaptionName, bVersionFlag); |
| 506 CFX_WideString wsError; | 503 CFX_WideString wsError; |
| 507 pAppProvider->LoadString(XFA_IDS_ValidateNullError, wsError); | 504 pAppProvider->LoadString(XFA_IDS_ValidateNullError, wsError); |
| 508 wsNullMsg.Format(wsError.c_str(), wsCaptionName.c_str()); | 505 wsNullMsg.Format(wsError.c_str(), wsCaptionName.c_str()); |
| 509 } | 506 } |
| 510 pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(), | 507 pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK); |
| 511 XFA_MBICON_Status, XFA_MB_OK); | |
| 512 return XFA_EVENTERROR_Error; | 508 return XFA_EVENTERROR_Error; |
| 513 } | 509 } |
| 514 case XFA_ATTRIBUTEENUM_Warning: { | 510 case XFA_ATTRIBUTEENUM_Warning: { |
| 515 if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { | 511 if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { |
| 516 return TRUE; | 512 return TRUE; |
| 517 } | 513 } |
| 518 if (wsNullMsg.IsEmpty()) { | 514 if (wsNullMsg.IsEmpty()) { |
| 519 GetValidateCaptionName(wsCaptionName, bVersionFlag); | 515 GetValidateCaptionName(wsCaptionName, bVersionFlag); |
| 520 CFX_WideString wsWarning; | 516 CFX_WideString wsWarning; |
| 521 pAppProvider->LoadString(XFA_IDS_ValidateNullWarning, wsWarning); | 517 pAppProvider->LoadString(XFA_IDS_ValidateNullWarning, wsWarning); |
| 522 wsNullMsg.Format(wsWarning.c_str(), wsCaptionName.c_str(), | 518 wsNullMsg.Format(wsWarning.c_str(), wsCaptionName.c_str(), |
| 523 wsCaptionName.c_str()); | 519 wsCaptionName.c_str()); |
| 524 } | 520 } |
| 525 if (pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(), | 521 if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning, |
| 526 XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { | 522 XFA_MB_YesNo) == XFA_IDYes) { |
| 527 GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false); | 523 GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false); |
| 528 } | 524 } |
| 529 return XFA_EVENTERROR_Error; | 525 return XFA_EVENTERROR_Error; |
| 530 } | 526 } |
| 531 case XFA_ATTRIBUTEENUM_Disabled: | 527 case XFA_ATTRIBUTEENUM_Disabled: |
| 532 default: | 528 default: |
| 533 break; | 529 break; |
| 534 } | 530 } |
| 535 return XFA_EVENTERROR_Success; | 531 return XFA_EVENTERROR_Success; |
| 536 } | 532 } |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 if (pIDNode) { | 1676 if (pIDNode) { |
| 1681 pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData(); | 1677 pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData(); |
| 1682 } | 1678 } |
| 1683 if (pEmbAcc) { | 1679 if (pEmbAcc) { |
| 1684 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display); | 1680 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display); |
| 1685 return TRUE; | 1681 return TRUE; |
| 1686 } | 1682 } |
| 1687 } | 1683 } |
| 1688 return FALSE; | 1684 return FALSE; |
| 1689 } | 1685 } |
| OLD | NEW |