OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/parser/xfa_object.h" | 7 #include "xfa/fxfa/parser/xfa_object.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
10 #include "xfa/fde/xml/fde_xml_imp.h" | 10 #include "xfa/fde/xml/fde_xml_imp.h" |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 void CXFA_Node::SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode) { | 625 void CXFA_Node::SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode) { |
626 FXSYS_assert(m_ePacket == XFA_XDPPACKET_Datasets); | 626 FXSYS_assert(m_ePacket == XFA_XDPPACKET_Datasets); |
627 m_pAuxNode = pDataDescriptionNode; | 627 m_pAuxNode = pDataDescriptionNode; |
628 } | 628 } |
629 void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { | 629 void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { |
630 int32_t iLength = pArguments->GetLength(); | 630 int32_t iLength = pArguments->GetLength(); |
631 if (iLength != 1) { | 631 if (iLength != 1) { |
632 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resolveNode"); | 632 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resolveNode"); |
633 return; | 633 return; |
634 } | 634 } |
635 CFX_WideString wsExpression; | 635 CFX_WideString wsExpression = |
636 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 636 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsByteStringC()); |
637 wsExpression = | |
638 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | |
639 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 637 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
640 if (!pScriptContext) { | 638 if (!pScriptContext) { |
641 return; | 639 return; |
642 } | 640 } |
643 CXFA_Node* refNode = this; | 641 CXFA_Node* refNode = this; |
644 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { | 642 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { |
645 refNode = ToNode(pScriptContext->GetThisObject()); | 643 refNode = ToNode(pScriptContext->GetThisObject()); |
646 } | 644 } |
647 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | | 645 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | |
648 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | | 646 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | |
(...skipping 23 matching lines...) Expand all Loading... |
672 } | 670 } |
673 } | 671 } |
674 } | 672 } |
675 void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) { | 673 void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) { |
676 int32_t iLength = pArguments->GetLength(); | 674 int32_t iLength = pArguments->GetLength(); |
677 if (iLength != 1) { | 675 if (iLength != 1) { |
678 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 676 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
679 L"resolveNodes"); | 677 L"resolveNodes"); |
680 return; | 678 return; |
681 } | 679 } |
682 CFX_WideString wsExpression; | 680 CFX_WideString wsExpression = |
683 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 681 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsByteStringC()); |
684 wsExpression = | |
685 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | |
686 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 682 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
687 if (!hValue) { | 683 if (!hValue) { |
688 return; | 684 return; |
689 } | 685 } |
690 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | | 686 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | |
691 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | | 687 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | |
692 XFA_RESOLVENODE_Siblings; | 688 XFA_RESOLVENODE_Siblings; |
693 CXFA_Node* refNode = this; | 689 CXFA_Node* refNode = this; |
694 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { | 690 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { |
695 refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject()); | 691 refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject()); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 FXJSE_Value_SetUTF8String(hValue, | 816 FXJSE_Value_SetUTF8String(hValue, |
821 FX_UTF8Encode(wsSOMExpression).AsByteStringC()); | 817 FX_UTF8Encode(wsSOMExpression).AsByteStringC()); |
822 } | 818 } |
823 } | 819 } |
824 void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) { | 820 void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) { |
825 int32_t iLength = pArguments->GetLength(); | 821 int32_t iLength = pArguments->GetLength(); |
826 if (iLength != 1) { | 822 if (iLength != 1) { |
827 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"applyXSL"); | 823 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"applyXSL"); |
828 return; | 824 return; |
829 } | 825 } |
830 CFX_WideString wsExpression; | 826 CFX_WideString wsExpression = |
831 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 827 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsByteStringC()); |
832 wsExpression = | 828 // TODO(tsepez): actually do something here? |
833 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | |
834 } | 829 } |
835 void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) { | 830 void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) { |
836 int32_t iLength = pArguments->GetLength(); | 831 int32_t iLength = pArguments->GetLength(); |
837 if (iLength < 1 || iLength > 3) { | 832 if (iLength < 1 || iLength > 3) { |
838 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"assignNode"); | 833 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"assignNode"); |
839 return; | 834 return; |
840 } | 835 } |
841 CFX_WideString wsExpression; | 836 CFX_WideString wsExpression; |
842 CFX_WideString wsValue; | 837 CFX_WideString wsValue; |
843 int32_t iAction = 0; | 838 int32_t iAction = 0; |
844 if (iLength >= 1) { | 839 if (iLength >= 1) { |
845 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 840 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); |
846 wsExpression = | 841 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsByteStringC()); |
847 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | |
848 } | 842 } |
849 if (iLength >= 2) { | 843 if (iLength >= 2) { |
850 CFX_ByteString bsValue = pArguments->GetUTF8String(1); | 844 CFX_ByteString bsValue = pArguments->GetUTF8String(1); |
851 wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 845 wsValue = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); |
852 } | 846 } |
853 if (iLength >= 3) { | 847 if (iLength >= 3) { |
854 iAction = pArguments->GetInt32(2); | 848 iAction = pArguments->GetInt32(2); |
855 } | 849 } |
856 } | 850 } |
857 void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) { | 851 void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) { |
858 int32_t iLength = pArguments->GetLength(); | 852 int32_t iLength = pArguments->GetLength(); |
859 if (iLength != 1) { | 853 if (iLength != 1) { |
860 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clone"); | 854 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clone"); |
861 return; | 855 return; |
862 } | 856 } |
863 FX_BOOL bClone = TRUE; | 857 FX_BOOL bClone = TRUE; |
864 bClone = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; | 858 bClone = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; |
865 CXFA_Node* pCloneNode = Clone(bClone); | 859 CXFA_Node* pCloneNode = Clone(bClone); |
866 FXJSE_Value_Set( | 860 FXJSE_Value_Set( |
867 pArguments->GetReturnValue(), | 861 pArguments->GetReturnValue(), |
868 m_pDocument->GetScriptContext()->GetJSValueFromMap(pCloneNode)); | 862 m_pDocument->GetScriptContext()->GetJSValueFromMap(pCloneNode)); |
869 } | 863 } |
870 void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) { | 864 void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) { |
871 int32_t iLength = pArguments->GetLength(); | 865 int32_t iLength = pArguments->GetLength(); |
872 if (iLength != 1) { | 866 if (iLength != 1) { |
873 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 867 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
874 L"getAttribute"); | 868 L"getAttribute"); |
875 return; | 869 return; |
876 } | 870 } |
877 CFX_WideString wsExpression; | 871 CFX_WideString wsExpression = |
878 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 872 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsByteStringC()); |
879 wsExpression = | |
880 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | |
881 CFX_WideString wsValue; | 873 CFX_WideString wsValue; |
882 GetAttribute(wsExpression.AsWideStringC(), wsValue); | 874 GetAttribute(wsExpression.AsWideStringC(), wsValue); |
883 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 875 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
884 if (hValue) { | 876 if (hValue) { |
885 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); | 877 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); |
886 } | 878 } |
887 } | 879 } |
888 void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { | 880 void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { |
889 int32_t iLength = pArguments->GetLength(); | 881 int32_t iLength = pArguments->GetLength(); |
890 if (iLength < 1 || iLength > 2) { | 882 if (iLength < 1 || iLength > 2) { |
891 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getElement"); | 883 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getElement"); |
892 return; | 884 return; |
893 } | 885 } |
894 CFX_WideString wsExpression; | 886 CFX_WideString wsExpression; |
895 int32_t iValue = 0; | 887 int32_t iValue = 0; |
896 if (iLength >= 1) { | 888 if (iLength >= 1) { |
897 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 889 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); |
898 wsExpression = | 890 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsByteStringC()); |
899 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | |
900 } | 891 } |
901 if (iLength >= 2) { | 892 if (iLength >= 2) { |
902 iValue = pArguments->GetInt32(1); | 893 iValue = pArguments->GetInt32(1); |
903 } | 894 } |
904 const XFA_ELEMENTINFO* pElementInfo = | 895 const XFA_ELEMENTINFO* pElementInfo = |
905 XFA_GetElementByName(wsExpression.AsWideStringC()); | 896 XFA_GetElementByName(wsExpression.AsWideStringC()); |
906 CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName); | 897 CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName); |
907 FXJSE_Value_Set(pArguments->GetReturnValue(), | 898 FXJSE_Value_Set(pArguments->GetReturnValue(), |
908 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); | 899 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); |
909 } | 900 } |
910 void CXFA_Node::Script_NodeClass_IsPropertySpecified( | 901 void CXFA_Node::Script_NodeClass_IsPropertySpecified( |
911 CFXJSE_Arguments* pArguments) { | 902 CFXJSE_Arguments* pArguments) { |
912 int32_t iLength = pArguments->GetLength(); | 903 int32_t iLength = pArguments->GetLength(); |
913 if (iLength < 1 || iLength > 3) { | 904 if (iLength < 1 || iLength > 3) { |
914 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 905 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
915 L"isPropertySpecified"); | 906 L"isPropertySpecified"); |
916 return; | 907 return; |
917 } | 908 } |
918 CFX_WideString wsExpression; | 909 CFX_WideString wsExpression; |
919 FX_BOOL bParent = TRUE; | 910 FX_BOOL bParent = TRUE; |
920 int32_t iIndex = 0; | 911 int32_t iIndex = 0; |
921 if (iLength >= 1) { | 912 if (iLength >= 1) { |
922 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 913 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); |
923 wsExpression = | 914 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsByteStringC()); |
924 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | |
925 } | 915 } |
926 if (iLength >= 2) { | 916 if (iLength >= 2) { |
927 bParent = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; | 917 bParent = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; |
928 } | 918 } |
929 if (iLength >= 3) { | 919 if (iLength >= 3) { |
930 iIndex = pArguments->GetInt32(2); | 920 iIndex = pArguments->GetInt32(2); |
931 } | 921 } |
932 FX_BOOL bHas = FALSE; | 922 FX_BOOL bHas = FALSE; |
933 const XFA_ATTRIBUTEINFO* pAttributeInfo = | 923 const XFA_ATTRIBUTEINFO* pAttributeInfo = |
934 XFA_GetAttributeByName(wsExpression.AsWideStringC()); | 924 XFA_GetAttributeByName(wsExpression.AsWideStringC()); |
(...skipping 15 matching lines...) Expand all Loading... |
950 int32_t iLength = pArguments->GetLength(); | 940 int32_t iLength = pArguments->GetLength(); |
951 if (iLength < 1 || iLength > 3) { | 941 if (iLength < 1 || iLength > 3) { |
952 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"loadXML"); | 942 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"loadXML"); |
953 return; | 943 return; |
954 } | 944 } |
955 CFX_WideString wsExpression; | 945 CFX_WideString wsExpression; |
956 FX_BOOL bIgnoreRoot = TRUE; | 946 FX_BOOL bIgnoreRoot = TRUE; |
957 FX_BOOL bOverwrite = 0; | 947 FX_BOOL bOverwrite = 0; |
958 if (iLength >= 1) { | 948 if (iLength >= 1) { |
959 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 949 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); |
960 wsExpression = | 950 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsByteStringC()); |
961 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | |
962 if (wsExpression.IsEmpty()) { | 951 if (wsExpression.IsEmpty()) { |
963 return; | 952 return; |
964 } | 953 } |
965 } | 954 } |
966 if (iLength >= 2) { | 955 if (iLength >= 2) { |
967 bIgnoreRoot = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; | 956 bIgnoreRoot = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; |
968 } | 957 } |
969 if (iLength >= 3) { | 958 if (iLength >= 3) { |
970 bOverwrite = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; | 959 bOverwrite = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; |
971 } | 960 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), ""); | 1136 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), ""); |
1148 } | 1137 } |
1149 | 1138 |
1150 void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) { | 1139 void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) { |
1151 int32_t iLength = pArguments->GetLength(); | 1140 int32_t iLength = pArguments->GetLength(); |
1152 if (iLength != 2) { | 1141 if (iLength != 2) { |
1153 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1142 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1154 L"setAttribute"); | 1143 L"setAttribute"); |
1155 return; | 1144 return; |
1156 } | 1145 } |
1157 CFX_WideString wsAttribute; | 1146 CFX_WideString wsAttributeValue = |
1158 CFX_WideString wsAttributeValue; | 1147 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsByteStringC()); |
1159 CFX_ByteString bsAttributeValue = pArguments->GetUTF8String(0); | 1148 CFX_WideString wsAttribute = |
1160 CFX_ByteString bsAttribute = pArguments->GetUTF8String(1); | 1149 CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsByteStringC()); |
1161 wsAttributeValue = | |
1162 CFX_WideString::FromUTF8(bsAttributeValue, bsAttributeValue.GetLength()); | |
1163 wsAttribute = CFX_WideString::FromUTF8(bsAttribute, bsAttribute.GetLength()); | |
1164 SetAttribute(wsAttribute.AsWideStringC(), wsAttributeValue.AsWideStringC(), | 1150 SetAttribute(wsAttribute.AsWideStringC(), wsAttributeValue.AsWideStringC(), |
1165 TRUE); | 1151 TRUE); |
1166 } | 1152 } |
1167 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { | 1153 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { |
1168 int32_t iLength = pArguments->GetLength(); | 1154 int32_t iLength = pArguments->GetLength(); |
1169 if (iLength != 1 && iLength != 2) { | 1155 if (iLength != 1 && iLength != 2) { |
1170 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement"); | 1156 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement"); |
1171 return; | 1157 return; |
1172 } | 1158 } |
1173 CXFA_Node* pNode = NULL; | 1159 CXFA_Node* pNode = NULL; |
1174 CFX_WideString wsName; | 1160 CFX_WideString wsName; |
1175 if (iLength >= 1) { | 1161 if (iLength >= 1) { |
1176 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 1162 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
1177 } | 1163 } |
1178 if (iLength >= 2) { | 1164 if (iLength >= 2) { |
1179 CFX_ByteString bsName = pArguments->GetUTF8String(1); | 1165 CFX_ByteString bsName = pArguments->GetUTF8String(1); |
1180 wsName = CFX_WideString::FromUTF8(bsName, bsName.GetLength()); | 1166 wsName = CFX_WideString::FromUTF8(bsName.AsByteStringC()); |
1181 } | 1167 } |
1182 } | 1168 } |
1183 void CXFA_Node::Script_NodeClass_Ns(FXJSE_HVALUE hValue, | 1169 void CXFA_Node::Script_NodeClass_Ns(FXJSE_HVALUE hValue, |
1184 FX_BOOL bSetting, | 1170 FX_BOOL bSetting, |
1185 XFA_ATTRIBUTE eAttribute) { | 1171 XFA_ATTRIBUTE eAttribute) { |
1186 if (bSetting) { | 1172 if (bSetting) { |
1187 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 1173 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
1188 } else { | 1174 } else { |
1189 CFX_WideString wsNameSpace; | 1175 CFX_WideString wsNameSpace; |
1190 TryNamespace(wsNameSpace); | 1176 TryNamespace(wsNameSpace); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 void CXFA_Node::Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments) { | 1240 void CXFA_Node::Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments) { |
1255 int32_t iLength = pArguments->GetLength(); | 1241 int32_t iLength = pArguments->GetLength(); |
1256 if (iLength < 1) { | 1242 if (iLength < 1) { |
1257 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1243 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1258 L"isCompatibleNS"); | 1244 L"isCompatibleNS"); |
1259 return; | 1245 return; |
1260 } | 1246 } |
1261 CFX_WideString wsNameSpace; | 1247 CFX_WideString wsNameSpace; |
1262 if (iLength >= 1) { | 1248 if (iLength >= 1) { |
1263 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(0); | 1249 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(0); |
1264 wsNameSpace = | 1250 wsNameSpace = CFX_WideString::FromUTF8(bsNameSpace.AsByteStringC()); |
1265 CFX_WideString::FromUTF8(bsNameSpace, bsNameSpace.GetLength()); | |
1266 } | 1251 } |
1267 CFX_WideString wsNodeNameSpace; | 1252 CFX_WideString wsNodeNameSpace; |
1268 TryNamespace(wsNodeNameSpace); | 1253 TryNamespace(wsNodeNameSpace); |
1269 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 1254 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
1270 if (hValue) { | 1255 if (hValue) { |
1271 FXJSE_Value_SetBoolean(hValue, wsNodeNameSpace == wsNameSpace); | 1256 FXJSE_Value_SetBoolean(hValue, wsNodeNameSpace == wsNameSpace); |
1272 } | 1257 } |
1273 } | 1258 } |
1274 void CXFA_Node::Script_ModelClass_Context(FXJSE_HVALUE hValue, | 1259 void CXFA_Node::Script_ModelClass_Context(FXJSE_HVALUE hValue, |
1275 FX_BOOL bSetting, | 1260 FX_BOOL bSetting, |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, eValue, | 1463 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, eValue, |
1479 this, this); | 1464 this, this); |
1480 } | 1465 } |
1481 } | 1466 } |
1482 void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, | 1467 void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, |
1483 FX_BOOL bSetting, | 1468 FX_BOOL bSetting, |
1484 XFA_ATTRIBUTE eAttribute) { | 1469 XFA_ATTRIBUTE eAttribute) { |
1485 if (bSetting) { | 1470 if (bSetting) { |
1486 CFX_ByteString szValue; | 1471 CFX_ByteString szValue; |
1487 FXJSE_Value_ToUTF8String(hValue, szValue); | 1472 FXJSE_Value_ToUTF8String(hValue, szValue); |
1488 CFX_WideString wsValue = | 1473 CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsByteStringC()); |
1489 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); | |
1490 SetAttribute(eAttribute, wsValue.AsWideStringC(), TRUE); | 1474 SetAttribute(eAttribute, wsValue.AsWideStringC(), TRUE); |
1491 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) { | 1475 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) { |
1492 CFX_WideString wsUseVal = wsValue, wsID, wsSOM; | 1476 CFX_WideString wsUseVal = wsValue, wsID, wsSOM; |
1493 CXFA_Node* pTemplateNode = | 1477 CXFA_Node* pTemplateNode = |
1494 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); | 1478 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); |
1495 CXFA_Node* pProtoRoot = | 1479 CXFA_Node* pProtoRoot = |
1496 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform) | 1480 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform) |
1497 ->GetFirstChildByClass(XFA_ELEMENT_Proto); | 1481 ->GetFirstChildByClass(XFA_ELEMENT_Proto); |
1498 if (!wsUseVal.IsEmpty()) { | 1482 if (!wsUseVal.IsEmpty()) { |
1499 if (wsUseVal[0] == '#') { | 1483 if (wsUseVal[0] == '#') { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 if (!validate) { | 1579 if (!validate) { |
1596 validate = pWidgetData->GetValidate(TRUE); | 1580 validate = pWidgetData->GetValidate(TRUE); |
1597 bNew = TRUE; | 1581 bNew = TRUE; |
1598 } | 1582 } |
1599 if (bSetting) { | 1583 if (bSetting) { |
1600 CFX_ByteString bsMessage; | 1584 CFX_ByteString bsMessage; |
1601 FXJSE_Value_ToUTF8String(hValue, bsMessage); | 1585 FXJSE_Value_ToUTF8String(hValue, bsMessage); |
1602 switch (iMessageType) { | 1586 switch (iMessageType) { |
1603 case XFA_SOM_ValidationMessage: | 1587 case XFA_SOM_ValidationMessage: |
1604 validate.SetScriptMessageText( | 1588 validate.SetScriptMessageText( |
1605 CFX_WideString::FromUTF8(bsMessage, bsMessage.GetLength())); | 1589 CFX_WideString::FromUTF8(bsMessage.AsByteStringC())); |
1606 break; | 1590 break; |
1607 case XFA_SOM_FormatMessage: | 1591 case XFA_SOM_FormatMessage: |
1608 validate.SetFormatMessageText( | 1592 validate.SetFormatMessageText( |
1609 CFX_WideString::FromUTF8(bsMessage, bsMessage.GetLength())); | 1593 CFX_WideString::FromUTF8(bsMessage.AsByteStringC())); |
1610 break; | 1594 break; |
1611 case XFA_SOM_MandatoryMessage: | 1595 case XFA_SOM_MandatoryMessage: |
1612 validate.SetNullMessageText( | 1596 validate.SetNullMessageText( |
1613 CFX_WideString::FromUTF8(bsMessage, bsMessage.GetLength())); | 1597 CFX_WideString::FromUTF8(bsMessage.AsByteStringC())); |
1614 break; | 1598 break; |
1615 default: | 1599 default: |
1616 break; | 1600 break; |
1617 } | 1601 } |
1618 if (!bNew) { | 1602 if (!bNew) { |
1619 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 1603 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
1620 if (!pNotify) { | 1604 if (!pNotify) { |
1621 return; | 1605 return; |
1622 } | 1606 } |
1623 pNotify->AddCalcValidate(this); | 1607 pNotify->AddCalcValidate(this); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 } else if (classID == XFA_ELEMENT_Boolean) { | 1656 } else if (classID == XFA_ELEMENT_Boolean) { |
1673 Script_Boolean_Value(hValue, bSetting, eAttribute); | 1657 Script_Boolean_Value(hValue, bSetting, eAttribute); |
1674 return; | 1658 return; |
1675 } | 1659 } |
1676 if (bSetting) { | 1660 if (bSetting) { |
1677 CFX_ByteString newValue; | 1661 CFX_ByteString newValue; |
1678 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { | 1662 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { |
1679 FXJSE_Value_ToUTF8String(hValue, newValue); | 1663 FXJSE_Value_ToUTF8String(hValue, newValue); |
1680 } | 1664 } |
1681 CFX_WideString wsNewValue = | 1665 CFX_WideString wsNewValue = |
1682 CFX_WideString::FromUTF8(newValue, newValue.GetLength()); | 1666 CFX_WideString::FromUTF8(newValue.AsByteStringC()); |
1683 CFX_WideString wsFormatValue(wsNewValue); | 1667 CFX_WideString wsFormatValue(wsNewValue); |
1684 CXFA_WidgetData* pContainerWidgetData = NULL; | 1668 CXFA_WidgetData* pContainerWidgetData = NULL; |
1685 if (GetPacketID() == XFA_XDPPACKET_Datasets) { | 1669 if (GetPacketID() == XFA_XDPPACKET_Datasets) { |
1686 CXFA_NodeArray formNodes; | 1670 CXFA_NodeArray formNodes; |
1687 GetBindItems(formNodes); | 1671 GetBindItems(formNodes); |
1688 CFX_WideString wsPicture; | 1672 CFX_WideString wsPicture; |
1689 for (int32_t i = 0; i < formNodes.GetSize(); i++) { | 1673 for (int32_t i = 0; i < formNodes.GetSize(); i++) { |
1690 CXFA_Node* pFormNode = formNodes.GetAt(i); | 1674 CXFA_Node* pFormNode = formNodes.GetAt(i); |
1691 if (!pFormNode || pFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) { | 1675 if (!pFormNode || pFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) { |
1692 continue; | 1676 continue; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 1841 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
1858 if (!pWidgetData) { | 1842 if (!pWidgetData) { |
1859 return; | 1843 return; |
1860 } | 1844 } |
1861 CXFA_Border border = pWidgetData->GetBorder(TRUE); | 1845 CXFA_Border border = pWidgetData->GetBorder(TRUE); |
1862 int32_t iSize = border.CountEdges(); | 1846 int32_t iSize = border.CountEdges(); |
1863 CFX_WideString strColor; | 1847 CFX_WideString strColor; |
1864 if (bSetting) { | 1848 if (bSetting) { |
1865 CFX_ByteString bsValue; | 1849 CFX_ByteString bsValue; |
1866 FXJSE_Value_ToUTF8String(hValue, bsValue); | 1850 FXJSE_Value_ToUTF8String(hValue, bsValue); |
1867 strColor = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 1851 strColor = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); |
1868 int32_t r = 0, g = 0, b = 0; | 1852 int32_t r = 0, g = 0, b = 0; |
1869 XFA_STRING_TO_RGB(strColor, r, g, b); | 1853 XFA_STRING_TO_RGB(strColor, r, g, b); |
1870 FX_ARGB rgb = ArgbEncode(100, r, g, b); | 1854 FX_ARGB rgb = ArgbEncode(100, r, g, b); |
1871 for (int32_t i = 0; i < iSize; ++i) { | 1855 for (int32_t i = 0; i < iSize; ++i) { |
1872 CXFA_Edge edge = border.GetEdge(i); | 1856 CXFA_Edge edge = border.GetEdge(i); |
1873 edge.SetColor(rgb); | 1857 edge.SetColor(rgb); |
1874 } | 1858 } |
1875 } else { | 1859 } else { |
1876 CXFA_Edge edge = border.GetEdge(0); | 1860 CXFA_Edge edge = border.GetEdge(0); |
1877 FX_ARGB color = edge.GetColor(); | 1861 FX_ARGB color = edge.GetColor(); |
1878 int32_t a, r, g, b; | 1862 int32_t a, r, g, b; |
1879 ArgbDecode(color, a, r, g, b); | 1863 ArgbDecode(color, a, r, g, b); |
1880 strColor.Format(L"%d,%d,%d", r, g, b); | 1864 strColor.Format(L"%d,%d,%d", r, g, b); |
1881 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(strColor).AsByteStringC()); | 1865 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(strColor).AsByteStringC()); |
1882 } | 1866 } |
1883 } | 1867 } |
1884 void CXFA_Node::Script_Som_BorderWidth(FXJSE_HVALUE hValue, | 1868 void CXFA_Node::Script_Som_BorderWidth(FXJSE_HVALUE hValue, |
1885 FX_BOOL bSetting, | 1869 FX_BOOL bSetting, |
1886 XFA_ATTRIBUTE eAttribute) { | 1870 XFA_ATTRIBUTE eAttribute) { |
1887 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 1871 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
1888 if (!pWidgetData) { | 1872 if (!pWidgetData) { |
1889 return; | 1873 return; |
1890 } | 1874 } |
1891 CXFA_Border border = pWidgetData->GetBorder(TRUE); | 1875 CXFA_Border border = pWidgetData->GetBorder(TRUE); |
1892 int32_t iSize = border.CountEdges(); | 1876 int32_t iSize = border.CountEdges(); |
1893 CFX_WideString wsThickness; | 1877 CFX_WideString wsThickness; |
1894 if (bSetting) { | 1878 if (bSetting) { |
1895 CFX_ByteString bsValue; | 1879 CFX_ByteString bsValue; |
1896 FXJSE_Value_ToUTF8String(hValue, bsValue); | 1880 FXJSE_Value_ToUTF8String(hValue, bsValue); |
1897 wsThickness = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 1881 wsThickness = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); |
1898 for (int32_t i = 0; i < iSize; ++i) { | 1882 for (int32_t i = 0; i < iSize; ++i) { |
1899 CXFA_Edge edge = border.GetEdge(i); | 1883 CXFA_Edge edge = border.GetEdge(i); |
1900 CXFA_Measurement thickness(wsThickness.AsWideStringC()); | 1884 CXFA_Measurement thickness(wsThickness.AsWideStringC()); |
1901 edge.SetMSThickness(thickness); | 1885 edge.SetMSThickness(thickness); |
1902 } | 1886 } |
1903 } else { | 1887 } else { |
1904 CXFA_Edge edge = border.GetEdge(0); | 1888 CXFA_Edge edge = border.GetEdge(0); |
1905 CXFA_Measurement thickness = edge.GetMSThickness(); | 1889 CXFA_Measurement thickness = edge.GetMSThickness(); |
1906 thickness.ToString(wsThickness); | 1890 thickness.ToString(wsThickness); |
1907 FXJSE_Value_SetUTF8String(hValue, | 1891 FXJSE_Value_SetUTF8String(hValue, |
(...skipping 10 matching lines...) Expand all Loading... |
1918 CXFA_Border border = pWidgetData->GetBorder(TRUE); | 1902 CXFA_Border border = pWidgetData->GetBorder(TRUE); |
1919 CXFA_Fill borderfill = border.GetFill(TRUE); | 1903 CXFA_Fill borderfill = border.GetFill(TRUE); |
1920 CXFA_Node* pNode = borderfill.GetNode(); | 1904 CXFA_Node* pNode = borderfill.GetNode(); |
1921 if (!pNode) { | 1905 if (!pNode) { |
1922 return; | 1906 return; |
1923 } | 1907 } |
1924 CFX_WideString wsColor; | 1908 CFX_WideString wsColor; |
1925 if (bSetting) { | 1909 if (bSetting) { |
1926 CFX_ByteString bsValue; | 1910 CFX_ByteString bsValue; |
1927 FXJSE_Value_ToUTF8String(hValue, bsValue); | 1911 FXJSE_Value_ToUTF8String(hValue, bsValue); |
1928 wsColor = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 1912 wsColor = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); |
1929 int32_t r, g, b; | 1913 int32_t r, g, b; |
1930 XFA_STRING_TO_RGB(wsColor, r, g, b); | 1914 XFA_STRING_TO_RGB(wsColor, r, g, b); |
1931 FX_ARGB color = ArgbEncode(0xff, r, g, b); | 1915 FX_ARGB color = ArgbEncode(0xff, r, g, b); |
1932 borderfill.SetColor(color); | 1916 borderfill.SetColor(color); |
1933 } else { | 1917 } else { |
1934 FX_ARGB color = borderfill.GetColor(); | 1918 FX_ARGB color = borderfill.GetColor(); |
1935 int32_t a, r, g, b; | 1919 int32_t a, r, g, b; |
1936 ArgbDecode(color, a, r, g, b); | 1920 ArgbDecode(color, a, r, g, b); |
1937 wsColor.Format(L"%d,%d,%d", r, g, b); | 1921 wsColor.Format(L"%d,%d,%d", r, g, b); |
1938 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor).AsByteStringC()); | 1922 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor).AsByteStringC()); |
(...skipping 20 matching lines...) Expand all Loading... |
1959 XFA_ATTRIBUTE eAttribute) { | 1943 XFA_ATTRIBUTE eAttribute) { |
1960 if (bSetting) { | 1944 if (bSetting) { |
1961 if (FXJSE_Value_IsUTF8String(hValue)) { | 1945 if (FXJSE_Value_IsUTF8String(hValue)) { |
1962 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 1946 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
1963 FXSYS_assert(pWidgetData); | 1947 FXSYS_assert(pWidgetData); |
1964 XFA_ELEMENT uiType = pWidgetData->GetUIType(); | 1948 XFA_ELEMENT uiType = pWidgetData->GetUIType(); |
1965 if (uiType == XFA_ELEMENT_Text) { | 1949 if (uiType == XFA_ELEMENT_Text) { |
1966 CFX_ByteString newValue; | 1950 CFX_ByteString newValue; |
1967 FXJSE_Value_ToUTF8String(hValue, newValue); | 1951 FXJSE_Value_ToUTF8String(hValue, newValue); |
1968 CFX_WideString wsNewValue = | 1952 CFX_WideString wsNewValue = |
1969 CFX_WideString::FromUTF8(newValue, newValue.GetLength()); | 1953 CFX_WideString::FromUTF8(newValue.AsByteStringC()); |
1970 CFX_WideString wsFormatValue(wsNewValue); | 1954 CFX_WideString wsFormatValue(wsNewValue); |
1971 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); | 1955 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); |
1972 } else if (uiType != XFA_ELEMENT_Image) { | 1956 } else if (uiType != XFA_ELEMENT_Image) { |
1973 } | 1957 } |
1974 } | 1958 } |
1975 } else { | 1959 } else { |
1976 CFX_WideString content = GetScriptContent(TRUE); | 1960 CFX_WideString content = GetScriptContent(TRUE); |
1977 if (content.IsEmpty()) { | 1961 if (content.IsEmpty()) { |
1978 FXJSE_Value_SetNull(hValue); | 1962 FXJSE_Value_SetNull(hValue); |
1979 } else { | 1963 } else { |
(...skipping 15 matching lines...) Expand all Loading... |
1995 pWidgetData->m_bIsNull = TRUE; | 1979 pWidgetData->m_bIsNull = TRUE; |
1996 } else { | 1980 } else { |
1997 pWidgetData->m_bPreNull = pWidgetData->m_bIsNull; | 1981 pWidgetData->m_bPreNull = pWidgetData->m_bIsNull; |
1998 pWidgetData->m_bIsNull = FALSE; | 1982 pWidgetData->m_bIsNull = FALSE; |
1999 } | 1983 } |
2000 CFX_ByteString newValue; | 1984 CFX_ByteString newValue; |
2001 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { | 1985 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { |
2002 FXJSE_Value_ToUTF8String(hValue, newValue); | 1986 FXJSE_Value_ToUTF8String(hValue, newValue); |
2003 } | 1987 } |
2004 CFX_WideString wsNewText = | 1988 CFX_WideString wsNewText = |
2005 CFX_WideString::FromUTF8(newValue, newValue.GetLength()); | 1989 CFX_WideString::FromUTF8(newValue.AsByteStringC()); |
2006 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); | 1990 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); |
2007 if (pUIChild->GetClassID() == XFA_ELEMENT_NumericEdit) { | 1991 if (pUIChild->GetClassID() == XFA_ELEMENT_NumericEdit) { |
2008 int32_t iLeadDigits = 0; | 1992 int32_t iLeadDigits = 0; |
2009 int32_t iFracDigits = 0; | 1993 int32_t iFracDigits = 0; |
2010 pWidgetData->GetLeadDigits(iLeadDigits); | 1994 pWidgetData->GetLeadDigits(iLeadDigits); |
2011 pWidgetData->GetFracDigits(iFracDigits); | 1995 pWidgetData->GetFracDigits(iFracDigits); |
2012 wsNewText = XFA_NumericLimit(wsNewText, iLeadDigits, iFracDigits); | 1996 wsNewText = XFA_NumericLimit(wsNewText, iLeadDigits, iFracDigits); |
2013 } | 1997 } |
2014 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); | 1998 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); |
2015 CFX_WideString wsFormatText(wsNewText); | 1999 CFX_WideString wsFormatText(wsNewText); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 FX_BOOL bSetting, | 2040 FX_BOOL bSetting, |
2057 XFA_ATTRIBUTE eAttribute) { | 2041 XFA_ATTRIBUTE eAttribute) { |
2058 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2042 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2059 if (!pWidgetData) { | 2043 if (!pWidgetData) { |
2060 return; | 2044 return; |
2061 } | 2045 } |
2062 CFX_WideString wsValue; | 2046 CFX_WideString wsValue; |
2063 if (bSetting) { | 2047 if (bSetting) { |
2064 CFX_ByteString bsValue; | 2048 CFX_ByteString bsValue; |
2065 FXJSE_Value_ToUTF8String(hValue, bsValue); | 2049 FXJSE_Value_ToUTF8String(hValue, bsValue); |
2066 wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 2050 wsValue = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); |
2067 pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Edit); | 2051 pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Edit); |
2068 } else { | 2052 } else { |
2069 pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Edit); | 2053 pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Edit); |
2070 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); | 2054 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); |
2071 } | 2055 } |
2072 } | 2056 } |
2073 void CXFA_Node::Script_Som_FontColor(FXJSE_HVALUE hValue, | 2057 void CXFA_Node::Script_Som_FontColor(FXJSE_HVALUE hValue, |
2074 FX_BOOL bSetting, | 2058 FX_BOOL bSetting, |
2075 XFA_ATTRIBUTE eAttribute) { | 2059 XFA_ATTRIBUTE eAttribute) { |
2076 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2060 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2077 if (!pWidgetData) { | 2061 if (!pWidgetData) { |
2078 return; | 2062 return; |
2079 } | 2063 } |
2080 CXFA_Font font = pWidgetData->GetFont(TRUE); | 2064 CXFA_Font font = pWidgetData->GetFont(TRUE); |
2081 CXFA_Node* pNode = font.GetNode(); | 2065 CXFA_Node* pNode = font.GetNode(); |
2082 if (!pNode) { | 2066 if (!pNode) { |
2083 return; | 2067 return; |
2084 } | 2068 } |
2085 CFX_WideString wsColor; | 2069 CFX_WideString wsColor; |
2086 if (bSetting) { | 2070 if (bSetting) { |
2087 CFX_ByteString bsValue; | 2071 CFX_ByteString bsValue; |
2088 FXJSE_Value_ToUTF8String(hValue, bsValue); | 2072 FXJSE_Value_ToUTF8String(hValue, bsValue); |
2089 wsColor = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 2073 wsColor = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); |
2090 int32_t r, g, b; | 2074 int32_t r, g, b; |
2091 XFA_STRING_TO_RGB(wsColor, r, g, b); | 2075 XFA_STRING_TO_RGB(wsColor, r, g, b); |
2092 FX_ARGB color = ArgbEncode(0xff, r, g, b); | 2076 FX_ARGB color = ArgbEncode(0xff, r, g, b); |
2093 font.SetColor(color); | 2077 font.SetColor(color); |
2094 } else { | 2078 } else { |
2095 FX_ARGB color = font.GetColor(); | 2079 FX_ARGB color = font.GetColor(); |
2096 int32_t a, r, g, b; | 2080 int32_t a, r, g, b; |
2097 ArgbDecode(color, a, r, g, b); | 2081 ArgbDecode(color, a, r, g, b); |
2098 wsColor.Format(L"%d,%d,%d", r, g, b); | 2082 wsColor.Format(L"%d,%d,%d", r, g, b); |
2099 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor).AsByteStringC()); | 2083 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor).AsByteStringC()); |
2100 } | 2084 } |
2101 } | 2085 } |
2102 void CXFA_Node::Script_Field_FormatMessage(FXJSE_HVALUE hValue, | 2086 void CXFA_Node::Script_Field_FormatMessage(FXJSE_HVALUE hValue, |
2103 FX_BOOL bSetting, | 2087 FX_BOOL bSetting, |
2104 XFA_ATTRIBUTE eAttribute) { | 2088 XFA_ATTRIBUTE eAttribute) { |
2105 Script_Som_Message(hValue, bSetting, XFA_SOM_FormatMessage); | 2089 Script_Som_Message(hValue, bSetting, XFA_SOM_FormatMessage); |
2106 } | 2090 } |
2107 void CXFA_Node::Script_Field_FormattedValue(FXJSE_HVALUE hValue, | 2091 void CXFA_Node::Script_Field_FormattedValue(FXJSE_HVALUE hValue, |
2108 FX_BOOL bSetting, | 2092 FX_BOOL bSetting, |
2109 XFA_ATTRIBUTE eAttribute) { | 2093 XFA_ATTRIBUTE eAttribute) { |
2110 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2094 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2111 if (!pWidgetData) { | 2095 if (!pWidgetData) { |
2112 return; | 2096 return; |
2113 } | 2097 } |
2114 CFX_WideString wsValue; | 2098 CFX_WideString wsValue; |
2115 if (bSetting) { | 2099 if (bSetting) { |
2116 CFX_ByteString bsValue; | 2100 CFX_ByteString bsValue; |
2117 FXJSE_Value_ToUTF8String(hValue, bsValue); | 2101 FXJSE_Value_ToUTF8String(hValue, bsValue); |
2118 wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 2102 wsValue = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); |
2119 pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Display); | 2103 pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Display); |
2120 } else { | 2104 } else { |
2121 pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Display); | 2105 pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Display); |
2122 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); | 2106 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); |
2123 } | 2107 } |
2124 } | 2108 } |
2125 void CXFA_Node::Script_Som_Mandatory(FXJSE_HVALUE hValue, | 2109 void CXFA_Node::Script_Som_Mandatory(FXJSE_HVALUE hValue, |
2126 FX_BOOL bSetting, | 2110 FX_BOOL bSetting, |
2127 XFA_ATTRIBUTE eAttribute) { | 2111 XFA_ATTRIBUTE eAttribute) { |
2128 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2112 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2129 if (!pWidgetData) { | 2113 if (!pWidgetData) { |
2130 return; | 2114 return; |
2131 } | 2115 } |
2132 CXFA_Validate validate = pWidgetData->GetValidate(TRUE); | 2116 CXFA_Validate validate = pWidgetData->GetValidate(TRUE); |
2133 CFX_WideString wsValue; | 2117 CFX_WideString wsValue; |
2134 if (bSetting) { | 2118 if (bSetting) { |
2135 CFX_ByteString bsValue; | 2119 CFX_ByteString bsValue; |
2136 FXJSE_Value_ToUTF8String(hValue, bsValue); | 2120 FXJSE_Value_ToUTF8String(hValue, bsValue); |
2137 wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 2121 wsValue = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); |
2138 validate.SetNullTest(wsValue); | 2122 validate.SetNullTest(wsValue); |
2139 } else { | 2123 } else { |
2140 int32_t iValue = validate.GetNullTest(); | 2124 int32_t iValue = validate.GetNullTest(); |
2141 const XFA_ATTRIBUTEENUMINFO* pInfo = | 2125 const XFA_ATTRIBUTEENUMINFO* pInfo = |
2142 XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)iValue); | 2126 XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)iValue); |
2143 if (pInfo) { | 2127 if (pInfo) { |
2144 wsValue = pInfo->pName; | 2128 wsValue = pInfo->pName; |
2145 } | 2129 } |
2146 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); | 2130 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); |
2147 } | 2131 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 if (!pWidgetData) { | 2167 if (!pWidgetData) { |
2184 return; | 2168 return; |
2185 } | 2169 } |
2186 pWidgetData->DeleteItem(-1, TRUE); | 2170 pWidgetData->DeleteItem(-1, TRUE); |
2187 } | 2171 } |
2188 void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { | 2172 void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { |
2189 int32_t argc = pArguments->GetLength(); | 2173 int32_t argc = pArguments->GetLength(); |
2190 if (argc == 1) { | 2174 if (argc == 1) { |
2191 CFX_ByteString eventString = pArguments->GetUTF8String(0); | 2175 CFX_ByteString eventString = pArguments->GetUTF8String(0); |
2192 int32_t iRet = execSingleEventByName( | 2176 int32_t iRet = execSingleEventByName( |
2193 CFX_WideString::FromUTF8(eventString, eventString.GetLength()) | 2177 CFX_WideString::FromUTF8(eventString.AsByteStringC()).AsWideStringC(), |
2194 .AsWideStringC(), | |
2195 XFA_ELEMENT_Field); | 2178 XFA_ELEMENT_Field); |
2196 if (eventString == "validate") { | 2179 if (eventString == "validate") { |
2197 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), | 2180 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), |
2198 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); | 2181 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); |
2199 } | 2182 } |
2200 } else { | 2183 } else { |
2201 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); | 2184 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); |
2202 } | 2185 } |
2203 } | 2186 } |
2204 void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) { | 2187 void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2261 int32_t iLength = pArguments->GetLength(); | 2244 int32_t iLength = pArguments->GetLength(); |
2262 if (iLength != 1) { | 2245 if (iLength != 1) { |
2263 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"boundItem"); | 2246 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"boundItem"); |
2264 return; | 2247 return; |
2265 } | 2248 } |
2266 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2249 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2267 if (!pWidgetData) { | 2250 if (!pWidgetData) { |
2268 return; | 2251 return; |
2269 } | 2252 } |
2270 CFX_ByteString bsValue = pArguments->GetUTF8String(0); | 2253 CFX_ByteString bsValue = pArguments->GetUTF8String(0); |
2271 CFX_WideString wsValue = | 2254 CFX_WideString wsValue = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); |
2272 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | |
2273 CFX_WideString wsBoundValue; | 2255 CFX_WideString wsBoundValue; |
2274 pWidgetData->GetItemValue(wsValue.AsWideStringC(), wsBoundValue); | 2256 pWidgetData->GetItemValue(wsValue.AsWideStringC(), wsBoundValue); |
2275 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 2257 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
2276 if (hValue) { | 2258 if (hValue) { |
2277 FXJSE_Value_SetUTF8String(hValue, | 2259 FXJSE_Value_SetUTF8String(hValue, |
2278 FX_UTF8Encode(wsBoundValue).AsByteStringC()); | 2260 FX_UTF8Encode(wsBoundValue).AsByteStringC()); |
2279 } | 2261 } |
2280 } | 2262 } |
2281 void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { | 2263 void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { |
2282 int32_t iLength = pArguments->GetLength(); | 2264 int32_t iLength = pArguments->GetLength(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2363 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"addItem"); | 2345 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"addItem"); |
2364 return; | 2346 return; |
2365 } | 2347 } |
2366 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2348 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2367 if (!pWidgetData) { | 2349 if (!pWidgetData) { |
2368 return; | 2350 return; |
2369 } | 2351 } |
2370 CFX_WideString wsLabel; | 2352 CFX_WideString wsLabel; |
2371 CFX_WideString wsValue; | 2353 CFX_WideString wsValue; |
2372 if (iLength >= 1) { | 2354 if (iLength >= 1) { |
2373 CFX_ByteString bsLable = pArguments->GetUTF8String(0); | 2355 CFX_ByteString bsLabel = pArguments->GetUTF8String(0); |
2374 wsLabel = CFX_WideString::FromUTF8(bsLable, bsLable.GetLength()); | 2356 wsLabel = CFX_WideString::FromUTF8(bsLabel.AsByteStringC()); |
2375 } | 2357 } |
2376 if (iLength >= 2) { | 2358 if (iLength >= 2) { |
2377 CFX_ByteString bsValue = pArguments->GetUTF8String(1); | 2359 CFX_ByteString bsValue = pArguments->GetUTF8String(1); |
2378 wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 2360 wsValue = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); |
2379 } | 2361 } |
2380 pWidgetData->InsertItem(wsLabel, wsValue, -1, TRUE); | 2362 pWidgetData->InsertItem(wsLabel, wsValue, -1, TRUE); |
2381 } | 2363 } |
2382 void CXFA_Node::Script_Field_ExecValidate(CFXJSE_Arguments* pArguments) { | 2364 void CXFA_Node::Script_Field_ExecValidate(CFXJSE_Arguments* pArguments) { |
2383 int32_t argc = pArguments->GetLength(); | 2365 int32_t argc = pArguments->GetLength(); |
2384 if (argc == 0) { | 2366 if (argc == 0) { |
2385 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 2367 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
2386 if (!pNotify) { | 2368 if (!pNotify) { |
2387 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); | 2369 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); |
2388 } else { | 2370 } else { |
(...skipping 19 matching lines...) Expand all Loading... |
2408 FX_BOOL bSetting, | 2390 FX_BOOL bSetting, |
2409 XFA_ATTRIBUTE eAttribute) { | 2391 XFA_ATTRIBUTE eAttribute) { |
2410 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2392 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2411 if (!pWidgetData) { | 2393 if (!pWidgetData) { |
2412 return; | 2394 return; |
2413 } | 2395 } |
2414 if (bSetting) { | 2396 if (bSetting) { |
2415 CFX_ByteString bsValue; | 2397 CFX_ByteString bsValue; |
2416 FXJSE_Value_ToUTF8String(hValue, bsValue); | 2398 FXJSE_Value_ToUTF8String(hValue, bsValue); |
2417 pWidgetData->SetSelectedMemberByValue( | 2399 pWidgetData->SetSelectedMemberByValue( |
2418 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()).AsWideStringC(), | 2400 CFX_WideString::FromUTF8(bsValue.AsByteStringC()).AsWideStringC(), TRUE, |
2419 TRUE, TRUE); | 2401 TRUE); |
2420 } else { | 2402 } else { |
2421 CFX_WideString wsValue = GetScriptContent(TRUE); | 2403 CFX_WideString wsValue = GetScriptContent(TRUE); |
2422 XFA_VERSION curVersion = GetDocument()->GetCurVersionMode(); | 2404 XFA_VERSION curVersion = GetDocument()->GetCurVersionMode(); |
2423 if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) { | 2405 if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) { |
2424 FXJSE_Value_SetNull(hValue); | 2406 FXJSE_Value_SetNull(hValue); |
2425 } else { | 2407 } else { |
2426 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); | 2408 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); |
2427 } | 2409 } |
2428 } | 2410 } |
2429 } | 2411 } |
2430 void CXFA_Node::Script_ExclGroup_Transient(FXJSE_HVALUE hValue, | 2412 void CXFA_Node::Script_ExclGroup_Transient(FXJSE_HVALUE hValue, |
2431 FX_BOOL bSetting, | 2413 FX_BOOL bSetting, |
2432 XFA_ATTRIBUTE eAttribute) {} | 2414 XFA_ATTRIBUTE eAttribute) {} |
2433 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { | 2415 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { |
2434 int32_t argc = pArguments->GetLength(); | 2416 int32_t argc = pArguments->GetLength(); |
2435 if (argc == 1) { | 2417 if (argc == 1) { |
2436 CFX_ByteString eventString = pArguments->GetUTF8String(0); | 2418 CFX_ByteString eventString = pArguments->GetUTF8String(0); |
2437 execSingleEventByName( | 2419 execSingleEventByName( |
2438 CFX_WideString::FromUTF8(eventString, eventString.GetLength()) | 2420 CFX_WideString::FromUTF8(eventString.AsByteStringC()).AsWideStringC(), |
2439 .AsWideStringC(), | |
2440 XFA_ELEMENT_ExclGroup); | 2421 XFA_ELEMENT_ExclGroup); |
2441 } else { | 2422 } else { |
2442 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); | 2423 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); |
2443 } | 2424 } |
2444 } | 2425 } |
2445 void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { | 2426 void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { |
2446 int32_t argc = pArguments->GetLength(); | 2427 int32_t argc = pArguments->GetLength(); |
2447 if ((argc == 0) || (argc == 1)) { | 2428 if ((argc == 0) || (argc == 1)) { |
2448 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2429 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2449 if (!pWidgetData) { | 2430 if (!pWidgetData) { |
2450 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 2431 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
2451 } else { | 2432 } else { |
2452 CXFA_Node* pReturnNode = NULL; | 2433 CXFA_Node* pReturnNode = NULL; |
2453 if (argc == 0) { | 2434 if (argc == 0) { |
2454 pReturnNode = pWidgetData->GetSelectedMember(); | 2435 pReturnNode = pWidgetData->GetSelectedMember(); |
2455 } else { | 2436 } else { |
2456 CFX_ByteString szName; | 2437 CFX_ByteString szName; |
2457 szName = pArguments->GetUTF8String(0); | 2438 szName = pArguments->GetUTF8String(0); |
2458 pReturnNode = pWidgetData->SetSelectedMember( | 2439 pReturnNode = pWidgetData->SetSelectedMember( |
2459 CFX_WideString::FromUTF8(szName, szName.GetLength()) | 2440 CFX_WideString::FromUTF8(szName.AsByteStringC()).AsWideStringC()); |
2460 .AsWideStringC()); | |
2461 } | 2441 } |
2462 if (pReturnNode) { | 2442 if (pReturnNode) { |
2463 FXJSE_Value_Set( | 2443 FXJSE_Value_Set( |
2464 pArguments->GetReturnValue(), | 2444 pArguments->GetReturnValue(), |
2465 m_pDocument->GetScriptContext()->GetJSValueFromMap(pReturnNode)); | 2445 m_pDocument->GetScriptContext()->GetJSValueFromMap(pReturnNode)); |
2466 } else { | 2446 } else { |
2467 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 2447 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
2468 } | 2448 } |
2469 } | 2449 } |
2470 } else { | 2450 } else { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2611 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 2591 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
2612 } | 2592 } |
2613 } | 2593 } |
2614 void CXFA_Node::Script_Subform_Locale(FXJSE_HVALUE hValue, | 2594 void CXFA_Node::Script_Subform_Locale(FXJSE_HVALUE hValue, |
2615 FX_BOOL bSetting, | 2595 FX_BOOL bSetting, |
2616 XFA_ATTRIBUTE eAttribute) { | 2596 XFA_ATTRIBUTE eAttribute) { |
2617 if (bSetting) { | 2597 if (bSetting) { |
2618 CFX_ByteString bsLocaleName; | 2598 CFX_ByteString bsLocaleName; |
2619 FXJSE_Value_ToUTF8String(hValue, bsLocaleName); | 2599 FXJSE_Value_ToUTF8String(hValue, bsLocaleName); |
2620 SetCData(XFA_ATTRIBUTE_Locale, | 2600 SetCData(XFA_ATTRIBUTE_Locale, |
2621 CFX_WideString::FromUTF8(bsLocaleName, bsLocaleName.GetLength()), | 2601 CFX_WideString::FromUTF8(bsLocaleName.AsByteStringC()), TRUE, |
2622 TRUE, TRUE); | 2602 TRUE); |
2623 } else { | 2603 } else { |
2624 CFX_WideString wsLocaleName; | 2604 CFX_WideString wsLocaleName; |
2625 GetLocaleName(wsLocaleName); | 2605 GetLocaleName(wsLocaleName); |
2626 FXJSE_Value_SetUTF8String( | 2606 FXJSE_Value_SetUTF8String( |
2627 hValue, | 2607 hValue, |
2628 FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength()).AsByteStringC()); | 2608 FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength()).AsByteStringC()); |
2629 } | 2609 } |
2630 } | 2610 } |
2631 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { | 2611 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { |
2632 int32_t argc = pArguments->GetLength(); | 2612 int32_t argc = pArguments->GetLength(); |
2633 if (argc == 1) { | 2613 if (argc == 1) { |
2634 CFX_ByteString eventString = pArguments->GetUTF8String(0); | 2614 CFX_ByteString eventString = pArguments->GetUTF8String(0); |
2635 execSingleEventByName( | 2615 execSingleEventByName( |
2636 CFX_WideString::FromUTF8(eventString, eventString.GetLength()) | 2616 CFX_WideString::FromUTF8(eventString.AsByteStringC()).AsWideStringC(), |
2637 .AsWideStringC(), | |
2638 XFA_ELEMENT_Subform); | 2617 XFA_ELEMENT_Subform); |
2639 } else { | 2618 } else { |
2640 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); | 2619 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); |
2641 } | 2620 } |
2642 } | 2621 } |
2643 void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { | 2622 void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { |
2644 int32_t argc = pArguments->GetLength(); | 2623 int32_t argc = pArguments->GetLength(); |
2645 if (argc == 0) { | 2624 if (argc == 0) { |
2646 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 2625 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
2647 if (!pNotify) { | 2626 if (!pNotify) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 L"execInitialize"); | 2712 L"execInitialize"); |
2734 } | 2713 } |
2735 } | 2714 } |
2736 void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { | 2715 void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { |
2737 int32_t argc = pArguments->GetLength(); | 2716 int32_t argc = pArguments->GetLength(); |
2738 if ((argc > 0) && (argc < 4)) { | 2717 if ((argc > 0) && (argc < 4)) { |
2739 CFX_WideString strTagName; | 2718 CFX_WideString strTagName; |
2740 CFX_WideString strName; | 2719 CFX_WideString strName; |
2741 CFX_WideString strNameSpace; | 2720 CFX_WideString strNameSpace; |
2742 CFX_ByteString bsTagName = pArguments->GetUTF8String(0); | 2721 CFX_ByteString bsTagName = pArguments->GetUTF8String(0); |
2743 strTagName = CFX_WideString::FromUTF8(bsTagName, bsTagName.GetLength()); | 2722 strTagName = CFX_WideString::FromUTF8(bsTagName.AsByteStringC()); |
2744 if (argc > 1) { | 2723 if (argc > 1) { |
2745 CFX_ByteString bsName = pArguments->GetUTF8String(1); | 2724 CFX_ByteString bsName = pArguments->GetUTF8String(1); |
2746 strName = CFX_WideString::FromUTF8(bsName, bsName.GetLength()); | 2725 strName = CFX_WideString::FromUTF8(bsName.AsByteStringC()); |
2747 if (argc == 3) { | 2726 if (argc == 3) { |
2748 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(2); | 2727 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(2); |
2749 strNameSpace = | 2728 strNameSpace = CFX_WideString::FromUTF8(bsNameSpace.AsByteStringC()); |
2750 CFX_WideString::FromUTF8(bsNameSpace, bsNameSpace.GetLength()); | |
2751 } | 2729 } |
2752 } | 2730 } |
2753 const XFA_ELEMENTINFO* pElement = | 2731 const XFA_ELEMENTINFO* pElement = |
2754 XFA_GetElementByName(strTagName.AsWideStringC()); | 2732 XFA_GetElementByName(strTagName.AsWideStringC()); |
2755 CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName); | 2733 CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName); |
2756 if (!pNewNode) { | 2734 if (!pNewNode) { |
2757 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 2735 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
2758 } else { | 2736 } else { |
2759 if (!strName.IsEmpty()) { | 2737 if (!strName.IsEmpty()) { |
2760 if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name, | 2738 if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name, |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3510 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3488 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3511 L"execValidate"); | 3489 L"execValidate"); |
3512 } | 3490 } |
3513 } | 3491 } |
3514 void CXFA_Node::Script_Form_Checksum(FXJSE_HVALUE hValue, | 3492 void CXFA_Node::Script_Form_Checksum(FXJSE_HVALUE hValue, |
3515 FX_BOOL bSetting, | 3493 FX_BOOL bSetting, |
3516 XFA_ATTRIBUTE eAttribute) { | 3494 XFA_ATTRIBUTE eAttribute) { |
3517 if (bSetting) { | 3495 if (bSetting) { |
3518 CFX_ByteString bsChecksum; | 3496 CFX_ByteString bsChecksum; |
3519 FXJSE_Value_ToUTF8String(hValue, bsChecksum); | 3497 FXJSE_Value_ToUTF8String(hValue, bsChecksum); |
3520 SetAttribute(XFA_ATTRIBUTE_Checksum, | 3498 SetAttribute( |
3521 CFX_WideString::FromUTF8(bsChecksum, bsChecksum.GetLength()) | 3499 XFA_ATTRIBUTE_Checksum, |
3522 .AsWideStringC()); | 3500 CFX_WideString::FromUTF8(bsChecksum.AsByteStringC()).AsWideStringC()); |
3523 } else { | 3501 } else { |
3524 CFX_WideString wsChecksum; | 3502 CFX_WideString wsChecksum; |
3525 GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); | 3503 GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); |
3526 FXJSE_Value_SetUTF8String( | 3504 FXJSE_Value_SetUTF8String( |
3527 hValue, | 3505 hValue, |
3528 FX_UTF8Encode(wsChecksum, wsChecksum.GetLength()).AsByteStringC()); | 3506 FX_UTF8Encode(wsChecksum, wsChecksum.GetLength()).AsByteStringC()); |
3529 } | 3507 } |
3530 } | 3508 } |
3531 void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { | 3509 void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { |
3532 int32_t argc = pArguments->GetLength(); | 3510 int32_t argc = pArguments->GetLength(); |
3533 if (argc == 1) { | 3511 if (argc == 1) { |
3534 CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0); | 3512 CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0); |
3535 CFX_WideString wsAttributeValue; | 3513 CFX_WideString wsAttributeValue; |
3536 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3514 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
3537 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3515 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
3538 static_cast<CFDE_XMLElement*>(pXMLNode) | 3516 static_cast<CFDE_XMLElement*>(pXMLNode) |
3539 ->GetString(CFX_WideString::FromUTF8(bsAttributeName, | 3517 ->GetString(CFX_WideString::FromUTF8(bsAttributeName.AsByteStringC()), |
3540 bsAttributeName.GetLength()), | |
3541 wsAttributeValue); | 3518 wsAttributeValue); |
3542 } | 3519 } |
3543 FXJSE_Value_SetUTF8String( | 3520 FXJSE_Value_SetUTF8String( |
3544 pArguments->GetReturnValue(), | 3521 pArguments->GetReturnValue(), |
3545 FX_UTF8Encode(wsAttributeValue, wsAttributeValue.GetLength()) | 3522 FX_UTF8Encode(wsAttributeValue, wsAttributeValue.GetLength()) |
3546 .AsByteStringC()); | 3523 .AsByteStringC()); |
3547 } else { | 3524 } else { |
3548 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3525 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3549 L"getAttribute"); | 3526 L"getAttribute"); |
3550 } | 3527 } |
3551 } | 3528 } |
3552 void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { | 3529 void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { |
3553 int32_t argc = pArguments->GetLength(); | 3530 int32_t argc = pArguments->GetLength(); |
3554 if (argc == 2) { | 3531 if (argc == 2) { |
3555 CFX_ByteString bsValue = pArguments->GetUTF8String(0); | 3532 CFX_ByteString bsValue = pArguments->GetUTF8String(0); |
3556 CFX_ByteString bsName = pArguments->GetUTF8String(1); | 3533 CFX_ByteString bsName = pArguments->GetUTF8String(1); |
3557 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3534 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
3558 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3535 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
3559 static_cast<CFDE_XMLElement*>(pXMLNode) | 3536 static_cast<CFDE_XMLElement*>(pXMLNode) |
3560 ->SetString(CFX_WideString::FromUTF8(bsName, bsName.GetLength()), | 3537 ->SetString(CFX_WideString::FromUTF8(bsName.AsByteStringC()), |
3561 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength())); | 3538 CFX_WideString::FromUTF8(bsValue.AsByteStringC())); |
3562 } | 3539 } |
3563 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 3540 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
3564 } else { | 3541 } else { |
3565 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3542 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3566 L"setAttribute"); | 3543 L"setAttribute"); |
3567 } | 3544 } |
3568 } | 3545 } |
3569 void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { | 3546 void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { |
3570 int32_t argc = pArguments->GetLength(); | 3547 int32_t argc = pArguments->GetLength(); |
3571 if (argc == 1) { | 3548 if (argc == 1) { |
3572 CFX_ByteString bsName = pArguments->GetUTF8String(0); | 3549 CFX_ByteString bsName = pArguments->GetUTF8String(0); |
3573 CFX_WideString wsName = | 3550 CFX_WideString wsName = CFX_WideString::FromUTF8(bsName.AsByteStringC()); |
3574 CFX_WideString::FromUTF8(bsName, bsName.GetLength()); | |
3575 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3551 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
3576 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3552 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
3577 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 3553 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
3578 if (pXMLElement->HasAttribute(wsName)) { | 3554 if (pXMLElement->HasAttribute(wsName)) { |
3579 pXMLElement->RemoveAttribute(wsName); | 3555 pXMLElement->RemoveAttribute(wsName); |
3580 } | 3556 } |
3581 } | 3557 } |
3582 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 3558 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
3583 } else { | 3559 } else { |
3584 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3560 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3585 L"removeAttribute"); | 3561 L"removeAttribute"); |
3586 } | 3562 } |
3587 } | 3563 } |
3588 void CXFA_Node::Script_Packet_Content(FXJSE_HVALUE hValue, | 3564 void CXFA_Node::Script_Packet_Content(FXJSE_HVALUE hValue, |
3589 FX_BOOL bSetting, | 3565 FX_BOOL bSetting, |
3590 XFA_ATTRIBUTE eAttribute) { | 3566 XFA_ATTRIBUTE eAttribute) { |
3591 if (bSetting) { | 3567 if (bSetting) { |
3592 CFX_ByteString bsNewContent; | 3568 CFX_ByteString bsNewContent; |
3593 FXJSE_Value_ToUTF8String(hValue, bsNewContent); | 3569 FXJSE_Value_ToUTF8String(hValue, bsNewContent); |
3594 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3570 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
3595 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3571 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
3596 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 3572 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
3597 pXMLElement->SetTextData( | 3573 pXMLElement->SetTextData( |
3598 CFX_WideString::FromUTF8(bsNewContent, bsNewContent.GetLength())); | 3574 CFX_WideString::FromUTF8(bsNewContent.AsByteStringC())); |
3599 } | 3575 } |
3600 } else { | 3576 } else { |
3601 CFX_WideString wsTextData; | 3577 CFX_WideString wsTextData; |
3602 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3578 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
3603 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3579 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
3604 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 3580 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
3605 pXMLElement->GetTextData(wsTextData); | 3581 pXMLElement->GetTextData(wsTextData); |
3606 } | 3582 } |
3607 FXJSE_Value_SetUTF8String( | 3583 FXJSE_Value_SetUTF8String( |
3608 hValue, | 3584 hValue, |
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5342 } else { | 5318 } else { |
5343 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"item"); | 5319 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"item"); |
5344 } | 5320 } |
5345 } | 5321 } |
5346 void CXFA_NodeList::Script_TreelistClass_NamedItem( | 5322 void CXFA_NodeList::Script_TreelistClass_NamedItem( |
5347 CFXJSE_Arguments* pArguments) { | 5323 CFXJSE_Arguments* pArguments) { |
5348 int32_t argc = pArguments->GetLength(); | 5324 int32_t argc = pArguments->GetLength(); |
5349 if (argc == 1) { | 5325 if (argc == 1) { |
5350 CFX_ByteString szName = pArguments->GetUTF8String(0); | 5326 CFX_ByteString szName = pArguments->GetUTF8String(0); |
5351 CXFA_Node* pNode = NamedItem( | 5327 CXFA_Node* pNode = NamedItem( |
5352 CFX_WideString::FromUTF8(szName, szName.GetLength()).AsWideStringC()); | 5328 CFX_WideString::FromUTF8(szName.AsByteStringC()).AsWideStringC()); |
5353 if (!pNode) { | 5329 if (!pNode) { |
5354 return; | 5330 return; |
5355 } | 5331 } |
5356 FXJSE_Value_Set(pArguments->GetReturnValue(), | 5332 FXJSE_Value_Set(pArguments->GetReturnValue(), |
5357 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); | 5333 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); |
5358 } else { | 5334 } else { |
5359 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"namedItem"); | 5335 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"namedItem"); |
5360 } | 5336 } |
5361 } | 5337 } |
5362 void CXFA_NodeList::Script_ListClass_Length(FXJSE_HVALUE hValue, | 5338 void CXFA_NodeList::Script_ListClass_Length(FXJSE_HVALUE hValue, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5439 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5415 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
5440 } | 5416 } |
5441 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5417 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
5442 return m_pAttachNode->RemoveChild(pNode); | 5418 return m_pAttachNode->RemoveChild(pNode); |
5443 } | 5419 } |
5444 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5420 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
5445 return m_pAttachNode->GetChild( | 5421 return m_pAttachNode->GetChild( |
5446 iIndex, XFA_ELEMENT_UNKNOWN, | 5422 iIndex, XFA_ELEMENT_UNKNOWN, |
5447 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); | 5423 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); |
5448 } | 5424 } |
OLD | NEW |