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

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

Issue 1862123003: Rename both As{Byte,Wide}StringC() helpers to AsStringC(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, fix new usage. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_localevalue.cpp ('k') | xfa/fxfa/parser/xfa_parser_imp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/parser/xfa_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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 ASSERT(FALSE); 50 ASSERT(FALSE);
51 return (XFA_ELEMENT)0; 51 return (XFA_ELEMENT)0;
52 } 52 }
53 void CXFA_Object::Script_ObjectClass_ClassName(FXJSE_HVALUE hValue, 53 void CXFA_Object::Script_ObjectClass_ClassName(FXJSE_HVALUE hValue,
54 FX_BOOL bSetting, 54 FX_BOOL bSetting,
55 XFA_ATTRIBUTE eAttribute) { 55 XFA_ATTRIBUTE eAttribute) {
56 if (!bSetting) { 56 if (!bSetting) {
57 CFX_WideStringC className; 57 CFX_WideStringC className;
58 GetClassName(className); 58 GetClassName(className);
59 FXJSE_Value_SetUTF8String( 59 FXJSE_Value_SetUTF8String(
60 hValue, FX_UTF8Encode(className.c_str(), className.GetLength()) 60 hValue,
61 .AsByteStringC()); 61 FX_UTF8Encode(className.c_str(), className.GetLength()).AsStringC());
62 } else { 62 } else {
63 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 63 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
64 } 64 }
65 } 65 }
66 void CXFA_Object::ThrowScriptErrorMessage(int32_t iStringID, ...) { 66 void CXFA_Object::ThrowScriptErrorMessage(int32_t iStringID, ...) {
67 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); 67 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider();
68 FXSYS_assert(pAppProvider); 68 FXSYS_assert(pAppProvider);
69 CFX_WideString wsFormat; 69 CFX_WideString wsFormat;
70 pAppProvider->LoadString(iStringID, wsFormat); 70 pAppProvider->LoadString(iStringID, wsFormat);
71 CFX_WideString wsMessage; 71 CFX_WideString wsMessage;
72 va_list arg_ptr; 72 va_list arg_ptr;
73 va_start(arg_ptr, iStringID); 73 va_start(arg_ptr, iStringID);
74 wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr); 74 wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr);
75 va_end(arg_ptr); 75 va_end(arg_ptr);
76 FXJSE_ThrowMessage( 76 FXJSE_ThrowMessage(
77 "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsByteStringC()); 77 "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsStringC());
78 } 78 }
79 79
80 static void XFA_DeleteWideString(void* pData) { 80 static void XFA_DeleteWideString(void* pData) {
81 delete static_cast<CFX_WideString*>(pData); 81 delete static_cast<CFX_WideString*>(pData);
82 } 82 }
83 83
84 static void XFA_CopyWideString(void*& pData) { 84 static void XFA_CopyWideString(void*& pData) {
85 if (pData) { 85 if (pData) {
86 CFX_WideString* pNewData = new CFX_WideString(*(CFX_WideString*)pData); 86 CFX_WideString* pNewData = new CFX_WideString(*(CFX_WideString*)pData);
87 pData = pNewData; 87 pData = pNewData;
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 FXSYS_assert(m_ePacket == XFA_XDPPACKET_Datasets); 627 FXSYS_assert(m_ePacket == XFA_XDPPACKET_Datasets);
628 m_pAuxNode = pDataDescriptionNode; 628 m_pAuxNode = pDataDescriptionNode;
629 } 629 }
630 void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { 630 void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) {
631 int32_t iLength = pArguments->GetLength(); 631 int32_t iLength = pArguments->GetLength();
632 if (iLength != 1) { 632 if (iLength != 1) {
633 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resolveNode"); 633 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resolveNode");
634 return; 634 return;
635 } 635 }
636 CFX_WideString wsExpression = 636 CFX_WideString wsExpression =
637 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsByteStringC()); 637 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
638 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 638 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
639 if (!pScriptContext) { 639 if (!pScriptContext) {
640 return; 640 return;
641 } 641 }
642 CXFA_Node* refNode = this; 642 CXFA_Node* refNode = this;
643 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { 643 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) {
644 refNode = ToNode(pScriptContext->GetThisObject()); 644 refNode = ToNode(pScriptContext->GetThisObject());
645 } 645 }
646 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | 646 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes |
647 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | 647 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
648 XFA_RESOLVENODE_Siblings; 648 XFA_RESOLVENODE_Siblings;
649 XFA_RESOLVENODE_RS resoveNodeRS; 649 XFA_RESOLVENODE_RS resoveNodeRS;
650 int32_t iRet = pScriptContext->ResolveObjects( 650 int32_t iRet = pScriptContext->ResolveObjects(
651 refNode, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag); 651 refNode, wsExpression.AsStringC(), resoveNodeRS, dwFlag);
652 if (iRet < 1) { 652 if (iRet < 1) {
653 return FXJSE_Value_SetNull(pArguments->GetReturnValue()); 653 return FXJSE_Value_SetNull(pArguments->GetReturnValue());
654 } 654 }
655 FXJSE_HVALUE hValue = NULL; 655 FXJSE_HVALUE hValue = NULL;
656 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { 656 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
657 CXFA_Object* pNode = resoveNodeRS.nodes[0]; 657 CXFA_Object* pNode = resoveNodeRS.nodes[0];
658 hValue = pScriptContext->GetJSValueFromMap(pNode); 658 hValue = pScriptContext->GetJSValueFromMap(pNode);
659 FXJSE_Value_Set(pArguments->GetReturnValue(), hValue); 659 FXJSE_Value_Set(pArguments->GetReturnValue(), hValue);
660 } else { 660 } else {
661 const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = 661 const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo =
(...skipping 10 matching lines...) Expand all
672 } 672 }
673 } 673 }
674 void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) { 674 void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) {
675 int32_t iLength = pArguments->GetLength(); 675 int32_t iLength = pArguments->GetLength();
676 if (iLength != 1) { 676 if (iLength != 1) {
677 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 677 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
678 L"resolveNodes"); 678 L"resolveNodes");
679 return; 679 return;
680 } 680 }
681 CFX_WideString wsExpression = 681 CFX_WideString wsExpression =
682 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsByteStringC()); 682 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
683 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 683 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
684 if (!hValue) { 684 if (!hValue) {
685 return; 685 return;
686 } 686 }
687 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | 687 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes |
688 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | 688 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
689 XFA_RESOLVENODE_Siblings; 689 XFA_RESOLVENODE_Siblings;
690 CXFA_Node* refNode = this; 690 CXFA_Node* refNode = this;
691 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { 691 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) {
692 refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject()); 692 refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject());
693 } 693 }
694 Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag, refNode); 694 Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag, refNode);
695 } 695 }
696 void CXFA_Node::Script_Som_ResolveNodeList(FXJSE_HVALUE hValue, 696 void CXFA_Node::Script_Som_ResolveNodeList(FXJSE_HVALUE hValue,
697 CFX_WideString wsExpression, 697 CFX_WideString wsExpression,
698 uint32_t dwFlag, 698 uint32_t dwFlag,
699 CXFA_Node* refNode) { 699 CXFA_Node* refNode) {
700 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 700 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
701 if (!pScriptContext) { 701 if (!pScriptContext) {
702 return; 702 return;
703 } 703 }
704 XFA_RESOLVENODE_RS resoveNodeRS; 704 XFA_RESOLVENODE_RS resoveNodeRS;
705 if (refNode == NULL) { 705 if (refNode == NULL) {
706 refNode = this; 706 refNode = this;
707 } 707 }
708 pScriptContext->ResolveObjects(refNode, wsExpression.AsWideStringC(), 708 pScriptContext->ResolveObjects(refNode, wsExpression.AsStringC(),
709 resoveNodeRS, dwFlag); 709 resoveNodeRS, dwFlag);
710 CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument); 710 CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument);
711 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { 711 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
712 for (int32_t i = 0; i < resoveNodeRS.nodes.GetSize(); i++) { 712 for (int32_t i = 0; i < resoveNodeRS.nodes.GetSize(); i++) {
713 if (resoveNodeRS.nodes[i]->IsNode()) 713 if (resoveNodeRS.nodes[i]->IsNode())
714 pNodeList->Append(resoveNodeRS.nodes[i]->AsNode()); 714 pNodeList->Append(resoveNodeRS.nodes[i]->AsNode());
715 } 715 }
716 } else { 716 } else {
717 CXFA_HVALUEArray hValueArray(pScriptContext->GetRuntime()); 717 CXFA_HVALUEArray hValueArray(pScriptContext->GetRuntime());
718 if (resoveNodeRS.GetAttributeResult(hValueArray) > 0) { 718 if (resoveNodeRS.GetAttributeResult(hValueArray) > 0) {
(...skipping 27 matching lines...) Expand all
746 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 746 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
747 if (!pScriptContext) { 747 if (!pScriptContext) {
748 return; 748 return;
749 } 749 }
750 if (bSetting) { 750 if (bSetting) {
751 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); 751 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider();
752 FXSYS_assert(pAppProvider); 752 FXSYS_assert(pAppProvider);
753 CFX_WideString wsMessage; 753 CFX_WideString wsMessage;
754 pAppProvider->LoadString(XFA_IDS_Unable_TO_SET, wsMessage); 754 pAppProvider->LoadString(XFA_IDS_Unable_TO_SET, wsMessage);
755 FXJSE_ThrowMessage( 755 FXJSE_ThrowMessage(
756 "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsByteStringC()); 756 "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsStringC());
757 } else { 757 } else {
758 CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this); 758 CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this);
759 FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList, 759 FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList,
760 pScriptContext->GetJseNormalClass()); 760 pScriptContext->GetJseNormalClass());
761 } 761 }
762 } 762 }
763 void CXFA_Node::Script_TreeClass_ClassAll(FXJSE_HVALUE hValue, 763 void CXFA_Node::Script_TreeClass_ClassAll(FXJSE_HVALUE hValue,
764 FX_BOOL bSetting, 764 FX_BOOL bSetting,
765 XFA_ATTRIBUTE eAttribute) { 765 XFA_ATTRIBUTE eAttribute) {
766 if (bSetting) { 766 if (bSetting) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 } 808 }
809 void CXFA_Node::Script_TreeClass_SomExpression(FXJSE_HVALUE hValue, 809 void CXFA_Node::Script_TreeClass_SomExpression(FXJSE_HVALUE hValue,
810 FX_BOOL bSetting, 810 FX_BOOL bSetting,
811 XFA_ATTRIBUTE eAttribute) { 811 XFA_ATTRIBUTE eAttribute) {
812 if (bSetting) { 812 if (bSetting) {
813 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 813 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
814 } else { 814 } else {
815 CFX_WideString wsSOMExpression; 815 CFX_WideString wsSOMExpression;
816 GetSOMExpression(wsSOMExpression); 816 GetSOMExpression(wsSOMExpression);
817 FXJSE_Value_SetUTF8String(hValue, 817 FXJSE_Value_SetUTF8String(hValue,
818 FX_UTF8Encode(wsSOMExpression).AsByteStringC()); 818 FX_UTF8Encode(wsSOMExpression).AsStringC());
819 } 819 }
820 } 820 }
821 void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) { 821 void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) {
822 int32_t iLength = pArguments->GetLength(); 822 int32_t iLength = pArguments->GetLength();
823 if (iLength != 1) { 823 if (iLength != 1) {
824 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"applyXSL"); 824 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"applyXSL");
825 return; 825 return;
826 } 826 }
827 CFX_WideString wsExpression = 827 CFX_WideString wsExpression =
828 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsByteStringC()); 828 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
829 // TODO(tsepez): actually do something here? 829 // TODO(tsepez): actually do something here?
830 } 830 }
831 void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) { 831 void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) {
832 int32_t iLength = pArguments->GetLength(); 832 int32_t iLength = pArguments->GetLength();
833 if (iLength < 1 || iLength > 3) { 833 if (iLength < 1 || iLength > 3) {
834 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"assignNode"); 834 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"assignNode");
835 return; 835 return;
836 } 836 }
837 CFX_WideString wsExpression; 837 CFX_WideString wsExpression;
838 CFX_WideString wsValue; 838 CFX_WideString wsValue;
839 int32_t iAction = 0; 839 int32_t iAction = 0;
840 if (iLength >= 1) { 840 if (iLength >= 1) {
841 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 841 CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
842 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsByteStringC()); 842 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC());
843 } 843 }
844 if (iLength >= 2) { 844 if (iLength >= 2) {
845 CFX_ByteString bsValue = pArguments->GetUTF8String(1); 845 CFX_ByteString bsValue = pArguments->GetUTF8String(1);
846 wsValue = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); 846 wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC());
847 } 847 }
848 if (iLength >= 3) { 848 if (iLength >= 3) {
849 iAction = pArguments->GetInt32(2); 849 iAction = pArguments->GetInt32(2);
850 } 850 }
851 } 851 }
852 void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) { 852 void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) {
853 int32_t iLength = pArguments->GetLength(); 853 int32_t iLength = pArguments->GetLength();
854 if (iLength != 1) { 854 if (iLength != 1) {
855 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clone"); 855 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clone");
856 return; 856 return;
857 } 857 }
858 FX_BOOL bClone = TRUE; 858 FX_BOOL bClone = TRUE;
859 bClone = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; 859 bClone = pArguments->GetInt32(0) == 0 ? FALSE : TRUE;
860 CXFA_Node* pCloneNode = Clone(bClone); 860 CXFA_Node* pCloneNode = Clone(bClone);
861 FXJSE_Value_Set( 861 FXJSE_Value_Set(
862 pArguments->GetReturnValue(), 862 pArguments->GetReturnValue(),
863 m_pDocument->GetScriptContext()->GetJSValueFromMap(pCloneNode)); 863 m_pDocument->GetScriptContext()->GetJSValueFromMap(pCloneNode));
864 } 864 }
865 void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) { 865 void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) {
866 int32_t iLength = pArguments->GetLength(); 866 int32_t iLength = pArguments->GetLength();
867 if (iLength != 1) { 867 if (iLength != 1) {
868 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 868 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
869 L"getAttribute"); 869 L"getAttribute");
870 return; 870 return;
871 } 871 }
872 CFX_WideString wsExpression = 872 CFX_WideString wsExpression =
873 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsByteStringC()); 873 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
874 CFX_WideString wsValue; 874 CFX_WideString wsValue;
875 GetAttribute(wsExpression.AsWideStringC(), wsValue); 875 GetAttribute(wsExpression.AsStringC(), wsValue);
876 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 876 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
877 if (hValue) { 877 if (hValue) {
878 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); 878 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsStringC());
879 } 879 }
880 } 880 }
881 void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { 881 void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) {
882 int32_t iLength = pArguments->GetLength(); 882 int32_t iLength = pArguments->GetLength();
883 if (iLength < 1 || iLength > 2) { 883 if (iLength < 1 || iLength > 2) {
884 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getElement"); 884 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getElement");
885 return; 885 return;
886 } 886 }
887 CFX_WideString wsExpression; 887 CFX_WideString wsExpression;
888 int32_t iValue = 0; 888 int32_t iValue = 0;
889 if (iLength >= 1) { 889 if (iLength >= 1) {
890 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 890 CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
891 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsByteStringC()); 891 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC());
892 } 892 }
893 if (iLength >= 2) { 893 if (iLength >= 2) {
894 iValue = pArguments->GetInt32(1); 894 iValue = pArguments->GetInt32(1);
895 } 895 }
896 const XFA_ELEMENTINFO* pElementInfo = 896 const XFA_ELEMENTINFO* pElementInfo =
897 XFA_GetElementByName(wsExpression.AsWideStringC()); 897 XFA_GetElementByName(wsExpression.AsStringC());
898 CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName); 898 CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName);
899 FXJSE_Value_Set(pArguments->GetReturnValue(), 899 FXJSE_Value_Set(pArguments->GetReturnValue(),
900 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); 900 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode));
901 } 901 }
902 void CXFA_Node::Script_NodeClass_IsPropertySpecified( 902 void CXFA_Node::Script_NodeClass_IsPropertySpecified(
903 CFXJSE_Arguments* pArguments) { 903 CFXJSE_Arguments* pArguments) {
904 int32_t iLength = pArguments->GetLength(); 904 int32_t iLength = pArguments->GetLength();
905 if (iLength < 1 || iLength > 3) { 905 if (iLength < 1 || iLength > 3) {
906 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 906 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
907 L"isPropertySpecified"); 907 L"isPropertySpecified");
908 return; 908 return;
909 } 909 }
910 CFX_WideString wsExpression; 910 CFX_WideString wsExpression;
911 FX_BOOL bParent = TRUE; 911 FX_BOOL bParent = TRUE;
912 int32_t iIndex = 0; 912 int32_t iIndex = 0;
913 if (iLength >= 1) { 913 if (iLength >= 1) {
914 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 914 CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
915 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsByteStringC()); 915 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC());
916 } 916 }
917 if (iLength >= 2) { 917 if (iLength >= 2) {
918 bParent = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; 918 bParent = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;
919 } 919 }
920 if (iLength >= 3) { 920 if (iLength >= 3) {
921 iIndex = pArguments->GetInt32(2); 921 iIndex = pArguments->GetInt32(2);
922 } 922 }
923 FX_BOOL bHas = FALSE; 923 FX_BOOL bHas = FALSE;
924 const XFA_ATTRIBUTEINFO* pAttributeInfo = 924 const XFA_ATTRIBUTEINFO* pAttributeInfo =
925 XFA_GetAttributeByName(wsExpression.AsWideStringC()); 925 XFA_GetAttributeByName(wsExpression.AsStringC());
926 CFX_WideString wsValue; 926 CFX_WideString wsValue;
927 if (pAttributeInfo) { 927 if (pAttributeInfo) {
928 bHas = HasAttribute(pAttributeInfo->eName); 928 bHas = HasAttribute(pAttributeInfo->eName);
929 } 929 }
930 if (!bHas) { 930 if (!bHas) {
931 const XFA_ELEMENTINFO* pElementInfo = 931 const XFA_ELEMENTINFO* pElementInfo =
932 XFA_GetElementByName(wsExpression.AsWideStringC()); 932 XFA_GetElementByName(wsExpression.AsStringC());
933 bHas = (GetProperty(iIndex, pElementInfo->eName) != NULL); 933 bHas = (GetProperty(iIndex, pElementInfo->eName) != NULL);
934 } 934 }
935 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 935 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
936 if (hValue) { 936 if (hValue) {
937 FXJSE_Value_SetBoolean(hValue, bHas); 937 FXJSE_Value_SetBoolean(hValue, bHas);
938 } 938 }
939 } 939 }
940 void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { 940 void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
941 int32_t iLength = pArguments->GetLength(); 941 int32_t iLength = pArguments->GetLength();
942 if (iLength < 1 || iLength > 3) { 942 if (iLength < 1 || iLength > 3) {
943 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"loadXML"); 943 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"loadXML");
944 return; 944 return;
945 } 945 }
946 CFX_WideString wsExpression; 946 CFX_WideString wsExpression;
947 FX_BOOL bIgnoreRoot = TRUE; 947 FX_BOOL bIgnoreRoot = TRUE;
948 FX_BOOL bOverwrite = 0; 948 FX_BOOL bOverwrite = 0;
949 if (iLength >= 1) { 949 if (iLength >= 1) {
950 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 950 CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
951 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsByteStringC()); 951 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC());
952 if (wsExpression.IsEmpty()) { 952 if (wsExpression.IsEmpty()) {
953 return; 953 return;
954 } 954 }
955 } 955 }
956 if (iLength >= 2) { 956 if (iLength >= 2) {
957 bIgnoreRoot = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; 957 bIgnoreRoot = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;
958 } 958 }
959 if (iLength >= 3) { 959 if (iLength >= 3) {
960 bOverwrite = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; 960 bOverwrite = pArguments->GetInt32(2) == 0 ? FALSE : TRUE;
961 } 961 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 } 1138 }
1139 1139
1140 void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) { 1140 void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) {
1141 int32_t iLength = pArguments->GetLength(); 1141 int32_t iLength = pArguments->GetLength();
1142 if (iLength != 2) { 1142 if (iLength != 2) {
1143 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 1143 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
1144 L"setAttribute"); 1144 L"setAttribute");
1145 return; 1145 return;
1146 } 1146 }
1147 CFX_WideString wsAttributeValue = 1147 CFX_WideString wsAttributeValue =
1148 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsByteStringC()); 1148 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
1149 CFX_WideString wsAttribute = 1149 CFX_WideString wsAttribute =
1150 CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsByteStringC()); 1150 CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
1151 SetAttribute(wsAttribute.AsWideStringC(), wsAttributeValue.AsWideStringC(), 1151 SetAttribute(wsAttribute.AsStringC(), wsAttributeValue.AsStringC(), TRUE);
1152 TRUE);
1153 } 1152 }
1154 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { 1153 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) {
1155 int32_t iLength = pArguments->GetLength(); 1154 int32_t iLength = pArguments->GetLength();
1156 if (iLength != 1 && iLength != 2) { 1155 if (iLength != 1 && iLength != 2) {
1157 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement"); 1156 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement");
1158 return; 1157 return;
1159 } 1158 }
1160 CXFA_Node* pNode = NULL; 1159 CXFA_Node* pNode = NULL;
1161 CFX_WideString wsName; 1160 CFX_WideString wsName;
1162 if (iLength >= 1) { 1161 if (iLength >= 1) {
1163 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); 1162 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
1164 } 1163 }
1165 if (iLength >= 2) { 1164 if (iLength >= 2) {
1166 CFX_ByteString bsName = pArguments->GetUTF8String(1); 1165 CFX_ByteString bsName = pArguments->GetUTF8String(1);
1167 wsName = CFX_WideString::FromUTF8(bsName.AsByteStringC()); 1166 wsName = CFX_WideString::FromUTF8(bsName.AsStringC());
1168 } 1167 }
1169 } 1168 }
1170 void CXFA_Node::Script_NodeClass_Ns(FXJSE_HVALUE hValue, 1169 void CXFA_Node::Script_NodeClass_Ns(FXJSE_HVALUE hValue,
1171 FX_BOOL bSetting, 1170 FX_BOOL bSetting,
1172 XFA_ATTRIBUTE eAttribute) { 1171 XFA_ATTRIBUTE eAttribute) {
1173 if (bSetting) { 1172 if (bSetting) {
1174 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1173 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
1175 } else { 1174 } else {
1176 CFX_WideString wsNameSpace; 1175 CFX_WideString wsNameSpace;
1177 TryNamespace(wsNameSpace); 1176 TryNamespace(wsNameSpace);
1178 FXJSE_Value_SetUTF8String(hValue, 1177 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsNameSpace).AsStringC());
1179 FX_UTF8Encode(wsNameSpace).AsByteStringC());
1180 } 1178 }
1181 } 1179 }
1182 void CXFA_Node::Script_NodeClass_Model(FXJSE_HVALUE hValue, 1180 void CXFA_Node::Script_NodeClass_Model(FXJSE_HVALUE hValue,
1183 FX_BOOL bSetting, 1181 FX_BOOL bSetting,
1184 XFA_ATTRIBUTE eAttribute) { 1182 XFA_ATTRIBUTE eAttribute) {
1185 if (bSetting) { 1183 if (bSetting) {
1186 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1184 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
1187 } else { 1185 } else {
1188 FXJSE_Value_Set(hValue, m_pDocument->GetScriptContext()->GetJSValueFromMap( 1186 FXJSE_Value_Set(hValue, m_pDocument->GetScriptContext()->GetJSValueFromMap(
1189 GetModelNode())); 1187 GetModelNode()));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 void CXFA_Node::Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments) { 1239 void CXFA_Node::Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments) {
1242 int32_t iLength = pArguments->GetLength(); 1240 int32_t iLength = pArguments->GetLength();
1243 if (iLength < 1) { 1241 if (iLength < 1) {
1244 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 1242 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
1245 L"isCompatibleNS"); 1243 L"isCompatibleNS");
1246 return; 1244 return;
1247 } 1245 }
1248 CFX_WideString wsNameSpace; 1246 CFX_WideString wsNameSpace;
1249 if (iLength >= 1) { 1247 if (iLength >= 1) {
1250 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(0); 1248 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(0);
1251 wsNameSpace = CFX_WideString::FromUTF8(bsNameSpace.AsByteStringC()); 1249 wsNameSpace = CFX_WideString::FromUTF8(bsNameSpace.AsStringC());
1252 } 1250 }
1253 CFX_WideString wsNodeNameSpace; 1251 CFX_WideString wsNodeNameSpace;
1254 TryNamespace(wsNodeNameSpace); 1252 TryNamespace(wsNodeNameSpace);
1255 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 1253 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
1256 if (hValue) { 1254 if (hValue) {
1257 FXJSE_Value_SetBoolean(hValue, wsNodeNameSpace == wsNameSpace); 1255 FXJSE_Value_SetBoolean(hValue, wsNodeNameSpace == wsNameSpace);
1258 } 1256 }
1259 } 1257 }
1260 void CXFA_Node::Script_ModelClass_Context(FXJSE_HVALUE hValue, 1258 void CXFA_Node::Script_ModelClass_Context(FXJSE_HVALUE hValue,
1261 FX_BOOL bSetting, 1259 FX_BOOL bSetting,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, eValue, 1462 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, eValue,
1465 this, this); 1463 this, this);
1466 } 1464 }
1467 } 1465 }
1468 void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, 1466 void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue,
1469 FX_BOOL bSetting, 1467 FX_BOOL bSetting,
1470 XFA_ATTRIBUTE eAttribute) { 1468 XFA_ATTRIBUTE eAttribute) {
1471 if (bSetting) { 1469 if (bSetting) {
1472 CFX_ByteString szValue; 1470 CFX_ByteString szValue;
1473 FXJSE_Value_ToUTF8String(hValue, szValue); 1471 FXJSE_Value_ToUTF8String(hValue, szValue);
1474 CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsByteStringC()); 1472 CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC());
1475 SetAttribute(eAttribute, wsValue.AsWideStringC(), TRUE); 1473 SetAttribute(eAttribute, wsValue.AsStringC(), TRUE);
1476 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) { 1474 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) {
1477 CFX_WideString wsUseVal = wsValue, wsID, wsSOM; 1475 CFX_WideString wsUseVal = wsValue, wsID, wsSOM;
1478 CXFA_Node* pTemplateNode = 1476 CXFA_Node* pTemplateNode =
1479 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); 1477 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template));
1480 CXFA_Node* pProtoRoot = 1478 CXFA_Node* pProtoRoot =
1481 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform) 1479 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform)
1482 ->GetFirstChildByClass(XFA_ELEMENT_Proto); 1480 ->GetFirstChildByClass(XFA_ELEMENT_Proto);
1483 if (!wsUseVal.IsEmpty()) { 1481 if (!wsUseVal.IsEmpty()) {
1484 if (wsUseVal[0] == '#') { 1482 if (wsUseVal[0] == '#') {
1485 wsID = CFX_WideString((const FX_WCHAR*)wsUseVal + 1, 1483 wsID = CFX_WideString((const FX_WCHAR*)wsUseVal + 1,
1486 wsUseVal.GetLength() - 1); 1484 wsUseVal.GetLength() - 1);
1487 } else { 1485 } else {
1488 wsSOM = 1486 wsSOM =
1489 CFX_WideString((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength()); 1487 CFX_WideString((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength());
1490 } 1488 }
1491 } 1489 }
1492 CXFA_Node* pProtoNode = NULL; 1490 CXFA_Node* pProtoNode = NULL;
1493 if (!wsSOM.IsEmpty()) { 1491 if (!wsSOM.IsEmpty()) {
1494 uint32_t dwFlag = XFA_RESOLVENODE_Children | 1492 uint32_t dwFlag = XFA_RESOLVENODE_Children |
1495 XFA_RESOLVENODE_Attributes | 1493 XFA_RESOLVENODE_Attributes |
1496 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | 1494 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
1497 XFA_RESOLVENODE_Siblings; 1495 XFA_RESOLVENODE_Siblings;
1498 XFA_RESOLVENODE_RS resoveNodeRS; 1496 XFA_RESOLVENODE_RS resoveNodeRS;
1499 int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects( 1497 int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects(
1500 pProtoRoot, wsSOM.AsWideStringC(), resoveNodeRS, dwFlag); 1498 pProtoRoot, wsSOM.AsStringC(), resoveNodeRS, dwFlag);
1501 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { 1499 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) {
1502 pProtoNode = resoveNodeRS.nodes[0]->AsNode(); 1500 pProtoNode = resoveNodeRS.nodes[0]->AsNode();
1503 } 1501 }
1504 } else if (!wsID.IsEmpty()) { 1502 } else if (!wsID.IsEmpty()) {
1505 pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID.AsWideStringC()); 1503 pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID.AsStringC());
1506 } 1504 }
1507 if (pProtoNode) { 1505 if (pProtoNode) {
1508 CXFA_Node* pHeadChild = GetNodeItem(XFA_NODEITEM_FirstChild); 1506 CXFA_Node* pHeadChild = GetNodeItem(XFA_NODEITEM_FirstChild);
1509 while (pHeadChild) { 1507 while (pHeadChild) {
1510 CXFA_Node* pSibling = 1508 CXFA_Node* pSibling =
1511 pHeadChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1509 pHeadChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1512 RemoveChild(pHeadChild); 1510 RemoveChild(pHeadChild);
1513 pHeadChild = pSibling; 1511 pHeadChild = pSibling;
1514 } 1512 }
1515 CXFA_Node* pProtoForm = pProtoNode->CloneTemplateToForm(TRUE); 1513 CXFA_Node* pProtoForm = pProtoNode->CloneTemplateToForm(TRUE);
1516 pHeadChild = pProtoForm->GetNodeItem(XFA_NODEITEM_FirstChild); 1514 pHeadChild = pProtoForm->GetNodeItem(XFA_NODEITEM_FirstChild);
1517 while (pHeadChild) { 1515 while (pHeadChild) {
1518 CXFA_Node* pSibling = 1516 CXFA_Node* pSibling =
1519 pHeadChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1517 pHeadChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1520 pProtoForm->RemoveChild(pHeadChild); 1518 pProtoForm->RemoveChild(pHeadChild);
1521 InsertChild(pHeadChild); 1519 InsertChild(pHeadChild);
1522 pHeadChild = pSibling; 1520 pHeadChild = pSibling;
1523 } 1521 }
1524 m_pDocument->RemovePurgeNode(pProtoForm); 1522 m_pDocument->RemovePurgeNode(pProtoForm);
1525 delete pProtoForm; 1523 delete pProtoForm;
1526 } 1524 }
1527 } 1525 }
1528 } else { 1526 } else {
1529 CFX_WideString wsValue; 1527 CFX_WideString wsValue;
1530 GetAttribute(eAttribute, wsValue); 1528 GetAttribute(eAttribute, wsValue);
1531 FXJSE_Value_SetUTF8String( 1529 FXJSE_Value_SetUTF8String(
1532 hValue, FX_UTF8Encode(wsValue, wsValue.GetLength()).AsByteStringC()); 1530 hValue, FX_UTF8Encode(wsValue, wsValue.GetLength()).AsStringC());
1533 } 1531 }
1534 } 1532 }
1535 void CXFA_Node::Script_Attribute_StringRead(FXJSE_HVALUE hValue, 1533 void CXFA_Node::Script_Attribute_StringRead(FXJSE_HVALUE hValue,
1536 FX_BOOL bSetting, 1534 FX_BOOL bSetting,
1537 XFA_ATTRIBUTE eAttribute) { 1535 XFA_ATTRIBUTE eAttribute) {
1538 if (!bSetting) { 1536 if (!bSetting) {
1539 CFX_WideString wsValue; 1537 CFX_WideString wsValue;
1540 GetAttribute(eAttribute, wsValue); 1538 GetAttribute(eAttribute, wsValue);
1541 FXJSE_Value_SetUTF8String( 1539 FXJSE_Value_SetUTF8String(
1542 hValue, FX_UTF8Encode(wsValue, wsValue.GetLength()).AsByteStringC()); 1540 hValue, FX_UTF8Encode(wsValue, wsValue.GetLength()).AsStringC());
1543 } else { 1541 } else {
1544 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1542 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
1545 } 1543 }
1546 } 1544 }
1547 void CXFA_Node::Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments) { 1545 void CXFA_Node::Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments) {
1548 int32_t argc = pArguments->GetLength(); 1546 int32_t argc = pArguments->GetLength();
1549 if ((argc == 0) || (argc == 1)) { 1547 if ((argc == 0) || (argc == 1)) {
1550 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); 1548 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE);
1551 } else { 1549 } else {
1552 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execute"); 1550 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execute");
(...skipping 27 matching lines...) Expand all
1580 if (!validate) { 1578 if (!validate) {
1581 validate = pWidgetData->GetValidate(TRUE); 1579 validate = pWidgetData->GetValidate(TRUE);
1582 bNew = TRUE; 1580 bNew = TRUE;
1583 } 1581 }
1584 if (bSetting) { 1582 if (bSetting) {
1585 CFX_ByteString bsMessage; 1583 CFX_ByteString bsMessage;
1586 FXJSE_Value_ToUTF8String(hValue, bsMessage); 1584 FXJSE_Value_ToUTF8String(hValue, bsMessage);
1587 switch (iMessageType) { 1585 switch (iMessageType) {
1588 case XFA_SOM_ValidationMessage: 1586 case XFA_SOM_ValidationMessage:
1589 validate.SetScriptMessageText( 1587 validate.SetScriptMessageText(
1590 CFX_WideString::FromUTF8(bsMessage.AsByteStringC())); 1588 CFX_WideString::FromUTF8(bsMessage.AsStringC()));
1591 break; 1589 break;
1592 case XFA_SOM_FormatMessage: 1590 case XFA_SOM_FormatMessage:
1593 validate.SetFormatMessageText( 1591 validate.SetFormatMessageText(
1594 CFX_WideString::FromUTF8(bsMessage.AsByteStringC())); 1592 CFX_WideString::FromUTF8(bsMessage.AsStringC()));
1595 break; 1593 break;
1596 case XFA_SOM_MandatoryMessage: 1594 case XFA_SOM_MandatoryMessage:
1597 validate.SetNullMessageText( 1595 validate.SetNullMessageText(
1598 CFX_WideString::FromUTF8(bsMessage.AsByteStringC())); 1596 CFX_WideString::FromUTF8(bsMessage.AsStringC()));
1599 break; 1597 break;
1600 default: 1598 default:
1601 break; 1599 break;
1602 } 1600 }
1603 if (!bNew) { 1601 if (!bNew) {
1604 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 1602 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
1605 if (!pNotify) { 1603 if (!pNotify) {
1606 return; 1604 return;
1607 } 1605 }
1608 pNotify->AddCalcValidate(this); 1606 pNotify->AddCalcValidate(this);
1609 } 1607 }
1610 } else { 1608 } else {
1611 CFX_WideString wsMessage; 1609 CFX_WideString wsMessage;
1612 switch (iMessageType) { 1610 switch (iMessageType) {
1613 case XFA_SOM_ValidationMessage: 1611 case XFA_SOM_ValidationMessage:
1614 validate.GetScriptMessageText(wsMessage); 1612 validate.GetScriptMessageText(wsMessage);
1615 break; 1613 break;
1616 case XFA_SOM_FormatMessage: 1614 case XFA_SOM_FormatMessage:
1617 validate.GetFormatMessageText(wsMessage); 1615 validate.GetFormatMessageText(wsMessage);
1618 break; 1616 break;
1619 case XFA_SOM_MandatoryMessage: 1617 case XFA_SOM_MandatoryMessage:
1620 validate.GetNullMessageText(wsMessage); 1618 validate.GetNullMessageText(wsMessage);
1621 break; 1619 break;
1622 default: 1620 default:
1623 break; 1621 break;
1624 } 1622 }
1625 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsMessage).AsByteStringC()); 1623 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsMessage).AsStringC());
1626 } 1624 }
1627 } 1625 }
1628 void CXFA_Node::Script_Som_ValidationMessage(FXJSE_HVALUE hValue, 1626 void CXFA_Node::Script_Som_ValidationMessage(FXJSE_HVALUE hValue,
1629 FX_BOOL bSetting, 1627 FX_BOOL bSetting,
1630 XFA_ATTRIBUTE eAttribute) { 1628 XFA_ATTRIBUTE eAttribute) {
1631 Script_Som_Message(hValue, bSetting, XFA_SOM_ValidationMessage); 1629 Script_Som_Message(hValue, bSetting, XFA_SOM_ValidationMessage);
1632 } 1630 }
1633 void CXFA_Node::Script_Field_Length(FXJSE_HVALUE hValue, 1631 void CXFA_Node::Script_Field_Length(FXJSE_HVALUE hValue,
1634 FX_BOOL bSetting, 1632 FX_BOOL bSetting,
1635 XFA_ATTRIBUTE eAttribute) { 1633 XFA_ATTRIBUTE eAttribute) {
(...skipping 20 matching lines...) Expand all
1656 return; 1654 return;
1657 } else if (classID == XFA_ELEMENT_Boolean) { 1655 } else if (classID == XFA_ELEMENT_Boolean) {
1658 Script_Boolean_Value(hValue, bSetting, eAttribute); 1656 Script_Boolean_Value(hValue, bSetting, eAttribute);
1659 return; 1657 return;
1660 } 1658 }
1661 if (bSetting) { 1659 if (bSetting) {
1662 CFX_ByteString newValue; 1660 CFX_ByteString newValue;
1663 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { 1661 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) {
1664 FXJSE_Value_ToUTF8String(hValue, newValue); 1662 FXJSE_Value_ToUTF8String(hValue, newValue);
1665 } 1663 }
1666 CFX_WideString wsNewValue = 1664 CFX_WideString wsNewValue = CFX_WideString::FromUTF8(newValue.AsStringC());
1667 CFX_WideString::FromUTF8(newValue.AsByteStringC());
1668 CFX_WideString wsFormatValue(wsNewValue); 1665 CFX_WideString wsFormatValue(wsNewValue);
1669 CXFA_WidgetData* pContainerWidgetData = NULL; 1666 CXFA_WidgetData* pContainerWidgetData = NULL;
1670 if (GetPacketID() == XFA_XDPPACKET_Datasets) { 1667 if (GetPacketID() == XFA_XDPPACKET_Datasets) {
1671 CXFA_NodeArray formNodes; 1668 CXFA_NodeArray formNodes;
1672 GetBindItems(formNodes); 1669 GetBindItems(formNodes);
1673 CFX_WideString wsPicture; 1670 CFX_WideString wsPicture;
1674 for (int32_t i = 0; i < formNodes.GetSize(); i++) { 1671 for (int32_t i = 0; i < formNodes.GetSize(); i++) {
1675 CXFA_Node* pFormNode = formNodes.GetAt(i); 1672 CXFA_Node* pFormNode = formNodes.GetAt(i);
1676 if (!pFormNode || pFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) { 1673 if (!pFormNode || pFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) {
1677 continue; 1674 continue;
1678 } 1675 }
1679 pContainerWidgetData = pFormNode->GetContainerWidgetData(); 1676 pContainerWidgetData = pFormNode->GetContainerWidgetData();
1680 if (pContainerWidgetData) { 1677 if (pContainerWidgetData) {
1681 pContainerWidgetData->GetPictureContent(wsPicture, 1678 pContainerWidgetData->GetPictureContent(wsPicture,
1682 XFA_VALUEPICTURE_DataBind); 1679 XFA_VALUEPICTURE_DataBind);
1683 } 1680 }
1684 if (!wsPicture.IsEmpty()) { 1681 if (!wsPicture.IsEmpty()) {
1685 break; 1682 break;
1686 } 1683 }
1687 pContainerWidgetData = NULL; 1684 pContainerWidgetData = NULL;
1688 } 1685 }
1689 } else if (GetPacketID() == XFA_XDPPACKET_Form) { 1686 } else if (GetPacketID() == XFA_XDPPACKET_Form) {
1690 pContainerWidgetData = GetContainerWidgetData(); 1687 pContainerWidgetData = GetContainerWidgetData();
1691 } 1688 }
1692 if (pContainerWidgetData) { 1689 if (pContainerWidgetData) {
1693 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsWideStringC(), 1690 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsStringC(),
1694 wsFormatValue); 1691 wsFormatValue);
1695 } 1692 }
1696 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); 1693 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
1697 } else { 1694 } else {
1698 CFX_WideString content = GetScriptContent(TRUE); 1695 CFX_WideString content = GetScriptContent(TRUE);
1699 if (content.IsEmpty() && classID != XFA_ELEMENT_Text && 1696 if (content.IsEmpty() && classID != XFA_ELEMENT_Text &&
1700 classID != XFA_ELEMENT_SubmitUrl) { 1697 classID != XFA_ELEMENT_SubmitUrl) {
1701 FXJSE_Value_SetNull(hValue); 1698 FXJSE_Value_SetNull(hValue);
1702 } else if (classID == XFA_ELEMENT_Integer) { 1699 } else if (classID == XFA_ELEMENT_Integer) {
1703 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); 1700 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content));
1704 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { 1701 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) {
1705 CFX_Decimal decimal(content.AsWideStringC()); 1702 CFX_Decimal decimal(content.AsStringC());
1706 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); 1703 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
1707 } else { 1704 } else {
1708 FXJSE_Value_SetUTF8String( 1705 FXJSE_Value_SetUTF8String(
1709 hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); 1706 hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC());
1710 } 1707 }
1711 } 1708 }
1712 } 1709 }
1713 void CXFA_Node::Script_Som_DefaultValue_Read(FXJSE_HVALUE hValue, 1710 void CXFA_Node::Script_Som_DefaultValue_Read(FXJSE_HVALUE hValue,
1714 FX_BOOL bSetting, 1711 FX_BOOL bSetting,
1715 XFA_ATTRIBUTE eAttribute) { 1712 XFA_ATTRIBUTE eAttribute) {
1716 if (bSetting) { 1713 if (bSetting) {
1717 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1714 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
1718 return; 1715 return;
1719 } 1716 }
1720 CFX_WideString content = GetScriptContent(TRUE); 1717 CFX_WideString content = GetScriptContent(TRUE);
1721 if (content.IsEmpty()) { 1718 if (content.IsEmpty()) {
1722 FXJSE_Value_SetNull(hValue); 1719 FXJSE_Value_SetNull(hValue);
1723 } else { 1720 } else {
1724 FXJSE_Value_SetUTF8String( 1721 FXJSE_Value_SetUTF8String(
1725 hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); 1722 hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC());
1726 } 1723 }
1727 } 1724 }
1728 void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, 1725 void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue,
1729 FX_BOOL bSetting, 1726 FX_BOOL bSetting,
1730 XFA_ATTRIBUTE eAttribute) { 1727 XFA_ATTRIBUTE eAttribute) {
1731 if (bSetting) { 1728 if (bSetting) {
1732 CFX_ByteString newValue; 1729 CFX_ByteString newValue;
1733 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { 1730 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) {
1734 FXJSE_Value_ToUTF8String(hValue, newValue); 1731 FXJSE_Value_ToUTF8String(hValue, newValue);
1735 } 1732 }
1736 int32_t iValue = FXSYS_atoi(newValue); 1733 int32_t iValue = FXSYS_atoi(newValue);
1737 CFX_WideString wsNewValue = (iValue == 0) ? FX_WSTRC(L"0") : FX_WSTRC(L"1"); 1734 CFX_WideString wsNewValue = (iValue == 0) ? FX_WSTRC(L"0") : FX_WSTRC(L"1");
1738 CFX_WideString wsFormatValue(wsNewValue); 1735 CFX_WideString wsFormatValue(wsNewValue);
1739 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); 1736 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
1740 if (pContainerWidgetData) { 1737 if (pContainerWidgetData) {
1741 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsWideStringC(), 1738 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsStringC(),
1742 wsFormatValue); 1739 wsFormatValue);
1743 } 1740 }
1744 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); 1741 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
1745 } else { 1742 } else {
1746 CFX_WideString wsValue = GetScriptContent(TRUE); 1743 CFX_WideString wsValue = GetScriptContent(TRUE);
1747 FXJSE_Value_SetBoolean(hValue, wsValue == FX_WSTRC(L"1")); 1744 FXJSE_Value_SetBoolean(hValue, wsValue == FX_WSTRC(L"1"));
1748 } 1745 }
1749 } 1746 }
1750 struct XFA_ExecEventParaInfo { 1747 struct XFA_ExecEventParaInfo {
1751 public: 1748 public:
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 CXFA_WidgetData* pWidgetData = GetWidgetData(); 1839 CXFA_WidgetData* pWidgetData = GetWidgetData();
1843 if (!pWidgetData) { 1840 if (!pWidgetData) {
1844 return; 1841 return;
1845 } 1842 }
1846 CXFA_Border border = pWidgetData->GetBorder(TRUE); 1843 CXFA_Border border = pWidgetData->GetBorder(TRUE);
1847 int32_t iSize = border.CountEdges(); 1844 int32_t iSize = border.CountEdges();
1848 CFX_WideString strColor; 1845 CFX_WideString strColor;
1849 if (bSetting) { 1846 if (bSetting) {
1850 CFX_ByteString bsValue; 1847 CFX_ByteString bsValue;
1851 FXJSE_Value_ToUTF8String(hValue, bsValue); 1848 FXJSE_Value_ToUTF8String(hValue, bsValue);
1852 strColor = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); 1849 strColor = CFX_WideString::FromUTF8(bsValue.AsStringC());
1853 int32_t r = 0, g = 0, b = 0; 1850 int32_t r = 0, g = 0, b = 0;
1854 XFA_STRING_TO_RGB(strColor, r, g, b); 1851 XFA_STRING_TO_RGB(strColor, r, g, b);
1855 FX_ARGB rgb = ArgbEncode(100, r, g, b); 1852 FX_ARGB rgb = ArgbEncode(100, r, g, b);
1856 for (int32_t i = 0; i < iSize; ++i) { 1853 for (int32_t i = 0; i < iSize; ++i) {
1857 CXFA_Edge edge = border.GetEdge(i); 1854 CXFA_Edge edge = border.GetEdge(i);
1858 edge.SetColor(rgb); 1855 edge.SetColor(rgb);
1859 } 1856 }
1860 } else { 1857 } else {
1861 CXFA_Edge edge = border.GetEdge(0); 1858 CXFA_Edge edge = border.GetEdge(0);
1862 FX_ARGB color = edge.GetColor(); 1859 FX_ARGB color = edge.GetColor();
1863 int32_t a, r, g, b; 1860 int32_t a, r, g, b;
1864 ArgbDecode(color, a, r, g, b); 1861 ArgbDecode(color, a, r, g, b);
1865 strColor.Format(L"%d,%d,%d", r, g, b); 1862 strColor.Format(L"%d,%d,%d", r, g, b);
1866 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(strColor).AsByteStringC()); 1863 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(strColor).AsStringC());
1867 } 1864 }
1868 } 1865 }
1869 void CXFA_Node::Script_Som_BorderWidth(FXJSE_HVALUE hValue, 1866 void CXFA_Node::Script_Som_BorderWidth(FXJSE_HVALUE hValue,
1870 FX_BOOL bSetting, 1867 FX_BOOL bSetting,
1871 XFA_ATTRIBUTE eAttribute) { 1868 XFA_ATTRIBUTE eAttribute) {
1872 CXFA_WidgetData* pWidgetData = GetWidgetData(); 1869 CXFA_WidgetData* pWidgetData = GetWidgetData();
1873 if (!pWidgetData) { 1870 if (!pWidgetData) {
1874 return; 1871 return;
1875 } 1872 }
1876 CXFA_Border border = pWidgetData->GetBorder(TRUE); 1873 CXFA_Border border = pWidgetData->GetBorder(TRUE);
1877 int32_t iSize = border.CountEdges(); 1874 int32_t iSize = border.CountEdges();
1878 CFX_WideString wsThickness; 1875 CFX_WideString wsThickness;
1879 if (bSetting) { 1876 if (bSetting) {
1880 CFX_ByteString bsValue; 1877 CFX_ByteString bsValue;
1881 FXJSE_Value_ToUTF8String(hValue, bsValue); 1878 FXJSE_Value_ToUTF8String(hValue, bsValue);
1882 wsThickness = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); 1879 wsThickness = CFX_WideString::FromUTF8(bsValue.AsStringC());
1883 for (int32_t i = 0; i < iSize; ++i) { 1880 for (int32_t i = 0; i < iSize; ++i) {
1884 CXFA_Edge edge = border.GetEdge(i); 1881 CXFA_Edge edge = border.GetEdge(i);
1885 CXFA_Measurement thickness(wsThickness.AsWideStringC()); 1882 CXFA_Measurement thickness(wsThickness.AsStringC());
1886 edge.SetMSThickness(thickness); 1883 edge.SetMSThickness(thickness);
1887 } 1884 }
1888 } else { 1885 } else {
1889 CXFA_Edge edge = border.GetEdge(0); 1886 CXFA_Edge edge = border.GetEdge(0);
1890 CXFA_Measurement thickness = edge.GetMSThickness(); 1887 CXFA_Measurement thickness = edge.GetMSThickness();
1891 thickness.ToString(wsThickness); 1888 thickness.ToString(wsThickness);
1892 FXJSE_Value_SetUTF8String(hValue, 1889 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsThickness).AsStringC());
1893 FX_UTF8Encode(wsThickness).AsByteStringC());
1894 } 1890 }
1895 } 1891 }
1896 void CXFA_Node::Script_Som_FillColor(FXJSE_HVALUE hValue, 1892 void CXFA_Node::Script_Som_FillColor(FXJSE_HVALUE hValue,
1897 FX_BOOL bSetting, 1893 FX_BOOL bSetting,
1898 XFA_ATTRIBUTE eAttribute) { 1894 XFA_ATTRIBUTE eAttribute) {
1899 CXFA_WidgetData* pWidgetData = GetWidgetData(); 1895 CXFA_WidgetData* pWidgetData = GetWidgetData();
1900 if (!pWidgetData) { 1896 if (!pWidgetData) {
1901 return; 1897 return;
1902 } 1898 }
1903 CXFA_Border border = pWidgetData->GetBorder(TRUE); 1899 CXFA_Border border = pWidgetData->GetBorder(TRUE);
1904 CXFA_Fill borderfill = border.GetFill(TRUE); 1900 CXFA_Fill borderfill = border.GetFill(TRUE);
1905 CXFA_Node* pNode = borderfill.GetNode(); 1901 CXFA_Node* pNode = borderfill.GetNode();
1906 if (!pNode) { 1902 if (!pNode) {
1907 return; 1903 return;
1908 } 1904 }
1909 CFX_WideString wsColor; 1905 CFX_WideString wsColor;
1910 if (bSetting) { 1906 if (bSetting) {
1911 CFX_ByteString bsValue; 1907 CFX_ByteString bsValue;
1912 FXJSE_Value_ToUTF8String(hValue, bsValue); 1908 FXJSE_Value_ToUTF8String(hValue, bsValue);
1913 wsColor = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); 1909 wsColor = CFX_WideString::FromUTF8(bsValue.AsStringC());
1914 int32_t r, g, b; 1910 int32_t r, g, b;
1915 XFA_STRING_TO_RGB(wsColor, r, g, b); 1911 XFA_STRING_TO_RGB(wsColor, r, g, b);
1916 FX_ARGB color = ArgbEncode(0xff, r, g, b); 1912 FX_ARGB color = ArgbEncode(0xff, r, g, b);
1917 borderfill.SetColor(color); 1913 borderfill.SetColor(color);
1918 } else { 1914 } else {
1919 FX_ARGB color = borderfill.GetColor(); 1915 FX_ARGB color = borderfill.GetColor();
1920 int32_t a, r, g, b; 1916 int32_t a, r, g, b;
1921 ArgbDecode(color, a, r, g, b); 1917 ArgbDecode(color, a, r, g, b);
1922 wsColor.Format(L"%d,%d,%d", r, g, b); 1918 wsColor.Format(L"%d,%d,%d", r, g, b);
1923 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor).AsByteStringC()); 1919 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor).AsStringC());
1924 } 1920 }
1925 } 1921 }
1926 void CXFA_Node::Script_Som_DataNode(FXJSE_HVALUE hValue, 1922 void CXFA_Node::Script_Som_DataNode(FXJSE_HVALUE hValue,
1927 FX_BOOL bSetting, 1923 FX_BOOL bSetting,
1928 XFA_ATTRIBUTE eAttribute) { 1924 XFA_ATTRIBUTE eAttribute) {
1929 if (!bSetting) { 1925 if (!bSetting) {
1930 CXFA_Node* pDataNode = GetBindData(); 1926 CXFA_Node* pDataNode = GetBindData();
1931 if (pDataNode) { 1927 if (pDataNode) {
1932 FXJSE_Value_Set( 1928 FXJSE_Value_Set(
1933 hValue, 1929 hValue,
(...skipping 10 matching lines...) Expand all
1944 XFA_ATTRIBUTE eAttribute) { 1940 XFA_ATTRIBUTE eAttribute) {
1945 if (bSetting) { 1941 if (bSetting) {
1946 if (FXJSE_Value_IsUTF8String(hValue)) { 1942 if (FXJSE_Value_IsUTF8String(hValue)) {
1947 CXFA_WidgetData* pWidgetData = GetWidgetData(); 1943 CXFA_WidgetData* pWidgetData = GetWidgetData();
1948 FXSYS_assert(pWidgetData); 1944 FXSYS_assert(pWidgetData);
1949 XFA_ELEMENT uiType = pWidgetData->GetUIType(); 1945 XFA_ELEMENT uiType = pWidgetData->GetUIType();
1950 if (uiType == XFA_ELEMENT_Text) { 1946 if (uiType == XFA_ELEMENT_Text) {
1951 CFX_ByteString newValue; 1947 CFX_ByteString newValue;
1952 FXJSE_Value_ToUTF8String(hValue, newValue); 1948 FXJSE_Value_ToUTF8String(hValue, newValue);
1953 CFX_WideString wsNewValue = 1949 CFX_WideString wsNewValue =
1954 CFX_WideString::FromUTF8(newValue.AsByteStringC()); 1950 CFX_WideString::FromUTF8(newValue.AsStringC());
1955 CFX_WideString wsFormatValue(wsNewValue); 1951 CFX_WideString wsFormatValue(wsNewValue);
1956 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); 1952 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
1957 } else if (uiType != XFA_ELEMENT_Image) { 1953 } else if (uiType != XFA_ELEMENT_Image) {
1958 } 1954 }
1959 } 1955 }
1960 } else { 1956 } else {
1961 CFX_WideString content = GetScriptContent(TRUE); 1957 CFX_WideString content = GetScriptContent(TRUE);
1962 if (content.IsEmpty()) { 1958 if (content.IsEmpty()) {
1963 FXJSE_Value_SetNull(hValue); 1959 FXJSE_Value_SetNull(hValue);
1964 } else { 1960 } else {
1965 FXJSE_Value_SetUTF8String( 1961 FXJSE_Value_SetUTF8String(
1966 hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); 1962 hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC());
1967 } 1963 }
1968 } 1964 }
1969 } 1965 }
1970 void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue, 1966 void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue,
1971 FX_BOOL bSetting, 1967 FX_BOOL bSetting,
1972 XFA_ATTRIBUTE eAttribute) { 1968 XFA_ATTRIBUTE eAttribute) {
1973 CXFA_WidgetData* pWidgetData = GetWidgetData(); 1969 CXFA_WidgetData* pWidgetData = GetWidgetData();
1974 if (!pWidgetData) { 1970 if (!pWidgetData) {
1975 return; 1971 return;
1976 } 1972 }
1977 if (bSetting) { 1973 if (bSetting) {
1978 if (FXJSE_Value_IsNull(hValue)) { 1974 if (FXJSE_Value_IsNull(hValue)) {
1979 pWidgetData->m_bPreNull = pWidgetData->m_bIsNull; 1975 pWidgetData->m_bPreNull = pWidgetData->m_bIsNull;
1980 pWidgetData->m_bIsNull = TRUE; 1976 pWidgetData->m_bIsNull = TRUE;
1981 } else { 1977 } else {
1982 pWidgetData->m_bPreNull = pWidgetData->m_bIsNull; 1978 pWidgetData->m_bPreNull = pWidgetData->m_bIsNull;
1983 pWidgetData->m_bIsNull = FALSE; 1979 pWidgetData->m_bIsNull = FALSE;
1984 } 1980 }
1985 CFX_ByteString newValue; 1981 CFX_ByteString newValue;
1986 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { 1982 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) {
1987 FXJSE_Value_ToUTF8String(hValue, newValue); 1983 FXJSE_Value_ToUTF8String(hValue, newValue);
1988 } 1984 }
1989 CFX_WideString wsNewText = 1985 CFX_WideString wsNewText = CFX_WideString::FromUTF8(newValue.AsStringC());
1990 CFX_WideString::FromUTF8(newValue.AsByteStringC());
1991 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); 1986 CXFA_Node* pUIChild = pWidgetData->GetUIChild();
1992 if (pUIChild->GetClassID() == XFA_ELEMENT_NumericEdit) { 1987 if (pUIChild->GetClassID() == XFA_ELEMENT_NumericEdit) {
1993 int32_t iLeadDigits = 0; 1988 int32_t iLeadDigits = 0;
1994 int32_t iFracDigits = 0; 1989 int32_t iFracDigits = 0;
1995 pWidgetData->GetLeadDigits(iLeadDigits); 1990 pWidgetData->GetLeadDigits(iLeadDigits);
1996 pWidgetData->GetFracDigits(iFracDigits); 1991 pWidgetData->GetFracDigits(iFracDigits);
1997 wsNewText = 1992 wsNewText =
1998 pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits); 1993 pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits);
1999 } 1994 }
2000 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); 1995 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
2001 CFX_WideString wsFormatText(wsNewText); 1996 CFX_WideString wsFormatText(wsNewText);
2002 if (pContainerWidgetData) { 1997 if (pContainerWidgetData) {
2003 pContainerWidgetData->GetFormatDataValue(wsNewText.AsWideStringC(), 1998 pContainerWidgetData->GetFormatDataValue(wsNewText.AsStringC(),
2004 wsFormatText); 1999 wsFormatText);
2005 } 2000 }
2006 SetScriptContent(wsNewText, wsFormatText, TRUE, TRUE); 2001 SetScriptContent(wsNewText, wsFormatText, TRUE, TRUE);
2007 } else { 2002 } else {
2008 CFX_WideString content = GetScriptContent(TRUE); 2003 CFX_WideString content = GetScriptContent(TRUE);
2009 if (content.IsEmpty()) { 2004 if (content.IsEmpty()) {
2010 FXJSE_Value_SetNull(hValue); 2005 FXJSE_Value_SetNull(hValue);
2011 } else { 2006 } else {
2012 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); 2007 CXFA_Node* pUIChild = pWidgetData->GetUIChild();
2013 XFA_ELEMENT eUI = pUIChild->GetClassID(); 2008 XFA_ELEMENT eUI = pUIChild->GetClassID();
2014 CXFA_Value defVal = pWidgetData->GetFormValue(); 2009 CXFA_Value defVal = pWidgetData->GetFormValue();
2015 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); 2010 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild);
2016 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Decimal) { 2011 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Decimal) {
2017 if (eUI == XFA_ELEMENT_NumericEdit && 2012 if (eUI == XFA_ELEMENT_NumericEdit &&
2018 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { 2013 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) {
2019 FXJSE_Value_SetUTF8String( 2014 FXJSE_Value_SetUTF8String(
2020 hValue, 2015 hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC());
2021 FX_UTF8Encode(content, content.GetLength()).AsByteStringC());
2022 } else { 2016 } else {
2023 CFX_Decimal decimal(content.AsWideStringC()); 2017 CFX_Decimal decimal(content.AsStringC());
2024 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); 2018 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
2025 } 2019 }
2026 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) { 2020 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) {
2027 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); 2021 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content));
2028 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) { 2022 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) {
2029 FXJSE_Value_SetBoolean(hValue, FXSYS_wtoi(content) == 0 ? FALSE : TRUE); 2023 FXJSE_Value_SetBoolean(hValue, FXSYS_wtoi(content) == 0 ? FALSE : TRUE);
2030 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) { 2024 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) {
2031 CFX_Decimal decimal(content.AsWideStringC()); 2025 CFX_Decimal decimal(content.AsStringC());
2032 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); 2026 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
2033 } else { 2027 } else {
2034 FXJSE_Value_SetUTF8String( 2028 FXJSE_Value_SetUTF8String(
2035 hValue, 2029 hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC());
2036 FX_UTF8Encode(content, content.GetLength()).AsByteStringC());
2037 } 2030 }
2038 } 2031 }
2039 } 2032 }
2040 } 2033 }
2041 void CXFA_Node::Script_Field_EditValue(FXJSE_HVALUE hValue, 2034 void CXFA_Node::Script_Field_EditValue(FXJSE_HVALUE hValue,
2042 FX_BOOL bSetting, 2035 FX_BOOL bSetting,
2043 XFA_ATTRIBUTE eAttribute) { 2036 XFA_ATTRIBUTE eAttribute) {
2044 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2037 CXFA_WidgetData* pWidgetData = GetWidgetData();
2045 if (!pWidgetData) { 2038 if (!pWidgetData) {
2046 return; 2039 return;
2047 } 2040 }
2048 CFX_WideString wsValue; 2041 CFX_WideString wsValue;
2049 if (bSetting) { 2042 if (bSetting) {
2050 CFX_ByteString bsValue; 2043 CFX_ByteString bsValue;
2051 FXJSE_Value_ToUTF8String(hValue, bsValue); 2044 FXJSE_Value_ToUTF8String(hValue, bsValue);
2052 wsValue = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); 2045 wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC());
2053 pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Edit); 2046 pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Edit);
2054 } else { 2047 } else {
2055 pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Edit); 2048 pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Edit);
2056 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); 2049 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsStringC());
2057 } 2050 }
2058 } 2051 }
2059 void CXFA_Node::Script_Som_FontColor(FXJSE_HVALUE hValue, 2052 void CXFA_Node::Script_Som_FontColor(FXJSE_HVALUE hValue,
2060 FX_BOOL bSetting, 2053 FX_BOOL bSetting,
2061 XFA_ATTRIBUTE eAttribute) { 2054 XFA_ATTRIBUTE eAttribute) {
2062 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2055 CXFA_WidgetData* pWidgetData = GetWidgetData();
2063 if (!pWidgetData) { 2056 if (!pWidgetData) {
2064 return; 2057 return;
2065 } 2058 }
2066 CXFA_Font font = pWidgetData->GetFont(TRUE); 2059 CXFA_Font font = pWidgetData->GetFont(TRUE);
2067 CXFA_Node* pNode = font.GetNode(); 2060 CXFA_Node* pNode = font.GetNode();
2068 if (!pNode) { 2061 if (!pNode) {
2069 return; 2062 return;
2070 } 2063 }
2071 CFX_WideString wsColor; 2064 CFX_WideString wsColor;
2072 if (bSetting) { 2065 if (bSetting) {
2073 CFX_ByteString bsValue; 2066 CFX_ByteString bsValue;
2074 FXJSE_Value_ToUTF8String(hValue, bsValue); 2067 FXJSE_Value_ToUTF8String(hValue, bsValue);
2075 wsColor = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); 2068 wsColor = CFX_WideString::FromUTF8(bsValue.AsStringC());
2076 int32_t r, g, b; 2069 int32_t r, g, b;
2077 XFA_STRING_TO_RGB(wsColor, r, g, b); 2070 XFA_STRING_TO_RGB(wsColor, r, g, b);
2078 FX_ARGB color = ArgbEncode(0xff, r, g, b); 2071 FX_ARGB color = ArgbEncode(0xff, r, g, b);
2079 font.SetColor(color); 2072 font.SetColor(color);
2080 } else { 2073 } else {
2081 FX_ARGB color = font.GetColor(); 2074 FX_ARGB color = font.GetColor();
2082 int32_t a, r, g, b; 2075 int32_t a, r, g, b;
2083 ArgbDecode(color, a, r, g, b); 2076 ArgbDecode(color, a, r, g, b);
2084 wsColor.Format(L"%d,%d,%d", r, g, b); 2077 wsColor.Format(L"%d,%d,%d", r, g, b);
2085 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor).AsByteStringC()); 2078 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor).AsStringC());
2086 } 2079 }
2087 } 2080 }
2088 void CXFA_Node::Script_Field_FormatMessage(FXJSE_HVALUE hValue, 2081 void CXFA_Node::Script_Field_FormatMessage(FXJSE_HVALUE hValue,
2089 FX_BOOL bSetting, 2082 FX_BOOL bSetting,
2090 XFA_ATTRIBUTE eAttribute) { 2083 XFA_ATTRIBUTE eAttribute) {
2091 Script_Som_Message(hValue, bSetting, XFA_SOM_FormatMessage); 2084 Script_Som_Message(hValue, bSetting, XFA_SOM_FormatMessage);
2092 } 2085 }
2093 void CXFA_Node::Script_Field_FormattedValue(FXJSE_HVALUE hValue, 2086 void CXFA_Node::Script_Field_FormattedValue(FXJSE_HVALUE hValue,
2094 FX_BOOL bSetting, 2087 FX_BOOL bSetting,
2095 XFA_ATTRIBUTE eAttribute) { 2088 XFA_ATTRIBUTE eAttribute) {
2096 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2089 CXFA_WidgetData* pWidgetData = GetWidgetData();
2097 if (!pWidgetData) { 2090 if (!pWidgetData) {
2098 return; 2091 return;
2099 } 2092 }
2100 CFX_WideString wsValue; 2093 CFX_WideString wsValue;
2101 if (bSetting) { 2094 if (bSetting) {
2102 CFX_ByteString bsValue; 2095 CFX_ByteString bsValue;
2103 FXJSE_Value_ToUTF8String(hValue, bsValue); 2096 FXJSE_Value_ToUTF8String(hValue, bsValue);
2104 wsValue = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); 2097 wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC());
2105 pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Display); 2098 pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Display);
2106 } else { 2099 } else {
2107 pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Display); 2100 pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Display);
2108 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); 2101 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsStringC());
2109 } 2102 }
2110 } 2103 }
2111 void CXFA_Node::Script_Som_Mandatory(FXJSE_HVALUE hValue, 2104 void CXFA_Node::Script_Som_Mandatory(FXJSE_HVALUE hValue,
2112 FX_BOOL bSetting, 2105 FX_BOOL bSetting,
2113 XFA_ATTRIBUTE eAttribute) { 2106 XFA_ATTRIBUTE eAttribute) {
2114 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2107 CXFA_WidgetData* pWidgetData = GetWidgetData();
2115 if (!pWidgetData) { 2108 if (!pWidgetData) {
2116 return; 2109 return;
2117 } 2110 }
2118 CXFA_Validate validate = pWidgetData->GetValidate(TRUE); 2111 CXFA_Validate validate = pWidgetData->GetValidate(TRUE);
2119 CFX_WideString wsValue; 2112 CFX_WideString wsValue;
2120 if (bSetting) { 2113 if (bSetting) {
2121 CFX_ByteString bsValue; 2114 CFX_ByteString bsValue;
2122 FXJSE_Value_ToUTF8String(hValue, bsValue); 2115 FXJSE_Value_ToUTF8String(hValue, bsValue);
2123 wsValue = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); 2116 wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC());
2124 validate.SetNullTest(wsValue); 2117 validate.SetNullTest(wsValue);
2125 } else { 2118 } else {
2126 int32_t iValue = validate.GetNullTest(); 2119 int32_t iValue = validate.GetNullTest();
2127 const XFA_ATTRIBUTEENUMINFO* pInfo = 2120 const XFA_ATTRIBUTEENUMINFO* pInfo =
2128 XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)iValue); 2121 XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)iValue);
2129 if (pInfo) { 2122 if (pInfo) {
2130 wsValue = pInfo->pName; 2123 wsValue = pInfo->pName;
2131 } 2124 }
2132 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); 2125 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsStringC());
2133 } 2126 }
2134 } 2127 }
2135 void CXFA_Node::Script_Som_MandatoryMessage(FXJSE_HVALUE hValue, 2128 void CXFA_Node::Script_Som_MandatoryMessage(FXJSE_HVALUE hValue,
2136 FX_BOOL bSetting, 2129 FX_BOOL bSetting,
2137 XFA_ATTRIBUTE eAttribute) { 2130 XFA_ATTRIBUTE eAttribute) {
2138 Script_Som_Message(hValue, bSetting, XFA_SOM_MandatoryMessage); 2131 Script_Som_Message(hValue, bSetting, XFA_SOM_MandatoryMessage);
2139 } 2132 }
2140 void CXFA_Node::Script_Field_ParentSubform(FXJSE_HVALUE hValue, 2133 void CXFA_Node::Script_Field_ParentSubform(FXJSE_HVALUE hValue,
2141 FX_BOOL bSetting, 2134 FX_BOOL bSetting,
2142 XFA_ATTRIBUTE eAttribute) { 2135 XFA_ATTRIBUTE eAttribute) {
(...skipping 26 matching lines...) Expand all
2169 if (!pWidgetData) { 2162 if (!pWidgetData) {
2170 return; 2163 return;
2171 } 2164 }
2172 pWidgetData->DeleteItem(-1, TRUE); 2165 pWidgetData->DeleteItem(-1, TRUE);
2173 } 2166 }
2174 void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { 2167 void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) {
2175 int32_t argc = pArguments->GetLength(); 2168 int32_t argc = pArguments->GetLength();
2176 if (argc == 1) { 2169 if (argc == 1) {
2177 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2170 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2178 int32_t iRet = execSingleEventByName( 2171 int32_t iRet = execSingleEventByName(
2179 CFX_WideString::FromUTF8(eventString.AsByteStringC()).AsWideStringC(), 2172 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
2180 XFA_ELEMENT_Field); 2173 XFA_ELEMENT_Field);
2181 if (eventString == "validate") { 2174 if (eventString == "validate") {
2182 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), 2175 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(),
2183 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); 2176 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE));
2184 } 2177 }
2185 } else { 2178 } else {
2186 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2179 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2187 } 2180 }
2188 } 2181 }
2189 void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) { 2182 void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2223 CXFA_WidgetData* pWidgetData = GetWidgetData();
2231 if (!pWidgetData) { 2224 if (!pWidgetData) {
2232 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2225 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2233 return; 2226 return;
2234 } 2227 }
2235 CFX_WideString wsValue; 2228 CFX_WideString wsValue;
2236 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, TRUE); 2229 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, TRUE);
2237 if (bHasItem) { 2230 if (bHasItem) {
2238 FXJSE_Value_SetUTF8String( 2231 FXJSE_Value_SetUTF8String(
2239 pArguments->GetReturnValue(), 2232 pArguments->GetReturnValue(),
2240 FX_UTF8Encode(wsValue, wsValue.GetLength()).AsByteStringC()); 2233 FX_UTF8Encode(wsValue, wsValue.GetLength()).AsStringC());
2241 } else { 2234 } else {
2242 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2235 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2243 } 2236 }
2244 } 2237 }
2245 void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { 2238 void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) {
2246 int32_t iLength = pArguments->GetLength(); 2239 int32_t iLength = pArguments->GetLength();
2247 if (iLength != 1) { 2240 if (iLength != 1) {
2248 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"boundItem"); 2241 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"boundItem");
2249 return; 2242 return;
2250 } 2243 }
2251 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2244 CXFA_WidgetData* pWidgetData = GetWidgetData();
2252 if (!pWidgetData) { 2245 if (!pWidgetData) {
2253 return; 2246 return;
2254 } 2247 }
2255 CFX_ByteString bsValue = pArguments->GetUTF8String(0); 2248 CFX_ByteString bsValue = pArguments->GetUTF8String(0);
2256 CFX_WideString wsValue = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); 2249 CFX_WideString wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC());
2257 CFX_WideString wsBoundValue; 2250 CFX_WideString wsBoundValue;
2258 pWidgetData->GetItemValue(wsValue.AsWideStringC(), wsBoundValue); 2251 pWidgetData->GetItemValue(wsValue.AsStringC(), wsBoundValue);
2259 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 2252 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
2260 if (hValue) { 2253 if (hValue) {
2261 FXJSE_Value_SetUTF8String(hValue, 2254 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsBoundValue).AsStringC());
2262 FX_UTF8Encode(wsBoundValue).AsByteStringC());
2263 } 2255 }
2264 } 2256 }
2265 void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { 2257 void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) {
2266 int32_t iLength = pArguments->GetLength(); 2258 int32_t iLength = pArguments->GetLength();
2267 if (iLength != 1) { 2259 if (iLength != 1) {
2268 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2260 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
2269 L"getItemState"); 2261 L"getItemState");
2270 return; 2262 return;
2271 } 2263 }
2272 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2264 CXFA_WidgetData* pWidgetData = GetWidgetData();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2301 CXFA_WidgetData* pWidgetData = GetWidgetData();
2310 if (!pWidgetData) { 2302 if (!pWidgetData) {
2311 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2303 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2312 return; 2304 return;
2313 } 2305 }
2314 CFX_WideString wsValue; 2306 CFX_WideString wsValue;
2315 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, FALSE); 2307 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, FALSE);
2316 if (bHasItem) { 2308 if (bHasItem) {
2317 FXJSE_Value_SetUTF8String( 2309 FXJSE_Value_SetUTF8String(
2318 pArguments->GetReturnValue(), 2310 pArguments->GetReturnValue(),
2319 FX_UTF8Encode(wsValue, wsValue.GetLength()).AsByteStringC()); 2311 FX_UTF8Encode(wsValue, wsValue.GetLength()).AsStringC());
2320 } else { 2312 } else {
2321 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2313 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2322 } 2314 }
2323 } 2315 }
2324 void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) { 2316 void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) {
2325 int32_t iLength = pArguments->GetLength(); 2317 int32_t iLength = pArguments->GetLength();
2326 if (iLength != 2) { 2318 if (iLength != 2) {
2327 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2319 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
2328 L"setItemState"); 2320 L"setItemState");
2329 return; 2321 return;
(...skipping 18 matching lines...) Expand all
2348 return; 2340 return;
2349 } 2341 }
2350 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2342 CXFA_WidgetData* pWidgetData = GetWidgetData();
2351 if (!pWidgetData) { 2343 if (!pWidgetData) {
2352 return; 2344 return;
2353 } 2345 }
2354 CFX_WideString wsLabel; 2346 CFX_WideString wsLabel;
2355 CFX_WideString wsValue; 2347 CFX_WideString wsValue;
2356 if (iLength >= 1) { 2348 if (iLength >= 1) {
2357 CFX_ByteString bsLabel = pArguments->GetUTF8String(0); 2349 CFX_ByteString bsLabel = pArguments->GetUTF8String(0);
2358 wsLabel = CFX_WideString::FromUTF8(bsLabel.AsByteStringC()); 2350 wsLabel = CFX_WideString::FromUTF8(bsLabel.AsStringC());
2359 } 2351 }
2360 if (iLength >= 2) { 2352 if (iLength >= 2) {
2361 CFX_ByteString bsValue = pArguments->GetUTF8String(1); 2353 CFX_ByteString bsValue = pArguments->GetUTF8String(1);
2362 wsValue = CFX_WideString::FromUTF8(bsValue.AsByteStringC()); 2354 wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC());
2363 } 2355 }
2364 pWidgetData->InsertItem(wsLabel, wsValue, -1, TRUE); 2356 pWidgetData->InsertItem(wsLabel, wsValue, -1, TRUE);
2365 } 2357 }
2366 void CXFA_Node::Script_Field_ExecValidate(CFXJSE_Arguments* pArguments) { 2358 void CXFA_Node::Script_Field_ExecValidate(CFXJSE_Arguments* pArguments) {
2367 int32_t argc = pArguments->GetLength(); 2359 int32_t argc = pArguments->GetLength();
2368 if (argc == 0) { 2360 if (argc == 0) {
2369 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2361 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2370 if (!pNotify) { 2362 if (!pNotify) {
2371 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); 2363 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE);
2372 } else { 2364 } else {
(...skipping 19 matching lines...) Expand all
2392 FX_BOOL bSetting, 2384 FX_BOOL bSetting,
2393 XFA_ATTRIBUTE eAttribute) { 2385 XFA_ATTRIBUTE eAttribute) {
2394 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2386 CXFA_WidgetData* pWidgetData = GetWidgetData();
2395 if (!pWidgetData) { 2387 if (!pWidgetData) {
2396 return; 2388 return;
2397 } 2389 }
2398 if (bSetting) { 2390 if (bSetting) {
2399 CFX_ByteString bsValue; 2391 CFX_ByteString bsValue;
2400 FXJSE_Value_ToUTF8String(hValue, bsValue); 2392 FXJSE_Value_ToUTF8String(hValue, bsValue);
2401 pWidgetData->SetSelectedMemberByValue( 2393 pWidgetData->SetSelectedMemberByValue(
2402 CFX_WideString::FromUTF8(bsValue.AsByteStringC()).AsWideStringC(), TRUE, 2394 CFX_WideString::FromUTF8(bsValue.AsStringC()).AsStringC(), TRUE, TRUE);
2403 TRUE);
2404 } else { 2395 } else {
2405 CFX_WideString wsValue = GetScriptContent(TRUE); 2396 CFX_WideString wsValue = GetScriptContent(TRUE);
2406 XFA_VERSION curVersion = GetDocument()->GetCurVersionMode(); 2397 XFA_VERSION curVersion = GetDocument()->GetCurVersionMode();
2407 if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) { 2398 if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) {
2408 FXJSE_Value_SetNull(hValue); 2399 FXJSE_Value_SetNull(hValue);
2409 } else { 2400 } else {
2410 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); 2401 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsStringC());
2411 } 2402 }
2412 } 2403 }
2413 } 2404 }
2414 void CXFA_Node::Script_ExclGroup_Transient(FXJSE_HVALUE hValue, 2405 void CXFA_Node::Script_ExclGroup_Transient(FXJSE_HVALUE hValue,
2415 FX_BOOL bSetting, 2406 FX_BOOL bSetting,
2416 XFA_ATTRIBUTE eAttribute) {} 2407 XFA_ATTRIBUTE eAttribute) {}
2417 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { 2408 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) {
2418 int32_t argc = pArguments->GetLength(); 2409 int32_t argc = pArguments->GetLength();
2419 if (argc == 1) { 2410 if (argc == 1) {
2420 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2411 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2421 execSingleEventByName( 2412 execSingleEventByName(
2422 CFX_WideString::FromUTF8(eventString.AsByteStringC()).AsWideStringC(), 2413 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
2423 XFA_ELEMENT_ExclGroup); 2414 XFA_ELEMENT_ExclGroup);
2424 } else { 2415 } else {
2425 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2416 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2426 } 2417 }
2427 } 2418 }
2428 void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { 2419 void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) {
2429 int32_t argc = pArguments->GetLength(); 2420 int32_t argc = pArguments->GetLength();
2430 if ((argc == 0) || (argc == 1)) { 2421 if ((argc == 0) || (argc == 1)) {
2431 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2422 CXFA_WidgetData* pWidgetData = GetWidgetData();
2432 if (!pWidgetData) { 2423 if (!pWidgetData) {
2433 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2424 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2434 } else { 2425 } else {
2435 CXFA_Node* pReturnNode = NULL; 2426 CXFA_Node* pReturnNode = NULL;
2436 if (argc == 0) { 2427 if (argc == 0) {
2437 pReturnNode = pWidgetData->GetSelectedMember(); 2428 pReturnNode = pWidgetData->GetSelectedMember();
2438 } else { 2429 } else {
2439 CFX_ByteString szName; 2430 CFX_ByteString szName;
2440 szName = pArguments->GetUTF8String(0); 2431 szName = pArguments->GetUTF8String(0);
2441 pReturnNode = pWidgetData->SetSelectedMember( 2432 pReturnNode = pWidgetData->SetSelectedMember(
2442 CFX_WideString::FromUTF8(szName.AsByteStringC()).AsWideStringC()); 2433 CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC());
2443 } 2434 }
2444 if (pReturnNode) { 2435 if (pReturnNode) {
2445 FXJSE_Value_Set( 2436 FXJSE_Value_Set(
2446 pArguments->GetReturnValue(), 2437 pArguments->GetReturnValue(),
2447 m_pDocument->GetScriptContext()->GetJSValueFromMap(pReturnNode)); 2438 m_pDocument->GetScriptContext()->GetJSValueFromMap(pReturnNode));
2448 } else { 2439 } else {
2449 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2440 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2450 } 2441 }
2451 } 2442 }
2452 } else { 2443 } else {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2593 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 2584 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
2594 } 2585 }
2595 } 2586 }
2596 void CXFA_Node::Script_Subform_Locale(FXJSE_HVALUE hValue, 2587 void CXFA_Node::Script_Subform_Locale(FXJSE_HVALUE hValue,
2597 FX_BOOL bSetting, 2588 FX_BOOL bSetting,
2598 XFA_ATTRIBUTE eAttribute) { 2589 XFA_ATTRIBUTE eAttribute) {
2599 if (bSetting) { 2590 if (bSetting) {
2600 CFX_ByteString bsLocaleName; 2591 CFX_ByteString bsLocaleName;
2601 FXJSE_Value_ToUTF8String(hValue, bsLocaleName); 2592 FXJSE_Value_ToUTF8String(hValue, bsLocaleName);
2602 SetCData(XFA_ATTRIBUTE_Locale, 2593 SetCData(XFA_ATTRIBUTE_Locale,
2603 CFX_WideString::FromUTF8(bsLocaleName.AsByteStringC()), TRUE, 2594 CFX_WideString::FromUTF8(bsLocaleName.AsStringC()), TRUE, TRUE);
2604 TRUE);
2605 } else { 2595 } else {
2606 CFX_WideString wsLocaleName; 2596 CFX_WideString wsLocaleName;
2607 GetLocaleName(wsLocaleName); 2597 GetLocaleName(wsLocaleName);
2608 FXJSE_Value_SetUTF8String( 2598 FXJSE_Value_SetUTF8String(
2609 hValue, 2599 hValue,
2610 FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength()).AsByteStringC()); 2600 FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength()).AsStringC());
2611 } 2601 }
2612 } 2602 }
2613 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { 2603 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) {
2614 int32_t argc = pArguments->GetLength(); 2604 int32_t argc = pArguments->GetLength();
2615 if (argc == 1) { 2605 if (argc == 1) {
2616 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2606 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2617 execSingleEventByName( 2607 execSingleEventByName(
2618 CFX_WideString::FromUTF8(eventString.AsByteStringC()).AsWideStringC(), 2608 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
2619 XFA_ELEMENT_Subform); 2609 XFA_ELEMENT_Subform);
2620 } else { 2610 } else {
2621 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2611 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2622 } 2612 }
2623 } 2613 }
2624 void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { 2614 void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) {
2625 int32_t argc = pArguments->GetLength(); 2615 int32_t argc = pArguments->GetLength();
2626 if (argc == 0) { 2616 if (argc == 0) {
2627 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2617 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2628 if (!pNotify) { 2618 if (!pNotify) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 L"execInitialize"); 2704 L"execInitialize");
2715 } 2705 }
2716 } 2706 }
2717 void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { 2707 void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) {
2718 int32_t argc = pArguments->GetLength(); 2708 int32_t argc = pArguments->GetLength();
2719 if ((argc > 0) && (argc < 4)) { 2709 if ((argc > 0) && (argc < 4)) {
2720 CFX_WideString strTagName; 2710 CFX_WideString strTagName;
2721 CFX_WideString strName; 2711 CFX_WideString strName;
2722 CFX_WideString strNameSpace; 2712 CFX_WideString strNameSpace;
2723 CFX_ByteString bsTagName = pArguments->GetUTF8String(0); 2713 CFX_ByteString bsTagName = pArguments->GetUTF8String(0);
2724 strTagName = CFX_WideString::FromUTF8(bsTagName.AsByteStringC()); 2714 strTagName = CFX_WideString::FromUTF8(bsTagName.AsStringC());
2725 if (argc > 1) { 2715 if (argc > 1) {
2726 CFX_ByteString bsName = pArguments->GetUTF8String(1); 2716 CFX_ByteString bsName = pArguments->GetUTF8String(1);
2727 strName = CFX_WideString::FromUTF8(bsName.AsByteStringC()); 2717 strName = CFX_WideString::FromUTF8(bsName.AsStringC());
2728 if (argc == 3) { 2718 if (argc == 3) {
2729 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(2); 2719 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(2);
2730 strNameSpace = CFX_WideString::FromUTF8(bsNameSpace.AsByteStringC()); 2720 strNameSpace = CFX_WideString::FromUTF8(bsNameSpace.AsStringC());
2731 } 2721 }
2732 } 2722 }
2733 const XFA_ELEMENTINFO* pElement = 2723 const XFA_ELEMENTINFO* pElement =
2734 XFA_GetElementByName(strTagName.AsWideStringC()); 2724 XFA_GetElementByName(strTagName.AsStringC());
2735 CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName); 2725 CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName);
2736 if (!pNewNode) { 2726 if (!pNewNode) {
2737 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2727 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2738 } else { 2728 } else {
2739 if (!strName.IsEmpty()) { 2729 if (!strName.IsEmpty()) {
2740 if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name, 2730 if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name,
2741 XFA_XDPPACKET_UNKNOWN)) { 2731 XFA_XDPPACKET_UNKNOWN)) {
2742 pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsWideStringC(), 2732 pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringC(), TRUE);
2743 TRUE);
2744 if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) { 2733 if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) {
2745 pNewNode->CreateXMLMappingNode(); 2734 pNewNode->CreateXMLMappingNode();
2746 } 2735 }
2747 FXJSE_Value_Set( 2736 FXJSE_Value_Set(
2748 pArguments->GetReturnValue(), 2737 pArguments->GetReturnValue(),
2749 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode)); 2738 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode));
2750 } else { 2739 } else {
2751 ThrowScriptErrorMessage(XFA_IDS_NOT_HAVE_PROPERTY, 2740 ThrowScriptErrorMessage(XFA_IDS_NOT_HAVE_PROPERTY,
2752 (const FX_WCHAR*)strTagName, L"name"); 2741 (const FX_WCHAR*)strTagName, L"name");
2753 } 2742 }
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
3490 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 3479 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
3491 L"execValidate"); 3480 L"execValidate");
3492 } 3481 }
3493 } 3482 }
3494 void CXFA_Node::Script_Form_Checksum(FXJSE_HVALUE hValue, 3483 void CXFA_Node::Script_Form_Checksum(FXJSE_HVALUE hValue,
3495 FX_BOOL bSetting, 3484 FX_BOOL bSetting,
3496 XFA_ATTRIBUTE eAttribute) { 3485 XFA_ATTRIBUTE eAttribute) {
3497 if (bSetting) { 3486 if (bSetting) {
3498 CFX_ByteString bsChecksum; 3487 CFX_ByteString bsChecksum;
3499 FXJSE_Value_ToUTF8String(hValue, bsChecksum); 3488 FXJSE_Value_ToUTF8String(hValue, bsChecksum);
3500 SetAttribute( 3489 SetAttribute(XFA_ATTRIBUTE_Checksum,
3501 XFA_ATTRIBUTE_Checksum, 3490 CFX_WideString::FromUTF8(bsChecksum.AsStringC()).AsStringC());
3502 CFX_WideString::FromUTF8(bsChecksum.AsByteStringC()).AsWideStringC());
3503 } else { 3491 } else {
3504 CFX_WideString wsChecksum; 3492 CFX_WideString wsChecksum;
3505 GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); 3493 GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE);
3506 FXJSE_Value_SetUTF8String( 3494 FXJSE_Value_SetUTF8String(
3507 hValue, 3495 hValue, FX_UTF8Encode(wsChecksum, wsChecksum.GetLength()).AsStringC());
3508 FX_UTF8Encode(wsChecksum, wsChecksum.GetLength()).AsByteStringC());
3509 } 3496 }
3510 } 3497 }
3511 void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { 3498 void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) {
3512 int32_t argc = pArguments->GetLength(); 3499 int32_t argc = pArguments->GetLength();
3513 if (argc == 1) { 3500 if (argc == 1) {
3514 CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0); 3501 CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0);
3515 CFX_WideString wsAttributeValue; 3502 CFX_WideString wsAttributeValue;
3516 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); 3503 CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
3517 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { 3504 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
3518 static_cast<CFDE_XMLElement*>(pXMLNode) 3505 static_cast<CFDE_XMLElement*>(pXMLNode)
3519 ->GetString(CFX_WideString::FromUTF8(bsAttributeName.AsByteStringC()), 3506 ->GetString(CFX_WideString::FromUTF8(bsAttributeName.AsStringC()),
3520 wsAttributeValue); 3507 wsAttributeValue);
3521 } 3508 }
3522 FXJSE_Value_SetUTF8String( 3509 FXJSE_Value_SetUTF8String(
3523 pArguments->GetReturnValue(), 3510 pArguments->GetReturnValue(),
3524 FX_UTF8Encode(wsAttributeValue, wsAttributeValue.GetLength()) 3511 FX_UTF8Encode(wsAttributeValue, wsAttributeValue.GetLength())
3525 .AsByteStringC()); 3512 .AsStringC());
3526 } else { 3513 } else {
3527 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 3514 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
3528 L"getAttribute"); 3515 L"getAttribute");
3529 } 3516 }
3530 } 3517 }
3531 void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { 3518 void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) {
3532 int32_t argc = pArguments->GetLength(); 3519 int32_t argc = pArguments->GetLength();
3533 if (argc == 2) { 3520 if (argc == 2) {
3534 CFX_ByteString bsValue = pArguments->GetUTF8String(0); 3521 CFX_ByteString bsValue = pArguments->GetUTF8String(0);
3535 CFX_ByteString bsName = pArguments->GetUTF8String(1); 3522 CFX_ByteString bsName = pArguments->GetUTF8String(1);
3536 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); 3523 CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
3537 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { 3524 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
3538 static_cast<CFDE_XMLElement*>(pXMLNode) 3525 static_cast<CFDE_XMLElement*>(pXMLNode)
3539 ->SetString(CFX_WideString::FromUTF8(bsName.AsByteStringC()), 3526 ->SetString(CFX_WideString::FromUTF8(bsName.AsStringC()),
3540 CFX_WideString::FromUTF8(bsValue.AsByteStringC())); 3527 CFX_WideString::FromUTF8(bsValue.AsStringC()));
3541 } 3528 }
3542 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 3529 FXJSE_Value_SetNull(pArguments->GetReturnValue());
3543 } else { 3530 } else {
3544 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 3531 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
3545 L"setAttribute"); 3532 L"setAttribute");
3546 } 3533 }
3547 } 3534 }
3548 void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { 3535 void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) {
3549 int32_t argc = pArguments->GetLength(); 3536 int32_t argc = pArguments->GetLength();
3550 if (argc == 1) { 3537 if (argc == 1) {
3551 CFX_ByteString bsName = pArguments->GetUTF8String(0); 3538 CFX_ByteString bsName = pArguments->GetUTF8String(0);
3552 CFX_WideString wsName = CFX_WideString::FromUTF8(bsName.AsByteStringC()); 3539 CFX_WideString wsName = CFX_WideString::FromUTF8(bsName.AsStringC());
3553 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); 3540 CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
3554 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { 3541 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
3555 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); 3542 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
3556 if (pXMLElement->HasAttribute(wsName)) { 3543 if (pXMLElement->HasAttribute(wsName)) {
3557 pXMLElement->RemoveAttribute(wsName); 3544 pXMLElement->RemoveAttribute(wsName);
3558 } 3545 }
3559 } 3546 }
3560 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 3547 FXJSE_Value_SetNull(pArguments->GetReturnValue());
3561 } else { 3548 } else {
3562 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 3549 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
3563 L"removeAttribute"); 3550 L"removeAttribute");
3564 } 3551 }
3565 } 3552 }
3566 void CXFA_Node::Script_Packet_Content(FXJSE_HVALUE hValue, 3553 void CXFA_Node::Script_Packet_Content(FXJSE_HVALUE hValue,
3567 FX_BOOL bSetting, 3554 FX_BOOL bSetting,
3568 XFA_ATTRIBUTE eAttribute) { 3555 XFA_ATTRIBUTE eAttribute) {
3569 if (bSetting) { 3556 if (bSetting) {
3570 CFX_ByteString bsNewContent; 3557 CFX_ByteString bsNewContent;
3571 FXJSE_Value_ToUTF8String(hValue, bsNewContent); 3558 FXJSE_Value_ToUTF8String(hValue, bsNewContent);
3572 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); 3559 CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
3573 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { 3560 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
3574 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); 3561 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
3575 pXMLElement->SetTextData( 3562 pXMLElement->SetTextData(
3576 CFX_WideString::FromUTF8(bsNewContent.AsByteStringC())); 3563 CFX_WideString::FromUTF8(bsNewContent.AsStringC()));
3577 } 3564 }
3578 } else { 3565 } else {
3579 CFX_WideString wsTextData; 3566 CFX_WideString wsTextData;
3580 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); 3567 CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
3581 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { 3568 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
3582 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); 3569 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
3583 pXMLElement->GetTextData(wsTextData); 3570 pXMLElement->GetTextData(wsTextData);
3584 } 3571 }
3585 FXJSE_Value_SetUTF8String( 3572 FXJSE_Value_SetUTF8String(
3586 hValue, 3573 hValue, FX_UTF8Encode(wsTextData, wsTextData.GetLength()).AsStringC());
3587 FX_UTF8Encode(wsTextData, wsTextData.GetLength()).AsByteStringC());
3588 } 3574 }
3589 } 3575 }
3590 void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) { 3576 void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) {
3591 int32_t argc = pArguments->GetLength(); 3577 int32_t argc = pArguments->GetLength();
3592 if (argc == 0) { 3578 if (argc == 0) {
3593 } else { 3579 } else {
3594 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"next"); 3580 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"next");
3595 } 3581 }
3596 } 3582 }
3597 void CXFA_Node::Script_Source_CancelBatch(CFXJSE_Arguments* pArguments) { 3583 void CXFA_Node::Script_Source_CancelBatch(CFXJSE_Arguments* pArguments) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3729 void CXFA_Node::Script_Extras_Type(FXJSE_HVALUE hValue, 3715 void CXFA_Node::Script_Extras_Type(FXJSE_HVALUE hValue,
3730 FX_BOOL bSetting, 3716 FX_BOOL bSetting,
3731 XFA_ATTRIBUTE eAttribute) {} 3717 XFA_ATTRIBUTE eAttribute) {}
3732 void CXFA_Node::Script_Script_Stateless(FXJSE_HVALUE hValue, 3718 void CXFA_Node::Script_Script_Stateless(FXJSE_HVALUE hValue,
3733 FX_BOOL bSetting, 3719 FX_BOOL bSetting,
3734 XFA_ATTRIBUTE eAttribute) { 3720 XFA_ATTRIBUTE eAttribute) {
3735 if (bSetting) { 3721 if (bSetting) {
3736 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 3722 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
3737 return; 3723 return;
3738 } 3724 }
3739 FXJSE_Value_SetUTF8String(hValue, 3725 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(FX_WSTRC(L"0")).AsStringC());
3740 FX_UTF8Encode(FX_WSTRC(L"0")).AsByteStringC());
3741 } 3726 }
3742 void CXFA_Node::Script_Encrypt_Format(FXJSE_HVALUE hValue, 3727 void CXFA_Node::Script_Encrypt_Format(FXJSE_HVALUE hValue,
3743 FX_BOOL bSetting, 3728 FX_BOOL bSetting,
3744 XFA_ATTRIBUTE eAttribute) {} 3729 XFA_ATTRIBUTE eAttribute) {}
3745 enum XFA_KEYTYPE { 3730 enum XFA_KEYTYPE {
3746 XFA_KEYTYPE_Custom, 3731 XFA_KEYTYPE_Custom,
3747 XFA_KEYTYPE_Element, 3732 XFA_KEYTYPE_Element,
3748 }; 3733 };
3749 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { 3734 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) {
3750 uint32_t dwKey = FX_HashCode_String_GetW(wsKey.c_str(), wsKey.GetLength()); 3735 uint32_t dwKey = FX_HashCode_String_GetW(wsKey.c_str(), wsKey.GetLength());
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
3950 FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, 3935 FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr,
3951 const CFX_WideString& wsValue, 3936 const CFX_WideString& wsValue,
3952 FX_BOOL bNotify, 3937 FX_BOOL bNotify,
3953 FX_BOOL bScriptModify) { 3938 FX_BOOL bScriptModify) {
3954 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); 3939 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
3955 OnChanging(eAttr, (void*)(const FX_WCHAR*)wsValue, bNotify); 3940 OnChanging(eAttr, (void*)(const FX_WCHAR*)wsValue, bNotify);
3956 if (eAttr == XFA_ATTRIBUTE_Value) { 3941 if (eAttr == XFA_ATTRIBUTE_Value) {
3957 CFX_WideString* pClone = new CFX_WideString(wsValue); 3942 CFX_WideString* pClone = new CFX_WideString(wsValue);
3958 SetUserData(pKey, pClone, &deleteWideStringCallBack); 3943 SetUserData(pKey, pClone, &deleteWideStringCallBack);
3959 } else { 3944 } else {
3960 SetMapModuleString(pKey, wsValue.AsWideStringC()); 3945 SetMapModuleString(pKey, wsValue.AsStringC());
3961 if (eAttr == XFA_ATTRIBUTE_Name) 3946 if (eAttr == XFA_ATTRIBUTE_Name)
3962 UpdateNameHash(); 3947 UpdateNameHash();
3963 } 3948 }
3964 OnChanged(eAttr, (void*)(const FX_WCHAR*)wsValue, bNotify, bScriptModify); 3949 OnChanged(eAttr, (void*)(const FX_WCHAR*)wsValue, bNotify, bScriptModify);
3965 if (IsNeedSavingXMLNode() && eAttr != XFA_ATTRIBUTE_QualifiedName && 3950 if (IsNeedSavingXMLNode() && eAttr != XFA_ATTRIBUTE_QualifiedName &&
3966 eAttr != XFA_ATTRIBUTE_BindingNode) { 3951 eAttr != XFA_ATTRIBUTE_BindingNode) {
3967 if (eAttr == XFA_ATTRIBUTE_Name && 3952 if (eAttr == XFA_ATTRIBUTE_Name &&
3968 (m_eNodeClass == XFA_ELEMENT_DataValue || 3953 (m_eNodeClass == XFA_ELEMENT_DataValue ||
3969 m_eNodeClass == XFA_ELEMENT_DataGroup)) { 3954 m_eNodeClass == XFA_ELEMENT_DataGroup)) {
3970 return TRUE; 3955 return TRUE;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 } 4292 }
4308 pBindNode = NULL; 4293 pBindNode = NULL;
4309 break; 4294 break;
4310 } 4295 }
4311 case XFA_OBJECTTYPE_ContentNode: { 4296 case XFA_OBJECTTYPE_ContentNode: {
4312 CFX_WideString wsContentType; 4297 CFX_WideString wsContentType;
4313 if (GetClassID() == XFA_ELEMENT_ExData) { 4298 if (GetClassID() == XFA_ELEMENT_ExData) {
4314 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); 4299 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE);
4315 if (wsContentType == FX_WSTRC(L"text/html")) { 4300 if (wsContentType == FX_WSTRC(L"text/html")) {
4316 wsContentType = FX_WSTRC(L""); 4301 wsContentType = FX_WSTRC(L"");
4317 SetAttribute(XFA_ATTRIBUTE_ContentType, 4302 SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType.AsStringC());
4318 wsContentType.AsWideStringC());
4319 } 4303 }
4320 } 4304 }
4321 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); 4305 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild);
4322 if (!pContentRawDataNode) { 4306 if (!pContentRawDataNode) {
4323 pContentRawDataNode = CreateSamePacketNode( 4307 pContentRawDataNode = CreateSamePacketNode(
4324 (wsContentType == FX_WSTRC(L"text/xml")) ? XFA_ELEMENT_Sharpxml 4308 (wsContentType == FX_WSTRC(L"text/xml")) ? XFA_ELEMENT_Sharpxml
4325 : XFA_ELEMENT_Sharptext); 4309 : XFA_ELEMENT_Sharptext);
4326 InsertChild(pContentRawDataNode); 4310 InsertChild(pContentRawDataNode);
4327 } 4311 }
4328 return pContentRawDataNode->SetScriptContent( 4312 return pContentRawDataNode->SetScriptContent(
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
5220 pDstModuleData->m_BufferMap.RemoveKey(pKey); 5204 pDstModuleData->m_BufferMap.RemoveKey(pKey);
5221 pDstModuleData->m_BufferMap.SetAt(pKey, 5205 pDstModuleData->m_BufferMap.SetAt(pKey,
5222 (XFA_MAPDATABLOCK*)pBufferBlockData); 5206 (XFA_MAPDATABLOCK*)pBufferBlockData);
5223 } 5207 }
5224 } 5208 }
5225 if (pDstModule->GetObjectType() == XFA_OBJECTTYPE_NodeV) { 5209 if (pDstModule->GetObjectType() == XFA_OBJECTTYPE_NodeV) {
5226 CFX_WideString wsValue = pDstModule->GetScriptContent(FALSE); 5210 CFX_WideString wsValue = pDstModule->GetScriptContent(FALSE);
5227 CFX_WideString wsFormatValue(wsValue); 5211 CFX_WideString wsFormatValue(wsValue);
5228 CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData(); 5212 CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData();
5229 if (pWidgetData) { 5213 if (pWidgetData) {
5230 pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), wsFormatValue); 5214 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatValue);
5231 } 5215 }
5232 pDstModule->SetScriptContent(wsValue, wsFormatValue, TRUE, TRUE); 5216 pDstModule->SetScriptContent(wsValue, wsFormatValue, TRUE, TRUE);
5233 } 5217 }
5234 } 5218 }
5235 void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule, 5219 void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule,
5236 CXFA_Node* pDstModule, 5220 CXFA_Node* pDstModule,
5237 void* pKey, 5221 void* pKey,
5238 FX_BOOL bRecursive) { 5222 FX_BOOL bRecursive) {
5239 if (!pSrcModule || !pDstModule || !pKey) { 5223 if (!pSrcModule || !pDstModule || !pKey) {
5240 return; 5224 return;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
5319 } 5303 }
5320 } else { 5304 } else {
5321 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"item"); 5305 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"item");
5322 } 5306 }
5323 } 5307 }
5324 void CXFA_NodeList::Script_TreelistClass_NamedItem( 5308 void CXFA_NodeList::Script_TreelistClass_NamedItem(
5325 CFXJSE_Arguments* pArguments) { 5309 CFXJSE_Arguments* pArguments) {
5326 int32_t argc = pArguments->GetLength(); 5310 int32_t argc = pArguments->GetLength();
5327 if (argc == 1) { 5311 if (argc == 1) {
5328 CFX_ByteString szName = pArguments->GetUTF8String(0); 5312 CFX_ByteString szName = pArguments->GetUTF8String(0);
5329 CXFA_Node* pNode = NamedItem( 5313 CXFA_Node* pNode =
5330 CFX_WideString::FromUTF8(szName.AsByteStringC()).AsWideStringC()); 5314 NamedItem(CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC());
5331 if (!pNode) { 5315 if (!pNode) {
5332 return; 5316 return;
5333 } 5317 }
5334 FXJSE_Value_Set(pArguments->GetReturnValue(), 5318 FXJSE_Value_Set(pArguments->GetReturnValue(),
5335 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); 5319 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode));
5336 } else { 5320 } else {
5337 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"namedItem"); 5321 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"namedItem");
5338 } 5322 }
5339 } 5323 }
5340 void CXFA_NodeList::Script_ListClass_Length(FXJSE_HVALUE hValue, 5324 void CXFA_NodeList::Script_ListClass_Length(FXJSE_HVALUE hValue,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
5417 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); 5401 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
5418 } 5402 }
5419 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { 5403 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
5420 return m_pAttachNode->RemoveChild(pNode); 5404 return m_pAttachNode->RemoveChild(pNode);
5421 } 5405 }
5422 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { 5406 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
5423 return m_pAttachNode->GetChild( 5407 return m_pAttachNode->GetChild(
5424 iIndex, XFA_ELEMENT_UNKNOWN, 5408 iIndex, XFA_ELEMENT_UNKNOWN,
5425 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5409 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
5426 } 5410 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_localevalue.cpp ('k') | xfa/fxfa/parser/xfa_parser_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698