OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/parser/xfa_object.h" | 7 #include "xfa/fxfa/parser/xfa_object.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
10 #include "xfa/fde/xml/fde_xml_imp.h" | 10 #include "xfa/fde/xml/fde_xml_imp.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(wsFormat.c_str(), arg_ptr); |
75 va_end(arg_ptr); | 75 va_end(arg_ptr); |
76 FXJSE_ThrowMessage( | 76 FXJSE_ThrowMessage( |
77 "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsStringC()); | 77 "", FX_UTF8Encode(wsMessage.c_str(), 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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()).AsStringC()); | 756 "", |
| 757 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); |
757 } else { | 758 } else { |
758 CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this); | 759 CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this); |
759 FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList, | 760 FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList, |
760 pScriptContext->GetJseNormalClass()); | 761 pScriptContext->GetJseNormalClass()); |
761 } | 762 } |
762 } | 763 } |
763 void CXFA_Node::Script_TreeClass_ClassAll(FXJSE_HVALUE hValue, | 764 void CXFA_Node::Script_TreeClass_ClassAll(FXJSE_HVALUE hValue, |
764 FX_BOOL bSetting, | 765 FX_BOOL bSetting, |
765 XFA_ATTRIBUTE eAttribute) { | 766 XFA_ATTRIBUTE eAttribute) { |
766 if (bSetting) { | 767 if (bSetting) { |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 SetAttribute(eAttribute, wsValue.AsStringC(), TRUE); | 1474 SetAttribute(eAttribute, wsValue.AsStringC(), TRUE); |
1474 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) { | 1475 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) { |
1475 CFX_WideString wsUseVal = wsValue, wsID, wsSOM; | 1476 CFX_WideString wsUseVal = wsValue, wsID, wsSOM; |
1476 CXFA_Node* pTemplateNode = | 1477 CXFA_Node* pTemplateNode = |
1477 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); | 1478 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); |
1478 CXFA_Node* pProtoRoot = | 1479 CXFA_Node* pProtoRoot = |
1479 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform) | 1480 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform) |
1480 ->GetFirstChildByClass(XFA_ELEMENT_Proto); | 1481 ->GetFirstChildByClass(XFA_ELEMENT_Proto); |
1481 if (!wsUseVal.IsEmpty()) { | 1482 if (!wsUseVal.IsEmpty()) { |
1482 if (wsUseVal[0] == '#') { | 1483 if (wsUseVal[0] == '#') { |
1483 wsID = CFX_WideString((const FX_WCHAR*)wsUseVal + 1, | 1484 wsID = CFX_WideString(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1); |
1484 wsUseVal.GetLength() - 1); | |
1485 } else { | 1485 } else { |
1486 wsSOM = | 1486 wsSOM = wsUseVal; |
1487 CFX_WideString((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength()); | |
1488 } | 1487 } |
1489 } | 1488 } |
1490 CXFA_Node* pProtoNode = NULL; | 1489 CXFA_Node* pProtoNode = NULL; |
1491 if (!wsSOM.IsEmpty()) { | 1490 if (!wsSOM.IsEmpty()) { |
1492 uint32_t dwFlag = XFA_RESOLVENODE_Children | | 1491 uint32_t dwFlag = XFA_RESOLVENODE_Children | |
1493 XFA_RESOLVENODE_Attributes | | 1492 XFA_RESOLVENODE_Attributes | |
1494 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | | 1493 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | |
1495 XFA_RESOLVENODE_Siblings; | 1494 XFA_RESOLVENODE_Siblings; |
1496 XFA_RESOLVENODE_RS resoveNodeRS; | 1495 XFA_RESOLVENODE_RS resoveNodeRS; |
1497 int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects( | 1496 int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects( |
(...skipping 22 matching lines...) Expand all Loading... |
1520 pHeadChild = pSibling; | 1519 pHeadChild = pSibling; |
1521 } | 1520 } |
1522 m_pDocument->RemovePurgeNode(pProtoForm); | 1521 m_pDocument->RemovePurgeNode(pProtoForm); |
1523 delete pProtoForm; | 1522 delete pProtoForm; |
1524 } | 1523 } |
1525 } | 1524 } |
1526 } else { | 1525 } else { |
1527 CFX_WideString wsValue; | 1526 CFX_WideString wsValue; |
1528 GetAttribute(eAttribute, wsValue); | 1527 GetAttribute(eAttribute, wsValue); |
1529 FXJSE_Value_SetUTF8String( | 1528 FXJSE_Value_SetUTF8String( |
1530 hValue, FX_UTF8Encode(wsValue, wsValue.GetLength()).AsStringC()); | 1529 hValue, |
| 1530 FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); |
1531 } | 1531 } |
1532 } | 1532 } |
1533 void CXFA_Node::Script_Attribute_StringRead(FXJSE_HVALUE hValue, | 1533 void CXFA_Node::Script_Attribute_StringRead(FXJSE_HVALUE hValue, |
1534 FX_BOOL bSetting, | 1534 FX_BOOL bSetting, |
1535 XFA_ATTRIBUTE eAttribute) { | 1535 XFA_ATTRIBUTE eAttribute) { |
1536 if (!bSetting) { | 1536 if (!bSetting) { |
1537 CFX_WideString wsValue; | 1537 CFX_WideString wsValue; |
1538 GetAttribute(eAttribute, wsValue); | 1538 GetAttribute(eAttribute, wsValue); |
1539 FXJSE_Value_SetUTF8String( | 1539 FXJSE_Value_SetUTF8String( |
1540 hValue, FX_UTF8Encode(wsValue, wsValue.GetLength()).AsStringC()); | 1540 hValue, |
| 1541 FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); |
1541 } else { | 1542 } else { |
1542 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 1543 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
1543 } | 1544 } |
1544 } | 1545 } |
1545 void CXFA_Node::Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments) { | 1546 void CXFA_Node::Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments) { |
1546 int32_t argc = pArguments->GetLength(); | 1547 int32_t argc = pArguments->GetLength(); |
1547 if ((argc == 0) || (argc == 1)) { | 1548 if ((argc == 0) || (argc == 1)) { |
1548 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); | 1549 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); |
1549 } else { | 1550 } else { |
1550 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execute"); | 1551 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execute"); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsStringC(), | 1691 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsStringC(), |
1691 wsFormatValue); | 1692 wsFormatValue); |
1692 } | 1693 } |
1693 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); | 1694 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); |
1694 } else { | 1695 } else { |
1695 CFX_WideString content = GetScriptContent(TRUE); | 1696 CFX_WideString content = GetScriptContent(TRUE); |
1696 if (content.IsEmpty() && classID != XFA_ELEMENT_Text && | 1697 if (content.IsEmpty() && classID != XFA_ELEMENT_Text && |
1697 classID != XFA_ELEMENT_SubmitUrl) { | 1698 classID != XFA_ELEMENT_SubmitUrl) { |
1698 FXJSE_Value_SetNull(hValue); | 1699 FXJSE_Value_SetNull(hValue); |
1699 } else if (classID == XFA_ELEMENT_Integer) { | 1700 } else if (classID == XFA_ELEMENT_Integer) { |
1700 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); | 1701 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content.c_str())); |
1701 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { | 1702 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { |
1702 CFX_Decimal decimal(content.AsStringC()); | 1703 CFX_Decimal decimal(content.AsStringC()); |
1703 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); | 1704 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); |
1704 } else { | 1705 } else { |
1705 FXJSE_Value_SetUTF8String( | 1706 FXJSE_Value_SetUTF8String( |
1706 hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC()); | 1707 hValue, |
| 1708 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); |
1707 } | 1709 } |
1708 } | 1710 } |
1709 } | 1711 } |
1710 void CXFA_Node::Script_Som_DefaultValue_Read(FXJSE_HVALUE hValue, | 1712 void CXFA_Node::Script_Som_DefaultValue_Read(FXJSE_HVALUE hValue, |
1711 FX_BOOL bSetting, | 1713 FX_BOOL bSetting, |
1712 XFA_ATTRIBUTE eAttribute) { | 1714 XFA_ATTRIBUTE eAttribute) { |
1713 if (bSetting) { | 1715 if (bSetting) { |
1714 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 1716 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
1715 return; | 1717 return; |
1716 } | 1718 } |
1717 CFX_WideString content = GetScriptContent(TRUE); | 1719 CFX_WideString content = GetScriptContent(TRUE); |
1718 if (content.IsEmpty()) { | 1720 if (content.IsEmpty()) { |
1719 FXJSE_Value_SetNull(hValue); | 1721 FXJSE_Value_SetNull(hValue); |
1720 } else { | 1722 } else { |
1721 FXJSE_Value_SetUTF8String( | 1723 FXJSE_Value_SetUTF8String( |
1722 hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC()); | 1724 hValue, |
| 1725 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); |
1723 } | 1726 } |
1724 } | 1727 } |
1725 void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, | 1728 void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, |
1726 FX_BOOL bSetting, | 1729 FX_BOOL bSetting, |
1727 XFA_ATTRIBUTE eAttribute) { | 1730 XFA_ATTRIBUTE eAttribute) { |
1728 if (bSetting) { | 1731 if (bSetting) { |
1729 CFX_ByteString newValue; | 1732 CFX_ByteString newValue; |
1730 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { | 1733 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { |
1731 FXJSE_Value_ToUTF8String(hValue, newValue); | 1734 FXJSE_Value_ToUTF8String(hValue, newValue); |
1732 } | 1735 } |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1952 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); | 1955 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); |
1953 } else if (uiType != XFA_ELEMENT_Image) { | 1956 } else if (uiType != XFA_ELEMENT_Image) { |
1954 } | 1957 } |
1955 } | 1958 } |
1956 } else { | 1959 } else { |
1957 CFX_WideString content = GetScriptContent(TRUE); | 1960 CFX_WideString content = GetScriptContent(TRUE); |
1958 if (content.IsEmpty()) { | 1961 if (content.IsEmpty()) { |
1959 FXJSE_Value_SetNull(hValue); | 1962 FXJSE_Value_SetNull(hValue); |
1960 } else { | 1963 } else { |
1961 FXJSE_Value_SetUTF8String( | 1964 FXJSE_Value_SetUTF8String( |
1962 hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC()); | 1965 hValue, |
| 1966 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); |
1963 } | 1967 } |
1964 } | 1968 } |
1965 } | 1969 } |
1966 void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue, | 1970 void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue, |
1967 FX_BOOL bSetting, | 1971 FX_BOOL bSetting, |
1968 XFA_ATTRIBUTE eAttribute) { | 1972 XFA_ATTRIBUTE eAttribute) { |
1969 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 1973 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
1970 if (!pWidgetData) { | 1974 if (!pWidgetData) { |
1971 return; | 1975 return; |
1972 } | 1976 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2005 FXJSE_Value_SetNull(hValue); | 2009 FXJSE_Value_SetNull(hValue); |
2006 } else { | 2010 } else { |
2007 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); | 2011 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); |
2008 XFA_ELEMENT eUI = pUIChild->GetClassID(); | 2012 XFA_ELEMENT eUI = pUIChild->GetClassID(); |
2009 CXFA_Value defVal = pWidgetData->GetFormValue(); | 2013 CXFA_Value defVal = pWidgetData->GetFormValue(); |
2010 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); | 2014 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); |
2011 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Decimal) { | 2015 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Decimal) { |
2012 if (eUI == XFA_ELEMENT_NumericEdit && | 2016 if (eUI == XFA_ELEMENT_NumericEdit && |
2013 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { | 2017 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { |
2014 FXJSE_Value_SetUTF8String( | 2018 FXJSE_Value_SetUTF8String( |
2015 hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC()); | 2019 hValue, |
| 2020 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); |
2016 } else { | 2021 } else { |
2017 CFX_Decimal decimal(content.AsStringC()); | 2022 CFX_Decimal decimal(content.AsStringC()); |
2018 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); | 2023 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); |
2019 } | 2024 } |
2020 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) { | 2025 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) { |
2021 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); | 2026 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content.c_str())); |
2022 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) { | 2027 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) { |
2023 FXJSE_Value_SetBoolean(hValue, FXSYS_wtoi(content) == 0 ? FALSE : TRUE); | 2028 FXJSE_Value_SetBoolean(hValue, |
| 2029 FXSYS_wtoi(content.c_str()) == 0 ? FALSE : TRUE); |
2024 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) { | 2030 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) { |
2025 CFX_Decimal decimal(content.AsStringC()); | 2031 CFX_Decimal decimal(content.AsStringC()); |
2026 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); | 2032 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); |
2027 } else { | 2033 } else { |
2028 FXJSE_Value_SetUTF8String( | 2034 FXJSE_Value_SetUTF8String( |
2029 hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC()); | 2035 hValue, |
| 2036 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); |
2030 } | 2037 } |
2031 } | 2038 } |
2032 } | 2039 } |
2033 } | 2040 } |
2034 void CXFA_Node::Script_Field_EditValue(FXJSE_HVALUE hValue, | 2041 void CXFA_Node::Script_Field_EditValue(FXJSE_HVALUE hValue, |
2035 FX_BOOL bSetting, | 2042 FX_BOOL bSetting, |
2036 XFA_ATTRIBUTE eAttribute) { | 2043 XFA_ATTRIBUTE eAttribute) { |
2037 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2044 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2038 if (!pWidgetData) { | 2045 if (!pWidgetData) { |
2039 return; | 2046 return; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2223 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2230 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2224 if (!pWidgetData) { | 2231 if (!pWidgetData) { |
2225 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 2232 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
2226 return; | 2233 return; |
2227 } | 2234 } |
2228 CFX_WideString wsValue; | 2235 CFX_WideString wsValue; |
2229 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, TRUE); | 2236 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, TRUE); |
2230 if (bHasItem) { | 2237 if (bHasItem) { |
2231 FXJSE_Value_SetUTF8String( | 2238 FXJSE_Value_SetUTF8String( |
2232 pArguments->GetReturnValue(), | 2239 pArguments->GetReturnValue(), |
2233 FX_UTF8Encode(wsValue, wsValue.GetLength()).AsStringC()); | 2240 FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); |
2234 } else { | 2241 } else { |
2235 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 2242 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
2236 } | 2243 } |
2237 } | 2244 } |
2238 void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { | 2245 void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { |
2239 int32_t iLength = pArguments->GetLength(); | 2246 int32_t iLength = pArguments->GetLength(); |
2240 if (iLength != 1) { | 2247 if (iLength != 1) { |
2241 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"boundItem"); | 2248 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"boundItem"); |
2242 return; | 2249 return; |
2243 } | 2250 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2308 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2302 if (!pWidgetData) { | 2309 if (!pWidgetData) { |
2303 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 2310 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
2304 return; | 2311 return; |
2305 } | 2312 } |
2306 CFX_WideString wsValue; | 2313 CFX_WideString wsValue; |
2307 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, FALSE); | 2314 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, FALSE); |
2308 if (bHasItem) { | 2315 if (bHasItem) { |
2309 FXJSE_Value_SetUTF8String( | 2316 FXJSE_Value_SetUTF8String( |
2310 pArguments->GetReturnValue(), | 2317 pArguments->GetReturnValue(), |
2311 FX_UTF8Encode(wsValue, wsValue.GetLength()).AsStringC()); | 2318 FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); |
2312 } else { | 2319 } else { |
2313 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 2320 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
2314 } | 2321 } |
2315 } | 2322 } |
2316 void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) { | 2323 void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) { |
2317 int32_t iLength = pArguments->GetLength(); | 2324 int32_t iLength = pArguments->GetLength(); |
2318 if (iLength != 2) { | 2325 if (iLength != 2) { |
2319 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2326 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
2320 L"setItemState"); | 2327 L"setItemState"); |
2321 return; | 2328 return; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2589 XFA_ATTRIBUTE eAttribute) { | 2596 XFA_ATTRIBUTE eAttribute) { |
2590 if (bSetting) { | 2597 if (bSetting) { |
2591 CFX_ByteString bsLocaleName; | 2598 CFX_ByteString bsLocaleName; |
2592 FXJSE_Value_ToUTF8String(hValue, bsLocaleName); | 2599 FXJSE_Value_ToUTF8String(hValue, bsLocaleName); |
2593 SetCData(XFA_ATTRIBUTE_Locale, | 2600 SetCData(XFA_ATTRIBUTE_Locale, |
2594 CFX_WideString::FromUTF8(bsLocaleName.AsStringC()), TRUE, TRUE); | 2601 CFX_WideString::FromUTF8(bsLocaleName.AsStringC()), TRUE, TRUE); |
2595 } else { | 2602 } else { |
2596 CFX_WideString wsLocaleName; | 2603 CFX_WideString wsLocaleName; |
2597 GetLocaleName(wsLocaleName); | 2604 GetLocaleName(wsLocaleName); |
2598 FXJSE_Value_SetUTF8String( | 2605 FXJSE_Value_SetUTF8String( |
2599 hValue, | 2606 hValue, FX_UTF8Encode(wsLocaleName.c_str(), wsLocaleName.GetLength()) |
2600 FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength()).AsStringC()); | 2607 .AsStringC()); |
2601 } | 2608 } |
2602 } | 2609 } |
2603 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { | 2610 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { |
2604 int32_t argc = pArguments->GetLength(); | 2611 int32_t argc = pArguments->GetLength(); |
2605 if (argc == 1) { | 2612 if (argc == 1) { |
2606 CFX_ByteString eventString = pArguments->GetUTF8String(0); | 2613 CFX_ByteString eventString = pArguments->GetUTF8String(0); |
2607 execSingleEventByName( | 2614 execSingleEventByName( |
2608 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), | 2615 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), |
2609 XFA_ELEMENT_Subform); | 2616 XFA_ELEMENT_Subform); |
2610 } else { | 2617 } else { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2730 if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name, | 2737 if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name, |
2731 XFA_XDPPACKET_UNKNOWN)) { | 2738 XFA_XDPPACKET_UNKNOWN)) { |
2732 pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringC(), TRUE); | 2739 pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringC(), TRUE); |
2733 if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) { | 2740 if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) { |
2734 pNewNode->CreateXMLMappingNode(); | 2741 pNewNode->CreateXMLMappingNode(); |
2735 } | 2742 } |
2736 FXJSE_Value_Set( | 2743 FXJSE_Value_Set( |
2737 pArguments->GetReturnValue(), | 2744 pArguments->GetReturnValue(), |
2738 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode)); | 2745 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode)); |
2739 } else { | 2746 } else { |
2740 ThrowScriptErrorMessage(XFA_IDS_NOT_HAVE_PROPERTY, | 2747 ThrowScriptErrorMessage(XFA_IDS_NOT_HAVE_PROPERTY, strTagName.c_str(), |
2741 (const FX_WCHAR*)strTagName, L"name"); | 2748 L"name"); |
2742 } | 2749 } |
2743 } else { | 2750 } else { |
2744 FXJSE_Value_Set( | 2751 FXJSE_Value_Set( |
2745 pArguments->GetReturnValue(), | 2752 pArguments->GetReturnValue(), |
2746 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode)); | 2753 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode)); |
2747 } | 2754 } |
2748 } | 2755 } |
2749 } else { | 2756 } else { |
2750 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"createNode"); | 2757 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"createNode"); |
2751 } | 2758 } |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3289 if (iDesired == iCount) { | 3296 if (iDesired == iCount) { |
3290 return 0; | 3297 return 0; |
3291 } | 3298 } |
3292 if (iDesired < iCount) { | 3299 if (iDesired < iCount) { |
3293 CFX_WideStringC wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name); | 3300 CFX_WideStringC wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name); |
3294 CFX_WideString wsInstanceName = wsInstManagerName.IsEmpty() | 3301 CFX_WideString wsInstanceName = wsInstManagerName.IsEmpty() |
3295 ? wsInstManagerName | 3302 ? wsInstManagerName |
3296 : wsInstManagerName.Mid(1); | 3303 : wsInstManagerName.Mid(1); |
3297 uint32_t dInstanceNameHash = | 3304 uint32_t dInstanceNameHash = |
3298 wsInstanceName.IsEmpty() ? 0 : FX_HashCode_String_GetW( | 3305 wsInstanceName.IsEmpty() ? 0 : FX_HashCode_String_GetW( |
3299 wsInstanceName, | 3306 wsInstanceName.c_str(), |
3300 wsInstanceName.GetLength()); | 3307 wsInstanceName.GetLength()); |
3301 CXFA_Node* pPrevSibling = | 3308 CXFA_Node* pPrevSibling = |
3302 (iDesired == 0) ? this | 3309 (iDesired == 0) ? this |
3303 : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1); | 3310 : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1); |
3304 while (iCount > iDesired) { | 3311 while (iCount > iDesired) { |
3305 CXFA_Node* pRemoveInstance = | 3312 CXFA_Node* pRemoveInstance = |
3306 pPrevSibling->GetNodeItem(XFA_NODEITEM_NextSibling); | 3313 pPrevSibling->GetNodeItem(XFA_NODEITEM_NextSibling); |
3307 if (pRemoveInstance->GetClassID() != XFA_ELEMENT_Subform && | 3314 if (pRemoveInstance->GetClassID() != XFA_ELEMENT_Subform && |
3308 pRemoveInstance->GetClassID() != XFA_ELEMENT_SubformSet) { | 3315 pRemoveInstance->GetClassID() != XFA_ELEMENT_SubformSet) { |
3309 continue; | 3316 continue; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3485 XFA_ATTRIBUTE eAttribute) { | 3492 XFA_ATTRIBUTE eAttribute) { |
3486 if (bSetting) { | 3493 if (bSetting) { |
3487 CFX_ByteString bsChecksum; | 3494 CFX_ByteString bsChecksum; |
3488 FXJSE_Value_ToUTF8String(hValue, bsChecksum); | 3495 FXJSE_Value_ToUTF8String(hValue, bsChecksum); |
3489 SetAttribute(XFA_ATTRIBUTE_Checksum, | 3496 SetAttribute(XFA_ATTRIBUTE_Checksum, |
3490 CFX_WideString::FromUTF8(bsChecksum.AsStringC()).AsStringC()); | 3497 CFX_WideString::FromUTF8(bsChecksum.AsStringC()).AsStringC()); |
3491 } else { | 3498 } else { |
3492 CFX_WideString wsChecksum; | 3499 CFX_WideString wsChecksum; |
3493 GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); | 3500 GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); |
3494 FXJSE_Value_SetUTF8String( | 3501 FXJSE_Value_SetUTF8String( |
3495 hValue, FX_UTF8Encode(wsChecksum, wsChecksum.GetLength()).AsStringC()); | 3502 hValue, |
| 3503 FX_UTF8Encode(wsChecksum.c_str(), wsChecksum.GetLength()).AsStringC()); |
3496 } | 3504 } |
3497 } | 3505 } |
3498 void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { | 3506 void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { |
3499 int32_t argc = pArguments->GetLength(); | 3507 int32_t argc = pArguments->GetLength(); |
3500 if (argc == 1) { | 3508 if (argc == 1) { |
3501 CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0); | 3509 CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0); |
3502 CFX_WideString wsAttributeValue; | 3510 CFX_WideString wsAttributeValue; |
3503 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3511 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
3504 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3512 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
3505 static_cast<CFDE_XMLElement*>(pXMLNode) | 3513 static_cast<CFDE_XMLElement*>(pXMLNode)->GetString( |
3506 ->GetString(CFX_WideString::FromUTF8(bsAttributeName.AsStringC()), | 3514 CFX_WideString::FromUTF8(bsAttributeName.AsStringC()).c_str(), |
3507 wsAttributeValue); | 3515 wsAttributeValue); |
3508 } | 3516 } |
3509 FXJSE_Value_SetUTF8String( | 3517 FXJSE_Value_SetUTF8String( |
3510 pArguments->GetReturnValue(), | 3518 pArguments->GetReturnValue(), |
3511 FX_UTF8Encode(wsAttributeValue, wsAttributeValue.GetLength()) | 3519 FX_UTF8Encode(wsAttributeValue.c_str(), wsAttributeValue.GetLength()) |
3512 .AsStringC()); | 3520 .AsStringC()); |
3513 } else { | 3521 } else { |
3514 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3522 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3515 L"getAttribute"); | 3523 L"getAttribute"); |
3516 } | 3524 } |
3517 } | 3525 } |
3518 void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { | 3526 void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { |
3519 int32_t argc = pArguments->GetLength(); | 3527 int32_t argc = pArguments->GetLength(); |
3520 if (argc == 2) { | 3528 if (argc == 2) { |
3521 CFX_ByteString bsValue = pArguments->GetUTF8String(0); | 3529 CFX_ByteString bsValue = pArguments->GetUTF8String(0); |
(...skipping 11 matching lines...) Expand all Loading... |
3533 } | 3541 } |
3534 } | 3542 } |
3535 void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { | 3543 void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { |
3536 int32_t argc = pArguments->GetLength(); | 3544 int32_t argc = pArguments->GetLength(); |
3537 if (argc == 1) { | 3545 if (argc == 1) { |
3538 CFX_ByteString bsName = pArguments->GetUTF8String(0); | 3546 CFX_ByteString bsName = pArguments->GetUTF8String(0); |
3539 CFX_WideString wsName = CFX_WideString::FromUTF8(bsName.AsStringC()); | 3547 CFX_WideString wsName = CFX_WideString::FromUTF8(bsName.AsStringC()); |
3540 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3548 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
3541 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3549 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
3542 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 3550 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
3543 if (pXMLElement->HasAttribute(wsName)) { | 3551 if (pXMLElement->HasAttribute(wsName.c_str())) { |
3544 pXMLElement->RemoveAttribute(wsName); | 3552 pXMLElement->RemoveAttribute(wsName.c_str()); |
3545 } | 3553 } |
3546 } | 3554 } |
3547 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 3555 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
3548 } else { | 3556 } else { |
3549 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3557 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3550 L"removeAttribute"); | 3558 L"removeAttribute"); |
3551 } | 3559 } |
3552 } | 3560 } |
3553 void CXFA_Node::Script_Packet_Content(FXJSE_HVALUE hValue, | 3561 void CXFA_Node::Script_Packet_Content(FXJSE_HVALUE hValue, |
3554 FX_BOOL bSetting, | 3562 FX_BOOL bSetting, |
3555 XFA_ATTRIBUTE eAttribute) { | 3563 XFA_ATTRIBUTE eAttribute) { |
3556 if (bSetting) { | 3564 if (bSetting) { |
3557 CFX_ByteString bsNewContent; | 3565 CFX_ByteString bsNewContent; |
3558 FXJSE_Value_ToUTF8String(hValue, bsNewContent); | 3566 FXJSE_Value_ToUTF8String(hValue, bsNewContent); |
3559 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3567 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
3560 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3568 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
3561 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 3569 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
3562 pXMLElement->SetTextData( | 3570 pXMLElement->SetTextData( |
3563 CFX_WideString::FromUTF8(bsNewContent.AsStringC())); | 3571 CFX_WideString::FromUTF8(bsNewContent.AsStringC())); |
3564 } | 3572 } |
3565 } else { | 3573 } else { |
3566 CFX_WideString wsTextData; | 3574 CFX_WideString wsTextData; |
3567 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3575 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
3568 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3576 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
3569 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 3577 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
3570 pXMLElement->GetTextData(wsTextData); | 3578 pXMLElement->GetTextData(wsTextData); |
3571 } | 3579 } |
3572 FXJSE_Value_SetUTF8String( | 3580 FXJSE_Value_SetUTF8String( |
3573 hValue, FX_UTF8Encode(wsTextData, wsTextData.GetLength()).AsStringC()); | 3581 hValue, |
| 3582 FX_UTF8Encode(wsTextData.c_str(), wsTextData.GetLength()).AsStringC()); |
3574 } | 3583 } |
3575 } | 3584 } |
3576 void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) { | 3585 void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) { |
3577 int32_t argc = pArguments->GetLength(); | 3586 int32_t argc = pArguments->GetLength(); |
3578 if (argc == 0) { | 3587 if (argc == 0) { |
3579 } else { | 3588 } else { |
3580 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"next"); | 3589 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"next"); |
3581 } | 3590 } |
3582 } | 3591 } |
3583 void CXFA_Node::Script_Source_CancelBatch(CFXJSE_Arguments* pArguments) { | 3592 void CXFA_Node::Script_Source_CancelBatch(CFXJSE_Arguments* pArguments) { |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3930 CXFA_Measurement CXFA_Node::GetMeasure(XFA_ATTRIBUTE eAttr) const { | 3939 CXFA_Measurement CXFA_Node::GetMeasure(XFA_ATTRIBUTE eAttr) const { |
3931 CXFA_Measurement mValue; | 3940 CXFA_Measurement mValue; |
3932 return TryMeasure(eAttr, mValue, TRUE) ? mValue : CXFA_Measurement(); | 3941 return TryMeasure(eAttr, mValue, TRUE) ? mValue : CXFA_Measurement(); |
3933 } | 3942 } |
3934 | 3943 |
3935 FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, | 3944 FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, |
3936 const CFX_WideString& wsValue, | 3945 const CFX_WideString& wsValue, |
3937 FX_BOOL bNotify, | 3946 FX_BOOL bNotify, |
3938 FX_BOOL bScriptModify) { | 3947 FX_BOOL bScriptModify) { |
3939 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 3948 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); |
3940 OnChanging(eAttr, (void*)(const FX_WCHAR*)wsValue, bNotify); | 3949 OnChanging(eAttr, (void*)wsValue.c_str(), bNotify); |
3941 if (eAttr == XFA_ATTRIBUTE_Value) { | 3950 if (eAttr == XFA_ATTRIBUTE_Value) { |
3942 CFX_WideString* pClone = new CFX_WideString(wsValue); | 3951 CFX_WideString* pClone = new CFX_WideString(wsValue); |
3943 SetUserData(pKey, pClone, &deleteWideStringCallBack); | 3952 SetUserData(pKey, pClone, &deleteWideStringCallBack); |
3944 } else { | 3953 } else { |
3945 SetMapModuleString(pKey, wsValue.AsStringC()); | 3954 SetMapModuleString(pKey, wsValue.AsStringC()); |
3946 if (eAttr == XFA_ATTRIBUTE_Name) | 3955 if (eAttr == XFA_ATTRIBUTE_Name) |
3947 UpdateNameHash(); | 3956 UpdateNameHash(); |
3948 } | 3957 } |
3949 OnChanged(eAttr, (void*)(const FX_WCHAR*)wsValue, bNotify, bScriptModify); | 3958 OnChanged(eAttr, (void*)wsValue.c_str(), bNotify, bScriptModify); |
3950 if (IsNeedSavingXMLNode() && eAttr != XFA_ATTRIBUTE_QualifiedName && | 3959 if (IsNeedSavingXMLNode() && eAttr != XFA_ATTRIBUTE_QualifiedName && |
3951 eAttr != XFA_ATTRIBUTE_BindingNode) { | 3960 eAttr != XFA_ATTRIBUTE_BindingNode) { |
3952 if (eAttr == XFA_ATTRIBUTE_Name && | 3961 if (eAttr == XFA_ATTRIBUTE_Name && |
3953 (m_eNodeClass == XFA_ELEMENT_DataValue || | 3962 (m_eNodeClass == XFA_ELEMENT_DataValue || |
3954 m_eNodeClass == XFA_ELEMENT_DataGroup)) { | 3963 m_eNodeClass == XFA_ELEMENT_DataGroup)) { |
3955 return TRUE; | 3964 return TRUE; |
3956 } | 3965 } |
3957 if (eAttr == XFA_ATTRIBUTE_Value) { | 3966 if (eAttr == XFA_ATTRIBUTE_Value) { |
3958 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); | 3967 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); |
3959 switch (eXMLType) { | 3968 switch (eXMLType) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3999 static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue); | 4008 static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue); |
4000 } | 4009 } |
4001 } | 4010 } |
4002 return TRUE; | 4011 return TRUE; |
4003 } | 4012 } |
4004 FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, | 4013 FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, |
4005 const CFX_WideString& wsXMLValue, | 4014 const CFX_WideString& wsXMLValue, |
4006 FX_BOOL bNotify, | 4015 FX_BOOL bNotify, |
4007 FX_BOOL bScriptModify) { | 4016 FX_BOOL bScriptModify) { |
4008 void* pKey = XFA_GetMapKey_Element(GetClassID(), XFA_ATTRIBUTE_Value); | 4017 void* pKey = XFA_GetMapKey_Element(GetClassID(), XFA_ATTRIBUTE_Value); |
4009 OnChanging(XFA_ATTRIBUTE_Value, (void*)(const FX_WCHAR*)wsValue, bNotify); | 4018 OnChanging(XFA_ATTRIBUTE_Value, (void*)wsValue.c_str(), bNotify); |
4010 CFX_WideString* pClone = new CFX_WideString(wsValue); | 4019 CFX_WideString* pClone = new CFX_WideString(wsValue); |
4011 SetUserData(pKey, pClone, &deleteWideStringCallBack); | 4020 SetUserData(pKey, pClone, &deleteWideStringCallBack); |
4012 OnChanged(XFA_ATTRIBUTE_Value, (void*)(const FX_WCHAR*)wsValue, bNotify, | 4021 OnChanged(XFA_ATTRIBUTE_Value, (void*)wsValue.c_str(), bNotify, |
4013 bScriptModify); | 4022 bScriptModify); |
4014 if (IsNeedSavingXMLNode()) { | 4023 if (IsNeedSavingXMLNode()) { |
4015 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); | 4024 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); |
4016 switch (eXMLType) { | 4025 switch (eXMLType) { |
4017 case FDE_XMLNODE_Element: | 4026 case FDE_XMLNODE_Element: |
4018 if (IsAttributeInXML()) { | 4027 if (IsAttributeInXML()) { |
4019 static_cast<CFDE_XMLElement*>(m_pXMLNode) | 4028 static_cast<CFDE_XMLElement*>(m_pXMLNode) |
4020 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsXMLValue); | 4029 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsXMLValue); |
4021 } else { | 4030 } else { |
4022 FX_BOOL bDeleteChildren = TRUE; | 4031 FX_BOOL bDeleteChildren = TRUE; |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5401 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5410 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
5402 } | 5411 } |
5403 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5412 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
5404 return m_pAttachNode->RemoveChild(pNode); | 5413 return m_pAttachNode->RemoveChild(pNode); |
5405 } | 5414 } |
5406 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5415 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
5407 return m_pAttachNode->GetChild( | 5416 return m_pAttachNode->GetChild( |
5408 iIndex, XFA_ELEMENT_UNKNOWN, | 5417 iIndex, XFA_ELEMENT_UNKNOWN, |
5409 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); | 5418 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); |
5410 } | 5419 } |
OLD | NEW |