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