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

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

Issue 2029043002: Change ThrowScriptErrorMessage() to ThrowException(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@value_toobject_cleanup
Patch Set: Created 4 years, 6 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_object.h ('k') | xfa/fxfa/parser/xfa_script_hostpseudomodel.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_object.h" 7 #include "xfa/fxfa/parser/xfa_object.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, 83 void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue,
84 FX_BOOL bSetting, 84 FX_BOOL bSetting,
85 XFA_ATTRIBUTE eAttribute) { 85 XFA_ATTRIBUTE eAttribute) {
86 if (!bSetting) { 86 if (!bSetting) {
87 CFX_WideStringC className; 87 CFX_WideStringC className;
88 GetClassName(className); 88 GetClassName(className);
89 FXJSE_Value_SetUTF8String( 89 FXJSE_Value_SetUTF8String(
90 pValue, 90 pValue,
91 FX_UTF8Encode(className.c_str(), className.GetLength()).AsStringC()); 91 FX_UTF8Encode(className.c_str(), className.GetLength()).AsStringC());
92 } else { 92 } else {
93 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 93 ThrowException(XFA_IDS_INVAlID_PROP_SET);
94 } 94 }
95 } 95 }
96 96
97 void CXFA_Object::ThrowScriptErrorMessage(int32_t iStringID, ...) { 97 void CXFA_Object::ThrowException(int32_t iStringID, ...) {
98 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); 98 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider();
99 ASSERT(pAppProvider); 99 ASSERT(pAppProvider);
100 CFX_WideString wsFormat; 100 CFX_WideString wsFormat;
101 pAppProvider->LoadString(iStringID, wsFormat); 101 pAppProvider->LoadString(iStringID, wsFormat);
102 CFX_WideString wsMessage; 102 CFX_WideString wsMessage;
103 va_list arg_ptr; 103 va_list arg_ptr;
104 va_start(arg_ptr, iStringID); 104 va_start(arg_ptr, iStringID);
105 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); 105 wsMessage.FormatV(wsFormat.c_str(), arg_ptr);
106 va_end(arg_ptr); 106 va_end(arg_ptr);
107 FXJSE_ThrowMessage( 107 FXJSE_ThrowMessage(
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 } 621 }
622 622
623 void CXFA_Node::SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode) { 623 void CXFA_Node::SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode) {
624 ASSERT(m_ePacket == XFA_XDPPACKET_Datasets); 624 ASSERT(m_ePacket == XFA_XDPPACKET_Datasets);
625 m_pAuxNode = pDataDescriptionNode; 625 m_pAuxNode = pDataDescriptionNode;
626 } 626 }
627 627
628 void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { 628 void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) {
629 int32_t iLength = pArguments->GetLength(); 629 int32_t iLength = pArguments->GetLength();
630 if (iLength != 1) { 630 if (iLength != 1) {
631 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resolveNode"); 631 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resolveNode");
632 return; 632 return;
633 } 633 }
634 CFX_WideString wsExpression = 634 CFX_WideString wsExpression =
635 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 635 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
636 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 636 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
637 if (!pScriptContext) 637 if (!pScriptContext)
638 return; 638 return;
639 CXFA_Node* refNode = this; 639 CXFA_Node* refNode = this;
640 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) 640 if (refNode->GetClassID() == XFA_ELEMENT_Xfa)
641 refNode = ToNode(pScriptContext->GetThisObject()); 641 refNode = ToNode(pScriptContext->GetThisObject());
(...skipping 20 matching lines...) Expand all
662 FXJSE_Value_Set(pArguments->GetReturnValue(), pValue.get()); 662 FXJSE_Value_Set(pArguments->GetReturnValue(), pValue.get());
663 } else { 663 } else {
664 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 664 FXJSE_Value_SetNull(pArguments->GetReturnValue());
665 } 665 }
666 } 666 }
667 } 667 }
668 668
669 void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) { 669 void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) {
670 int32_t iLength = pArguments->GetLength(); 670 int32_t iLength = pArguments->GetLength();
671 if (iLength != 1) { 671 if (iLength != 1) {
672 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 672 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resolveNodes");
673 L"resolveNodes");
674 return; 673 return;
675 } 674 }
676 CFX_WideString wsExpression = 675 CFX_WideString wsExpression =
677 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 676 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
678 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 677 CFXJSE_Value* pValue = pArguments->GetReturnValue();
679 if (!pValue) 678 if (!pValue)
680 return; 679 return;
681 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | 680 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes |
682 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | 681 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
683 XFA_RESOLVENODE_Siblings; 682 XFA_RESOLVENODE_Siblings;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 } 716 }
718 } 717 }
719 FXJSE_Value_SetObject(pValue, (CXFA_Object*)pNodeList, 718 FXJSE_Value_SetObject(pValue, (CXFA_Object*)pNodeList,
720 pScriptContext->GetJseNormalClass()); 719 pScriptContext->GetJseNormalClass());
721 } 720 }
722 721
723 void CXFA_Node::Script_TreeClass_All(CFXJSE_Value* pValue, 722 void CXFA_Node::Script_TreeClass_All(CFXJSE_Value* pValue,
724 FX_BOOL bSetting, 723 FX_BOOL bSetting,
725 XFA_ATTRIBUTE eAttribute) { 724 XFA_ATTRIBUTE eAttribute) {
726 if (bSetting) { 725 if (bSetting) {
727 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 726 ThrowException(XFA_IDS_INVAlID_PROP_SET);
728 } else { 727 } else {
729 uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL; 728 uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL;
730 CFX_WideString wsName; 729 CFX_WideString wsName;
731 GetAttribute(XFA_ATTRIBUTE_Name, wsName); 730 GetAttribute(XFA_ATTRIBUTE_Name, wsName);
732 CFX_WideString wsExpression = wsName + FX_WSTRC(L"[*]"); 731 CFX_WideString wsExpression = wsName + FX_WSTRC(L"[*]");
733 Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag); 732 Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag);
734 } 733 }
735 } 734 }
736 735
737 void CXFA_Node::Script_TreeClass_Nodes(CFXJSE_Value* pValue, 736 void CXFA_Node::Script_TreeClass_Nodes(CFXJSE_Value* pValue,
(...skipping 14 matching lines...) Expand all
752 CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this); 751 CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this);
753 FXJSE_Value_SetObject(pValue, (CXFA_Object*)pNodeList, 752 FXJSE_Value_SetObject(pValue, (CXFA_Object*)pNodeList,
754 pScriptContext->GetJseNormalClass()); 753 pScriptContext->GetJseNormalClass());
755 } 754 }
756 } 755 }
757 756
758 void CXFA_Node::Script_TreeClass_ClassAll(CFXJSE_Value* pValue, 757 void CXFA_Node::Script_TreeClass_ClassAll(CFXJSE_Value* pValue,
759 FX_BOOL bSetting, 758 FX_BOOL bSetting,
760 XFA_ATTRIBUTE eAttribute) { 759 XFA_ATTRIBUTE eAttribute) {
761 if (bSetting) { 760 if (bSetting) {
762 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 761 ThrowException(XFA_IDS_INVAlID_PROP_SET);
763 } else { 762 } else {
764 uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL; 763 uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL;
765 CFX_WideStringC wsName; 764 CFX_WideStringC wsName;
766 GetClassName(wsName); 765 GetClassName(wsName);
767 CFX_WideString wsExpression = FX_WSTRC(L"#") + wsName + FX_WSTRC(L"[*]"); 766 CFX_WideString wsExpression = FX_WSTRC(L"#") + wsName + FX_WSTRC(L"[*]");
768 Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag); 767 Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag);
769 } 768 }
770 } 769 }
771 770
772 void CXFA_Node::Script_TreeClass_Parent(CFXJSE_Value* pValue, 771 void CXFA_Node::Script_TreeClass_Parent(CFXJSE_Value* pValue,
773 FX_BOOL bSetting, 772 FX_BOOL bSetting,
774 XFA_ATTRIBUTE eAttribute) { 773 XFA_ATTRIBUTE eAttribute) {
775 if (bSetting) { 774 if (bSetting) {
776 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 775 ThrowException(XFA_IDS_INVAlID_PROP_SET);
777 } else { 776 } else {
778 CXFA_Node* pParent = GetNodeItem(XFA_NODEITEM_Parent); 777 CXFA_Node* pParent = GetNodeItem(XFA_NODEITEM_Parent);
779 if (pParent) { 778 if (pParent) {
780 FXJSE_Value_Set( 779 FXJSE_Value_Set(
781 pValue, m_pDocument->GetScriptContext()->GetJSValueFromMap(pParent)); 780 pValue, m_pDocument->GetScriptContext()->GetJSValueFromMap(pParent));
782 } else { 781 } else {
783 FXJSE_Value_SetNull(pValue); 782 FXJSE_Value_SetNull(pValue);
784 } 783 }
785 } 784 }
786 } 785 }
787 786
788 void CXFA_Node::Script_TreeClass_Index(CFXJSE_Value* pValue, 787 void CXFA_Node::Script_TreeClass_Index(CFXJSE_Value* pValue,
789 FX_BOOL bSetting, 788 FX_BOOL bSetting,
790 XFA_ATTRIBUTE eAttribute) { 789 XFA_ATTRIBUTE eAttribute) {
791 if (bSetting) 790 if (bSetting)
792 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 791 ThrowException(XFA_IDS_INVAlID_PROP_SET);
793 else 792 else
794 FXJSE_Value_SetInteger(pValue, GetNodeSameNameIndex()); 793 FXJSE_Value_SetInteger(pValue, GetNodeSameNameIndex());
795 } 794 }
796 795
797 void CXFA_Node::Script_TreeClass_ClassIndex(CFXJSE_Value* pValue, 796 void CXFA_Node::Script_TreeClass_ClassIndex(CFXJSE_Value* pValue,
798 FX_BOOL bSetting, 797 FX_BOOL bSetting,
799 XFA_ATTRIBUTE eAttribute) { 798 XFA_ATTRIBUTE eAttribute) {
800 if (bSetting) 799 if (bSetting)
801 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 800 ThrowException(XFA_IDS_INVAlID_PROP_SET);
802 else 801 else
803 FXJSE_Value_SetInteger(pValue, GetNodeSameClassIndex()); 802 FXJSE_Value_SetInteger(pValue, GetNodeSameClassIndex());
804 } 803 }
805 804
806 void CXFA_Node::Script_TreeClass_SomExpression(CFXJSE_Value* pValue, 805 void CXFA_Node::Script_TreeClass_SomExpression(CFXJSE_Value* pValue,
807 FX_BOOL bSetting, 806 FX_BOOL bSetting,
808 XFA_ATTRIBUTE eAttribute) { 807 XFA_ATTRIBUTE eAttribute) {
809 if (bSetting) { 808 if (bSetting) {
810 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 809 ThrowException(XFA_IDS_INVAlID_PROP_SET);
811 } else { 810 } else {
812 CFX_WideString wsSOMExpression; 811 CFX_WideString wsSOMExpression;
813 GetSOMExpression(wsSOMExpression); 812 GetSOMExpression(wsSOMExpression);
814 FXJSE_Value_SetUTF8String(pValue, 813 FXJSE_Value_SetUTF8String(pValue,
815 FX_UTF8Encode(wsSOMExpression).AsStringC()); 814 FX_UTF8Encode(wsSOMExpression).AsStringC());
816 } 815 }
817 } 816 }
818 817
819 void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) { 818 void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) {
820 int32_t iLength = pArguments->GetLength(); 819 int32_t iLength = pArguments->GetLength();
821 if (iLength != 1) { 820 if (iLength != 1) {
822 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"applyXSL"); 821 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"applyXSL");
823 return; 822 return;
824 } 823 }
825 CFX_WideString wsExpression = 824 CFX_WideString wsExpression =
826 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 825 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
827 // TODO(weili): check whether we need to implement this, pdfium:501. 826 // TODO(weili): check whether we need to implement this, pdfium:501.
828 // For now, just put the variables here to avoid unused variable warning. 827 // For now, just put the variables here to avoid unused variable warning.
829 (void)wsExpression; 828 (void)wsExpression;
830 } 829 }
831 830
832 void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) { 831 void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) {
833 int32_t iLength = pArguments->GetLength(); 832 int32_t iLength = pArguments->GetLength();
834 if (iLength < 1 || iLength > 3) { 833 if (iLength < 1 || iLength > 3) {
835 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"assignNode"); 834 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"assignNode");
836 return; 835 return;
837 } 836 }
838 CFX_WideString wsExpression; 837 CFX_WideString wsExpression;
839 CFX_WideString wsValue; 838 CFX_WideString wsValue;
840 int32_t iAction = 0; 839 int32_t iAction = 0;
841 wsExpression = 840 wsExpression =
842 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 841 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
843 if (iLength >= 2) { 842 if (iLength >= 2) {
844 wsValue = 843 wsValue =
845 CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC()); 844 CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
846 } 845 }
847 if (iLength >= 3) 846 if (iLength >= 3)
848 iAction = pArguments->GetInt32(2); 847 iAction = pArguments->GetInt32(2);
849 // TODO(weili): check whether we need to implement this, pdfium:501. 848 // TODO(weili): check whether we need to implement this, pdfium:501.
850 // For now, just put the variables here to avoid unused variable warning. 849 // For now, just put the variables here to avoid unused variable warning.
851 (void)wsExpression; 850 (void)wsExpression;
852 (void)wsValue; 851 (void)wsValue;
853 (void)iAction; 852 (void)iAction;
854 } 853 }
855 854
856 void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) { 855 void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) {
857 int32_t iLength = pArguments->GetLength(); 856 int32_t iLength = pArguments->GetLength();
858 if (iLength != 1) { 857 if (iLength != 1) {
859 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clone"); 858 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clone");
860 return; 859 return;
861 } 860 }
862 bool bClone = !!pArguments->GetInt32(0); 861 bool bClone = !!pArguments->GetInt32(0);
863 CXFA_Node* pCloneNode = Clone(bClone); 862 CXFA_Node* pCloneNode = Clone(bClone);
864 FXJSE_Value_Set( 863 FXJSE_Value_Set(
865 pArguments->GetReturnValue(), 864 pArguments->GetReturnValue(),
866 m_pDocument->GetScriptContext()->GetJSValueFromMap(pCloneNode)); 865 m_pDocument->GetScriptContext()->GetJSValueFromMap(pCloneNode));
867 } 866 }
868 867
869 void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) { 868 void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) {
870 int32_t iLength = pArguments->GetLength(); 869 int32_t iLength = pArguments->GetLength();
871 if (iLength != 1) { 870 if (iLength != 1) {
872 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 871 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getAttribute");
873 L"getAttribute");
874 return; 872 return;
875 } 873 }
876 CFX_WideString wsExpression = 874 CFX_WideString wsExpression =
877 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 875 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
878 CFX_WideString wsValue; 876 CFX_WideString wsValue;
879 GetAttribute(wsExpression.AsStringC(), wsValue); 877 GetAttribute(wsExpression.AsStringC(), wsValue);
880 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 878 CFXJSE_Value* pValue = pArguments->GetReturnValue();
881 if (pValue) 879 if (pValue)
882 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC()); 880 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC());
883 } 881 }
884 882
885 void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { 883 void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) {
886 int32_t iLength = pArguments->GetLength(); 884 int32_t iLength = pArguments->GetLength();
887 if (iLength < 1 || iLength > 2) { 885 if (iLength < 1 || iLength > 2) {
888 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getElement"); 886 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getElement");
889 return; 887 return;
890 } 888 }
891 CFX_WideString wsExpression; 889 CFX_WideString wsExpression;
892 int32_t iValue = 0; 890 int32_t iValue = 0;
893 wsExpression = 891 wsExpression =
894 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 892 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
895 if (iLength >= 2) 893 if (iLength >= 2)
896 iValue = pArguments->GetInt32(1); 894 iValue = pArguments->GetInt32(1);
897 const XFA_ELEMENTINFO* pElementInfo = 895 const XFA_ELEMENTINFO* pElementInfo =
898 XFA_GetElementByName(wsExpression.AsStringC()); 896 XFA_GetElementByName(wsExpression.AsStringC());
899 CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName); 897 CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName);
900 FXJSE_Value_Set(pArguments->GetReturnValue(), 898 FXJSE_Value_Set(pArguments->GetReturnValue(),
901 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); 899 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode));
902 } 900 }
903 901
904 void CXFA_Node::Script_NodeClass_IsPropertySpecified( 902 void CXFA_Node::Script_NodeClass_IsPropertySpecified(
905 CFXJSE_Arguments* pArguments) { 903 CFXJSE_Arguments* pArguments) {
906 int32_t iLength = pArguments->GetLength(); 904 int32_t iLength = pArguments->GetLength();
907 if (iLength < 1 || iLength > 3) { 905 if (iLength < 1 || iLength > 3) {
908 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 906 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"isPropertySpecified");
909 L"isPropertySpecified");
910 return; 907 return;
911 } 908 }
912 CFX_WideString wsExpression; 909 CFX_WideString wsExpression;
913 bool bParent = true; 910 bool bParent = true;
914 int32_t iIndex = 0; 911 int32_t iIndex = 0;
915 wsExpression = 912 wsExpression =
916 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 913 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
917 if (iLength >= 2) 914 if (iLength >= 2)
918 bParent = !!pArguments->GetInt32(1); 915 bParent = !!pArguments->GetInt32(1);
919 if (iLength >= 3) 916 if (iLength >= 3)
(...skipping 16 matching lines...) Expand all
936 } 933 }
937 } 934 }
938 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 935 CFXJSE_Value* pValue = pArguments->GetReturnValue();
939 if (pValue) 936 if (pValue)
940 FXJSE_Value_SetBoolean(pValue, bHas); 937 FXJSE_Value_SetBoolean(pValue, bHas);
941 } 938 }
942 939
943 void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { 940 void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
944 int32_t iLength = pArguments->GetLength(); 941 int32_t iLength = pArguments->GetLength();
945 if (iLength < 1 || iLength > 3) { 942 if (iLength < 1 || iLength > 3) {
946 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"loadXML"); 943 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"loadXML");
947 return; 944 return;
948 } 945 }
949 CFX_WideString wsExpression; 946 CFX_WideString wsExpression;
950 bool bIgnoreRoot = true; 947 bool bIgnoreRoot = true;
951 bool bOverwrite = 0; 948 bool bOverwrite = 0;
952 wsExpression = 949 wsExpression =
953 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 950 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
954 if (wsExpression.IsEmpty()) 951 if (wsExpression.IsEmpty())
955 return; 952 return;
956 if (iLength >= 2) 953 if (iLength >= 2)
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 } 1055 }
1059 } 1056 }
1060 1057
1061 void CXFA_Node::Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments) { 1058 void CXFA_Node::Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments) {
1062 // TODO(weili): Check whether we need to implement this, pdfium:501. 1059 // TODO(weili): Check whether we need to implement this, pdfium:501.
1063 } 1060 }
1064 1061
1065 void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { 1062 void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) {
1066 int32_t iLength = pArguments->GetLength(); 1063 int32_t iLength = pArguments->GetLength();
1067 if (iLength < 0 || iLength > 1) { 1064 if (iLength < 0 || iLength > 1) {
1068 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"saveXML"); 1065 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"saveXML");
1069 return; 1066 return;
1070 } 1067 }
1071 bool bPrettyMode = false; 1068 bool bPrettyMode = false;
1072 if (iLength == 1) { 1069 if (iLength == 1) {
1073 if (pArguments->GetUTF8String(0) != "pretty") { 1070 if (pArguments->GetUTF8String(0) != "pretty") {
1074 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); 1071 ThrowException(XFA_IDS_ARGUMENT_MISMATCH);
1075 return; 1072 return;
1076 } 1073 }
1077 bPrettyMode = true; 1074 bPrettyMode = true;
1078 } 1075 }
1079 CFX_ByteStringC bsXMLHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; 1076 CFX_ByteStringC bsXMLHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
1080 if (GetPacketID() == XFA_XDPPACKET_Form || 1077 if (GetPacketID() == XFA_XDPPACKET_Form ||
1081 GetPacketID() == XFA_XDPPACKET_Datasets) { 1078 GetPacketID() == XFA_XDPPACKET_Datasets) {
1082 CFDE_XMLNode* pElement = nullptr; 1079 CFDE_XMLNode* pElement = nullptr;
1083 if (GetPacketID() == XFA_XDPPACKET_Datasets) { 1080 if (GetPacketID() == XFA_XDPPACKET_Datasets) {
1084 pElement = GetXMLMappingNode(); 1081 pElement = GetXMLMappingNode();
(...skipping 27 matching lines...) Expand all
1112 pArguments->GetReturnValue(), 1109 pArguments->GetReturnValue(),
1113 CFX_ByteStringC(pMemoryStream->GetBuffer(), pMemoryStream->GetSize())); 1110 CFX_ByteStringC(pMemoryStream->GetBuffer(), pMemoryStream->GetSize()));
1114 return; 1111 return;
1115 } 1112 }
1116 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), ""); 1113 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), "");
1117 } 1114 }
1118 1115
1119 void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) { 1116 void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) {
1120 int32_t iLength = pArguments->GetLength(); 1117 int32_t iLength = pArguments->GetLength();
1121 if (iLength != 2) { 1118 if (iLength != 2) {
1122 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 1119 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setAttribute");
1123 L"setAttribute");
1124 return; 1120 return;
1125 } 1121 }
1126 CFX_WideString wsAttributeValue = 1122 CFX_WideString wsAttributeValue =
1127 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 1123 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
1128 CFX_WideString wsAttribute = 1124 CFX_WideString wsAttribute =
1129 CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC()); 1125 CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
1130 SetAttribute(wsAttribute.AsStringC(), wsAttributeValue.AsStringC(), true); 1126 SetAttribute(wsAttribute.AsStringC(), wsAttributeValue.AsStringC(), true);
1131 } 1127 }
1132 1128
1133 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { 1129 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) {
1134 int32_t iLength = pArguments->GetLength(); 1130 int32_t iLength = pArguments->GetLength();
1135 if (iLength != 1 && iLength != 2) { 1131 if (iLength != 1 && iLength != 2) {
1136 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement"); 1132 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement");
1137 return; 1133 return;
1138 } 1134 }
1139 CXFA_Node* pNode = nullptr; 1135 CXFA_Node* pNode = nullptr;
1140 CFX_WideString wsName; 1136 CFX_WideString wsName;
1141 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); 1137 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
1142 if (iLength == 2) 1138 if (iLength == 2)
1143 wsName = CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC()); 1139 wsName = CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
1144 // TODO(weili): check whether we need to implement this, pdfium:501. 1140 // TODO(weili): check whether we need to implement this, pdfium:501.
1145 // For now, just put the variables here to avoid unused variable warning. 1141 // For now, just put the variables here to avoid unused variable warning.
1146 (void)pNode; 1142 (void)pNode;
1147 (void)wsName; 1143 (void)wsName;
1148 } 1144 }
1149 1145
1150 void CXFA_Node::Script_NodeClass_Ns(CFXJSE_Value* pValue, 1146 void CXFA_Node::Script_NodeClass_Ns(CFXJSE_Value* pValue,
1151 FX_BOOL bSetting, 1147 FX_BOOL bSetting,
1152 XFA_ATTRIBUTE eAttribute) { 1148 XFA_ATTRIBUTE eAttribute) {
1153 if (bSetting) { 1149 if (bSetting) {
1154 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1150 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1155 } else { 1151 } else {
1156 CFX_WideString wsNameSpace; 1152 CFX_WideString wsNameSpace;
1157 TryNamespace(wsNameSpace); 1153 TryNamespace(wsNameSpace);
1158 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsNameSpace).AsStringC()); 1154 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsNameSpace).AsStringC());
1159 } 1155 }
1160 } 1156 }
1161 1157
1162 void CXFA_Node::Script_NodeClass_Model(CFXJSE_Value* pValue, 1158 void CXFA_Node::Script_NodeClass_Model(CFXJSE_Value* pValue,
1163 FX_BOOL bSetting, 1159 FX_BOOL bSetting,
1164 XFA_ATTRIBUTE eAttribute) { 1160 XFA_ATTRIBUTE eAttribute) {
1165 if (bSetting) { 1161 if (bSetting) {
1166 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1162 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1167 } else { 1163 } else {
1168 FXJSE_Value_Set(pValue, m_pDocument->GetScriptContext()->GetJSValueFromMap( 1164 FXJSE_Value_Set(pValue, m_pDocument->GetScriptContext()->GetJSValueFromMap(
1169 GetModelNode())); 1165 GetModelNode()));
1170 } 1166 }
1171 } 1167 }
1172 1168
1173 void CXFA_Node::Script_NodeClass_IsContainer(CFXJSE_Value* pValue, 1169 void CXFA_Node::Script_NodeClass_IsContainer(CFXJSE_Value* pValue,
1174 FX_BOOL bSetting, 1170 FX_BOOL bSetting,
1175 XFA_ATTRIBUTE eAttribute) { 1171 XFA_ATTRIBUTE eAttribute) {
1176 if (bSetting) 1172 if (bSetting)
1177 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1173 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1178 else 1174 else
1179 FXJSE_Value_SetBoolean(pValue, IsContainerNode()); 1175 FXJSE_Value_SetBoolean(pValue, IsContainerNode());
1180 } 1176 }
1181 1177
1182 void CXFA_Node::Script_NodeClass_IsNull(CFXJSE_Value* pValue, 1178 void CXFA_Node::Script_NodeClass_IsNull(CFXJSE_Value* pValue,
1183 FX_BOOL bSetting, 1179 FX_BOOL bSetting,
1184 XFA_ATTRIBUTE eAttribute) { 1180 XFA_ATTRIBUTE eAttribute) {
1185 if (bSetting) { 1181 if (bSetting) {
1186 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1182 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1187 } else { 1183 } else {
1188 if (GetClassID() == XFA_ELEMENT_Subform) { 1184 if (GetClassID() == XFA_ELEMENT_Subform) {
1189 FXJSE_Value_SetBoolean(pValue, FALSE); 1185 FXJSE_Value_SetBoolean(pValue, FALSE);
1190 return; 1186 return;
1191 } 1187 }
1192 CFX_WideString strValue; 1188 CFX_WideString strValue;
1193 FXJSE_Value_SetBoolean(pValue, !TryContent(strValue) || strValue.IsEmpty()); 1189 FXJSE_Value_SetBoolean(pValue, !TryContent(strValue) || strValue.IsEmpty());
1194 } 1190 }
1195 } 1191 }
1196 1192
1197 void CXFA_Node::Script_NodeClass_OneOfChild(CFXJSE_Value* pValue, 1193 void CXFA_Node::Script_NodeClass_OneOfChild(CFXJSE_Value* pValue,
1198 FX_BOOL bSetting, 1194 FX_BOOL bSetting,
1199 XFA_ATTRIBUTE eAttribute) { 1195 XFA_ATTRIBUTE eAttribute) {
1200 if (bSetting) { 1196 if (bSetting) {
1201 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1197 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1202 } else { 1198 } else {
1203 CXFA_NodeArray properts; 1199 CXFA_NodeArray properts;
1204 int32_t iSize = GetNodeList(properts, XFA_NODEFILTER_OneOfProperty); 1200 int32_t iSize = GetNodeList(properts, XFA_NODEFILTER_OneOfProperty);
1205 if (iSize > 0) { 1201 if (iSize > 0) {
1206 FXJSE_Value_Set( 1202 FXJSE_Value_Set(
1207 pValue, 1203 pValue,
1208 m_pDocument->GetScriptContext()->GetJSValueFromMap(properts[0])); 1204 m_pDocument->GetScriptContext()->GetJSValueFromMap(properts[0]));
1209 } 1205 }
1210 } 1206 }
1211 } 1207 }
1212 1208
1213 void CXFA_Node::Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments) {} 1209 void CXFA_Node::Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments) {}
1214 void CXFA_Node::Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments) { 1210 void CXFA_Node::Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments) {
1215 CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument); 1211 CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument);
1216 FXJSE_Value_SetObject(pArguments->GetReturnValue(), (CXFA_Object*)pFormNodes, 1212 FXJSE_Value_SetObject(pArguments->GetReturnValue(), (CXFA_Object*)pFormNodes,
1217 m_pDocument->GetScriptContext()->GetJseNormalClass()); 1213 m_pDocument->GetScriptContext()->GetJseNormalClass());
1218 } 1214 }
1219 void CXFA_Node::Script_ModelClass_ClearErrorList(CFXJSE_Arguments* pArguments) { 1215 void CXFA_Node::Script_ModelClass_ClearErrorList(CFXJSE_Arguments* pArguments) {
1220 } 1216 }
1221 void CXFA_Node::Script_ModelClass_CreateNode(CFXJSE_Arguments* pArguments) { 1217 void CXFA_Node::Script_ModelClass_CreateNode(CFXJSE_Arguments* pArguments) {
1222 Script_Template_CreateNode(pArguments); 1218 Script_Template_CreateNode(pArguments);
1223 } 1219 }
1224 void CXFA_Node::Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments) { 1220 void CXFA_Node::Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments) {
1225 int32_t iLength = pArguments->GetLength(); 1221 int32_t iLength = pArguments->GetLength();
1226 if (iLength < 1) { 1222 if (iLength < 1) {
1227 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 1223 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"isCompatibleNS");
1228 L"isCompatibleNS");
1229 return; 1224 return;
1230 } 1225 }
1231 CFX_WideString wsNameSpace; 1226 CFX_WideString wsNameSpace;
1232 if (iLength >= 1) { 1227 if (iLength >= 1) {
1233 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(0); 1228 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(0);
1234 wsNameSpace = CFX_WideString::FromUTF8(bsNameSpace.AsStringC()); 1229 wsNameSpace = CFX_WideString::FromUTF8(bsNameSpace.AsStringC());
1235 } 1230 }
1236 CFX_WideString wsNodeNameSpace; 1231 CFX_WideString wsNodeNameSpace;
1237 TryNamespace(wsNodeNameSpace); 1232 TryNamespace(wsNodeNameSpace);
1238 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 1233 CFXJSE_Value* pValue = pArguments->GetReturnValue();
(...skipping 15 matching lines...) Expand all
1254 } else { 1249 } else {
1255 FXJSE_Value_SetInteger(pValue, GetInteger(eAttribute)); 1250 FXJSE_Value_SetInteger(pValue, GetInteger(eAttribute));
1256 } 1251 }
1257 } 1252 }
1258 void CXFA_Node::Script_Attribute_IntegerRead(CFXJSE_Value* pValue, 1253 void CXFA_Node::Script_Attribute_IntegerRead(CFXJSE_Value* pValue,
1259 FX_BOOL bSetting, 1254 FX_BOOL bSetting,
1260 XFA_ATTRIBUTE eAttribute) { 1255 XFA_ATTRIBUTE eAttribute) {
1261 if (!bSetting) { 1256 if (!bSetting) {
1262 FXJSE_Value_SetInteger(pValue, GetInteger(eAttribute)); 1257 FXJSE_Value_SetInteger(pValue, GetInteger(eAttribute));
1263 } else { 1258 } else {
1264 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1259 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1265 } 1260 }
1266 } 1261 }
1267 void CXFA_Node::Script_Attribute_BOOL(CFXJSE_Value* pValue, 1262 void CXFA_Node::Script_Attribute_BOOL(CFXJSE_Value* pValue,
1268 FX_BOOL bSetting, 1263 FX_BOOL bSetting,
1269 XFA_ATTRIBUTE eAttribute) { 1264 XFA_ATTRIBUTE eAttribute) {
1270 if (bSetting) { 1265 if (bSetting) {
1271 SetBoolean(eAttribute, FXJSE_Value_ToBoolean(pValue), true); 1266 SetBoolean(eAttribute, FXJSE_Value_ToBoolean(pValue), true);
1272 } else { 1267 } else {
1273 FXJSE_Value_SetUTF8String(pValue, GetBoolean(eAttribute) ? "1" : "0"); 1268 FXJSE_Value_SetUTF8String(pValue, GetBoolean(eAttribute) ? "1" : "0");
1274 } 1269 }
1275 } 1270 }
1276 void CXFA_Node::Script_Attribute_BOOLRead(CFXJSE_Value* pValue, 1271 void CXFA_Node::Script_Attribute_BOOLRead(CFXJSE_Value* pValue,
1277 FX_BOOL bSetting, 1272 FX_BOOL bSetting,
1278 XFA_ATTRIBUTE eAttribute) { 1273 XFA_ATTRIBUTE eAttribute) {
1279 if (!bSetting) { 1274 if (!bSetting) {
1280 FXJSE_Value_SetUTF8String(pValue, GetBoolean(eAttribute) ? "1" : "0"); 1275 FXJSE_Value_SetUTF8String(pValue, GetBoolean(eAttribute) ? "1" : "0");
1281 } else { 1276 } else {
1282 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1277 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1283 } 1278 }
1284 } 1279 }
1285 1280
1286 void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( 1281 void CXFA_Node::Script_Attribute_SendAttributeChangeMessage(
1287 XFA_ATTRIBUTE eAttribute, 1282 XFA_ATTRIBUTE eAttribute,
1288 FX_BOOL bScriptModify) { 1283 FX_BOOL bScriptModify) {
1289 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); 1284 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor();
1290 if (!pLayoutPro) 1285 if (!pLayoutPro)
1291 return; 1286 return;
1292 1287
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 void CXFA_Node::Script_Attribute_StringRead(CFXJSE_Value* pValue, 1501 void CXFA_Node::Script_Attribute_StringRead(CFXJSE_Value* pValue,
1507 FX_BOOL bSetting, 1502 FX_BOOL bSetting,
1508 XFA_ATTRIBUTE eAttribute) { 1503 XFA_ATTRIBUTE eAttribute) {
1509 if (!bSetting) { 1504 if (!bSetting) {
1510 CFX_WideString wsValue; 1505 CFX_WideString wsValue;
1511 GetAttribute(eAttribute, wsValue); 1506 GetAttribute(eAttribute, wsValue);
1512 FXJSE_Value_SetUTF8String( 1507 FXJSE_Value_SetUTF8String(
1513 pValue, 1508 pValue,
1514 FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); 1509 FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC());
1515 } else { 1510 } else {
1516 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1511 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1517 } 1512 }
1518 } 1513 }
1519 void CXFA_Node::Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments) { 1514 void CXFA_Node::Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments) {
1520 int32_t argc = pArguments->GetLength(); 1515 int32_t argc = pArguments->GetLength();
1521 if ((argc == 0) || (argc == 1)) { 1516 if ((argc == 0) || (argc == 1)) {
1522 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); 1517 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE);
1523 } else { 1518 } else {
1524 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execute"); 1519 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execute");
1525 } 1520 }
1526 } 1521 }
1527 void CXFA_Node::Script_Delta_Restore(CFXJSE_Arguments* pArguments) { 1522 void CXFA_Node::Script_Delta_Restore(CFXJSE_Arguments* pArguments) {
1528 int32_t argc = pArguments->GetLength(); 1523 int32_t argc = pArguments->GetLength();
1529 if (argc == 0) { 1524 if (argc == 0) {
1530 } else { 1525 } else {
1531 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"restore"); 1526 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"restore");
1532 } 1527 }
1533 } 1528 }
1534 void CXFA_Node::Script_Delta_CurrentValue(CFXJSE_Value* pValue, 1529 void CXFA_Node::Script_Delta_CurrentValue(CFXJSE_Value* pValue,
1535 FX_BOOL bSetting, 1530 FX_BOOL bSetting,
1536 XFA_ATTRIBUTE eAttribute) {} 1531 XFA_ATTRIBUTE eAttribute) {}
1537 void CXFA_Node::Script_Delta_SavedValue(CFXJSE_Value* pValue, 1532 void CXFA_Node::Script_Delta_SavedValue(CFXJSE_Value* pValue,
1538 FX_BOOL bSetting, 1533 FX_BOOL bSetting,
1539 XFA_ATTRIBUTE eAttribute) {} 1534 XFA_ATTRIBUTE eAttribute) {}
1540 void CXFA_Node::Script_Delta_Target(CFXJSE_Value* pValue, 1535 void CXFA_Node::Script_Delta_Target(CFXJSE_Value* pValue,
1541 FX_BOOL bSetting, 1536 FX_BOOL bSetting,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 } 1594 }
1600 void CXFA_Node::Script_Som_ValidationMessage(CFXJSE_Value* pValue, 1595 void CXFA_Node::Script_Som_ValidationMessage(CFXJSE_Value* pValue,
1601 FX_BOOL bSetting, 1596 FX_BOOL bSetting,
1602 XFA_ATTRIBUTE eAttribute) { 1597 XFA_ATTRIBUTE eAttribute) {
1603 Script_Som_Message(pValue, bSetting, XFA_SOM_ValidationMessage); 1598 Script_Som_Message(pValue, bSetting, XFA_SOM_ValidationMessage);
1604 } 1599 }
1605 void CXFA_Node::Script_Field_Length(CFXJSE_Value* pValue, 1600 void CXFA_Node::Script_Field_Length(CFXJSE_Value* pValue,
1606 FX_BOOL bSetting, 1601 FX_BOOL bSetting,
1607 XFA_ATTRIBUTE eAttribute) { 1602 XFA_ATTRIBUTE eAttribute) {
1608 if (bSetting) { 1603 if (bSetting) {
1609 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1604 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1610 } else { 1605 } else {
1611 CXFA_WidgetData* pWidgetData = GetWidgetData(); 1606 CXFA_WidgetData* pWidgetData = GetWidgetData();
1612 if (!pWidgetData) { 1607 if (!pWidgetData) {
1613 FXJSE_Value_SetInteger(pValue, 0); 1608 FXJSE_Value_SetInteger(pValue, 0);
1614 return; 1609 return;
1615 } 1610 }
1616 FXJSE_Value_SetInteger(pValue, pWidgetData->CountChoiceListItems(TRUE)); 1611 FXJSE_Value_SetInteger(pValue, pWidgetData->CountChoiceListItems(TRUE));
1617 } 1612 }
1618 } 1613 }
1619 void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, 1614 void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 FXJSE_Value_SetUTF8String( 1673 FXJSE_Value_SetUTF8String(
1679 pValue, 1674 pValue,
1680 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); 1675 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC());
1681 } 1676 }
1682 } 1677 }
1683 } 1678 }
1684 void CXFA_Node::Script_Som_DefaultValue_Read(CFXJSE_Value* pValue, 1679 void CXFA_Node::Script_Som_DefaultValue_Read(CFXJSE_Value* pValue,
1685 FX_BOOL bSetting, 1680 FX_BOOL bSetting,
1686 XFA_ATTRIBUTE eAttribute) { 1681 XFA_ATTRIBUTE eAttribute) {
1687 if (bSetting) { 1682 if (bSetting) {
1688 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1683 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1689 return; 1684 return;
1690 } 1685 }
1691 CFX_WideString content = GetScriptContent(TRUE); 1686 CFX_WideString content = GetScriptContent(TRUE);
1692 if (content.IsEmpty()) { 1687 if (content.IsEmpty()) {
1693 FXJSE_Value_SetNull(pValue); 1688 FXJSE_Value_SetNull(pValue);
1694 } else { 1689 } else {
1695 FXJSE_Value_SetUTF8String( 1690 FXJSE_Value_SetUTF8String(
1696 pValue, 1691 pValue,
1697 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); 1692 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC());
1698 } 1693 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 if (!bSetting) { 1892 if (!bSetting) {
1898 CXFA_Node* pDataNode = GetBindData(); 1893 CXFA_Node* pDataNode = GetBindData();
1899 if (pDataNode) { 1894 if (pDataNode) {
1900 FXJSE_Value_Set( 1895 FXJSE_Value_Set(
1901 pValue, 1896 pValue,
1902 m_pDocument->GetScriptContext()->GetJSValueFromMap(pDataNode)); 1897 m_pDocument->GetScriptContext()->GetJSValueFromMap(pDataNode));
1903 } else { 1898 } else {
1904 FXJSE_Value_SetNull(pValue); 1899 FXJSE_Value_SetNull(pValue);
1905 } 1900 }
1906 } else { 1901 } else {
1907 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1902 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1908 } 1903 }
1909 } 1904 }
1910 void CXFA_Node::Script_Draw_DefaultValue(CFXJSE_Value* pValue, 1905 void CXFA_Node::Script_Draw_DefaultValue(CFXJSE_Value* pValue,
1911 FX_BOOL bSetting, 1906 FX_BOOL bSetting,
1912 XFA_ATTRIBUTE eAttribute) { 1907 XFA_ATTRIBUTE eAttribute) {
1913 if (bSetting) { 1908 if (bSetting) {
1914 if (FXJSE_Value_IsUTF8String(pValue)) { 1909 if (FXJSE_Value_IsUTF8String(pValue)) {
1915 CXFA_WidgetData* pWidgetData = GetWidgetData(); 1910 CXFA_WidgetData* pWidgetData = GetWidgetData();
1916 ASSERT(pWidgetData); 1911 ASSERT(pWidgetData);
1917 XFA_ELEMENT uiType = pWidgetData->GetUIType(); 1912 XFA_ELEMENT uiType = pWidgetData->GetUIType();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 } 2097 }
2103 void CXFA_Node::Script_Som_MandatoryMessage(CFXJSE_Value* pValue, 2098 void CXFA_Node::Script_Som_MandatoryMessage(CFXJSE_Value* pValue,
2104 FX_BOOL bSetting, 2099 FX_BOOL bSetting,
2105 XFA_ATTRIBUTE eAttribute) { 2100 XFA_ATTRIBUTE eAttribute) {
2106 Script_Som_Message(pValue, bSetting, XFA_SOM_MandatoryMessage); 2101 Script_Som_Message(pValue, bSetting, XFA_SOM_MandatoryMessage);
2107 } 2102 }
2108 void CXFA_Node::Script_Field_ParentSubform(CFXJSE_Value* pValue, 2103 void CXFA_Node::Script_Field_ParentSubform(CFXJSE_Value* pValue,
2109 FX_BOOL bSetting, 2104 FX_BOOL bSetting,
2110 XFA_ATTRIBUTE eAttribute) { 2105 XFA_ATTRIBUTE eAttribute) {
2111 if (bSetting) { 2106 if (bSetting) {
2112 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 2107 ThrowException(XFA_IDS_INVAlID_PROP_SET);
2113 } else { 2108 } else {
2114 FXJSE_Value_SetNull(pValue); 2109 FXJSE_Value_SetNull(pValue);
2115 } 2110 }
2116 } 2111 }
2117 void CXFA_Node::Script_Field_SelectedIndex(CFXJSE_Value* pValue, 2112 void CXFA_Node::Script_Field_SelectedIndex(CFXJSE_Value* pValue,
2118 FX_BOOL bSetting, 2113 FX_BOOL bSetting,
2119 XFA_ATTRIBUTE eAttribute) { 2114 XFA_ATTRIBUTE eAttribute) {
2120 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2115 CXFA_WidgetData* pWidgetData = GetWidgetData();
2121 if (!pWidgetData) { 2116 if (!pWidgetData) {
2122 return; 2117 return;
(...skipping 21 matching lines...) Expand all
2144 if (argc == 1) { 2139 if (argc == 1) {
2145 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2140 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2146 int32_t iRet = execSingleEventByName( 2141 int32_t iRet = execSingleEventByName(
2147 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), 2142 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
2148 XFA_ELEMENT_Field); 2143 XFA_ELEMENT_Field);
2149 if (eventString == "validate") { 2144 if (eventString == "validate") {
2150 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), 2145 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(),
2151 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); 2146 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE));
2152 } 2147 }
2153 } else { 2148 } else {
2154 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2149 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2155 } 2150 }
2156 } 2151 }
2157 void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) { 2152 void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) {
2158 int32_t argc = pArguments->GetLength(); 2153 int32_t argc = pArguments->GetLength();
2159 if (argc == 0) { 2154 if (argc == 0) {
2160 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2155 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2161 if (!pNotify) { 2156 if (!pNotify) {
2162 return; 2157 return;
2163 } 2158 }
2164 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Initialize, FALSE, FALSE); 2159 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Initialize, FALSE, FALSE);
2165 } else { 2160 } else {
2166 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2161 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execInitialize");
2167 L"execInitialize");
2168 } 2162 }
2169 } 2163 }
2170 void CXFA_Node::Script_Field_DeleteItem(CFXJSE_Arguments* pArguments) { 2164 void CXFA_Node::Script_Field_DeleteItem(CFXJSE_Arguments* pArguments) {
2171 int32_t iLength = pArguments->GetLength(); 2165 int32_t iLength = pArguments->GetLength();
2172 if (iLength != 1) { 2166 if (iLength != 1) {
2173 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"deleteItem"); 2167 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"deleteItem");
2174 return; 2168 return;
2175 } 2169 }
2176 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2170 CXFA_WidgetData* pWidgetData = GetWidgetData();
2177 if (!pWidgetData) { 2171 if (!pWidgetData) {
2178 return; 2172 return;
2179 } 2173 }
2180 int32_t iIndex = pArguments->GetInt32(0); 2174 int32_t iIndex = pArguments->GetInt32(0);
2181 FX_BOOL bValue = pWidgetData->DeleteItem(iIndex, TRUE, TRUE); 2175 FX_BOOL bValue = pWidgetData->DeleteItem(iIndex, TRUE, TRUE);
2182 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 2176 CFXJSE_Value* pValue = pArguments->GetReturnValue();
2183 if (pValue) { 2177 if (pValue) {
2184 FXJSE_Value_SetBoolean(pValue, bValue); 2178 FXJSE_Value_SetBoolean(pValue, bValue);
2185 } 2179 }
2186 } 2180 }
2187 void CXFA_Node::Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments) { 2181 void CXFA_Node::Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments) {
2188 int32_t iLength = pArguments->GetLength(); 2182 int32_t iLength = pArguments->GetLength();
2189 if (iLength != 1) { 2183 if (iLength != 1) {
2190 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getSaveItem"); 2184 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getSaveItem");
2191 return; 2185 return;
2192 } 2186 }
2193 int32_t iIndex = pArguments->GetInt32(0); 2187 int32_t iIndex = pArguments->GetInt32(0);
2194 if (iIndex < 0) { 2188 if (iIndex < 0) {
2195 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2189 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2196 return; 2190 return;
2197 } 2191 }
2198 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2192 CXFA_WidgetData* pWidgetData = GetWidgetData();
2199 if (!pWidgetData) { 2193 if (!pWidgetData) {
2200 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2194 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2201 return; 2195 return;
2202 } 2196 }
2203 CFX_WideString wsValue; 2197 CFX_WideString wsValue;
2204 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, TRUE); 2198 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, TRUE);
2205 if (bHasItem) { 2199 if (bHasItem) {
2206 FXJSE_Value_SetUTF8String( 2200 FXJSE_Value_SetUTF8String(
2207 pArguments->GetReturnValue(), 2201 pArguments->GetReturnValue(),
2208 FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); 2202 FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC());
2209 } else { 2203 } else {
2210 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2204 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2211 } 2205 }
2212 } 2206 }
2213 void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { 2207 void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) {
2214 int32_t iLength = pArguments->GetLength(); 2208 int32_t iLength = pArguments->GetLength();
2215 if (iLength != 1) { 2209 if (iLength != 1) {
2216 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"boundItem"); 2210 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"boundItem");
2217 return; 2211 return;
2218 } 2212 }
2219 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2213 CXFA_WidgetData* pWidgetData = GetWidgetData();
2220 if (!pWidgetData) { 2214 if (!pWidgetData) {
2221 return; 2215 return;
2222 } 2216 }
2223 CFX_ByteString bsValue = pArguments->GetUTF8String(0); 2217 CFX_ByteString bsValue = pArguments->GetUTF8String(0);
2224 CFX_WideString wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC()); 2218 CFX_WideString wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC());
2225 CFX_WideString wsBoundValue; 2219 CFX_WideString wsBoundValue;
2226 pWidgetData->GetItemValue(wsValue.AsStringC(), wsBoundValue); 2220 pWidgetData->GetItemValue(wsValue.AsStringC(), wsBoundValue);
2227 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 2221 CFXJSE_Value* pValue = pArguments->GetReturnValue();
2228 if (pValue) { 2222 if (pValue) {
2229 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsBoundValue).AsStringC()); 2223 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsBoundValue).AsStringC());
2230 } 2224 }
2231 } 2225 }
2232 void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { 2226 void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) {
2233 int32_t iLength = pArguments->GetLength(); 2227 int32_t iLength = pArguments->GetLength();
2234 if (iLength != 1) { 2228 if (iLength != 1) {
2235 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2229 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getItemState");
2236 L"getItemState");
2237 return; 2230 return;
2238 } 2231 }
2239 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2232 CXFA_WidgetData* pWidgetData = GetWidgetData();
2240 if (!pWidgetData) { 2233 if (!pWidgetData) {
2241 return; 2234 return;
2242 } 2235 }
2243 int32_t iIndex = pArguments->GetInt32(0); 2236 int32_t iIndex = pArguments->GetInt32(0);
2244 FX_BOOL bValue = pWidgetData->GetItemState(iIndex); 2237 FX_BOOL bValue = pWidgetData->GetItemState(iIndex);
2245 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 2238 CFXJSE_Value* pValue = pArguments->GetReturnValue();
2246 if (pValue) { 2239 if (pValue) {
2247 FXJSE_Value_SetBoolean(pValue, bValue); 2240 FXJSE_Value_SetBoolean(pValue, bValue);
2248 } 2241 }
2249 } 2242 }
2250 void CXFA_Node::Script_Field_ExecCalculate(CFXJSE_Arguments* pArguments) { 2243 void CXFA_Node::Script_Field_ExecCalculate(CFXJSE_Arguments* pArguments) {
2251 int32_t argc = pArguments->GetLength(); 2244 int32_t argc = pArguments->GetLength();
2252 if (argc == 0) { 2245 if (argc == 0) {
2253 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2246 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2254 if (!pNotify) { 2247 if (!pNotify) {
2255 return; 2248 return;
2256 } 2249 }
2257 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Calculate, FALSE, FALSE); 2250 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Calculate, FALSE, FALSE);
2258 } else { 2251 } else {
2259 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2252 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execCalculate");
2260 L"execCalculate");
2261 } 2253 }
2262 } 2254 }
2263 void CXFA_Node::Script_Field_SetItems(CFXJSE_Arguments* pArguments) {} 2255 void CXFA_Node::Script_Field_SetItems(CFXJSE_Arguments* pArguments) {}
2264 void CXFA_Node::Script_Field_GetDisplayItem(CFXJSE_Arguments* pArguments) { 2256 void CXFA_Node::Script_Field_GetDisplayItem(CFXJSE_Arguments* pArguments) {
2265 int32_t iLength = pArguments->GetLength(); 2257 int32_t iLength = pArguments->GetLength();
2266 if (iLength != 1) { 2258 if (iLength != 1) {
2267 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2259 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getDisplayItem");
2268 L"getDisplayItem");
2269 return; 2260 return;
2270 } 2261 }
2271 int32_t iIndex = pArguments->GetInt32(0); 2262 int32_t iIndex = pArguments->GetInt32(0);
2272 if (iIndex < 0) { 2263 if (iIndex < 0) {
2273 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2264 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2274 return; 2265 return;
2275 } 2266 }
2276 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2267 CXFA_WidgetData* pWidgetData = GetWidgetData();
2277 if (!pWidgetData) { 2268 if (!pWidgetData) {
2278 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2269 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2279 return; 2270 return;
2280 } 2271 }
2281 CFX_WideString wsValue; 2272 CFX_WideString wsValue;
2282 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, FALSE); 2273 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, FALSE);
2283 if (bHasItem) { 2274 if (bHasItem) {
2284 FXJSE_Value_SetUTF8String( 2275 FXJSE_Value_SetUTF8String(
2285 pArguments->GetReturnValue(), 2276 pArguments->GetReturnValue(),
2286 FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); 2277 FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC());
2287 } else { 2278 } else {
2288 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2279 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2289 } 2280 }
2290 } 2281 }
2291 void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) { 2282 void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) {
2292 int32_t iLength = pArguments->GetLength(); 2283 int32_t iLength = pArguments->GetLength();
2293 if (iLength != 2) { 2284 if (iLength != 2) {
2294 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2285 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setItemState");
2295 L"setItemState");
2296 return; 2286 return;
2297 } 2287 }
2298 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2288 CXFA_WidgetData* pWidgetData = GetWidgetData();
2299 if (!pWidgetData) 2289 if (!pWidgetData)
2300 return; 2290 return;
2301 2291
2302 int32_t iIndex = pArguments->GetInt32(0); 2292 int32_t iIndex = pArguments->GetInt32(0);
2303 if (pArguments->GetInt32(1) != 0) { 2293 if (pArguments->GetInt32(1) != 0) {
2304 pWidgetData->SetItemState(iIndex, TRUE, true, TRUE, TRUE); 2294 pWidgetData->SetItemState(iIndex, TRUE, true, TRUE, TRUE);
2305 } else { 2295 } else {
2306 if (pWidgetData->GetItemState(iIndex)) 2296 if (pWidgetData->GetItemState(iIndex))
2307 pWidgetData->SetItemState(iIndex, FALSE, true, TRUE, TRUE); 2297 pWidgetData->SetItemState(iIndex, FALSE, true, TRUE, TRUE);
2308 } 2298 }
2309 } 2299 }
2310 void CXFA_Node::Script_Field_AddItem(CFXJSE_Arguments* pArguments) { 2300 void CXFA_Node::Script_Field_AddItem(CFXJSE_Arguments* pArguments) {
2311 int32_t iLength = pArguments->GetLength(); 2301 int32_t iLength = pArguments->GetLength();
2312 if (iLength < 1 || iLength > 2) { 2302 if (iLength < 1 || iLength > 2) {
2313 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"addItem"); 2303 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"addItem");
2314 return; 2304 return;
2315 } 2305 }
2316 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2306 CXFA_WidgetData* pWidgetData = GetWidgetData();
2317 if (!pWidgetData) { 2307 if (!pWidgetData) {
2318 return; 2308 return;
2319 } 2309 }
2320 CFX_WideString wsLabel; 2310 CFX_WideString wsLabel;
2321 CFX_WideString wsValue; 2311 CFX_WideString wsValue;
2322 if (iLength >= 1) { 2312 if (iLength >= 1) {
2323 CFX_ByteString bsLabel = pArguments->GetUTF8String(0); 2313 CFX_ByteString bsLabel = pArguments->GetUTF8String(0);
(...skipping 11 matching lines...) Expand all
2335 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2325 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2336 if (!pNotify) { 2326 if (!pNotify) {
2337 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); 2327 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE);
2338 } else { 2328 } else {
2339 int32_t iRet = 2329 int32_t iRet =
2340 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate, FALSE, FALSE); 2330 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate, FALSE, FALSE);
2341 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), 2331 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(),
2342 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); 2332 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE));
2343 } 2333 }
2344 } else { 2334 } else {
2345 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2335 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate");
2346 L"execValidate");
2347 } 2336 }
2348 } 2337 }
2349 void CXFA_Node::Script_ExclGroup_ErrorText(CFXJSE_Value* pValue, 2338 void CXFA_Node::Script_ExclGroup_ErrorText(CFXJSE_Value* pValue,
2350 FX_BOOL bSetting, 2339 FX_BOOL bSetting,
2351 XFA_ATTRIBUTE eAttribute) { 2340 XFA_ATTRIBUTE eAttribute) {
2352 if (!bSetting) { 2341 if (!bSetting) {
2353 } else { 2342 } else {
2354 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 2343 ThrowException(XFA_IDS_INVAlID_PROP_SET);
2355 } 2344 }
2356 } 2345 }
2357 void CXFA_Node::Script_ExclGroup_DefaultAndRawValue(CFXJSE_Value* pValue, 2346 void CXFA_Node::Script_ExclGroup_DefaultAndRawValue(CFXJSE_Value* pValue,
2358 FX_BOOL bSetting, 2347 FX_BOOL bSetting,
2359 XFA_ATTRIBUTE eAttribute) { 2348 XFA_ATTRIBUTE eAttribute) {
2360 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2349 CXFA_WidgetData* pWidgetData = GetWidgetData();
2361 if (!pWidgetData) { 2350 if (!pWidgetData) {
2362 return; 2351 return;
2363 } 2352 }
2364 if (bSetting) { 2353 if (bSetting) {
(...skipping 16 matching lines...) Expand all
2381 FX_BOOL bSetting, 2370 FX_BOOL bSetting,
2382 XFA_ATTRIBUTE eAttribute) {} 2371 XFA_ATTRIBUTE eAttribute) {}
2383 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { 2372 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) {
2384 int32_t argc = pArguments->GetLength(); 2373 int32_t argc = pArguments->GetLength();
2385 if (argc == 1) { 2374 if (argc == 1) {
2386 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2375 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2387 execSingleEventByName( 2376 execSingleEventByName(
2388 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), 2377 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
2389 XFA_ELEMENT_ExclGroup); 2378 XFA_ELEMENT_ExclGroup);
2390 } else { 2379 } else {
2391 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2380 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2392 } 2381 }
2393 } 2382 }
2394 2383
2395 void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { 2384 void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) {
2396 int32_t argc = pArguments->GetLength(); 2385 int32_t argc = pArguments->GetLength();
2397 if (argc < 0 || argc > 1) { 2386 if (argc < 0 || argc > 1) {
2398 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2387 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"selectedMember");
2399 L"selectedMember");
2400 return; 2388 return;
2401 } 2389 }
2402 2390
2403 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2391 CXFA_WidgetData* pWidgetData = GetWidgetData();
2404 if (!pWidgetData) { 2392 if (!pWidgetData) {
2405 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2393 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2406 return; 2394 return;
2407 } 2395 }
2408 2396
2409 CXFA_Node* pReturnNode = nullptr; 2397 CXFA_Node* pReturnNode = nullptr;
(...skipping 16 matching lines...) Expand all
2426 2414
2427 void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) { 2415 void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) {
2428 int32_t argc = pArguments->GetLength(); 2416 int32_t argc = pArguments->GetLength();
2429 if (argc == 0) { 2417 if (argc == 0) {
2430 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2418 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2431 if (!pNotify) { 2419 if (!pNotify) {
2432 return; 2420 return;
2433 } 2421 }
2434 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Initialize); 2422 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Initialize);
2435 } else { 2423 } else {
2436 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2424 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execInitialize");
2437 L"execInitialize");
2438 } 2425 }
2439 } 2426 }
2440 void CXFA_Node::Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments) { 2427 void CXFA_Node::Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments) {
2441 int32_t argc = pArguments->GetLength(); 2428 int32_t argc = pArguments->GetLength();
2442 if (argc == 0) { 2429 if (argc == 0) {
2443 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2430 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2444 if (!pNotify) { 2431 if (!pNotify) {
2445 return; 2432 return;
2446 } 2433 }
2447 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Calculate); 2434 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Calculate);
2448 } else { 2435 } else {
2449 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2436 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execCalculate");
2450 L"execCalculate");
2451 } 2437 }
2452 } 2438 }
2453 void CXFA_Node::Script_ExclGroup_ExecValidate(CFXJSE_Arguments* pArguments) { 2439 void CXFA_Node::Script_ExclGroup_ExecValidate(CFXJSE_Arguments* pArguments) {
2454 int32_t argc = pArguments->GetLength(); 2440 int32_t argc = pArguments->GetLength();
2455 if (argc == 0) { 2441 if (argc == 0) {
2456 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2442 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2457 if (!pNotify) { 2443 if (!pNotify) {
2458 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); 2444 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE);
2459 } else { 2445 } else {
2460 int32_t iRet = pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate); 2446 int32_t iRet = pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate);
2461 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), 2447 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(),
2462 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); 2448 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE));
2463 } 2449 }
2464 } else { 2450 } else {
2465 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2451 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate");
2466 L"execValidate");
2467 } 2452 }
2468 } 2453 }
2469 static CXFA_Node* XFA_ScriptInstanceManager_GetItem(CXFA_Node* pInstMgrNode, 2454 static CXFA_Node* XFA_ScriptInstanceManager_GetItem(CXFA_Node* pInstMgrNode,
2470 int32_t iIndex) { 2455 int32_t iIndex) {
2471 ASSERT(pInstMgrNode); 2456 ASSERT(pInstMgrNode);
2472 int32_t iCount = 0; 2457 int32_t iCount = 0;
2473 uint32_t dwNameHash = 0; 2458 uint32_t dwNameHash = 0;
2474 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); 2459 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling);
2475 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 2460 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
2476 XFA_ELEMENT eCurType = pNode->GetClassID(); 2461 XFA_ELEMENT eCurType = pNode->GetClassID();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2553 } 2538 }
2554 } 2539 }
2555 if (pInstanceMgr) { 2540 if (pInstanceMgr) {
2556 FXJSE_Value_Set( 2541 FXJSE_Value_Set(
2557 pValue, 2542 pValue,
2558 m_pDocument->GetScriptContext()->GetJSValueFromMap(pInstanceMgr)); 2543 m_pDocument->GetScriptContext()->GetJSValueFromMap(pInstanceMgr));
2559 } else { 2544 } else {
2560 FXJSE_Value_SetNull(pValue); 2545 FXJSE_Value_SetNull(pValue);
2561 } 2546 }
2562 } else { 2547 } else {
2563 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 2548 ThrowException(XFA_IDS_INVAlID_PROP_SET);
2564 } 2549 }
2565 } 2550 }
2566 void CXFA_Node::Script_Subform_Locale(CFXJSE_Value* pValue, 2551 void CXFA_Node::Script_Subform_Locale(CFXJSE_Value* pValue,
2567 FX_BOOL bSetting, 2552 FX_BOOL bSetting,
2568 XFA_ATTRIBUTE eAttribute) { 2553 XFA_ATTRIBUTE eAttribute) {
2569 if (bSetting) { 2554 if (bSetting) {
2570 CFX_ByteString bsLocaleName; 2555 CFX_ByteString bsLocaleName;
2571 FXJSE_Value_ToUTF8String(pValue, bsLocaleName); 2556 FXJSE_Value_ToUTF8String(pValue, bsLocaleName);
2572 SetCData(XFA_ATTRIBUTE_Locale, 2557 SetCData(XFA_ATTRIBUTE_Locale,
2573 CFX_WideString::FromUTF8(bsLocaleName.AsStringC()), true, TRUE); 2558 CFX_WideString::FromUTF8(bsLocaleName.AsStringC()), true, TRUE);
2574 } else { 2559 } else {
2575 CFX_WideString wsLocaleName; 2560 CFX_WideString wsLocaleName;
2576 GetLocaleName(wsLocaleName); 2561 GetLocaleName(wsLocaleName);
2577 FXJSE_Value_SetUTF8String( 2562 FXJSE_Value_SetUTF8String(
2578 pValue, FX_UTF8Encode(wsLocaleName.c_str(), wsLocaleName.GetLength()) 2563 pValue, FX_UTF8Encode(wsLocaleName.c_str(), wsLocaleName.GetLength())
2579 .AsStringC()); 2564 .AsStringC());
2580 } 2565 }
2581 } 2566 }
2582 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { 2567 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) {
2583 int32_t argc = pArguments->GetLength(); 2568 int32_t argc = pArguments->GetLength();
2584 if (argc == 1) { 2569 if (argc == 1) {
2585 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2570 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2586 execSingleEventByName( 2571 execSingleEventByName(
2587 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), 2572 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
2588 XFA_ELEMENT_Subform); 2573 XFA_ELEMENT_Subform);
2589 } else { 2574 } else {
2590 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2575 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2591 } 2576 }
2592 } 2577 }
2593 void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { 2578 void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) {
2594 int32_t argc = pArguments->GetLength(); 2579 int32_t argc = pArguments->GetLength();
2595 if (argc == 0) { 2580 if (argc == 0) {
2596 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2581 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2597 if (!pNotify) { 2582 if (!pNotify) {
2598 return; 2583 return;
2599 } 2584 }
2600 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Initialize); 2585 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Initialize);
2601 } else { 2586 } else {
2602 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2587 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execInitialize");
2603 L"execInitialize");
2604 } 2588 }
2605 } 2589 }
2606 void CXFA_Node::Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments) { 2590 void CXFA_Node::Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments) {
2607 int32_t argc = pArguments->GetLength(); 2591 int32_t argc = pArguments->GetLength();
2608 if (argc == 0) { 2592 if (argc == 0) {
2609 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2593 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2610 if (!pNotify) { 2594 if (!pNotify) {
2611 return; 2595 return;
2612 } 2596 }
2613 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Calculate); 2597 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Calculate);
2614 } else { 2598 } else {
2615 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2599 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execCalculate");
2616 L"execCalculate");
2617 } 2600 }
2618 } 2601 }
2619 void CXFA_Node::Script_Subform_ExecValidate(CFXJSE_Arguments* pArguments) { 2602 void CXFA_Node::Script_Subform_ExecValidate(CFXJSE_Arguments* pArguments) {
2620 int32_t argc = pArguments->GetLength(); 2603 int32_t argc = pArguments->GetLength();
2621 if (argc == 0) { 2604 if (argc == 0) {
2622 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2605 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2623 if (!pNotify) { 2606 if (!pNotify) {
2624 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); 2607 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE);
2625 } else { 2608 } else {
2626 int32_t iRet = pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate); 2609 int32_t iRet = pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate);
2627 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), 2610 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(),
2628 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); 2611 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE));
2629 } 2612 }
2630 } else { 2613 } else {
2631 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2614 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate");
2632 L"execValidate");
2633 } 2615 }
2634 } 2616 }
2635 void CXFA_Node::Script_Subform_GetInvalidObjects(CFXJSE_Arguments* pArguments) { 2617 void CXFA_Node::Script_Subform_GetInvalidObjects(CFXJSE_Arguments* pArguments) {
2636 int32_t argc = pArguments->GetLength(); 2618 int32_t argc = pArguments->GetLength();
2637 if (argc == 0) { 2619 if (argc == 0) {
2638 } else { 2620 } else {
2639 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2621 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getInvalidObjects");
2640 L"getInvalidObjects");
2641 } 2622 }
2642 } 2623 }
2643 int32_t CXFA_Node::Subform_and_SubformSet_InstanceIndex() { 2624 int32_t CXFA_Node::Subform_and_SubformSet_InstanceIndex() {
2644 int32_t index = 0; 2625 int32_t index = 0;
2645 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; 2626 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode;
2646 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { 2627 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) {
2647 if ((pNode->GetClassID() == XFA_ELEMENT_Subform) || 2628 if ((pNode->GetClassID() == XFA_ELEMENT_Subform) ||
2648 (pNode->GetClassID() == XFA_ELEMENT_SubformSet)) { 2629 (pNode->GetClassID() == XFA_ELEMENT_SubformSet)) {
2649 index++; 2630 index++;
2650 } else { 2631 } else {
2651 break; 2632 break;
2652 } 2633 }
2653 } 2634 }
2654 return index; 2635 return index;
2655 } 2636 }
2656 void CXFA_Node::Script_Template_FormNodes(CFXJSE_Arguments* pArguments) { 2637 void CXFA_Node::Script_Template_FormNodes(CFXJSE_Arguments* pArguments) {
2657 int32_t argc = pArguments->GetLength(); 2638 int32_t argc = pArguments->GetLength();
2658 if (argc == 1) { 2639 if (argc == 1) {
2659 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE); 2640 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE);
2660 } else { 2641 } else {
2661 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"formNodes"); 2642 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"formNodes");
2662 } 2643 }
2663 } 2644 }
2664 void CXFA_Node::Script_Template_Remerge(CFXJSE_Arguments* pArguments) { 2645 void CXFA_Node::Script_Template_Remerge(CFXJSE_Arguments* pArguments) {
2665 int32_t argc = pArguments->GetLength(); 2646 int32_t argc = pArguments->GetLength();
2666 if (argc == 0) { 2647 if (argc == 0) {
2667 m_pDocument->DoDataRemerge(TRUE); 2648 m_pDocument->DoDataRemerge(TRUE);
2668 } else { 2649 } else {
2669 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"remerge"); 2650 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"remerge");
2670 } 2651 }
2671 } 2652 }
2672 void CXFA_Node::Script_Template_ExecInitialize(CFXJSE_Arguments* pArguments) { 2653 void CXFA_Node::Script_Template_ExecInitialize(CFXJSE_Arguments* pArguments) {
2673 int32_t argc = pArguments->GetLength(); 2654 int32_t argc = pArguments->GetLength();
2674 if (argc == 0) { 2655 if (argc == 0) {
2675 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2656 CXFA_WidgetData* pWidgetData = GetWidgetData();
2676 if (!pWidgetData) { 2657 if (!pWidgetData) {
2677 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); 2658 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE);
2678 } else { 2659 } else {
2679 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE); 2660 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE);
2680 } 2661 }
2681 } else { 2662 } else {
2682 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2663 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execInitialize");
2683 L"execInitialize");
2684 } 2664 }
2685 } 2665 }
2686 void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { 2666 void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) {
2687 int32_t argc = pArguments->GetLength(); 2667 int32_t argc = pArguments->GetLength();
2688 if ((argc > 0) && (argc < 4)) { 2668 if ((argc > 0) && (argc < 4)) {
2689 CFX_WideString strTagName; 2669 CFX_WideString strTagName;
2690 CFX_WideString strName; 2670 CFX_WideString strName;
2691 CFX_WideString strNameSpace; 2671 CFX_WideString strNameSpace;
2692 CFX_ByteString bsTagName = pArguments->GetUTF8String(0); 2672 CFX_ByteString bsTagName = pArguments->GetUTF8String(0);
2693 strTagName = CFX_WideString::FromUTF8(bsTagName.AsStringC()); 2673 strTagName = CFX_WideString::FromUTF8(bsTagName.AsStringC());
(...skipping 15 matching lines...) Expand all
2709 if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name, 2689 if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name,
2710 XFA_XDPPACKET_UNKNOWN)) { 2690 XFA_XDPPACKET_UNKNOWN)) {
2711 pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringC(), true); 2691 pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringC(), true);
2712 if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) { 2692 if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) {
2713 pNewNode->CreateXMLMappingNode(); 2693 pNewNode->CreateXMLMappingNode();
2714 } 2694 }
2715 FXJSE_Value_Set( 2695 FXJSE_Value_Set(
2716 pArguments->GetReturnValue(), 2696 pArguments->GetReturnValue(),
2717 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode)); 2697 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode));
2718 } else { 2698 } else {
2719 ThrowScriptErrorMessage(XFA_IDS_NOT_HAVE_PROPERTY, strTagName.c_str(), 2699 ThrowException(XFA_IDS_NOT_HAVE_PROPERTY, strTagName.c_str(),
2720 L"name"); 2700 L"name");
2721 } 2701 }
2722 } else { 2702 } else {
2723 FXJSE_Value_Set( 2703 FXJSE_Value_Set(
2724 pArguments->GetReturnValue(), 2704 pArguments->GetReturnValue(),
2725 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode)); 2705 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode));
2726 } 2706 }
2727 } 2707 }
2728 } else { 2708 } else {
2729 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"createNode"); 2709 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"createNode");
2730 } 2710 }
2731 } 2711 }
2732 void CXFA_Node::Script_Template_Recalculate(CFXJSE_Arguments* pArguments) { 2712 void CXFA_Node::Script_Template_Recalculate(CFXJSE_Arguments* pArguments) {
2733 if (pArguments->GetLength() == 1) { 2713 if (pArguments->GetLength() == 1) {
2734 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE); 2714 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE);
2735 } else { 2715 } else {
2736 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"recalculate"); 2716 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"recalculate");
2737 } 2717 }
2738 } 2718 }
2739 void CXFA_Node::Script_Template_ExecCalculate(CFXJSE_Arguments* pArguments) { 2719 void CXFA_Node::Script_Template_ExecCalculate(CFXJSE_Arguments* pArguments) {
2740 int32_t argc = pArguments->GetLength(); 2720 int32_t argc = pArguments->GetLength();
2741 if (argc == 0) { 2721 if (argc == 0) {
2742 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2722 CXFA_WidgetData* pWidgetData = GetWidgetData();
2743 if (!pWidgetData) { 2723 if (!pWidgetData) {
2744 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); 2724 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE);
2745 } else { 2725 } else {
2746 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE); 2726 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE);
2747 } 2727 }
2748 } else { 2728 } else {
2749 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2729 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execCalculate");
2750 L"execCalculate");
2751 } 2730 }
2752 } 2731 }
2753 void CXFA_Node::Script_Template_ExecValidate(CFXJSE_Arguments* pArguments) { 2732 void CXFA_Node::Script_Template_ExecValidate(CFXJSE_Arguments* pArguments) {
2754 int32_t argc = pArguments->GetLength(); 2733 int32_t argc = pArguments->GetLength();
2755 if (argc == 0) { 2734 if (argc == 0) {
2756 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2735 CXFA_WidgetData* pWidgetData = GetWidgetData();
2757 if (!pWidgetData) { 2736 if (!pWidgetData) {
2758 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); 2737 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE);
2759 } else { 2738 } else {
2760 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE); 2739 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE);
2761 } 2740 }
2762 } else { 2741 } else {
2763 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2742 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate");
2764 L"execValidate");
2765 } 2743 }
2766 } 2744 }
2767 void CXFA_Node::Script_Manifest_Evaluate(CFXJSE_Arguments* pArguments) { 2745 void CXFA_Node::Script_Manifest_Evaluate(CFXJSE_Arguments* pArguments) {
2768 int32_t argc = pArguments->GetLength(); 2746 int32_t argc = pArguments->GetLength();
2769 if (argc == 0) { 2747 if (argc == 0) {
2770 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2748 CXFA_WidgetData* pWidgetData = GetWidgetData();
2771 if (!pWidgetData) { 2749 if (!pWidgetData) {
2772 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); 2750 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE);
2773 } else { 2751 } else {
2774 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE); 2752 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE);
2775 } 2753 }
2776 } else { 2754 } else {
2777 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"evaluate"); 2755 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"evaluate");
2778 } 2756 }
2779 } 2757 }
2780 void CXFA_Node::Script_InstanceManager_Max(CFXJSE_Value* pValue, 2758 void CXFA_Node::Script_InstanceManager_Max(CFXJSE_Value* pValue,
2781 FX_BOOL bSetting, 2759 FX_BOOL bSetting,
2782 XFA_ATTRIBUTE eAttribute) { 2760 XFA_ATTRIBUTE eAttribute) {
2783 if (bSetting) { 2761 if (bSetting) {
2784 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 2762 ThrowException(XFA_IDS_INVAlID_PROP_SET);
2785 return; 2763 return;
2786 } 2764 }
2787 CXFA_Occur nodeOccur(GetOccurNode()); 2765 CXFA_Occur nodeOccur(GetOccurNode());
2788 FXJSE_Value_SetInteger(pValue, nodeOccur.GetMax()); 2766 FXJSE_Value_SetInteger(pValue, nodeOccur.GetMax());
2789 } 2767 }
2790 void CXFA_Node::Script_InstanceManager_Min(CFXJSE_Value* pValue, 2768 void CXFA_Node::Script_InstanceManager_Min(CFXJSE_Value* pValue,
2791 FX_BOOL bSetting, 2769 FX_BOOL bSetting,
2792 XFA_ATTRIBUTE eAttribute) { 2770 XFA_ATTRIBUTE eAttribute) {
2793 if (bSetting) { 2771 if (bSetting) {
2794 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 2772 ThrowException(XFA_IDS_INVAlID_PROP_SET);
2795 return; 2773 return;
2796 } 2774 }
2797 CXFA_Occur nodeOccur(GetOccurNode()); 2775 CXFA_Occur nodeOccur(GetOccurNode());
2798 FXJSE_Value_SetInteger(pValue, nodeOccur.GetMin()); 2776 FXJSE_Value_SetInteger(pValue, nodeOccur.GetMin());
2799 } 2777 }
2800 static int32_t XFA_ScriptInstanceManager_GetCount(CXFA_Node* pInstMgrNode) { 2778 static int32_t XFA_ScriptInstanceManager_GetCount(CXFA_Node* pInstMgrNode) {
2801 ASSERT(pInstMgrNode); 2779 ASSERT(pInstMgrNode);
2802 int32_t iCount = 0; 2780 int32_t iCount = 0;
2803 uint32_t dwNameHash = 0; 2781 uint32_t dwNameHash = 0;
2804 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); 2782 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling);
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
3106 void CXFA_Node::Script_InstanceManager_RemoveInstance( 3084 void CXFA_Node::Script_InstanceManager_RemoveInstance(
3107 CFXJSE_Arguments* pArguments) { 3085 CFXJSE_Arguments* pArguments) {
3108 int32_t argc = pArguments->GetLength(); 3086 int32_t argc = pArguments->GetLength();
3109 if (argc != 1) { 3087 if (argc != 1) {
3110 FXJSE_Value_SetUndefined(pArguments->GetReturnValue()); 3088 FXJSE_Value_SetUndefined(pArguments->GetReturnValue());
3111 return; 3089 return;
3112 } 3090 }
3113 int32_t iIndex = pArguments->GetInt32(0); 3091 int32_t iIndex = pArguments->GetInt32(0);
3114 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); 3092 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this);
3115 if (iIndex < 0 || iIndex >= iCount) { 3093 if (iIndex < 0 || iIndex >= iCount) {
3116 ThrowScriptErrorMessage(XFA_IDS_INDEX_OUT_OF_BOUNDS); 3094 ThrowException(XFA_IDS_INDEX_OUT_OF_BOUNDS);
3117 return; 3095 return;
3118 } 3096 }
3119 CXFA_Occur nodeOccur(GetOccurNode()); 3097 CXFA_Occur nodeOccur(GetOccurNode());
3120 int32_t iMin = nodeOccur.GetMin(); 3098 int32_t iMin = nodeOccur.GetMin();
3121 if (iCount - 1 < iMin) { 3099 if (iCount - 1 < iMin) {
3122 ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"min"); 3100 ThrowException(XFA_IDS_VIOLATE_BOUNDARY, L"min");
3123 return; 3101 return;
3124 } 3102 }
3125 CXFA_Node* pRemoveInstance = XFA_ScriptInstanceManager_GetItem(this, iIndex); 3103 CXFA_Node* pRemoveInstance = XFA_ScriptInstanceManager_GetItem(this, iIndex);
3126 XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance); 3104 XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance);
3127 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 3105 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
3128 if (pNotify) { 3106 if (pNotify) {
3129 for (int32_t i = iIndex; i < iCount - 1; i++) { 3107 for (int32_t i = iIndex; i < iCount - 1; i++) {
3130 CXFA_Node* pSubformInstance = XFA_ScriptInstanceManager_GetItem(this, i); 3108 CXFA_Node* pSubformInstance = XFA_ScriptInstanceManager_GetItem(this, i);
3131 if (pSubformInstance && 3109 if (pSubformInstance &&
3132 pSubformInstance->GetClassID() == XFA_ELEMENT_Subform) { 3110 pSubformInstance->GetClassID() == XFA_ELEMENT_Subform) {
(...skipping 15 matching lines...) Expand all
3148 FXJSE_Value_SetUndefined(pArguments->GetReturnValue()); 3126 FXJSE_Value_SetUndefined(pArguments->GetReturnValue());
3149 return; 3127 return;
3150 } 3128 }
3151 int32_t iDesired = pArguments->GetInt32(0); 3129 int32_t iDesired = pArguments->GetInt32(0);
3152 InstanceManager_SetInstances(iDesired); 3130 InstanceManager_SetInstances(iDesired);
3153 } 3131 }
3154 void CXFA_Node::Script_InstanceManager_AddInstance( 3132 void CXFA_Node::Script_InstanceManager_AddInstance(
3155 CFXJSE_Arguments* pArguments) { 3133 CFXJSE_Arguments* pArguments) {
3156 int32_t argc = pArguments->GetLength(); 3134 int32_t argc = pArguments->GetLength();
3157 if ((argc != 0) && (argc != 1)) { 3135 if ((argc != 0) && (argc != 1)) {
3158 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"addInstance"); 3136 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"addInstance");
3159 return; 3137 return;
3160 } 3138 }
3161 FX_BOOL fFlags = TRUE; 3139 FX_BOOL fFlags = TRUE;
3162 if (argc == 1) { 3140 if (argc == 1) {
3163 fFlags = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; 3141 fFlags = pArguments->GetInt32(0) == 0 ? FALSE : TRUE;
3164 } 3142 }
3165 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); 3143 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this);
3166 CXFA_Occur nodeOccur(GetOccurNode()); 3144 CXFA_Occur nodeOccur(GetOccurNode());
3167 int32_t iMax = nodeOccur.GetMax(); 3145 int32_t iMax = nodeOccur.GetMax();
3168 if (iMax >= 0 && iCount >= iMax) { 3146 if (iMax >= 0 && iCount >= iMax) {
3169 ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"max"); 3147 ThrowException(XFA_IDS_VIOLATE_BOUNDARY, L"max");
3170 return; 3148 return;
3171 } 3149 }
3172 CXFA_Node* pNewInstance = 3150 CXFA_Node* pNewInstance =
3173 XFA_ScriptInstanceManager_CreateInstance(this, fFlags); 3151 XFA_ScriptInstanceManager_CreateInstance(this, fFlags);
3174 XFA_ScriptInstanceManager_InsertItem(this, pNewInstance, iCount, iCount, 3152 XFA_ScriptInstanceManager_InsertItem(this, pNewInstance, iCount, iCount,
3175 FALSE); 3153 FALSE);
3176 FXJSE_Value_Set( 3154 FXJSE_Value_Set(
3177 pArguments->GetReturnValue(), 3155 pArguments->GetReturnValue(),
3178 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance)); 3156 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance));
3179 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 3157 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
3180 if (!pNotify) { 3158 if (!pNotify) {
3181 return; 3159 return;
3182 } 3160 }
3183 pNotify->RunNodeInitialize(pNewInstance); 3161 pNotify->RunNodeInitialize(pNewInstance);
3184 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); 3162 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor();
3185 if (!pLayoutPro) { 3163 if (!pLayoutPro) {
3186 return; 3164 return;
3187 } 3165 }
3188 pLayoutPro->AddChangedContainer( 3166 pLayoutPro->AddChangedContainer(
3189 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); 3167 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)));
3190 } 3168 }
3191 void CXFA_Node::Script_InstanceManager_InsertInstance( 3169 void CXFA_Node::Script_InstanceManager_InsertInstance(
3192 CFXJSE_Arguments* pArguments) { 3170 CFXJSE_Arguments* pArguments) {
3193 int32_t argc = pArguments->GetLength(); 3171 int32_t argc = pArguments->GetLength();
3194 if ((argc != 1) && (argc != 2)) { 3172 if ((argc != 1) && (argc != 2)) {
3195 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 3173 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"insertInstance");
3196 L"insertInstance");
3197 return; 3174 return;
3198 } 3175 }
3199 int32_t iIndex = pArguments->GetInt32(0); 3176 int32_t iIndex = pArguments->GetInt32(0);
3200 FX_BOOL bBind = FALSE; 3177 FX_BOOL bBind = FALSE;
3201 if (argc == 2) { 3178 if (argc == 2) {
3202 bBind = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; 3179 bBind = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;
3203 } 3180 }
3204 CXFA_Occur nodeOccur(GetOccurNode()); 3181 CXFA_Occur nodeOccur(GetOccurNode());
3205 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); 3182 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this);
3206 if (iIndex < 0 || iIndex > iCount) { 3183 if (iIndex < 0 || iIndex > iCount) {
3207 ThrowScriptErrorMessage(XFA_IDS_INDEX_OUT_OF_BOUNDS); 3184 ThrowException(XFA_IDS_INDEX_OUT_OF_BOUNDS);
3208 return; 3185 return;
3209 } 3186 }
3210 int32_t iMax = nodeOccur.GetMax(); 3187 int32_t iMax = nodeOccur.GetMax();
3211 if (iMax >= 0 && iCount >= iMax) { 3188 if (iMax >= 0 && iCount >= iMax) {
3212 ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"max"); 3189 ThrowException(XFA_IDS_VIOLATE_BOUNDARY, L"max");
3213 return; 3190 return;
3214 } 3191 }
3215 CXFA_Node* pNewInstance = 3192 CXFA_Node* pNewInstance =
3216 XFA_ScriptInstanceManager_CreateInstance(this, bBind); 3193 XFA_ScriptInstanceManager_CreateInstance(this, bBind);
3217 XFA_ScriptInstanceManager_InsertItem(this, pNewInstance, iIndex, iCount, 3194 XFA_ScriptInstanceManager_InsertItem(this, pNewInstance, iIndex, iCount,
3218 TRUE); 3195 TRUE);
3219 FXJSE_Value_Set( 3196 FXJSE_Value_Set(
3220 pArguments->GetReturnValue(), 3197 pArguments->GetReturnValue(),
3221 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance)); 3198 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance));
3222 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 3199 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
3223 if (!pNotify) { 3200 if (!pNotify) {
3224 return; 3201 return;
3225 } 3202 }
3226 pNotify->RunNodeInitialize(pNewInstance); 3203 pNotify->RunNodeInitialize(pNewInstance);
3227 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); 3204 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor();
3228 if (!pLayoutPro) { 3205 if (!pLayoutPro) {
3229 return; 3206 return;
3230 } 3207 }
3231 pLayoutPro->AddChangedContainer( 3208 pLayoutPro->AddChangedContainer(
3232 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); 3209 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)));
3233 } 3210 }
3234 int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { 3211 int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) {
3235 CXFA_Occur nodeOccur(GetOccurNode()); 3212 CXFA_Occur nodeOccur(GetOccurNode());
3236 int32_t iMax = nodeOccur.GetMax(); 3213 int32_t iMax = nodeOccur.GetMax();
3237 int32_t iMin = nodeOccur.GetMin(); 3214 int32_t iMin = nodeOccur.GetMin();
3238 if (iDesired < iMin) { 3215 if (iDesired < iMin) {
3239 ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"min"); 3216 ThrowException(XFA_IDS_VIOLATE_BOUNDARY, L"min");
3240 return 1; 3217 return 1;
3241 } 3218 }
3242 if ((iMax >= 0) && (iDesired > iMax)) { 3219 if ((iMax >= 0) && (iDesired > iMax)) {
3243 ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"max"); 3220 ThrowException(XFA_IDS_VIOLATE_BOUNDARY, L"max");
3244 return 2; 3221 return 2;
3245 } 3222 }
3246 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); 3223 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this);
3247 if (iDesired == iCount) { 3224 if (iDesired == iCount) {
3248 return 0; 3225 return 0;
3249 } 3226 }
3250 if (iDesired < iCount) { 3227 if (iDesired < iCount) {
3251 CFX_WideStringC wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name); 3228 CFX_WideStringC wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name);
3252 CFX_WideString wsInstanceName = 3229 CFX_WideString wsInstanceName =
3253 CFX_WideString(wsInstManagerName.IsEmpty() ? wsInstManagerName 3230 CFX_WideString(wsInstManagerName.IsEmpty() ? wsInstManagerName
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3290 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); 3267 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor();
3291 if (pLayoutPro) { 3268 if (pLayoutPro) {
3292 pLayoutPro->AddChangedContainer( 3269 pLayoutPro->AddChangedContainer(
3293 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); 3270 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)));
3294 } 3271 }
3295 return 0; 3272 return 0;
3296 } 3273 }
3297 int32_t CXFA_Node::InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom) { 3274 int32_t CXFA_Node::InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom) {
3298 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); 3275 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this);
3299 if (iFrom > iCount || iTo > iCount - 1) { 3276 if (iFrom > iCount || iTo > iCount - 1) {
3300 ThrowScriptErrorMessage(XFA_IDS_INDEX_OUT_OF_BOUNDS); 3277 ThrowException(XFA_IDS_INDEX_OUT_OF_BOUNDS);
3301 return 1; 3278 return 1;
3302 } 3279 }
3303 if (iFrom < 0 || iTo < 0 || iFrom == iTo) { 3280 if (iFrom < 0 || iTo < 0 || iFrom == iTo) {
3304 return 0; 3281 return 0;
3305 } 3282 }
3306 CXFA_Node* pMoveInstance = XFA_ScriptInstanceManager_GetItem(this, iFrom); 3283 CXFA_Node* pMoveInstance = XFA_ScriptInstanceManager_GetItem(this, iFrom);
3307 XFA_ScriptInstanceManager_RemoveItem(this, pMoveInstance, FALSE); 3284 XFA_ScriptInstanceManager_RemoveItem(this, pMoveInstance, FALSE);
3308 XFA_ScriptInstanceManager_InsertItem(this, pMoveInstance, iTo, iCount - 1, 3285 XFA_ScriptInstanceManager_InsertItem(this, pMoveInstance, iTo, iCount - 1,
3309 TRUE); 3286 TRUE);
3310 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); 3287 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor();
(...skipping 23 matching lines...) Expand all
3334 occur.SetMin(iMin); 3311 occur.SetMin(iMin);
3335 } else { 3312 } else {
3336 FXJSE_Value_SetInteger(pValue, occur.GetMin()); 3313 FXJSE_Value_SetInteger(pValue, occur.GetMin());
3337 } 3314 }
3338 } 3315 }
3339 void CXFA_Node::Script_Desc_Metadata(CFXJSE_Arguments* pArguments) { 3316 void CXFA_Node::Script_Desc_Metadata(CFXJSE_Arguments* pArguments) {
3340 int32_t argc = pArguments->GetLength(); 3317 int32_t argc = pArguments->GetLength();
3341 if ((argc == 0) || (argc == 1)) { 3318 if ((argc == 0) || (argc == 1)) {
3342 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), ""); 3319 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), "");
3343 } else { 3320 } else {
3344 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"metadata"); 3321 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"metadata");
3345 } 3322 }
3346 } 3323 }
3347 void CXFA_Node::Script_Form_FormNodes(CFXJSE_Arguments* pArguments) { 3324 void CXFA_Node::Script_Form_FormNodes(CFXJSE_Arguments* pArguments) {
3348 int32_t argc = pArguments->GetLength(); 3325 int32_t argc = pArguments->GetLength();
3349 if (argc == 1) { 3326 if (argc == 1) {
3350 CXFA_Node* pDataNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); 3327 CXFA_Node* pDataNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
3351 if (pDataNode) { 3328 if (pDataNode) {
3352 CXFA_NodeArray formItems; 3329 CXFA_NodeArray formItems;
3353 CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument); 3330 CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument);
3354 pFormNodes->SetArrayNodeList(formItems); 3331 pFormNodes->SetArrayNodeList(formItems);
3355 FXJSE_Value_SetObject( 3332 FXJSE_Value_SetObject(
3356 pArguments->GetReturnValue(), (CXFA_Object*)pFormNodes, 3333 pArguments->GetReturnValue(), (CXFA_Object*)pFormNodes,
3357 m_pDocument->GetScriptContext()->GetJseNormalClass()); 3334 m_pDocument->GetScriptContext()->GetJseNormalClass());
3358 } else { 3335 } else {
3359 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); 3336 ThrowException(XFA_IDS_ARGUMENT_MISMATCH);
3360 } 3337 }
3361 } else { 3338 } else {
3362 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"formNodes"); 3339 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"formNodes");
3363 } 3340 }
3364 } 3341 }
3365 void CXFA_Node::Script_Form_Remerge(CFXJSE_Arguments* pArguments) { 3342 void CXFA_Node::Script_Form_Remerge(CFXJSE_Arguments* pArguments) {
3366 int32_t argc = pArguments->GetLength(); 3343 int32_t argc = pArguments->GetLength();
3367 if (argc == 0) { 3344 if (argc == 0) {
3368 m_pDocument->DoDataRemerge(TRUE); 3345 m_pDocument->DoDataRemerge(TRUE);
3369 } else { 3346 } else {
3370 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"remerge"); 3347 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"remerge");
3371 } 3348 }
3372 } 3349 }
3373 void CXFA_Node::Script_Form_ExecInitialize(CFXJSE_Arguments* pArguments) { 3350 void CXFA_Node::Script_Form_ExecInitialize(CFXJSE_Arguments* pArguments) {
3374 int32_t argc = pArguments->GetLength(); 3351 int32_t argc = pArguments->GetLength();
3375 if (argc == 0) { 3352 if (argc == 0) {
3376 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 3353 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
3377 if (!pNotify) { 3354 if (!pNotify) {
3378 return; 3355 return;
3379 } 3356 }
3380 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Initialize); 3357 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Initialize);
3381 } else { 3358 } else {
3382 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 3359 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execInitialize");
3383 L"execInitialize");
3384 } 3360 }
3385 } 3361 }
3386 void CXFA_Node::Script_Form_Recalculate(CFXJSE_Arguments* pArguments) { 3362 void CXFA_Node::Script_Form_Recalculate(CFXJSE_Arguments* pArguments) {
3387 CXFA_EventParam* pEventParam = 3363 CXFA_EventParam* pEventParam =
3388 m_pDocument->GetScriptContext()->GetEventParam(); 3364 m_pDocument->GetScriptContext()->GetEventParam();
3389 if (pEventParam->m_eType == XFA_EVENT_Calculate || 3365 if (pEventParam->m_eType == XFA_EVENT_Calculate ||
3390 pEventParam->m_eType == XFA_EVENT_InitCalculate) { 3366 pEventParam->m_eType == XFA_EVENT_InitCalculate) {
3391 return; 3367 return;
3392 } 3368 }
3393 int32_t argc = pArguments->GetLength(); 3369 int32_t argc = pArguments->GetLength();
3394 if (argc == 1) { 3370 if (argc == 1) {
3395 const bool bScriptFlags = pArguments->GetInt32(0) != 0; 3371 const bool bScriptFlags = pArguments->GetInt32(0) != 0;
3396 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 3372 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
3397 if (!pNotify) { 3373 if (!pNotify) {
3398 return; 3374 return;
3399 } 3375 }
3400 if (bScriptFlags) { 3376 if (bScriptFlags) {
3401 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Calculate); 3377 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Calculate);
3402 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate); 3378 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate);
3403 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Ready, TRUE); 3379 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Ready, TRUE);
3404 } else { 3380 } else {
3405 } 3381 }
3406 } else { 3382 } else {
3407 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"recalculate"); 3383 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"recalculate");
3408 } 3384 }
3409 } 3385 }
3410 void CXFA_Node::Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments) { 3386 void CXFA_Node::Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments) {
3411 int32_t argc = pArguments->GetLength(); 3387 int32_t argc = pArguments->GetLength();
3412 if (argc == 0) { 3388 if (argc == 0) {
3413 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 3389 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
3414 if (!pNotify) { 3390 if (!pNotify) {
3415 return; 3391 return;
3416 } 3392 }
3417 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Calculate); 3393 pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Calculate);
3418 } else { 3394 } else {
3419 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 3395 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execCalculate");
3420 L"execCalculate");
3421 } 3396 }
3422 } 3397 }
3423 void CXFA_Node::Script_Form_ExecValidate(CFXJSE_Arguments* pArguments) { 3398 void CXFA_Node::Script_Form_ExecValidate(CFXJSE_Arguments* pArguments) {
3424 int32_t argc = pArguments->GetLength(); 3399 int32_t argc = pArguments->GetLength();
3425 if (argc == 0) { 3400 if (argc == 0) {
3426 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 3401 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
3427 if (!pNotify) { 3402 if (!pNotify) {
3428 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); 3403 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE);
3429 } else { 3404 } else {
3430 int32_t iRet = pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate); 3405 int32_t iRet = pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate);
3431 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), 3406 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(),
3432 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); 3407 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE));
3433 } 3408 }
3434 } else { 3409 } else {
3435 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 3410 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate");
3436 L"execValidate");
3437 } 3411 }
3438 } 3412 }
3439 void CXFA_Node::Script_Form_Checksum(CFXJSE_Value* pValue, 3413 void CXFA_Node::Script_Form_Checksum(CFXJSE_Value* pValue,
3440 FX_BOOL bSetting, 3414 FX_BOOL bSetting,
3441 XFA_ATTRIBUTE eAttribute) { 3415 XFA_ATTRIBUTE eAttribute) {
3442 if (bSetting) { 3416 if (bSetting) {
3443 CFX_ByteString bsChecksum; 3417 CFX_ByteString bsChecksum;
3444 FXJSE_Value_ToUTF8String(pValue, bsChecksum); 3418 FXJSE_Value_ToUTF8String(pValue, bsChecksum);
3445 SetAttribute(XFA_ATTRIBUTE_Checksum, 3419 SetAttribute(XFA_ATTRIBUTE_Checksum,
3446 CFX_WideString::FromUTF8(bsChecksum.AsStringC()).AsStringC()); 3420 CFX_WideString::FromUTF8(bsChecksum.AsStringC()).AsStringC());
(...skipping 14 matching lines...) Expand all
3461 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { 3435 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
3462 static_cast<CFDE_XMLElement*>(pXMLNode)->GetString( 3436 static_cast<CFDE_XMLElement*>(pXMLNode)->GetString(
3463 CFX_WideString::FromUTF8(bsAttributeName.AsStringC()).c_str(), 3437 CFX_WideString::FromUTF8(bsAttributeName.AsStringC()).c_str(),
3464 wsAttributeValue); 3438 wsAttributeValue);
3465 } 3439 }
3466 FXJSE_Value_SetUTF8String( 3440 FXJSE_Value_SetUTF8String(
3467 pArguments->GetReturnValue(), 3441 pArguments->GetReturnValue(),
3468 FX_UTF8Encode(wsAttributeValue.c_str(), wsAttributeValue.GetLength()) 3442 FX_UTF8Encode(wsAttributeValue.c_str(), wsAttributeValue.GetLength())
3469 .AsStringC()); 3443 .AsStringC());
3470 } else { 3444 } else {
3471 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 3445 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getAttribute");
3472 L"getAttribute");
3473 } 3446 }
3474 } 3447 }
3475 void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { 3448 void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) {
3476 int32_t argc = pArguments->GetLength(); 3449 int32_t argc = pArguments->GetLength();
3477 if (argc == 2) { 3450 if (argc == 2) {
3478 CFX_ByteString bsValue = pArguments->GetUTF8String(0); 3451 CFX_ByteString bsValue = pArguments->GetUTF8String(0);
3479 CFX_ByteString bsName = pArguments->GetUTF8String(1); 3452 CFX_ByteString bsName = pArguments->GetUTF8String(1);
3480 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); 3453 CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
3481 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { 3454 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
3482 static_cast<CFDE_XMLElement*>(pXMLNode) 3455 static_cast<CFDE_XMLElement*>(pXMLNode)
3483 ->SetString(CFX_WideString::FromUTF8(bsName.AsStringC()), 3456 ->SetString(CFX_WideString::FromUTF8(bsName.AsStringC()),
3484 CFX_WideString::FromUTF8(bsValue.AsStringC())); 3457 CFX_WideString::FromUTF8(bsValue.AsStringC()));
3485 } 3458 }
3486 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 3459 FXJSE_Value_SetNull(pArguments->GetReturnValue());
3487 } else { 3460 } else {
3488 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 3461 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setAttribute");
3489 L"setAttribute");
3490 } 3462 }
3491 } 3463 }
3492 void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { 3464 void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) {
3493 int32_t argc = pArguments->GetLength(); 3465 int32_t argc = pArguments->GetLength();
3494 if (argc == 1) { 3466 if (argc == 1) {
3495 CFX_ByteString bsName = pArguments->GetUTF8String(0); 3467 CFX_ByteString bsName = pArguments->GetUTF8String(0);
3496 CFX_WideString wsName = CFX_WideString::FromUTF8(bsName.AsStringC()); 3468 CFX_WideString wsName = CFX_WideString::FromUTF8(bsName.AsStringC());
3497 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); 3469 CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
3498 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { 3470 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
3499 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); 3471 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
3500 if (pXMLElement->HasAttribute(wsName.c_str())) { 3472 if (pXMLElement->HasAttribute(wsName.c_str())) {
3501 pXMLElement->RemoveAttribute(wsName.c_str()); 3473 pXMLElement->RemoveAttribute(wsName.c_str());
3502 } 3474 }
3503 } 3475 }
3504 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 3476 FXJSE_Value_SetNull(pArguments->GetReturnValue());
3505 } else { 3477 } else {
3506 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 3478 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"removeAttribute");
3507 L"removeAttribute");
3508 } 3479 }
3509 } 3480 }
3510 void CXFA_Node::Script_Packet_Content(CFXJSE_Value* pValue, 3481 void CXFA_Node::Script_Packet_Content(CFXJSE_Value* pValue,
3511 FX_BOOL bSetting, 3482 FX_BOOL bSetting,
3512 XFA_ATTRIBUTE eAttribute) { 3483 XFA_ATTRIBUTE eAttribute) {
3513 if (bSetting) { 3484 if (bSetting) {
3514 CFX_ByteString bsNewContent; 3485 CFX_ByteString bsNewContent;
3515 FXJSE_Value_ToUTF8String(pValue, bsNewContent); 3486 FXJSE_Value_ToUTF8String(pValue, bsNewContent);
3516 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); 3487 CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
3517 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { 3488 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
(...skipping 10 matching lines...) Expand all
3528 } 3499 }
3529 FXJSE_Value_SetUTF8String( 3500 FXJSE_Value_SetUTF8String(
3530 pValue, 3501 pValue,
3531 FX_UTF8Encode(wsTextData.c_str(), wsTextData.GetLength()).AsStringC()); 3502 FX_UTF8Encode(wsTextData.c_str(), wsTextData.GetLength()).AsStringC());
3532 } 3503 }
3533 } 3504 }
3534 void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) { 3505 void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) {
3535 int32_t argc = pArguments->GetLength(); 3506 int32_t argc = pArguments->GetLength();
3536 if (argc == 0) { 3507 if (argc == 0) {
3537 } else { 3508 } else {
3538 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"next"); 3509 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"next");
3539 } 3510 }
3540 } 3511 }
3541 void CXFA_Node::Script_Source_CancelBatch(CFXJSE_Arguments* pArguments) { 3512 void CXFA_Node::Script_Source_CancelBatch(CFXJSE_Arguments* pArguments) {
3542 int32_t argc = pArguments->GetLength(); 3513 int32_t argc = pArguments->GetLength();
3543 if (argc == 0) { 3514 if (argc == 0) {
3544 } else { 3515 } else {
3545 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"cancelBatch"); 3516 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"cancelBatch");
3546 } 3517 }
3547 } 3518 }
3548 void CXFA_Node::Script_Source_First(CFXJSE_Arguments* pArguments) { 3519 void CXFA_Node::Script_Source_First(CFXJSE_Arguments* pArguments) {
3549 int32_t argc = pArguments->GetLength(); 3520 int32_t argc = pArguments->GetLength();
3550 if (argc == 0) { 3521 if (argc == 0) {
3551 } else { 3522 } else {
3552 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"first"); 3523 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"first");
3553 } 3524 }
3554 } 3525 }
3555 void CXFA_Node::Script_Source_UpdateBatch(CFXJSE_Arguments* pArguments) { 3526 void CXFA_Node::Script_Source_UpdateBatch(CFXJSE_Arguments* pArguments) {
3556 int32_t argc = pArguments->GetLength(); 3527 int32_t argc = pArguments->GetLength();
3557 if (argc == 0) { 3528 if (argc == 0) {
3558 } else { 3529 } else {
3559 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"updateBatch"); 3530 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"updateBatch");
3560 } 3531 }
3561 } 3532 }
3562 void CXFA_Node::Script_Source_Previous(CFXJSE_Arguments* pArguments) { 3533 void CXFA_Node::Script_Source_Previous(CFXJSE_Arguments* pArguments) {
3563 int32_t argc = pArguments->GetLength(); 3534 int32_t argc = pArguments->GetLength();
3564 if (argc == 0) { 3535 if (argc == 0) {
3565 } else { 3536 } else {
3566 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"previous"); 3537 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"previous");
3567 } 3538 }
3568 } 3539 }
3569 void CXFA_Node::Script_Source_IsBOF(CFXJSE_Arguments* pArguments) { 3540 void CXFA_Node::Script_Source_IsBOF(CFXJSE_Arguments* pArguments) {
3570 int32_t argc = pArguments->GetLength(); 3541 int32_t argc = pArguments->GetLength();
3571 if (argc == 0) { 3542 if (argc == 0) {
3572 } else { 3543 } else {
3573 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"isBOF"); 3544 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"isBOF");
3574 } 3545 }
3575 } 3546 }
3576 void CXFA_Node::Script_Source_IsEOF(CFXJSE_Arguments* pArguments) { 3547 void CXFA_Node::Script_Source_IsEOF(CFXJSE_Arguments* pArguments) {
3577 int32_t argc = pArguments->GetLength(); 3548 int32_t argc = pArguments->GetLength();
3578 if (argc == 0) { 3549 if (argc == 0) {
3579 } else { 3550 } else {
3580 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"isEOF"); 3551 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"isEOF");
3581 } 3552 }
3582 } 3553 }
3583 void CXFA_Node::Script_Source_Cancel(CFXJSE_Arguments* pArguments) { 3554 void CXFA_Node::Script_Source_Cancel(CFXJSE_Arguments* pArguments) {
3584 int32_t argc = pArguments->GetLength(); 3555 int32_t argc = pArguments->GetLength();
3585 if (argc == 0) { 3556 if (argc == 0) {
3586 } else { 3557 } else {
3587 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"cancel"); 3558 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"cancel");
3588 } 3559 }
3589 } 3560 }
3590 void CXFA_Node::Script_Source_Update(CFXJSE_Arguments* pArguments) { 3561 void CXFA_Node::Script_Source_Update(CFXJSE_Arguments* pArguments) {
3591 int32_t argc = pArguments->GetLength(); 3562 int32_t argc = pArguments->GetLength();
3592 if (argc == 0) { 3563 if (argc == 0) {
3593 } else { 3564 } else {
3594 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"update"); 3565 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"update");
3595 } 3566 }
3596 } 3567 }
3597 void CXFA_Node::Script_Source_Open(CFXJSE_Arguments* pArguments) { 3568 void CXFA_Node::Script_Source_Open(CFXJSE_Arguments* pArguments) {
3598 int32_t argc = pArguments->GetLength(); 3569 int32_t argc = pArguments->GetLength();
3599 if (argc == 0) { 3570 if (argc == 0) {
3600 } else { 3571 } else {
3601 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"open"); 3572 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"open");
3602 } 3573 }
3603 } 3574 }
3604 void CXFA_Node::Script_Source_Delete(CFXJSE_Arguments* pArguments) { 3575 void CXFA_Node::Script_Source_Delete(CFXJSE_Arguments* pArguments) {
3605 int32_t argc = pArguments->GetLength(); 3576 int32_t argc = pArguments->GetLength();
3606 if (argc == 0) { 3577 if (argc == 0) {
3607 } else { 3578 } else {
3608 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"delete"); 3579 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"delete");
3609 } 3580 }
3610 } 3581 }
3611 void CXFA_Node::Script_Source_AddNew(CFXJSE_Arguments* pArguments) { 3582 void CXFA_Node::Script_Source_AddNew(CFXJSE_Arguments* pArguments) {
3612 int32_t argc = pArguments->GetLength(); 3583 int32_t argc = pArguments->GetLength();
3613 if (argc == 0) { 3584 if (argc == 0) {
3614 } else { 3585 } else {
3615 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"addNew"); 3586 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"addNew");
3616 } 3587 }
3617 } 3588 }
3618 void CXFA_Node::Script_Source_Requery(CFXJSE_Arguments* pArguments) { 3589 void CXFA_Node::Script_Source_Requery(CFXJSE_Arguments* pArguments) {
3619 int32_t argc = pArguments->GetLength(); 3590 int32_t argc = pArguments->GetLength();
3620 if (argc == 0) { 3591 if (argc == 0) {
3621 } else { 3592 } else {
3622 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"requery"); 3593 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"requery");
3623 } 3594 }
3624 } 3595 }
3625 void CXFA_Node::Script_Source_Resync(CFXJSE_Arguments* pArguments) { 3596 void CXFA_Node::Script_Source_Resync(CFXJSE_Arguments* pArguments) {
3626 int32_t argc = pArguments->GetLength(); 3597 int32_t argc = pArguments->GetLength();
3627 if (argc == 0) { 3598 if (argc == 0) {
3628 } else { 3599 } else {
3629 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resync"); 3600 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resync");
3630 } 3601 }
3631 } 3602 }
3632 void CXFA_Node::Script_Source_Close(CFXJSE_Arguments* pArguments) { 3603 void CXFA_Node::Script_Source_Close(CFXJSE_Arguments* pArguments) {
3633 int32_t argc = pArguments->GetLength(); 3604 int32_t argc = pArguments->GetLength();
3634 if (argc == 0) { 3605 if (argc == 0) {
3635 } else { 3606 } else {
3636 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"close"); 3607 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"close");
3637 } 3608 }
3638 } 3609 }
3639 void CXFA_Node::Script_Source_Last(CFXJSE_Arguments* pArguments) { 3610 void CXFA_Node::Script_Source_Last(CFXJSE_Arguments* pArguments) {
3640 int32_t argc = pArguments->GetLength(); 3611 int32_t argc = pArguments->GetLength();
3641 if (argc == 0) { 3612 if (argc == 0) {
3642 } else { 3613 } else {
3643 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"last"); 3614 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"last");
3644 } 3615 }
3645 } 3616 }
3646 void CXFA_Node::Script_Source_HasDataChanged(CFXJSE_Arguments* pArguments) { 3617 void CXFA_Node::Script_Source_HasDataChanged(CFXJSE_Arguments* pArguments) {
3647 int32_t argc = pArguments->GetLength(); 3618 int32_t argc = pArguments->GetLength();
3648 if (argc == 0) { 3619 if (argc == 0) {
3649 } else { 3620 } else {
3650 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 3621 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"hasDataChanged");
3651 L"hasDataChanged");
3652 } 3622 }
3653 } 3623 }
3654 void CXFA_Node::Script_Source_Db(CFXJSE_Value* pValue, 3624 void CXFA_Node::Script_Source_Db(CFXJSE_Value* pValue,
3655 FX_BOOL bSetting, 3625 FX_BOOL bSetting,
3656 XFA_ATTRIBUTE eAttribute) {} 3626 XFA_ATTRIBUTE eAttribute) {}
3657 void CXFA_Node::Script_Xfa_This(CFXJSE_Value* pValue, 3627 void CXFA_Node::Script_Xfa_This(CFXJSE_Value* pValue,
3658 FX_BOOL bSetting, 3628 FX_BOOL bSetting,
3659 XFA_ATTRIBUTE eAttribute) { 3629 XFA_ATTRIBUTE eAttribute) {
3660 if (!bSetting) { 3630 if (!bSetting) {
3661 CXFA_Object* pThis = m_pDocument->GetScriptContext()->GetThisObject(); 3631 CXFA_Object* pThis = m_pDocument->GetScriptContext()->GetThisObject();
3662 ASSERT(pThis); 3632 ASSERT(pThis);
3663 FXJSE_Value_Set(pValue, 3633 FXJSE_Value_Set(pValue,
3664 m_pDocument->GetScriptContext()->GetJSValueFromMap(pThis)); 3634 m_pDocument->GetScriptContext()->GetJSValueFromMap(pThis));
3665 } 3635 }
3666 } 3636 }
3667 void CXFA_Node::Script_Handler_Version(CFXJSE_Value* pValue, 3637 void CXFA_Node::Script_Handler_Version(CFXJSE_Value* pValue,
3668 FX_BOOL bSetting, 3638 FX_BOOL bSetting,
3669 XFA_ATTRIBUTE eAttribute) {} 3639 XFA_ATTRIBUTE eAttribute) {}
3670 void CXFA_Node::Script_SubmitFormat_Mode(CFXJSE_Value* pValue, 3640 void CXFA_Node::Script_SubmitFormat_Mode(CFXJSE_Value* pValue,
3671 FX_BOOL bSetting, 3641 FX_BOOL bSetting,
3672 XFA_ATTRIBUTE eAttribute) {} 3642 XFA_ATTRIBUTE eAttribute) {}
3673 void CXFA_Node::Script_Extras_Type(CFXJSE_Value* pValue, 3643 void CXFA_Node::Script_Extras_Type(CFXJSE_Value* pValue,
3674 FX_BOOL bSetting, 3644 FX_BOOL bSetting,
3675 XFA_ATTRIBUTE eAttribute) {} 3645 XFA_ATTRIBUTE eAttribute) {}
3676 void CXFA_Node::Script_Script_Stateless(CFXJSE_Value* pValue, 3646 void CXFA_Node::Script_Script_Stateless(CFXJSE_Value* pValue,
3677 FX_BOOL bSetting, 3647 FX_BOOL bSetting,
3678 XFA_ATTRIBUTE eAttribute) { 3648 XFA_ATTRIBUTE eAttribute) {
3679 if (bSetting) { 3649 if (bSetting) {
3680 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 3650 ThrowException(XFA_IDS_INVAlID_PROP_SET);
3681 return; 3651 return;
3682 } 3652 }
3683 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(FX_WSTRC(L"0")).AsStringC()); 3653 FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(FX_WSTRC(L"0")).AsStringC());
3684 } 3654 }
3685 void CXFA_Node::Script_Encrypt_Format(CFXJSE_Value* pValue, 3655 void CXFA_Node::Script_Encrypt_Format(CFXJSE_Value* pValue,
3686 FX_BOOL bSetting, 3656 FX_BOOL bSetting,
3687 XFA_ATTRIBUTE eAttribute) {} 3657 XFA_ATTRIBUTE eAttribute) {}
3688 enum XFA_KEYTYPE { 3658 enum XFA_KEYTYPE {
3689 XFA_KEYTYPE_Custom, 3659 XFA_KEYTYPE_Custom,
3690 XFA_KEYTYPE_Element, 3660 XFA_KEYTYPE_Element,
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
5194 } 5164 }
5195 return nullptr; 5165 return nullptr;
5196 } 5166 }
5197 void CXFA_NodeList::Script_ListClass_Append(CFXJSE_Arguments* pArguments) { 5167 void CXFA_NodeList::Script_ListClass_Append(CFXJSE_Arguments* pArguments) {
5198 int32_t argc = pArguments->GetLength(); 5168 int32_t argc = pArguments->GetLength();
5199 if (argc == 1) { 5169 if (argc == 1) {
5200 CXFA_Node* pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); 5170 CXFA_Node* pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
5201 if (pNode) { 5171 if (pNode) {
5202 Append(pNode); 5172 Append(pNode);
5203 } else { 5173 } else {
5204 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); 5174 ThrowException(XFA_IDS_ARGUMENT_MISMATCH);
5205 } 5175 }
5206 } else { 5176 } else {
5207 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"append"); 5177 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"append");
5208 } 5178 }
5209 } 5179 }
5210 void CXFA_NodeList::Script_ListClass_Insert(CFXJSE_Arguments* pArguments) { 5180 void CXFA_NodeList::Script_ListClass_Insert(CFXJSE_Arguments* pArguments) {
5211 int32_t argc = pArguments->GetLength(); 5181 int32_t argc = pArguments->GetLength();
5212 if (argc == 2) { 5182 if (argc == 2) {
5213 CXFA_Node* pNewNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); 5183 CXFA_Node* pNewNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
5214 CXFA_Node* pBeforeNode = static_cast<CXFA_Node*>(pArguments->GetObject(1)); 5184 CXFA_Node* pBeforeNode = static_cast<CXFA_Node*>(pArguments->GetObject(1));
5215 if (pNewNode) { 5185 if (pNewNode) {
5216 Insert(pNewNode, pBeforeNode); 5186 Insert(pNewNode, pBeforeNode);
5217 } else { 5187 } else {
5218 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); 5188 ThrowException(XFA_IDS_ARGUMENT_MISMATCH);
5219 } 5189 }
5220 } else { 5190 } else {
5221 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"insert"); 5191 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"insert");
5222 } 5192 }
5223 } 5193 }
5224 void CXFA_NodeList::Script_ListClass_Remove(CFXJSE_Arguments* pArguments) { 5194 void CXFA_NodeList::Script_ListClass_Remove(CFXJSE_Arguments* pArguments) {
5225 int32_t argc = pArguments->GetLength(); 5195 int32_t argc = pArguments->GetLength();
5226 if (argc == 1) { 5196 if (argc == 1) {
5227 CXFA_Node* pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); 5197 CXFA_Node* pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
5228 if (pNode) { 5198 if (pNode) {
5229 Remove(pNode); 5199 Remove(pNode);
5230 } else { 5200 } else {
5231 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); 5201 ThrowException(XFA_IDS_ARGUMENT_MISMATCH);
5232 } 5202 }
5233 } else { 5203 } else {
5234 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"remove"); 5204 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"remove");
5235 } 5205 }
5236 } 5206 }
5237 void CXFA_NodeList::Script_ListClass_Item(CFXJSE_Arguments* pArguments) { 5207 void CXFA_NodeList::Script_ListClass_Item(CFXJSE_Arguments* pArguments) {
5238 int32_t argc = pArguments->GetLength(); 5208 int32_t argc = pArguments->GetLength();
5239 if (argc == 1) { 5209 if (argc == 1) {
5240 int32_t iIndex = pArguments->GetInt32(0); 5210 int32_t iIndex = pArguments->GetInt32(0);
5241 if ((iIndex >= 0) && (iIndex + 1 <= GetLength())) { 5211 if ((iIndex >= 0) && (iIndex + 1 <= GetLength())) {
5242 FXJSE_Value_Set( 5212 FXJSE_Value_Set(
5243 pArguments->GetReturnValue(), 5213 pArguments->GetReturnValue(),
5244 m_pDocument->GetScriptContext()->GetJSValueFromMap(Item(iIndex))); 5214 m_pDocument->GetScriptContext()->GetJSValueFromMap(Item(iIndex)));
5245 } else { 5215 } else {
5246 ThrowScriptErrorMessage(XFA_IDS_INDEX_OUT_OF_BOUNDS); 5216 ThrowException(XFA_IDS_INDEX_OUT_OF_BOUNDS);
5247 } 5217 }
5248 } else { 5218 } else {
5249 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"item"); 5219 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"item");
5250 } 5220 }
5251 } 5221 }
5252 void CXFA_NodeList::Script_TreelistClass_NamedItem( 5222 void CXFA_NodeList::Script_TreelistClass_NamedItem(
5253 CFXJSE_Arguments* pArguments) { 5223 CFXJSE_Arguments* pArguments) {
5254 int32_t argc = pArguments->GetLength(); 5224 int32_t argc = pArguments->GetLength();
5255 if (argc == 1) { 5225 if (argc == 1) {
5256 CFX_ByteString szName = pArguments->GetUTF8String(0); 5226 CFX_ByteString szName = pArguments->GetUTF8String(0);
5257 CXFA_Node* pNode = 5227 CXFA_Node* pNode =
5258 NamedItem(CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC()); 5228 NamedItem(CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC());
5259 if (!pNode) { 5229 if (!pNode) {
5260 return; 5230 return;
5261 } 5231 }
5262 FXJSE_Value_Set(pArguments->GetReturnValue(), 5232 FXJSE_Value_Set(pArguments->GetReturnValue(),
5263 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); 5233 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode));
5264 } else { 5234 } else {
5265 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"namedItem"); 5235 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"namedItem");
5266 } 5236 }
5267 } 5237 }
5268 void CXFA_NodeList::Script_ListClass_Length(CFXJSE_Value* pValue, 5238 void CXFA_NodeList::Script_ListClass_Length(CFXJSE_Value* pValue,
5269 FX_BOOL bSetting, 5239 FX_BOOL bSetting,
5270 XFA_ATTRIBUTE eAttribute) { 5240 XFA_ATTRIBUTE eAttribute) {
5271 if (!bSetting) { 5241 if (!bSetting) {
5272 FXJSE_Value_SetInteger(pValue, GetLength()); 5242 FXJSE_Value_SetInteger(pValue, GetLength());
5273 } else { 5243 } else {
5274 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 5244 ThrowException(XFA_IDS_INVAlID_PROP_SET);
5275 } 5245 }
5276 } 5246 }
5277 CXFA_ArrayNodeList::CXFA_ArrayNodeList(CXFA_Document* pDocument) 5247 CXFA_ArrayNodeList::CXFA_ArrayNodeList(CXFA_Document* pDocument)
5278 : CXFA_NodeList(pDocument) {} 5248 : CXFA_NodeList(pDocument) {}
5279 void CXFA_ArrayNodeList::SetArrayNodeList(const CXFA_NodeArray& srcArray) { 5249 void CXFA_ArrayNodeList::SetArrayNodeList(const CXFA_NodeArray& srcArray) {
5280 if (srcArray.GetSize() > 0) { 5250 if (srcArray.GetSize() > 0) {
5281 m_array.Copy(srcArray); 5251 m_array.Copy(srcArray);
5282 } 5252 }
5283 } 5253 }
5284 int32_t CXFA_ArrayNodeList::GetLength() { 5254 int32_t CXFA_ArrayNodeList::GetLength() {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
5345 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); 5315 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
5346 } 5316 }
5347 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { 5317 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
5348 return m_pAttachNode->RemoveChild(pNode); 5318 return m_pAttachNode->RemoveChild(pNode);
5349 } 5319 }
5350 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { 5320 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
5351 return m_pAttachNode->GetChild( 5321 return m_pAttachNode->GetChild(
5352 iIndex, XFA_ELEMENT_UNKNOWN, 5322 iIndex, XFA_ELEMENT_UNKNOWN,
5353 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5323 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
5354 } 5324 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_object.h ('k') | xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698