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

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

Issue 1857073002: Make down-conversion explicit from CFX_Widetring to CFX_WideStringC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: String argument type 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_objectacc_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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 return; 641 return;
642 } 642 }
643 CXFA_Node* refNode = this; 643 CXFA_Node* refNode = this;
644 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { 644 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) {
645 refNode = ToNode(pScriptContext->GetThisObject()); 645 refNode = ToNode(pScriptContext->GetThisObject());
646 } 646 }
647 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | 647 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes |
648 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | 648 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
649 XFA_RESOLVENODE_Siblings; 649 XFA_RESOLVENODE_Siblings;
650 XFA_RESOLVENODE_RS resoveNodeRS; 650 XFA_RESOLVENODE_RS resoveNodeRS;
651 int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, 651 int32_t iRet = pScriptContext->ResolveObjects(
652 resoveNodeRS, dwFlag); 652 refNode, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag);
653 if (iRet < 1) { 653 if (iRet < 1) {
654 return FXJSE_Value_SetNull(pArguments->GetReturnValue()); 654 return FXJSE_Value_SetNull(pArguments->GetReturnValue());
655 } 655 }
656 FXJSE_HVALUE hValue = NULL; 656 FXJSE_HVALUE hValue = NULL;
657 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { 657 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
658 CXFA_Object* pNode = resoveNodeRS.nodes[0]; 658 CXFA_Object* pNode = resoveNodeRS.nodes[0];
659 hValue = pScriptContext->GetJSValueFromMap(pNode); 659 hValue = pScriptContext->GetJSValueFromMap(pNode);
660 FXJSE_Value_Set(pArguments->GetReturnValue(), hValue); 660 FXJSE_Value_Set(pArguments->GetReturnValue(), hValue);
661 } else { 661 } else {
662 const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = 662 const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 uint32_t dwFlag, 701 uint32_t dwFlag,
702 CXFA_Node* refNode) { 702 CXFA_Node* refNode) {
703 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 703 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
704 if (!pScriptContext) { 704 if (!pScriptContext) {
705 return; 705 return;
706 } 706 }
707 XFA_RESOLVENODE_RS resoveNodeRS; 707 XFA_RESOLVENODE_RS resoveNodeRS;
708 if (refNode == NULL) { 708 if (refNode == NULL) {
709 refNode = this; 709 refNode = this;
710 } 710 }
711 pScriptContext->ResolveObjects(refNode, wsExpression, resoveNodeRS, dwFlag); 711 pScriptContext->ResolveObjects(refNode, wsExpression.AsWideStringC(),
712 resoveNodeRS, dwFlag);
712 CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument); 713 CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument);
713 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { 714 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
714 for (int32_t i = 0; i < resoveNodeRS.nodes.GetSize(); i++) { 715 for (int32_t i = 0; i < resoveNodeRS.nodes.GetSize(); i++) {
715 if (resoveNodeRS.nodes[i]->IsNode()) 716 if (resoveNodeRS.nodes[i]->IsNode())
716 pNodeList->Append(resoveNodeRS.nodes[i]->AsNode()); 717 pNodeList->Append(resoveNodeRS.nodes[i]->AsNode());
717 } 718 }
718 } else { 719 } else {
719 CXFA_HVALUEArray hValueArray(pScriptContext->GetRuntime()); 720 CXFA_HVALUEArray hValueArray(pScriptContext->GetRuntime());
720 if (resoveNodeRS.GetAttributeResult(hValueArray) > 0) { 721 if (resoveNodeRS.GetAttributeResult(hValueArray) > 0) {
721 CXFA_ObjArray objectArray; 722 CXFA_ObjArray objectArray;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 if (iLength != 1) { 872 if (iLength != 1) {
872 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 873 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
873 L"getAttribute"); 874 L"getAttribute");
874 return; 875 return;
875 } 876 }
876 CFX_WideString wsExpression; 877 CFX_WideString wsExpression;
877 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 878 CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
878 wsExpression = 879 wsExpression =
879 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); 880 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength());
880 CFX_WideString wsValue; 881 CFX_WideString wsValue;
881 GetAttribute(wsExpression, wsValue); 882 GetAttribute(wsExpression.AsWideStringC(), wsValue);
882 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 883 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
883 if (hValue) { 884 if (hValue) {
884 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); 885 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC());
885 } 886 }
886 } 887 }
887 void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { 888 void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) {
888 int32_t iLength = pArguments->GetLength(); 889 int32_t iLength = pArguments->GetLength();
889 if (iLength < 1 || iLength > 2) { 890 if (iLength < 1 || iLength > 2) {
890 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getElement"); 891 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getElement");
891 return; 892 return;
892 } 893 }
893 CFX_WideString wsExpression; 894 CFX_WideString wsExpression;
894 int32_t iValue = 0; 895 int32_t iValue = 0;
895 if (iLength >= 1) { 896 if (iLength >= 1) {
896 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 897 CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
897 wsExpression = 898 wsExpression =
898 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); 899 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength());
899 } 900 }
900 if (iLength >= 2) { 901 if (iLength >= 2) {
901 iValue = pArguments->GetInt32(1); 902 iValue = pArguments->GetInt32(1);
902 } 903 }
903 const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression); 904 const XFA_ELEMENTINFO* pElementInfo =
905 XFA_GetElementByName(wsExpression.AsWideStringC());
904 CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName); 906 CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName);
905 FXJSE_Value_Set(pArguments->GetReturnValue(), 907 FXJSE_Value_Set(pArguments->GetReturnValue(),
906 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); 908 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode));
907 } 909 }
908 void CXFA_Node::Script_NodeClass_IsPropertySpecified( 910 void CXFA_Node::Script_NodeClass_IsPropertySpecified(
909 CFXJSE_Arguments* pArguments) { 911 CFXJSE_Arguments* pArguments) {
910 int32_t iLength = pArguments->GetLength(); 912 int32_t iLength = pArguments->GetLength();
911 if (iLength < 1 || iLength > 3) { 913 if (iLength < 1 || iLength > 3) {
912 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 914 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
913 L"isPropertySpecified"); 915 L"isPropertySpecified");
914 return; 916 return;
915 } 917 }
916 CFX_WideString wsExpression; 918 CFX_WideString wsExpression;
917 FX_BOOL bParent = TRUE; 919 FX_BOOL bParent = TRUE;
918 int32_t iIndex = 0; 920 int32_t iIndex = 0;
919 if (iLength >= 1) { 921 if (iLength >= 1) {
920 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); 922 CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
921 wsExpression = 923 wsExpression =
922 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); 924 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength());
923 } 925 }
924 if (iLength >= 2) { 926 if (iLength >= 2) {
925 bParent = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; 927 bParent = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;
926 } 928 }
927 if (iLength >= 3) { 929 if (iLength >= 3) {
928 iIndex = pArguments->GetInt32(2); 930 iIndex = pArguments->GetInt32(2);
929 } 931 }
930 FX_BOOL bHas = FALSE; 932 FX_BOOL bHas = FALSE;
931 const XFA_ATTRIBUTEINFO* pAttributeInfo = 933 const XFA_ATTRIBUTEINFO* pAttributeInfo =
932 XFA_GetAttributeByName(wsExpression); 934 XFA_GetAttributeByName(wsExpression.AsWideStringC());
933 CFX_WideString wsValue; 935 CFX_WideString wsValue;
934 if (pAttributeInfo) { 936 if (pAttributeInfo) {
935 bHas = HasAttribute(pAttributeInfo->eName); 937 bHas = HasAttribute(pAttributeInfo->eName);
936 } 938 }
937 if (!bHas) { 939 if (!bHas) {
938 const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression); 940 const XFA_ELEMENTINFO* pElementInfo =
941 XFA_GetElementByName(wsExpression.AsWideStringC());
939 bHas = (GetProperty(iIndex, pElementInfo->eName) != NULL); 942 bHas = (GetProperty(iIndex, pElementInfo->eName) != NULL);
940 } 943 }
941 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 944 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
942 if (hValue) { 945 if (hValue) {
943 FXJSE_Value_SetBoolean(hValue, bHas); 946 FXJSE_Value_SetBoolean(hValue, bHas);
944 } 947 }
945 } 948 }
946 void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { 949 void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
947 int32_t iLength = pArguments->GetLength(); 950 int32_t iLength = pArguments->GetLength();
948 if (iLength < 1 || iLength > 3) { 951 if (iLength < 1 || iLength > 3) {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 L"setAttribute"); 1154 L"setAttribute");
1152 return; 1155 return;
1153 } 1156 }
1154 CFX_WideString wsAttribute; 1157 CFX_WideString wsAttribute;
1155 CFX_WideString wsAttributeValue; 1158 CFX_WideString wsAttributeValue;
1156 CFX_ByteString bsAttributeValue = pArguments->GetUTF8String(0); 1159 CFX_ByteString bsAttributeValue = pArguments->GetUTF8String(0);
1157 CFX_ByteString bsAttribute = pArguments->GetUTF8String(1); 1160 CFX_ByteString bsAttribute = pArguments->GetUTF8String(1);
1158 wsAttributeValue = 1161 wsAttributeValue =
1159 CFX_WideString::FromUTF8(bsAttributeValue, bsAttributeValue.GetLength()); 1162 CFX_WideString::FromUTF8(bsAttributeValue, bsAttributeValue.GetLength());
1160 wsAttribute = CFX_WideString::FromUTF8(bsAttribute, bsAttribute.GetLength()); 1163 wsAttribute = CFX_WideString::FromUTF8(bsAttribute, bsAttribute.GetLength());
1161 SetAttribute(wsAttribute, wsAttributeValue, TRUE); 1164 SetAttribute(wsAttribute.AsWideStringC(), wsAttributeValue.AsWideStringC(),
1165 TRUE);
1162 } 1166 }
1163 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { 1167 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) {
1164 int32_t iLength = pArguments->GetLength(); 1168 int32_t iLength = pArguments->GetLength();
1165 if (iLength != 1 && iLength != 2) { 1169 if (iLength != 1 && iLength != 2) {
1166 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement"); 1170 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement");
1167 return; 1171 return;
1168 } 1172 }
1169 CXFA_Node* pNode = NULL; 1173 CXFA_Node* pNode = NULL;
1170 CFX_WideString wsName; 1174 CFX_WideString wsName;
1171 if (iLength >= 1) { 1175 if (iLength >= 1) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 } 1480 }
1477 } 1481 }
1478 void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, 1482 void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue,
1479 FX_BOOL bSetting, 1483 FX_BOOL bSetting,
1480 XFA_ATTRIBUTE eAttribute) { 1484 XFA_ATTRIBUTE eAttribute) {
1481 if (bSetting) { 1485 if (bSetting) {
1482 CFX_ByteString szValue; 1486 CFX_ByteString szValue;
1483 FXJSE_Value_ToUTF8String(hValue, szValue); 1487 FXJSE_Value_ToUTF8String(hValue, szValue);
1484 CFX_WideString wsValue = 1488 CFX_WideString wsValue =
1485 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); 1489 CFX_WideString::FromUTF8(szValue, szValue.GetLength());
1486 SetAttribute(eAttribute, wsValue, TRUE); 1490 SetAttribute(eAttribute, wsValue.AsWideStringC(), TRUE);
1487 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) { 1491 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) {
1488 CFX_WideString wsUseVal = wsValue, wsID, wsSOM; 1492 CFX_WideString wsUseVal = wsValue, wsID, wsSOM;
1489 CXFA_Node* pTemplateNode = 1493 CXFA_Node* pTemplateNode =
1490 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); 1494 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template));
1491 CXFA_Node* pProtoRoot = 1495 CXFA_Node* pProtoRoot =
1492 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform) 1496 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform)
1493 ->GetFirstChildByClass(XFA_ELEMENT_Proto); 1497 ->GetFirstChildByClass(XFA_ELEMENT_Proto);
1494 if (!wsUseVal.IsEmpty()) { 1498 if (!wsUseVal.IsEmpty()) {
1495 if (wsUseVal[0] == '#') { 1499 if (wsUseVal[0] == '#') {
1496 wsID = CFX_WideString((const FX_WCHAR*)wsUseVal + 1, 1500 wsID = CFX_WideString((const FX_WCHAR*)wsUseVal + 1,
1497 wsUseVal.GetLength() - 1); 1501 wsUseVal.GetLength() - 1);
1498 } else { 1502 } else {
1499 wsSOM = 1503 wsSOM =
1500 CFX_WideString((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength()); 1504 CFX_WideString((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength());
1501 } 1505 }
1502 } 1506 }
1503 CXFA_Node* pProtoNode = NULL; 1507 CXFA_Node* pProtoNode = NULL;
1504 if (!wsSOM.IsEmpty()) { 1508 if (!wsSOM.IsEmpty()) {
1505 uint32_t dwFlag = XFA_RESOLVENODE_Children | 1509 uint32_t dwFlag = XFA_RESOLVENODE_Children |
1506 XFA_RESOLVENODE_Attributes | 1510 XFA_RESOLVENODE_Attributes |
1507 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | 1511 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
1508 XFA_RESOLVENODE_Siblings; 1512 XFA_RESOLVENODE_Siblings;
1509 XFA_RESOLVENODE_RS resoveNodeRS; 1513 XFA_RESOLVENODE_RS resoveNodeRS;
1510 int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects( 1514 int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects(
1511 pProtoRoot, wsSOM, resoveNodeRS, dwFlag); 1515 pProtoRoot, wsSOM.AsWideStringC(), resoveNodeRS, dwFlag);
1512 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { 1516 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) {
1513 pProtoNode = resoveNodeRS.nodes[0]->AsNode(); 1517 pProtoNode = resoveNodeRS.nodes[0]->AsNode();
1514 } 1518 }
1515 } else if (!wsID.IsEmpty()) { 1519 } else if (!wsID.IsEmpty()) {
1516 pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID); 1520 pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID.AsWideStringC());
1517 } 1521 }
1518 if (pProtoNode) { 1522 if (pProtoNode) {
1519 CXFA_Node* pHeadChild = GetNodeItem(XFA_NODEITEM_FirstChild); 1523 CXFA_Node* pHeadChild = GetNodeItem(XFA_NODEITEM_FirstChild);
1520 while (pHeadChild) { 1524 while (pHeadChild) {
1521 CXFA_Node* pSibling = 1525 CXFA_Node* pSibling =
1522 pHeadChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1526 pHeadChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1523 RemoveChild(pHeadChild); 1527 RemoveChild(pHeadChild);
1524 pHeadChild = pSibling; 1528 pHeadChild = pSibling;
1525 } 1529 }
1526 CXFA_Node* pProtoForm = pProtoNode->CloneTemplateToForm(TRUE); 1530 CXFA_Node* pProtoForm = pProtoNode->CloneTemplateToForm(TRUE);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 } 1698 }
1695 if (!wsPicture.IsEmpty()) { 1699 if (!wsPicture.IsEmpty()) {
1696 break; 1700 break;
1697 } 1701 }
1698 pContainerWidgetData = NULL; 1702 pContainerWidgetData = NULL;
1699 } 1703 }
1700 } else if (GetPacketID() == XFA_XDPPACKET_Form) { 1704 } else if (GetPacketID() == XFA_XDPPACKET_Form) {
1701 pContainerWidgetData = GetContainerWidgetData(); 1705 pContainerWidgetData = GetContainerWidgetData();
1702 } 1706 }
1703 if (pContainerWidgetData) { 1707 if (pContainerWidgetData) {
1704 pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); 1708 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsWideStringC(),
1709 wsFormatValue);
1705 } 1710 }
1706 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); 1711 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
1707 } else { 1712 } else {
1708 CFX_WideString content = GetScriptContent(TRUE); 1713 CFX_WideString content = GetScriptContent(TRUE);
1709 if (content.IsEmpty() && classID != XFA_ELEMENT_Text && 1714 if (content.IsEmpty() && classID != XFA_ELEMENT_Text &&
1710 classID != XFA_ELEMENT_SubmitUrl) { 1715 classID != XFA_ELEMENT_SubmitUrl) {
1711 FXJSE_Value_SetNull(hValue); 1716 FXJSE_Value_SetNull(hValue);
1712 } else if (classID == XFA_ELEMENT_Integer) { 1717 } else if (classID == XFA_ELEMENT_Integer) {
1713 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); 1718 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content));
1714 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { 1719 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) {
1715 CFX_Decimal decimal(content); 1720 CFX_Decimal decimal(content.AsWideStringC());
1716 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); 1721 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
1717 } else { 1722 } else {
1718 FXJSE_Value_SetUTF8String( 1723 FXJSE_Value_SetUTF8String(
1719 hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); 1724 hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC());
1720 } 1725 }
1721 } 1726 }
1722 } 1727 }
1723 void CXFA_Node::Script_Som_DefaultValue_Read(FXJSE_HVALUE hValue, 1728 void CXFA_Node::Script_Som_DefaultValue_Read(FXJSE_HVALUE hValue,
1724 FX_BOOL bSetting, 1729 FX_BOOL bSetting,
1725 XFA_ATTRIBUTE eAttribute) { 1730 XFA_ATTRIBUTE eAttribute) {
(...skipping 15 matching lines...) Expand all
1741 if (bSetting) { 1746 if (bSetting) {
1742 CFX_ByteString newValue; 1747 CFX_ByteString newValue;
1743 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { 1748 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) {
1744 FXJSE_Value_ToUTF8String(hValue, newValue); 1749 FXJSE_Value_ToUTF8String(hValue, newValue);
1745 } 1750 }
1746 int32_t iValue = FXSYS_atoi(newValue); 1751 int32_t iValue = FXSYS_atoi(newValue);
1747 CFX_WideString wsNewValue = (iValue == 0) ? FX_WSTRC(L"0") : FX_WSTRC(L"1"); 1752 CFX_WideString wsNewValue = (iValue == 0) ? FX_WSTRC(L"0") : FX_WSTRC(L"1");
1748 CFX_WideString wsFormatValue(wsNewValue); 1753 CFX_WideString wsFormatValue(wsNewValue);
1749 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); 1754 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
1750 if (pContainerWidgetData) { 1755 if (pContainerWidgetData) {
1751 pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); 1756 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsWideStringC(),
1757 wsFormatValue);
1752 } 1758 }
1753 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); 1759 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
1754 } else { 1760 } else {
1755 CFX_WideString wsValue = GetScriptContent(TRUE); 1761 CFX_WideString wsValue = GetScriptContent(TRUE);
1756 FXJSE_Value_SetBoolean(hValue, wsValue == FX_WSTRC(L"1")); 1762 FXJSE_Value_SetBoolean(hValue, wsValue == FX_WSTRC(L"1"));
1757 } 1763 }
1758 } 1764 }
1759 struct XFA_ExecEventParaInfo { 1765 struct XFA_ExecEventParaInfo {
1760 public: 1766 public:
1761 uint32_t m_uHash; 1767 uint32_t m_uHash;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 } 1890 }
1885 CXFA_Border border = pWidgetData->GetBorder(TRUE); 1891 CXFA_Border border = pWidgetData->GetBorder(TRUE);
1886 int32_t iSize = border.CountEdges(); 1892 int32_t iSize = border.CountEdges();
1887 CFX_WideString wsThickness; 1893 CFX_WideString wsThickness;
1888 if (bSetting) { 1894 if (bSetting) {
1889 CFX_ByteString bsValue; 1895 CFX_ByteString bsValue;
1890 FXJSE_Value_ToUTF8String(hValue, bsValue); 1896 FXJSE_Value_ToUTF8String(hValue, bsValue);
1891 wsThickness = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); 1897 wsThickness = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength());
1892 for (int32_t i = 0; i < iSize; ++i) { 1898 for (int32_t i = 0; i < iSize; ++i) {
1893 CXFA_Edge edge = border.GetEdge(i); 1899 CXFA_Edge edge = border.GetEdge(i);
1894 CXFA_Measurement thickness(wsThickness); 1900 CXFA_Measurement thickness(wsThickness.AsWideStringC());
1895 edge.SetMSThickness(thickness); 1901 edge.SetMSThickness(thickness);
1896 } 1902 }
1897 } else { 1903 } else {
1898 CXFA_Edge edge = border.GetEdge(0); 1904 CXFA_Edge edge = border.GetEdge(0);
1899 CXFA_Measurement thickness = edge.GetMSThickness(); 1905 CXFA_Measurement thickness = edge.GetMSThickness();
1900 thickness.ToString(wsThickness); 1906 thickness.ToString(wsThickness);
1901 FXJSE_Value_SetUTF8String(hValue, 1907 FXJSE_Value_SetUTF8String(hValue,
1902 FX_UTF8Encode(wsThickness).AsByteStringC()); 1908 FX_UTF8Encode(wsThickness).AsByteStringC());
1903 } 1909 }
1904 } 1910 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 if (pUIChild->GetClassID() == XFA_ELEMENT_NumericEdit) { 2007 if (pUIChild->GetClassID() == XFA_ELEMENT_NumericEdit) {
2002 int32_t iLeadDigits = 0; 2008 int32_t iLeadDigits = 0;
2003 int32_t iFracDigits = 0; 2009 int32_t iFracDigits = 0;
2004 pWidgetData->GetLeadDigits(iLeadDigits); 2010 pWidgetData->GetLeadDigits(iLeadDigits);
2005 pWidgetData->GetFracDigits(iFracDigits); 2011 pWidgetData->GetFracDigits(iFracDigits);
2006 wsNewText = XFA_NumericLimit(wsNewText, iLeadDigits, iFracDigits); 2012 wsNewText = XFA_NumericLimit(wsNewText, iLeadDigits, iFracDigits);
2007 } 2013 }
2008 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); 2014 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
2009 CFX_WideString wsFormatText(wsNewText); 2015 CFX_WideString wsFormatText(wsNewText);
2010 if (pContainerWidgetData) { 2016 if (pContainerWidgetData) {
2011 pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText); 2017 pContainerWidgetData->GetFormatDataValue(wsNewText.AsWideStringC(),
2018 wsFormatText);
2012 } 2019 }
2013 SetScriptContent(wsNewText, wsFormatText, TRUE, TRUE); 2020 SetScriptContent(wsNewText, wsFormatText, TRUE, TRUE);
2014 } else { 2021 } else {
2015 CFX_WideString content = GetScriptContent(TRUE); 2022 CFX_WideString content = GetScriptContent(TRUE);
2016 if (content.IsEmpty()) { 2023 if (content.IsEmpty()) {
2017 FXJSE_Value_SetNull(hValue); 2024 FXJSE_Value_SetNull(hValue);
2018 } else { 2025 } else {
2019 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); 2026 CXFA_Node* pUIChild = pWidgetData->GetUIChild();
2020 XFA_ELEMENT eUI = pUIChild->GetClassID(); 2027 XFA_ELEMENT eUI = pUIChild->GetClassID();
2021 CXFA_Value defVal = pWidgetData->GetFormValue(); 2028 CXFA_Value defVal = pWidgetData->GetFormValue();
2022 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); 2029 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild);
2023 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Decimal) { 2030 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Decimal) {
2024 if (eUI == XFA_ELEMENT_NumericEdit && 2031 if (eUI == XFA_ELEMENT_NumericEdit &&
2025 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { 2032 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) {
2026 FXJSE_Value_SetUTF8String( 2033 FXJSE_Value_SetUTF8String(
2027 hValue, 2034 hValue,
2028 FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); 2035 FX_UTF8Encode(content, content.GetLength()).AsByteStringC());
2029 } else { 2036 } else {
2030 CFX_Decimal decimal(content); 2037 CFX_Decimal decimal(content.AsWideStringC());
2031 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); 2038 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
2032 } 2039 }
2033 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) { 2040 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) {
2034 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); 2041 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content));
2035 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) { 2042 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) {
2036 FXJSE_Value_SetBoolean(hValue, FXSYS_wtoi(content) == 0 ? FALSE : TRUE); 2043 FXJSE_Value_SetBoolean(hValue, FXSYS_wtoi(content) == 0 ? FALSE : TRUE);
2037 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) { 2044 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) {
2038 CFX_Decimal decimal(content); 2045 CFX_Decimal decimal(content.AsWideStringC());
2039 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); 2046 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
2040 } else { 2047 } else {
2041 FXJSE_Value_SetUTF8String( 2048 FXJSE_Value_SetUTF8String(
2042 hValue, 2049 hValue,
2043 FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); 2050 FX_UTF8Encode(content, content.GetLength()).AsByteStringC());
2044 } 2051 }
2045 } 2052 }
2046 } 2053 }
2047 } 2054 }
2048 void CXFA_Node::Script_Field_EditValue(FXJSE_HVALUE hValue, 2055 void CXFA_Node::Script_Field_EditValue(FXJSE_HVALUE hValue,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 if (!pWidgetData) { 2183 if (!pWidgetData) {
2177 return; 2184 return;
2178 } 2185 }
2179 pWidgetData->DeleteItem(-1, TRUE); 2186 pWidgetData->DeleteItem(-1, TRUE);
2180 } 2187 }
2181 void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { 2188 void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) {
2182 int32_t argc = pArguments->GetLength(); 2189 int32_t argc = pArguments->GetLength();
2183 if (argc == 1) { 2190 if (argc == 1) {
2184 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2191 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2185 int32_t iRet = execSingleEventByName( 2192 int32_t iRet = execSingleEventByName(
2186 CFX_WideString::FromUTF8(eventString, eventString.GetLength()), 2193 CFX_WideString::FromUTF8(eventString, eventString.GetLength())
2194 .AsWideStringC(),
2187 XFA_ELEMENT_Field); 2195 XFA_ELEMENT_Field);
2188 if (eventString == "validate") { 2196 if (eventString == "validate") {
2189 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), 2197 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(),
2190 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); 2198 ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE));
2191 } 2199 }
2192 } else { 2200 } else {
2193 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2201 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2194 } 2202 }
2195 } 2203 }
2196 void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) { 2204 void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 return; 2264 return;
2257 } 2265 }
2258 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2266 CXFA_WidgetData* pWidgetData = GetWidgetData();
2259 if (!pWidgetData) { 2267 if (!pWidgetData) {
2260 return; 2268 return;
2261 } 2269 }
2262 CFX_ByteString bsValue = pArguments->GetUTF8String(0); 2270 CFX_ByteString bsValue = pArguments->GetUTF8String(0);
2263 CFX_WideString wsValue = 2271 CFX_WideString wsValue =
2264 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); 2272 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength());
2265 CFX_WideString wsBoundValue; 2273 CFX_WideString wsBoundValue;
2266 pWidgetData->GetItemValue(wsValue, wsBoundValue); 2274 pWidgetData->GetItemValue(wsValue.AsWideStringC(), wsBoundValue);
2267 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 2275 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
2268 if (hValue) { 2276 if (hValue) {
2269 FXJSE_Value_SetUTF8String(hValue, 2277 FXJSE_Value_SetUTF8String(hValue,
2270 FX_UTF8Encode(wsBoundValue).AsByteStringC()); 2278 FX_UTF8Encode(wsBoundValue).AsByteStringC());
2271 } 2279 }
2272 } 2280 }
2273 void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { 2281 void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) {
2274 int32_t iLength = pArguments->GetLength(); 2282 int32_t iLength = pArguments->GetLength();
2275 if (iLength != 1) { 2283 if (iLength != 1) {
2276 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 2284 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2400 FX_BOOL bSetting, 2408 FX_BOOL bSetting,
2401 XFA_ATTRIBUTE eAttribute) { 2409 XFA_ATTRIBUTE eAttribute) {
2402 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2410 CXFA_WidgetData* pWidgetData = GetWidgetData();
2403 if (!pWidgetData) { 2411 if (!pWidgetData) {
2404 return; 2412 return;
2405 } 2413 }
2406 if (bSetting) { 2414 if (bSetting) {
2407 CFX_ByteString bsValue; 2415 CFX_ByteString bsValue;
2408 FXJSE_Value_ToUTF8String(hValue, bsValue); 2416 FXJSE_Value_ToUTF8String(hValue, bsValue);
2409 pWidgetData->SetSelectedMemberByValue( 2417 pWidgetData->SetSelectedMemberByValue(
2410 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()), TRUE, TRUE); 2418 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()).AsWideStringC(),
2419 TRUE, TRUE);
2411 } else { 2420 } else {
2412 CFX_WideString wsValue = GetScriptContent(TRUE); 2421 CFX_WideString wsValue = GetScriptContent(TRUE);
2413 XFA_VERSION curVersion = GetDocument()->GetCurVersionMode(); 2422 XFA_VERSION curVersion = GetDocument()->GetCurVersionMode();
2414 if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) { 2423 if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) {
2415 FXJSE_Value_SetNull(hValue); 2424 FXJSE_Value_SetNull(hValue);
2416 } else { 2425 } else {
2417 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); 2426 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC());
2418 } 2427 }
2419 } 2428 }
2420 } 2429 }
2421 void CXFA_Node::Script_ExclGroup_Transient(FXJSE_HVALUE hValue, 2430 void CXFA_Node::Script_ExclGroup_Transient(FXJSE_HVALUE hValue,
2422 FX_BOOL bSetting, 2431 FX_BOOL bSetting,
2423 XFA_ATTRIBUTE eAttribute) {} 2432 XFA_ATTRIBUTE eAttribute) {}
2424 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { 2433 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) {
2425 int32_t argc = pArguments->GetLength(); 2434 int32_t argc = pArguments->GetLength();
2426 if (argc == 1) { 2435 if (argc == 1) {
2427 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2436 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2428 execSingleEventByName( 2437 execSingleEventByName(
2429 CFX_WideString::FromUTF8(eventString, eventString.GetLength()), 2438 CFX_WideString::FromUTF8(eventString, eventString.GetLength())
2439 .AsWideStringC(),
2430 XFA_ELEMENT_ExclGroup); 2440 XFA_ELEMENT_ExclGroup);
2431 } else { 2441 } else {
2432 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2442 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2433 } 2443 }
2434 } 2444 }
2435 void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { 2445 void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) {
2436 int32_t argc = pArguments->GetLength(); 2446 int32_t argc = pArguments->GetLength();
2437 if ((argc == 0) || (argc == 1)) { 2447 if ((argc == 0) || (argc == 1)) {
2438 CXFA_WidgetData* pWidgetData = GetWidgetData(); 2448 CXFA_WidgetData* pWidgetData = GetWidgetData();
2439 if (!pWidgetData) { 2449 if (!pWidgetData) {
2440 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2450 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2441 } else { 2451 } else {
2442 CXFA_Node* pReturnNode = NULL; 2452 CXFA_Node* pReturnNode = NULL;
2443 if (argc == 0) { 2453 if (argc == 0) {
2444 pReturnNode = pWidgetData->GetSelectedMember(); 2454 pReturnNode = pWidgetData->GetSelectedMember();
2445 } else { 2455 } else {
2446 CFX_ByteString szName; 2456 CFX_ByteString szName;
2447 szName = pArguments->GetUTF8String(0); 2457 szName = pArguments->GetUTF8String(0);
2448 pReturnNode = pWidgetData->SetSelectedMember( 2458 pReturnNode = pWidgetData->SetSelectedMember(
2449 CFX_WideString::FromUTF8(szName, szName.GetLength())); 2459 CFX_WideString::FromUTF8(szName, szName.GetLength())
2460 .AsWideStringC());
2450 } 2461 }
2451 if (pReturnNode) { 2462 if (pReturnNode) {
2452 FXJSE_Value_Set( 2463 FXJSE_Value_Set(
2453 pArguments->GetReturnValue(), 2464 pArguments->GetReturnValue(),
2454 m_pDocument->GetScriptContext()->GetJSValueFromMap(pReturnNode)); 2465 m_pDocument->GetScriptContext()->GetJSValueFromMap(pReturnNode));
2455 } else { 2466 } else {
2456 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2467 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2457 } 2468 }
2458 } 2469 }
2459 } else { 2470 } else {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2615 FXJSE_Value_SetUTF8String( 2626 FXJSE_Value_SetUTF8String(
2616 hValue, 2627 hValue,
2617 FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength()).AsByteStringC()); 2628 FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength()).AsByteStringC());
2618 } 2629 }
2619 } 2630 }
2620 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { 2631 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) {
2621 int32_t argc = pArguments->GetLength(); 2632 int32_t argc = pArguments->GetLength();
2622 if (argc == 1) { 2633 if (argc == 1) {
2623 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2634 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2624 execSingleEventByName( 2635 execSingleEventByName(
2625 CFX_WideString::FromUTF8(eventString, eventString.GetLength()), 2636 CFX_WideString::FromUTF8(eventString, eventString.GetLength())
2637 .AsWideStringC(),
2626 XFA_ELEMENT_Subform); 2638 XFA_ELEMENT_Subform);
2627 } else { 2639 } else {
2628 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2640 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2629 } 2641 }
2630 } 2642 }
2631 void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { 2643 void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) {
2632 int32_t argc = pArguments->GetLength(); 2644 int32_t argc = pArguments->GetLength();
2633 if (argc == 0) { 2645 if (argc == 0) {
2634 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2646 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2635 if (!pNotify) { 2647 if (!pNotify) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2731 strTagName = CFX_WideString::FromUTF8(bsTagName, bsTagName.GetLength()); 2743 strTagName = CFX_WideString::FromUTF8(bsTagName, bsTagName.GetLength());
2732 if (argc > 1) { 2744 if (argc > 1) {
2733 CFX_ByteString bsName = pArguments->GetUTF8String(1); 2745 CFX_ByteString bsName = pArguments->GetUTF8String(1);
2734 strName = CFX_WideString::FromUTF8(bsName, bsName.GetLength()); 2746 strName = CFX_WideString::FromUTF8(bsName, bsName.GetLength());
2735 if (argc == 3) { 2747 if (argc == 3) {
2736 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(2); 2748 CFX_ByteString bsNameSpace = pArguments->GetUTF8String(2);
2737 strNameSpace = 2749 strNameSpace =
2738 CFX_WideString::FromUTF8(bsNameSpace, bsNameSpace.GetLength()); 2750 CFX_WideString::FromUTF8(bsNameSpace, bsNameSpace.GetLength());
2739 } 2751 }
2740 } 2752 }
2741 const XFA_ELEMENTINFO* pElement = XFA_GetElementByName(strTagName); 2753 const XFA_ELEMENTINFO* pElement =
2754 XFA_GetElementByName(strTagName.AsWideStringC());
2742 CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName); 2755 CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName);
2743 if (!pNewNode) { 2756 if (!pNewNode) {
2744 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2757 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2745 } else { 2758 } else {
2746 if (!strName.IsEmpty()) { 2759 if (!strName.IsEmpty()) {
2747 if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name, 2760 if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name,
2748 XFA_XDPPACKET_UNKNOWN)) { 2761 XFA_XDPPACKET_UNKNOWN)) {
2749 pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName, TRUE); 2762 pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsWideStringC(),
2763 TRUE);
2750 if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) { 2764 if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) {
2751 pNewNode->CreateXMLMappingNode(); 2765 pNewNode->CreateXMLMappingNode();
2752 } 2766 }
2753 FXJSE_Value_Set( 2767 FXJSE_Value_Set(
2754 pArguments->GetReturnValue(), 2768 pArguments->GetReturnValue(),
2755 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode)); 2769 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode));
2756 } else { 2770 } else {
2757 ThrowScriptErrorMessage(XFA_IDS_NOT_HAVE_PROPERTY, 2771 ThrowScriptErrorMessage(XFA_IDS_NOT_HAVE_PROPERTY,
2758 (const FX_WCHAR*)strTagName, L"name"); 2772 (const FX_WCHAR*)strTagName, L"name");
2759 } 2773 }
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
3497 L"execValidate"); 3511 L"execValidate");
3498 } 3512 }
3499 } 3513 }
3500 void CXFA_Node::Script_Form_Checksum(FXJSE_HVALUE hValue, 3514 void CXFA_Node::Script_Form_Checksum(FXJSE_HVALUE hValue,
3501 FX_BOOL bSetting, 3515 FX_BOOL bSetting,
3502 XFA_ATTRIBUTE eAttribute) { 3516 XFA_ATTRIBUTE eAttribute) {
3503 if (bSetting) { 3517 if (bSetting) {
3504 CFX_ByteString bsChecksum; 3518 CFX_ByteString bsChecksum;
3505 FXJSE_Value_ToUTF8String(hValue, bsChecksum); 3519 FXJSE_Value_ToUTF8String(hValue, bsChecksum);
3506 SetAttribute(XFA_ATTRIBUTE_Checksum, 3520 SetAttribute(XFA_ATTRIBUTE_Checksum,
3507 CFX_WideString::FromUTF8(bsChecksum, bsChecksum.GetLength())); 3521 CFX_WideString::FromUTF8(bsChecksum, bsChecksum.GetLength())
3522 .AsWideStringC());
3508 } else { 3523 } else {
3509 CFX_WideString wsChecksum; 3524 CFX_WideString wsChecksum;
3510 GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); 3525 GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE);
3511 FXJSE_Value_SetUTF8String( 3526 FXJSE_Value_SetUTF8String(
3512 hValue, 3527 hValue,
3513 FX_UTF8Encode(wsChecksum, wsChecksum.GetLength()).AsByteStringC()); 3528 FX_UTF8Encode(wsChecksum, wsChecksum.GetLength()).AsByteStringC());
3514 } 3529 }
3515 } 3530 }
3516 void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { 3531 void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) {
3517 int32_t argc = pArguments->GetLength(); 3532 int32_t argc = pArguments->GetLength();
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
3957 FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, 3972 FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr,
3958 const CFX_WideString& wsValue, 3973 const CFX_WideString& wsValue,
3959 FX_BOOL bNotify, 3974 FX_BOOL bNotify,
3960 FX_BOOL bScriptModify) { 3975 FX_BOOL bScriptModify) {
3961 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); 3976 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
3962 OnChanging(eAttr, (void*)(const FX_WCHAR*)wsValue, bNotify); 3977 OnChanging(eAttr, (void*)(const FX_WCHAR*)wsValue, bNotify);
3963 if (eAttr == XFA_ATTRIBUTE_Value) { 3978 if (eAttr == XFA_ATTRIBUTE_Value) {
3964 CFX_WideString* pClone = new CFX_WideString(wsValue); 3979 CFX_WideString* pClone = new CFX_WideString(wsValue);
3965 SetUserData(pKey, pClone, &deleteWideStringCallBack); 3980 SetUserData(pKey, pClone, &deleteWideStringCallBack);
3966 } else { 3981 } else {
3967 SetMapModuleString(pKey, wsValue); 3982 SetMapModuleString(pKey, wsValue.AsWideStringC());
3968 if (eAttr == XFA_ATTRIBUTE_Name) 3983 if (eAttr == XFA_ATTRIBUTE_Name)
3969 UpdateNameHash(); 3984 UpdateNameHash();
3970 } 3985 }
3971 OnChanged(eAttr, (void*)(const FX_WCHAR*)wsValue, bNotify, bScriptModify); 3986 OnChanged(eAttr, (void*)(const FX_WCHAR*)wsValue, bNotify, bScriptModify);
3972 if (IsNeedSavingXMLNode() && eAttr != XFA_ATTRIBUTE_QualifiedName && 3987 if (IsNeedSavingXMLNode() && eAttr != XFA_ATTRIBUTE_QualifiedName &&
3973 eAttr != XFA_ATTRIBUTE_BindingNode) { 3988 eAttr != XFA_ATTRIBUTE_BindingNode) {
3974 if (eAttr == XFA_ATTRIBUTE_Name && 3989 if (eAttr == XFA_ATTRIBUTE_Name &&
3975 (m_eNodeClass == XFA_ELEMENT_DataValue || 3990 (m_eNodeClass == XFA_ELEMENT_DataValue ||
3976 m_eNodeClass == XFA_ELEMENT_DataGroup)) { 3991 m_eNodeClass == XFA_ELEMENT_DataGroup)) {
3977 return TRUE; 3992 return TRUE;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
4314 } 4329 }
4315 pBindNode = NULL; 4330 pBindNode = NULL;
4316 break; 4331 break;
4317 } 4332 }
4318 case XFA_OBJECTTYPE_ContentNode: { 4333 case XFA_OBJECTTYPE_ContentNode: {
4319 CFX_WideString wsContentType; 4334 CFX_WideString wsContentType;
4320 if (GetClassID() == XFA_ELEMENT_ExData) { 4335 if (GetClassID() == XFA_ELEMENT_ExData) {
4321 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); 4336 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE);
4322 if (wsContentType == FX_WSTRC(L"text/html")) { 4337 if (wsContentType == FX_WSTRC(L"text/html")) {
4323 wsContentType = FX_WSTRC(L""); 4338 wsContentType = FX_WSTRC(L"");
4324 SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType); 4339 SetAttribute(XFA_ATTRIBUTE_ContentType,
4340 wsContentType.AsWideStringC());
4325 } 4341 }
4326 } 4342 }
4327 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); 4343 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild);
4328 if (!pContentRawDataNode) { 4344 if (!pContentRawDataNode) {
4329 pContentRawDataNode = CreateSamePacketNode( 4345 pContentRawDataNode = CreateSamePacketNode(
4330 (wsContentType == FX_WSTRC(L"text/xml")) ? XFA_ELEMENT_Sharpxml 4346 (wsContentType == FX_WSTRC(L"text/xml")) ? XFA_ELEMENT_Sharpxml
4331 : XFA_ELEMENT_Sharptext); 4347 : XFA_ELEMENT_Sharptext);
4332 InsertChild(pContentRawDataNode); 4348 InsertChild(pContentRawDataNode);
4333 } 4349 }
4334 return pContentRawDataNode->SetScriptContent( 4350 return pContentRawDataNode->SetScriptContent(
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
5226 pDstModuleData->m_BufferMap.RemoveKey(pKey); 5242 pDstModuleData->m_BufferMap.RemoveKey(pKey);
5227 pDstModuleData->m_BufferMap.SetAt(pKey, 5243 pDstModuleData->m_BufferMap.SetAt(pKey,
5228 (XFA_MAPDATABLOCK*)pBufferBlockData); 5244 (XFA_MAPDATABLOCK*)pBufferBlockData);
5229 } 5245 }
5230 } 5246 }
5231 if (pDstModule->GetObjectType() == XFA_OBJECTTYPE_NodeV) { 5247 if (pDstModule->GetObjectType() == XFA_OBJECTTYPE_NodeV) {
5232 CFX_WideString wsValue = pDstModule->GetScriptContent(FALSE); 5248 CFX_WideString wsValue = pDstModule->GetScriptContent(FALSE);
5233 CFX_WideString wsFormatValue(wsValue); 5249 CFX_WideString wsFormatValue(wsValue);
5234 CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData(); 5250 CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData();
5235 if (pWidgetData) { 5251 if (pWidgetData) {
5236 pWidgetData->GetFormatDataValue(wsValue, wsFormatValue); 5252 pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), wsFormatValue);
5237 } 5253 }
5238 pDstModule->SetScriptContent(wsValue, wsFormatValue, TRUE, TRUE); 5254 pDstModule->SetScriptContent(wsValue, wsFormatValue, TRUE, TRUE);
5239 } 5255 }
5240 } 5256 }
5241 void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule, 5257 void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule,
5242 CXFA_Node* pDstModule, 5258 CXFA_Node* pDstModule,
5243 void* pKey, 5259 void* pKey,
5244 FX_BOOL bRecursive) { 5260 FX_BOOL bRecursive) {
5245 if (!pSrcModule || !pDstModule || !pKey) { 5261 if (!pSrcModule || !pDstModule || !pKey) {
5246 return; 5262 return;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
5325 } 5341 }
5326 } else { 5342 } else {
5327 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"item"); 5343 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"item");
5328 } 5344 }
5329 } 5345 }
5330 void CXFA_NodeList::Script_TreelistClass_NamedItem( 5346 void CXFA_NodeList::Script_TreelistClass_NamedItem(
5331 CFXJSE_Arguments* pArguments) { 5347 CFXJSE_Arguments* pArguments) {
5332 int32_t argc = pArguments->GetLength(); 5348 int32_t argc = pArguments->GetLength();
5333 if (argc == 1) { 5349 if (argc == 1) {
5334 CFX_ByteString szName = pArguments->GetUTF8String(0); 5350 CFX_ByteString szName = pArguments->GetUTF8String(0);
5335 CXFA_Node* pNode = 5351 CXFA_Node* pNode = NamedItem(
5336 NamedItem(CFX_WideString::FromUTF8(szName, szName.GetLength())); 5352 CFX_WideString::FromUTF8(szName, szName.GetLength()).AsWideStringC());
5337 if (!pNode) { 5353 if (!pNode) {
5338 return; 5354 return;
5339 } 5355 }
5340 FXJSE_Value_Set(pArguments->GetReturnValue(), 5356 FXJSE_Value_Set(pArguments->GetReturnValue(),
5341 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); 5357 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode));
5342 } else { 5358 } else {
5343 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"namedItem"); 5359 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"namedItem");
5344 } 5360 }
5345 } 5361 }
5346 void CXFA_NodeList::Script_ListClass_Length(FXJSE_HVALUE hValue, 5362 void CXFA_NodeList::Script_ListClass_Length(FXJSE_HVALUE hValue,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
5423 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); 5439 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
5424 } 5440 }
5425 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { 5441 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
5426 return m_pAttachNode->RemoveChild(pNode); 5442 return m_pAttachNode->RemoveChild(pNode);
5427 } 5443 }
5428 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { 5444 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
5429 return m_pAttachNode->GetChild( 5445 return m_pAttachNode->GetChild(
5430 iIndex, XFA_ELEMENT_UNKNOWN, 5446 iIndex, XFA_ELEMENT_UNKNOWN,
5431 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5447 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
5432 } 5448 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_localevalue.cpp ('k') | xfa/fxfa/parser/xfa_objectacc_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698