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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 ASSERT(FALSE); | 49 ASSERT(FALSE); |
50 return (XFA_ELEMENT)0; | 50 return (XFA_ELEMENT)0; |
51 } | 51 } |
52 void CXFA_Object::Script_ObjectClass_ClassName(FXJSE_HVALUE hValue, | 52 void CXFA_Object::Script_ObjectClass_ClassName(FXJSE_HVALUE hValue, |
53 FX_BOOL bSetting, | 53 FX_BOOL bSetting, |
54 XFA_ATTRIBUTE eAttribute) { | 54 XFA_ATTRIBUTE eAttribute) { |
55 if (!bSetting) { | 55 if (!bSetting) { |
56 CFX_WideStringC className; | 56 CFX_WideStringC className; |
57 GetClassName(className); | 57 GetClassName(className); |
58 FXJSE_Value_SetUTF8String( | 58 FXJSE_Value_SetUTF8String( |
59 hValue, FX_UTF8Encode(className.GetPtr(), className.GetLength())); | 59 hValue, FX_UTF8Encode(className.GetPtr(), className.GetLength()) |
| 60 .AsByteStringC()); |
60 } else { | 61 } else { |
61 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 62 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
62 } | 63 } |
63 } | 64 } |
64 void CXFA_Object::ThrowScriptErrorMessage(int32_t iStringID, ...) { | 65 void CXFA_Object::ThrowScriptErrorMessage(int32_t iStringID, ...) { |
65 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); | 66 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); |
66 FXSYS_assert(pAppProvider); | 67 FXSYS_assert(pAppProvider); |
67 CFX_WideString wsFormat; | 68 CFX_WideString wsFormat; |
68 pAppProvider->LoadString(iStringID, wsFormat); | 69 pAppProvider->LoadString(iStringID, wsFormat); |
69 CFX_WideString wsMessage; | 70 CFX_WideString wsMessage; |
70 va_list arg_ptr; | 71 va_list arg_ptr; |
71 va_start(arg_ptr, iStringID); | 72 va_start(arg_ptr, iStringID); |
72 wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr); | 73 wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr); |
73 va_end(arg_ptr); | 74 va_end(arg_ptr); |
74 FXJSE_ThrowMessage("", FX_UTF8Encode(wsMessage, wsMessage.GetLength())); | 75 FXJSE_ThrowMessage( |
| 76 "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsByteStringC()); |
75 } | 77 } |
76 | 78 |
77 static void XFA_DeleteWideString(void* pData) { | 79 static void XFA_DeleteWideString(void* pData) { |
78 delete static_cast<CFX_WideString*>(pData); | 80 delete static_cast<CFX_WideString*>(pData); |
79 } | 81 } |
80 | 82 |
81 static void XFA_CopyWideString(void*& pData) { | 83 static void XFA_CopyWideString(void*& pData) { |
82 if (pData) { | 84 if (pData) { |
83 CFX_WideString* pNewData = new CFX_WideString(*(CFX_WideString*)pData); | 85 CFX_WideString* pNewData = new CFX_WideString(*(CFX_WideString*)pData); |
84 pData = pNewData; | 86 pData = pNewData; |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 XFA_ATTRIBUTE eAttribute) { | 747 XFA_ATTRIBUTE eAttribute) { |
746 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 748 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
747 if (!pScriptContext) { | 749 if (!pScriptContext) { |
748 return; | 750 return; |
749 } | 751 } |
750 if (bSetting) { | 752 if (bSetting) { |
751 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); | 753 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); |
752 FXSYS_assert(pAppProvider); | 754 FXSYS_assert(pAppProvider); |
753 CFX_WideString wsMessage; | 755 CFX_WideString wsMessage; |
754 pAppProvider->LoadString(XFA_IDS_Unable_TO_SET, wsMessage); | 756 pAppProvider->LoadString(XFA_IDS_Unable_TO_SET, wsMessage); |
755 FXJSE_ThrowMessage("", FX_UTF8Encode(wsMessage, wsMessage.GetLength())); | 757 FXJSE_ThrowMessage( |
| 758 "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsByteStringC()); |
756 } else { | 759 } else { |
757 CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this); | 760 CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this); |
758 FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList, | 761 FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList, |
759 pScriptContext->GetJseNormalClass()); | 762 pScriptContext->GetJseNormalClass()); |
760 } | 763 } |
761 } | 764 } |
762 void CXFA_Node::Script_TreeClass_ClassAll(FXJSE_HVALUE hValue, | 765 void CXFA_Node::Script_TreeClass_ClassAll(FXJSE_HVALUE hValue, |
763 FX_BOOL bSetting, | 766 FX_BOOL bSetting, |
764 XFA_ATTRIBUTE eAttribute) { | 767 XFA_ATTRIBUTE eAttribute) { |
765 if (bSetting) { | 768 if (bSetting) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 } | 809 } |
807 } | 810 } |
808 void CXFA_Node::Script_TreeClass_SomExpression(FXJSE_HVALUE hValue, | 811 void CXFA_Node::Script_TreeClass_SomExpression(FXJSE_HVALUE hValue, |
809 FX_BOOL bSetting, | 812 FX_BOOL bSetting, |
810 XFA_ATTRIBUTE eAttribute) { | 813 XFA_ATTRIBUTE eAttribute) { |
811 if (bSetting) { | 814 if (bSetting) { |
812 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 815 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
813 } else { | 816 } else { |
814 CFX_WideString wsSOMExpression; | 817 CFX_WideString wsSOMExpression; |
815 GetSOMExpression(wsSOMExpression); | 818 GetSOMExpression(wsSOMExpression); |
816 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsSOMExpression)); | 819 FXJSE_Value_SetUTF8String(hValue, |
| 820 FX_UTF8Encode(wsSOMExpression).AsByteStringC()); |
817 } | 821 } |
818 } | 822 } |
819 void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) { | 823 void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) { |
820 int32_t iLength = pArguments->GetLength(); | 824 int32_t iLength = pArguments->GetLength(); |
821 if (iLength != 1) { | 825 if (iLength != 1) { |
822 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"applyXSL"); | 826 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"applyXSL"); |
823 return; | 827 return; |
824 } | 828 } |
825 CFX_WideString wsExpression; | 829 CFX_WideString wsExpression; |
826 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 830 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 return; | 874 return; |
871 } | 875 } |
872 CFX_WideString wsExpression; | 876 CFX_WideString wsExpression; |
873 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 877 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); |
874 wsExpression = | 878 wsExpression = |
875 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | 879 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); |
876 CFX_WideString wsValue; | 880 CFX_WideString wsValue; |
877 GetAttribute(wsExpression, wsValue); | 881 GetAttribute(wsExpression, wsValue); |
878 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 882 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
879 if (hValue) { | 883 if (hValue) { |
880 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue)); | 884 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); |
881 } | 885 } |
882 } | 886 } |
883 void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { | 887 void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { |
884 int32_t iLength = pArguments->GetLength(); | 888 int32_t iLength = pArguments->GetLength(); |
885 if (iLength < 1 || iLength > 2) { | 889 if (iLength < 1 || iLength > 2) { |
886 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getElement"); | 890 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getElement"); |
887 return; | 891 return; |
888 } | 892 } |
889 CFX_WideString wsExpression; | 893 CFX_WideString wsExpression; |
890 int32_t iValue = 0; | 894 int32_t iValue = 0; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 } | 1177 } |
1174 } | 1178 } |
1175 void CXFA_Node::Script_NodeClass_Ns(FXJSE_HVALUE hValue, | 1179 void CXFA_Node::Script_NodeClass_Ns(FXJSE_HVALUE hValue, |
1176 FX_BOOL bSetting, | 1180 FX_BOOL bSetting, |
1177 XFA_ATTRIBUTE eAttribute) { | 1181 XFA_ATTRIBUTE eAttribute) { |
1178 if (bSetting) { | 1182 if (bSetting) { |
1179 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 1183 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
1180 } else { | 1184 } else { |
1181 CFX_WideString wsNameSpace; | 1185 CFX_WideString wsNameSpace; |
1182 TryNamespace(wsNameSpace); | 1186 TryNamespace(wsNameSpace); |
1183 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsNameSpace)); | 1187 FXJSE_Value_SetUTF8String(hValue, |
| 1188 FX_UTF8Encode(wsNameSpace).AsByteStringC()); |
1184 } | 1189 } |
1185 } | 1190 } |
1186 void CXFA_Node::Script_NodeClass_Model(FXJSE_HVALUE hValue, | 1191 void CXFA_Node::Script_NodeClass_Model(FXJSE_HVALUE hValue, |
1187 FX_BOOL bSetting, | 1192 FX_BOOL bSetting, |
1188 XFA_ATTRIBUTE eAttribute) { | 1193 XFA_ATTRIBUTE eAttribute) { |
1189 if (bSetting) { | 1194 if (bSetting) { |
1190 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 1195 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
1191 } else { | 1196 } else { |
1192 FXJSE_Value_Set(hValue, m_pDocument->GetScriptContext()->GetJSValueFromMap( | 1197 FXJSE_Value_Set(hValue, m_pDocument->GetScriptContext()->GetJSValueFromMap( |
1193 GetModelNode())); | 1198 GetModelNode())); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 InsertChild(pHeadChild); | 1532 InsertChild(pHeadChild); |
1528 pHeadChild = pSibling; | 1533 pHeadChild = pSibling; |
1529 } | 1534 } |
1530 m_pDocument->RemovePurgeNode(pProtoForm); | 1535 m_pDocument->RemovePurgeNode(pProtoForm); |
1531 delete pProtoForm; | 1536 delete pProtoForm; |
1532 } | 1537 } |
1533 } | 1538 } |
1534 } else { | 1539 } else { |
1535 CFX_WideString wsValue; | 1540 CFX_WideString wsValue; |
1536 GetAttribute(eAttribute, wsValue); | 1541 GetAttribute(eAttribute, wsValue); |
1537 FXJSE_Value_SetUTF8String(hValue, | 1542 FXJSE_Value_SetUTF8String( |
1538 FX_UTF8Encode(wsValue, wsValue.GetLength())); | 1543 hValue, FX_UTF8Encode(wsValue, wsValue.GetLength()).AsByteStringC()); |
1539 } | 1544 } |
1540 } | 1545 } |
1541 void CXFA_Node::Script_Attribute_StringRead(FXJSE_HVALUE hValue, | 1546 void CXFA_Node::Script_Attribute_StringRead(FXJSE_HVALUE hValue, |
1542 FX_BOOL bSetting, | 1547 FX_BOOL bSetting, |
1543 XFA_ATTRIBUTE eAttribute) { | 1548 XFA_ATTRIBUTE eAttribute) { |
1544 if (!bSetting) { | 1549 if (!bSetting) { |
1545 CFX_WideString wsValue; | 1550 CFX_WideString wsValue; |
1546 GetAttribute(eAttribute, wsValue); | 1551 GetAttribute(eAttribute, wsValue); |
1547 FXJSE_Value_SetUTF8String(hValue, | 1552 FXJSE_Value_SetUTF8String( |
1548 FX_UTF8Encode(wsValue, wsValue.GetLength())); | 1553 hValue, FX_UTF8Encode(wsValue, wsValue.GetLength()).AsByteStringC()); |
1549 } else { | 1554 } else { |
1550 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 1555 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
1551 } | 1556 } |
1552 } | 1557 } |
1553 void CXFA_Node::Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments) { | 1558 void CXFA_Node::Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments) { |
1554 int32_t argc = pArguments->GetLength(); | 1559 int32_t argc = pArguments->GetLength(); |
1555 if ((argc == 0) || (argc == 1)) { | 1560 if ((argc == 0) || (argc == 1)) { |
1556 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); | 1561 FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); |
1557 } else { | 1562 } else { |
1558 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execute"); | 1563 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execute"); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 break; | 1626 break; |
1622 case XFA_SOM_FormatMessage: | 1627 case XFA_SOM_FormatMessage: |
1623 validate.GetFormatMessageText(wsMessage); | 1628 validate.GetFormatMessageText(wsMessage); |
1624 break; | 1629 break; |
1625 case XFA_SOM_MandatoryMessage: | 1630 case XFA_SOM_MandatoryMessage: |
1626 validate.GetNullMessageText(wsMessage); | 1631 validate.GetNullMessageText(wsMessage); |
1627 break; | 1632 break; |
1628 default: | 1633 default: |
1629 break; | 1634 break; |
1630 } | 1635 } |
1631 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsMessage)); | 1636 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsMessage).AsByteStringC()); |
1632 } | 1637 } |
1633 } | 1638 } |
1634 void CXFA_Node::Script_Som_ValidationMessage(FXJSE_HVALUE hValue, | 1639 void CXFA_Node::Script_Som_ValidationMessage(FXJSE_HVALUE hValue, |
1635 FX_BOOL bSetting, | 1640 FX_BOOL bSetting, |
1636 XFA_ATTRIBUTE eAttribute) { | 1641 XFA_ATTRIBUTE eAttribute) { |
1637 Script_Som_Message(hValue, bSetting, XFA_SOM_ValidationMessage); | 1642 Script_Som_Message(hValue, bSetting, XFA_SOM_ValidationMessage); |
1638 } | 1643 } |
1639 void CXFA_Node::Script_Field_Length(FXJSE_HVALUE hValue, | 1644 void CXFA_Node::Script_Field_Length(FXJSE_HVALUE hValue, |
1640 FX_BOOL bSetting, | 1645 FX_BOOL bSetting, |
1641 XFA_ATTRIBUTE eAttribute) { | 1646 XFA_ATTRIBUTE eAttribute) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 CFX_WideString content = GetScriptContent(TRUE); | 1708 CFX_WideString content = GetScriptContent(TRUE); |
1704 if (content.IsEmpty() && classID != XFA_ELEMENT_Text && | 1709 if (content.IsEmpty() && classID != XFA_ELEMENT_Text && |
1705 classID != XFA_ELEMENT_SubmitUrl) { | 1710 classID != XFA_ELEMENT_SubmitUrl) { |
1706 FXJSE_Value_SetNull(hValue); | 1711 FXJSE_Value_SetNull(hValue); |
1707 } else if (classID == XFA_ELEMENT_Integer) { | 1712 } else if (classID == XFA_ELEMENT_Integer) { |
1708 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); | 1713 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); |
1709 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { | 1714 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { |
1710 CFX_Decimal decimal(content); | 1715 CFX_Decimal decimal(content); |
1711 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); | 1716 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); |
1712 } else { | 1717 } else { |
1713 FXJSE_Value_SetUTF8String(hValue, | 1718 FXJSE_Value_SetUTF8String( |
1714 FX_UTF8Encode(content, content.GetLength())); | 1719 hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); |
1715 } | 1720 } |
1716 } | 1721 } |
1717 } | 1722 } |
1718 void CXFA_Node::Script_Som_DefaultValue_Read(FXJSE_HVALUE hValue, | 1723 void CXFA_Node::Script_Som_DefaultValue_Read(FXJSE_HVALUE hValue, |
1719 FX_BOOL bSetting, | 1724 FX_BOOL bSetting, |
1720 XFA_ATTRIBUTE eAttribute) { | 1725 XFA_ATTRIBUTE eAttribute) { |
1721 if (bSetting) { | 1726 if (bSetting) { |
1722 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 1727 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
1723 return; | 1728 return; |
1724 } | 1729 } |
1725 CFX_WideString content = GetScriptContent(TRUE); | 1730 CFX_WideString content = GetScriptContent(TRUE); |
1726 if (content.IsEmpty()) { | 1731 if (content.IsEmpty()) { |
1727 FXJSE_Value_SetNull(hValue); | 1732 FXJSE_Value_SetNull(hValue); |
1728 } else { | 1733 } else { |
1729 FXJSE_Value_SetUTF8String(hValue, | 1734 FXJSE_Value_SetUTF8String( |
1730 FX_UTF8Encode(content, content.GetLength())); | 1735 hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); |
1731 } | 1736 } |
1732 } | 1737 } |
1733 void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, | 1738 void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, |
1734 FX_BOOL bSetting, | 1739 FX_BOOL bSetting, |
1735 XFA_ATTRIBUTE eAttribute) { | 1740 XFA_ATTRIBUTE eAttribute) { |
1736 if (bSetting) { | 1741 if (bSetting) { |
1737 CFX_ByteString newValue; | 1742 CFX_ByteString newValue; |
1738 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { | 1743 if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { |
1739 FXJSE_Value_ToUTF8String(hValue, newValue); | 1744 FXJSE_Value_ToUTF8String(hValue, newValue); |
1740 } | 1745 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1860 for (int32_t i = 0; i < iSize; ++i) { | 1865 for (int32_t i = 0; i < iSize; ++i) { |
1861 CXFA_Edge edge = border.GetEdge(i); | 1866 CXFA_Edge edge = border.GetEdge(i); |
1862 edge.SetColor(rgb); | 1867 edge.SetColor(rgb); |
1863 } | 1868 } |
1864 } else { | 1869 } else { |
1865 CXFA_Edge edge = border.GetEdge(0); | 1870 CXFA_Edge edge = border.GetEdge(0); |
1866 FX_ARGB color = edge.GetColor(); | 1871 FX_ARGB color = edge.GetColor(); |
1867 int32_t a, r, g, b; | 1872 int32_t a, r, g, b; |
1868 ArgbDecode(color, a, r, g, b); | 1873 ArgbDecode(color, a, r, g, b); |
1869 strColor.Format(L"%d,%d,%d", r, g, b); | 1874 strColor.Format(L"%d,%d,%d", r, g, b); |
1870 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(strColor)); | 1875 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(strColor).AsByteStringC()); |
1871 } | 1876 } |
1872 } | 1877 } |
1873 void CXFA_Node::Script_Som_BorderWidth(FXJSE_HVALUE hValue, | 1878 void CXFA_Node::Script_Som_BorderWidth(FXJSE_HVALUE hValue, |
1874 FX_BOOL bSetting, | 1879 FX_BOOL bSetting, |
1875 XFA_ATTRIBUTE eAttribute) { | 1880 XFA_ATTRIBUTE eAttribute) { |
1876 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 1881 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
1877 if (!pWidgetData) { | 1882 if (!pWidgetData) { |
1878 return; | 1883 return; |
1879 } | 1884 } |
1880 CXFA_Border border = pWidgetData->GetBorder(TRUE); | 1885 CXFA_Border border = pWidgetData->GetBorder(TRUE); |
1881 int32_t iSize = border.CountEdges(); | 1886 int32_t iSize = border.CountEdges(); |
1882 CFX_WideString wsThickness; | 1887 CFX_WideString wsThickness; |
1883 if (bSetting) { | 1888 if (bSetting) { |
1884 CFX_ByteString bsValue; | 1889 CFX_ByteString bsValue; |
1885 FXJSE_Value_ToUTF8String(hValue, bsValue); | 1890 FXJSE_Value_ToUTF8String(hValue, bsValue); |
1886 wsThickness = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 1891 wsThickness = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); |
1887 for (int32_t i = 0; i < iSize; ++i) { | 1892 for (int32_t i = 0; i < iSize; ++i) { |
1888 CXFA_Edge edge = border.GetEdge(i); | 1893 CXFA_Edge edge = border.GetEdge(i); |
1889 CXFA_Measurement thickness(wsThickness); | 1894 CXFA_Measurement thickness(wsThickness); |
1890 edge.SetMSThickness(thickness); | 1895 edge.SetMSThickness(thickness); |
1891 } | 1896 } |
1892 } else { | 1897 } else { |
1893 CXFA_Edge edge = border.GetEdge(0); | 1898 CXFA_Edge edge = border.GetEdge(0); |
1894 CXFA_Measurement thickness = edge.GetMSThickness(); | 1899 CXFA_Measurement thickness = edge.GetMSThickness(); |
1895 thickness.ToString(wsThickness); | 1900 thickness.ToString(wsThickness); |
1896 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsThickness)); | 1901 FXJSE_Value_SetUTF8String(hValue, |
| 1902 FX_UTF8Encode(wsThickness).AsByteStringC()); |
1897 } | 1903 } |
1898 } | 1904 } |
1899 void CXFA_Node::Script_Som_FillColor(FXJSE_HVALUE hValue, | 1905 void CXFA_Node::Script_Som_FillColor(FXJSE_HVALUE hValue, |
1900 FX_BOOL bSetting, | 1906 FX_BOOL bSetting, |
1901 XFA_ATTRIBUTE eAttribute) { | 1907 XFA_ATTRIBUTE eAttribute) { |
1902 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 1908 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
1903 if (!pWidgetData) { | 1909 if (!pWidgetData) { |
1904 return; | 1910 return; |
1905 } | 1911 } |
1906 CXFA_Border border = pWidgetData->GetBorder(TRUE); | 1912 CXFA_Border border = pWidgetData->GetBorder(TRUE); |
1907 CXFA_Fill borderfill = border.GetFill(TRUE); | 1913 CXFA_Fill borderfill = border.GetFill(TRUE); |
1908 CXFA_Node* pNode = borderfill.GetNode(); | 1914 CXFA_Node* pNode = borderfill.GetNode(); |
1909 if (!pNode) { | 1915 if (!pNode) { |
1910 return; | 1916 return; |
1911 } | 1917 } |
1912 CFX_WideString wsColor; | 1918 CFX_WideString wsColor; |
1913 if (bSetting) { | 1919 if (bSetting) { |
1914 CFX_ByteString bsValue; | 1920 CFX_ByteString bsValue; |
1915 FXJSE_Value_ToUTF8String(hValue, bsValue); | 1921 FXJSE_Value_ToUTF8String(hValue, bsValue); |
1916 wsColor = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 1922 wsColor = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); |
1917 int32_t r, g, b; | 1923 int32_t r, g, b; |
1918 XFA_STRING_TO_RGB(wsColor, r, g, b); | 1924 XFA_STRING_TO_RGB(wsColor, r, g, b); |
1919 FX_ARGB color = ArgbEncode(0xff, r, g, b); | 1925 FX_ARGB color = ArgbEncode(0xff, r, g, b); |
1920 borderfill.SetColor(color); | 1926 borderfill.SetColor(color); |
1921 } else { | 1927 } else { |
1922 FX_ARGB color = borderfill.GetColor(); | 1928 FX_ARGB color = borderfill.GetColor(); |
1923 int32_t a, r, g, b; | 1929 int32_t a, r, g, b; |
1924 ArgbDecode(color, a, r, g, b); | 1930 ArgbDecode(color, a, r, g, b); |
1925 wsColor.Format(L"%d,%d,%d", r, g, b); | 1931 wsColor.Format(L"%d,%d,%d", r, g, b); |
1926 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor)); | 1932 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor).AsByteStringC()); |
1927 } | 1933 } |
1928 } | 1934 } |
1929 void CXFA_Node::Script_Som_DataNode(FXJSE_HVALUE hValue, | 1935 void CXFA_Node::Script_Som_DataNode(FXJSE_HVALUE hValue, |
1930 FX_BOOL bSetting, | 1936 FX_BOOL bSetting, |
1931 XFA_ATTRIBUTE eAttribute) { | 1937 XFA_ATTRIBUTE eAttribute) { |
1932 if (!bSetting) { | 1938 if (!bSetting) { |
1933 CXFA_Node* pDataNode = GetBindData(); | 1939 CXFA_Node* pDataNode = GetBindData(); |
1934 if (pDataNode) { | 1940 if (pDataNode) { |
1935 FXJSE_Value_Set( | 1941 FXJSE_Value_Set( |
1936 hValue, | 1942 hValue, |
(...skipping 21 matching lines...) Expand all Loading... |
1958 CFX_WideString wsFormatValue(wsNewValue); | 1964 CFX_WideString wsFormatValue(wsNewValue); |
1959 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); | 1965 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); |
1960 } else if (uiType != XFA_ELEMENT_Image) { | 1966 } else if (uiType != XFA_ELEMENT_Image) { |
1961 } | 1967 } |
1962 } | 1968 } |
1963 } else { | 1969 } else { |
1964 CFX_WideString content = GetScriptContent(TRUE); | 1970 CFX_WideString content = GetScriptContent(TRUE); |
1965 if (content.IsEmpty()) { | 1971 if (content.IsEmpty()) { |
1966 FXJSE_Value_SetNull(hValue); | 1972 FXJSE_Value_SetNull(hValue); |
1967 } else { | 1973 } else { |
1968 FXJSE_Value_SetUTF8String(hValue, | 1974 FXJSE_Value_SetUTF8String( |
1969 FX_UTF8Encode(content, content.GetLength())); | 1975 hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); |
1970 } | 1976 } |
1971 } | 1977 } |
1972 } | 1978 } |
1973 void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue, | 1979 void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue, |
1974 FX_BOOL bSetting, | 1980 FX_BOOL bSetting, |
1975 XFA_ATTRIBUTE eAttribute) { | 1981 XFA_ATTRIBUTE eAttribute) { |
1976 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 1982 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
1977 if (!pWidgetData) { | 1983 if (!pWidgetData) { |
1978 return; | 1984 return; |
1979 } | 1985 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2011 FXJSE_Value_SetNull(hValue); | 2017 FXJSE_Value_SetNull(hValue); |
2012 } else { | 2018 } else { |
2013 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); | 2019 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); |
2014 XFA_ELEMENT eUI = pUIChild->GetClassID(); | 2020 XFA_ELEMENT eUI = pUIChild->GetClassID(); |
2015 CXFA_Value defVal = pWidgetData->GetFormValue(); | 2021 CXFA_Value defVal = pWidgetData->GetFormValue(); |
2016 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); | 2022 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); |
2017 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Decimal) { | 2023 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Decimal) { |
2018 if (eUI == XFA_ELEMENT_NumericEdit && | 2024 if (eUI == XFA_ELEMENT_NumericEdit && |
2019 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { | 2025 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { |
2020 FXJSE_Value_SetUTF8String( | 2026 FXJSE_Value_SetUTF8String( |
2021 hValue, FX_UTF8Encode(content, content.GetLength())); | 2027 hValue, |
| 2028 FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); |
2022 } else { | 2029 } else { |
2023 CFX_Decimal decimal(content); | 2030 CFX_Decimal decimal(content); |
2024 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); | 2031 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); |
2025 } | 2032 } |
2026 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) { | 2033 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) { |
2027 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); | 2034 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); |
2028 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) { | 2035 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) { |
2029 FXJSE_Value_SetBoolean(hValue, FXSYS_wtoi(content) == 0 ? FALSE : TRUE); | 2036 FXJSE_Value_SetBoolean(hValue, FXSYS_wtoi(content) == 0 ? FALSE : TRUE); |
2030 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) { | 2037 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) { |
2031 CFX_Decimal decimal(content); | 2038 CFX_Decimal decimal(content); |
2032 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); | 2039 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); |
2033 } else { | 2040 } else { |
2034 FXJSE_Value_SetUTF8String(hValue, | 2041 FXJSE_Value_SetUTF8String( |
2035 FX_UTF8Encode(content, content.GetLength())); | 2042 hValue, |
| 2043 FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); |
2036 } | 2044 } |
2037 } | 2045 } |
2038 } | 2046 } |
2039 } | 2047 } |
2040 void CXFA_Node::Script_Field_EditValue(FXJSE_HVALUE hValue, | 2048 void CXFA_Node::Script_Field_EditValue(FXJSE_HVALUE hValue, |
2041 FX_BOOL bSetting, | 2049 FX_BOOL bSetting, |
2042 XFA_ATTRIBUTE eAttribute) { | 2050 XFA_ATTRIBUTE eAttribute) { |
2043 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2051 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2044 if (!pWidgetData) { | 2052 if (!pWidgetData) { |
2045 return; | 2053 return; |
2046 } | 2054 } |
2047 CFX_WideString wsValue; | 2055 CFX_WideString wsValue; |
2048 if (bSetting) { | 2056 if (bSetting) { |
2049 CFX_ByteString bsValue; | 2057 CFX_ByteString bsValue; |
2050 FXJSE_Value_ToUTF8String(hValue, bsValue); | 2058 FXJSE_Value_ToUTF8String(hValue, bsValue); |
2051 wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 2059 wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); |
2052 pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Edit); | 2060 pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Edit); |
2053 } else { | 2061 } else { |
2054 pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Edit); | 2062 pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Edit); |
2055 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue)); | 2063 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); |
2056 } | 2064 } |
2057 } | 2065 } |
2058 void CXFA_Node::Script_Som_FontColor(FXJSE_HVALUE hValue, | 2066 void CXFA_Node::Script_Som_FontColor(FXJSE_HVALUE hValue, |
2059 FX_BOOL bSetting, | 2067 FX_BOOL bSetting, |
2060 XFA_ATTRIBUTE eAttribute) { | 2068 XFA_ATTRIBUTE eAttribute) { |
2061 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2069 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2062 if (!pWidgetData) { | 2070 if (!pWidgetData) { |
2063 return; | 2071 return; |
2064 } | 2072 } |
2065 CXFA_Font font = pWidgetData->GetFont(TRUE); | 2073 CXFA_Font font = pWidgetData->GetFont(TRUE); |
2066 CXFA_Node* pNode = font.GetNode(); | 2074 CXFA_Node* pNode = font.GetNode(); |
2067 if (!pNode) { | 2075 if (!pNode) { |
2068 return; | 2076 return; |
2069 } | 2077 } |
2070 CFX_WideString wsColor; | 2078 CFX_WideString wsColor; |
2071 if (bSetting) { | 2079 if (bSetting) { |
2072 CFX_ByteString bsValue; | 2080 CFX_ByteString bsValue; |
2073 FXJSE_Value_ToUTF8String(hValue, bsValue); | 2081 FXJSE_Value_ToUTF8String(hValue, bsValue); |
2074 wsColor = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 2082 wsColor = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); |
2075 int32_t r, g, b; | 2083 int32_t r, g, b; |
2076 XFA_STRING_TO_RGB(wsColor, r, g, b); | 2084 XFA_STRING_TO_RGB(wsColor, r, g, b); |
2077 FX_ARGB color = ArgbEncode(0xff, r, g, b); | 2085 FX_ARGB color = ArgbEncode(0xff, r, g, b); |
2078 font.SetColor(color); | 2086 font.SetColor(color); |
2079 } else { | 2087 } else { |
2080 FX_ARGB color = font.GetColor(); | 2088 FX_ARGB color = font.GetColor(); |
2081 int32_t a, r, g, b; | 2089 int32_t a, r, g, b; |
2082 ArgbDecode(color, a, r, g, b); | 2090 ArgbDecode(color, a, r, g, b); |
2083 wsColor.Format(L"%d,%d,%d", r, g, b); | 2091 wsColor.Format(L"%d,%d,%d", r, g, b); |
2084 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor)); | 2092 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor).AsByteStringC()); |
2085 } | 2093 } |
2086 } | 2094 } |
2087 void CXFA_Node::Script_Field_FormatMessage(FXJSE_HVALUE hValue, | 2095 void CXFA_Node::Script_Field_FormatMessage(FXJSE_HVALUE hValue, |
2088 FX_BOOL bSetting, | 2096 FX_BOOL bSetting, |
2089 XFA_ATTRIBUTE eAttribute) { | 2097 XFA_ATTRIBUTE eAttribute) { |
2090 Script_Som_Message(hValue, bSetting, XFA_SOM_FormatMessage); | 2098 Script_Som_Message(hValue, bSetting, XFA_SOM_FormatMessage); |
2091 } | 2099 } |
2092 void CXFA_Node::Script_Field_FormattedValue(FXJSE_HVALUE hValue, | 2100 void CXFA_Node::Script_Field_FormattedValue(FXJSE_HVALUE hValue, |
2093 FX_BOOL bSetting, | 2101 FX_BOOL bSetting, |
2094 XFA_ATTRIBUTE eAttribute) { | 2102 XFA_ATTRIBUTE eAttribute) { |
2095 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2103 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2096 if (!pWidgetData) { | 2104 if (!pWidgetData) { |
2097 return; | 2105 return; |
2098 } | 2106 } |
2099 CFX_WideString wsValue; | 2107 CFX_WideString wsValue; |
2100 if (bSetting) { | 2108 if (bSetting) { |
2101 CFX_ByteString bsValue; | 2109 CFX_ByteString bsValue; |
2102 FXJSE_Value_ToUTF8String(hValue, bsValue); | 2110 FXJSE_Value_ToUTF8String(hValue, bsValue); |
2103 wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 2111 wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); |
2104 pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Display); | 2112 pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Display); |
2105 } else { | 2113 } else { |
2106 pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Display); | 2114 pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Display); |
2107 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue)); | 2115 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); |
2108 } | 2116 } |
2109 } | 2117 } |
2110 void CXFA_Node::Script_Som_Mandatory(FXJSE_HVALUE hValue, | 2118 void CXFA_Node::Script_Som_Mandatory(FXJSE_HVALUE hValue, |
2111 FX_BOOL bSetting, | 2119 FX_BOOL bSetting, |
2112 XFA_ATTRIBUTE eAttribute) { | 2120 XFA_ATTRIBUTE eAttribute) { |
2113 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2121 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2114 if (!pWidgetData) { | 2122 if (!pWidgetData) { |
2115 return; | 2123 return; |
2116 } | 2124 } |
2117 CXFA_Validate validate = pWidgetData->GetValidate(TRUE); | 2125 CXFA_Validate validate = pWidgetData->GetValidate(TRUE); |
2118 CFX_WideString wsValue; | 2126 CFX_WideString wsValue; |
2119 if (bSetting) { | 2127 if (bSetting) { |
2120 CFX_ByteString bsValue; | 2128 CFX_ByteString bsValue; |
2121 FXJSE_Value_ToUTF8String(hValue, bsValue); | 2129 FXJSE_Value_ToUTF8String(hValue, bsValue); |
2122 wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 2130 wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); |
2123 validate.SetNullTest(wsValue); | 2131 validate.SetNullTest(wsValue); |
2124 } else { | 2132 } else { |
2125 int32_t iValue = validate.GetNullTest(); | 2133 int32_t iValue = validate.GetNullTest(); |
2126 const XFA_ATTRIBUTEENUMINFO* pInfo = | 2134 const XFA_ATTRIBUTEENUMINFO* pInfo = |
2127 XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)iValue); | 2135 XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)iValue); |
2128 if (pInfo) { | 2136 if (pInfo) { |
2129 wsValue = pInfo->pName; | 2137 wsValue = pInfo->pName; |
2130 } | 2138 } |
2131 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue)); | 2139 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); |
2132 } | 2140 } |
2133 } | 2141 } |
2134 void CXFA_Node::Script_Som_MandatoryMessage(FXJSE_HVALUE hValue, | 2142 void CXFA_Node::Script_Som_MandatoryMessage(FXJSE_HVALUE hValue, |
2135 FX_BOOL bSetting, | 2143 FX_BOOL bSetting, |
2136 XFA_ATTRIBUTE eAttribute) { | 2144 XFA_ATTRIBUTE eAttribute) { |
2137 Script_Som_Message(hValue, bSetting, XFA_SOM_MandatoryMessage); | 2145 Script_Som_Message(hValue, bSetting, XFA_SOM_MandatoryMessage); |
2138 } | 2146 } |
2139 void CXFA_Node::Script_Field_ParentSubform(FXJSE_HVALUE hValue, | 2147 void CXFA_Node::Script_Field_ParentSubform(FXJSE_HVALUE hValue, |
2140 FX_BOOL bSetting, | 2148 FX_BOOL bSetting, |
2141 XFA_ATTRIBUTE eAttribute) { | 2149 XFA_ATTRIBUTE eAttribute) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 return; | 2235 return; |
2228 } | 2236 } |
2229 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2237 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2230 if (!pWidgetData) { | 2238 if (!pWidgetData) { |
2231 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 2239 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
2232 return; | 2240 return; |
2233 } | 2241 } |
2234 CFX_WideString wsValue; | 2242 CFX_WideString wsValue; |
2235 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, TRUE); | 2243 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, TRUE); |
2236 if (bHasItem) { | 2244 if (bHasItem) { |
2237 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), | 2245 FXJSE_Value_SetUTF8String( |
2238 FX_UTF8Encode(wsValue, wsValue.GetLength())); | 2246 pArguments->GetReturnValue(), |
| 2247 FX_UTF8Encode(wsValue, wsValue.GetLength()).AsByteStringC()); |
2239 } else { | 2248 } else { |
2240 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 2249 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
2241 } | 2250 } |
2242 } | 2251 } |
2243 void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { | 2252 void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { |
2244 int32_t iLength = pArguments->GetLength(); | 2253 int32_t iLength = pArguments->GetLength(); |
2245 if (iLength != 1) { | 2254 if (iLength != 1) { |
2246 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"boundItem"); | 2255 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"boundItem"); |
2247 return; | 2256 return; |
2248 } | 2257 } |
2249 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2258 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2250 if (!pWidgetData) { | 2259 if (!pWidgetData) { |
2251 return; | 2260 return; |
2252 } | 2261 } |
2253 CFX_ByteString bsValue = pArguments->GetUTF8String(0); | 2262 CFX_ByteString bsValue = pArguments->GetUTF8String(0); |
2254 CFX_WideString wsValue = | 2263 CFX_WideString wsValue = |
2255 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); | 2264 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); |
2256 CFX_WideString wsBoundValue; | 2265 CFX_WideString wsBoundValue; |
2257 pWidgetData->GetItemValue(wsValue, wsBoundValue); | 2266 pWidgetData->GetItemValue(wsValue, wsBoundValue); |
2258 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 2267 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
2259 if (hValue) { | 2268 if (hValue) { |
2260 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsBoundValue)); | 2269 FXJSE_Value_SetUTF8String(hValue, |
| 2270 FX_UTF8Encode(wsBoundValue).AsByteStringC()); |
2261 } | 2271 } |
2262 } | 2272 } |
2263 void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { | 2273 void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { |
2264 int32_t iLength = pArguments->GetLength(); | 2274 int32_t iLength = pArguments->GetLength(); |
2265 if (iLength != 1) { | 2275 if (iLength != 1) { |
2266 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2276 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
2267 L"getItemState"); | 2277 L"getItemState"); |
2268 return; | 2278 return; |
2269 } | 2279 } |
2270 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2280 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2305 return; | 2315 return; |
2306 } | 2316 } |
2307 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 2317 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
2308 if (!pWidgetData) { | 2318 if (!pWidgetData) { |
2309 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 2319 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
2310 return; | 2320 return; |
2311 } | 2321 } |
2312 CFX_WideString wsValue; | 2322 CFX_WideString wsValue; |
2313 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, FALSE); | 2323 FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, FALSE); |
2314 if (bHasItem) { | 2324 if (bHasItem) { |
2315 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), | 2325 FXJSE_Value_SetUTF8String( |
2316 FX_UTF8Encode(wsValue, wsValue.GetLength())); | 2326 pArguments->GetReturnValue(), |
| 2327 FX_UTF8Encode(wsValue, wsValue.GetLength()).AsByteStringC()); |
2317 } else { | 2328 } else { |
2318 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 2329 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
2319 } | 2330 } |
2320 } | 2331 } |
2321 void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) { | 2332 void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) { |
2322 int32_t iLength = pArguments->GetLength(); | 2333 int32_t iLength = pArguments->GetLength(); |
2323 if (iLength != 2) { | 2334 if (iLength != 2) { |
2324 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2335 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
2325 L"setItemState"); | 2336 L"setItemState"); |
2326 return; | 2337 return; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 CFX_ByteString bsValue; | 2407 CFX_ByteString bsValue; |
2397 FXJSE_Value_ToUTF8String(hValue, bsValue); | 2408 FXJSE_Value_ToUTF8String(hValue, bsValue); |
2398 pWidgetData->SetSelectedMemberByValue( | 2409 pWidgetData->SetSelectedMemberByValue( |
2399 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()), TRUE, TRUE); | 2410 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()), TRUE, TRUE); |
2400 } else { | 2411 } else { |
2401 CFX_WideString wsValue = GetScriptContent(TRUE); | 2412 CFX_WideString wsValue = GetScriptContent(TRUE); |
2402 XFA_VERSION curVersion = GetDocument()->GetCurVersionMode(); | 2413 XFA_VERSION curVersion = GetDocument()->GetCurVersionMode(); |
2403 if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) { | 2414 if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) { |
2404 FXJSE_Value_SetNull(hValue); | 2415 FXJSE_Value_SetNull(hValue); |
2405 } else { | 2416 } else { |
2406 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue)); | 2417 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); |
2407 } | 2418 } |
2408 } | 2419 } |
2409 } | 2420 } |
2410 void CXFA_Node::Script_ExclGroup_Transient(FXJSE_HVALUE hValue, | 2421 void CXFA_Node::Script_ExclGroup_Transient(FXJSE_HVALUE hValue, |
2411 FX_BOOL bSetting, | 2422 FX_BOOL bSetting, |
2412 XFA_ATTRIBUTE eAttribute) {} | 2423 XFA_ATTRIBUTE eAttribute) {} |
2413 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { | 2424 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { |
2414 int32_t argc = pArguments->GetLength(); | 2425 int32_t argc = pArguments->GetLength(); |
2415 if (argc == 1) { | 2426 if (argc == 1) { |
2416 CFX_ByteString eventString = pArguments->GetUTF8String(0); | 2427 CFX_ByteString eventString = pArguments->GetUTF8String(0); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2595 if (bSetting) { | 2606 if (bSetting) { |
2596 CFX_ByteString bsLocaleName; | 2607 CFX_ByteString bsLocaleName; |
2597 FXJSE_Value_ToUTF8String(hValue, bsLocaleName); | 2608 FXJSE_Value_ToUTF8String(hValue, bsLocaleName); |
2598 SetCData(XFA_ATTRIBUTE_Locale, | 2609 SetCData(XFA_ATTRIBUTE_Locale, |
2599 CFX_WideString::FromUTF8(bsLocaleName, bsLocaleName.GetLength()), | 2610 CFX_WideString::FromUTF8(bsLocaleName, bsLocaleName.GetLength()), |
2600 TRUE, TRUE); | 2611 TRUE, TRUE); |
2601 } else { | 2612 } else { |
2602 CFX_WideString wsLocaleName; | 2613 CFX_WideString wsLocaleName; |
2603 GetLocaleName(wsLocaleName); | 2614 GetLocaleName(wsLocaleName); |
2604 FXJSE_Value_SetUTF8String( | 2615 FXJSE_Value_SetUTF8String( |
2605 hValue, FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength())); | 2616 hValue, |
| 2617 FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength()).AsByteStringC()); |
2606 } | 2618 } |
2607 } | 2619 } |
2608 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { | 2620 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { |
2609 int32_t argc = pArguments->GetLength(); | 2621 int32_t argc = pArguments->GetLength(); |
2610 if (argc == 1) { | 2622 if (argc == 1) { |
2611 CFX_ByteString eventString = pArguments->GetUTF8String(0); | 2623 CFX_ByteString eventString = pArguments->GetUTF8String(0); |
2612 execSingleEventByName( | 2624 execSingleEventByName( |
2613 CFX_WideString::FromUTF8(eventString, eventString.GetLength()), | 2625 CFX_WideString::FromUTF8(eventString, eventString.GetLength()), |
2614 XFA_ELEMENT_Subform); | 2626 XFA_ELEMENT_Subform); |
2615 } else { | 2627 } else { |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3490 XFA_ATTRIBUTE eAttribute) { | 3502 XFA_ATTRIBUTE eAttribute) { |
3491 if (bSetting) { | 3503 if (bSetting) { |
3492 CFX_ByteString bsChecksum; | 3504 CFX_ByteString bsChecksum; |
3493 FXJSE_Value_ToUTF8String(hValue, bsChecksum); | 3505 FXJSE_Value_ToUTF8String(hValue, bsChecksum); |
3494 SetAttribute(XFA_ATTRIBUTE_Checksum, | 3506 SetAttribute(XFA_ATTRIBUTE_Checksum, |
3495 CFX_WideString::FromUTF8(bsChecksum, bsChecksum.GetLength())); | 3507 CFX_WideString::FromUTF8(bsChecksum, bsChecksum.GetLength())); |
3496 } else { | 3508 } else { |
3497 CFX_WideString wsChecksum; | 3509 CFX_WideString wsChecksum; |
3498 GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); | 3510 GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); |
3499 FXJSE_Value_SetUTF8String( | 3511 FXJSE_Value_SetUTF8String( |
3500 hValue, FX_UTF8Encode(wsChecksum, wsChecksum.GetLength())); | 3512 hValue, |
| 3513 FX_UTF8Encode(wsChecksum, wsChecksum.GetLength()).AsByteStringC()); |
3501 } | 3514 } |
3502 } | 3515 } |
3503 void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { | 3516 void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { |
3504 int32_t argc = pArguments->GetLength(); | 3517 int32_t argc = pArguments->GetLength(); |
3505 if (argc == 1) { | 3518 if (argc == 1) { |
3506 CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0); | 3519 CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0); |
3507 CFX_WideString wsAttributeValue; | 3520 CFX_WideString wsAttributeValue; |
3508 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3521 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
3509 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3522 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
3510 static_cast<CFDE_XMLElement*>(pXMLNode) | 3523 static_cast<CFDE_XMLElement*>(pXMLNode) |
3511 ->GetString(CFX_WideString::FromUTF8(bsAttributeName, | 3524 ->GetString(CFX_WideString::FromUTF8(bsAttributeName, |
3512 bsAttributeName.GetLength()), | 3525 bsAttributeName.GetLength()), |
3513 wsAttributeValue); | 3526 wsAttributeValue); |
3514 } | 3527 } |
3515 FXJSE_Value_SetUTF8String( | 3528 FXJSE_Value_SetUTF8String( |
3516 pArguments->GetReturnValue(), | 3529 pArguments->GetReturnValue(), |
3517 FX_UTF8Encode(wsAttributeValue, wsAttributeValue.GetLength())); | 3530 FX_UTF8Encode(wsAttributeValue, wsAttributeValue.GetLength()) |
| 3531 .AsByteStringC()); |
3518 } else { | 3532 } else { |
3519 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3533 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3520 L"getAttribute"); | 3534 L"getAttribute"); |
3521 } | 3535 } |
3522 } | 3536 } |
3523 void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { | 3537 void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { |
3524 int32_t argc = pArguments->GetLength(); | 3538 int32_t argc = pArguments->GetLength(); |
3525 if (argc == 2) { | 3539 if (argc == 2) { |
3526 CFX_ByteString bsValue = pArguments->GetUTF8String(0); | 3540 CFX_ByteString bsValue = pArguments->GetUTF8String(0); |
3527 CFX_ByteString bsName = pArguments->GetUTF8String(1); | 3541 CFX_ByteString bsName = pArguments->GetUTF8String(1); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3569 CFX_WideString::FromUTF8(bsNewContent, bsNewContent.GetLength())); | 3583 CFX_WideString::FromUTF8(bsNewContent, bsNewContent.GetLength())); |
3570 } | 3584 } |
3571 } else { | 3585 } else { |
3572 CFX_WideString wsTextData; | 3586 CFX_WideString wsTextData; |
3573 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3587 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
3574 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3588 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
3575 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 3589 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
3576 pXMLElement->GetTextData(wsTextData); | 3590 pXMLElement->GetTextData(wsTextData); |
3577 } | 3591 } |
3578 FXJSE_Value_SetUTF8String( | 3592 FXJSE_Value_SetUTF8String( |
3579 hValue, FX_UTF8Encode(wsTextData, wsTextData.GetLength())); | 3593 hValue, |
| 3594 FX_UTF8Encode(wsTextData, wsTextData.GetLength()).AsByteStringC()); |
3580 } | 3595 } |
3581 } | 3596 } |
3582 void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) { | 3597 void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) { |
3583 int32_t argc = pArguments->GetLength(); | 3598 int32_t argc = pArguments->GetLength(); |
3584 if (argc == 0) { | 3599 if (argc == 0) { |
3585 } else { | 3600 } else { |
3586 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"next"); | 3601 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"next"); |
3587 } | 3602 } |
3588 } | 3603 } |
3589 void CXFA_Node::Script_Source_CancelBatch(CFXJSE_Arguments* pArguments) { | 3604 void CXFA_Node::Script_Source_CancelBatch(CFXJSE_Arguments* pArguments) { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3721 void CXFA_Node::Script_Extras_Type(FXJSE_HVALUE hValue, | 3736 void CXFA_Node::Script_Extras_Type(FXJSE_HVALUE hValue, |
3722 FX_BOOL bSetting, | 3737 FX_BOOL bSetting, |
3723 XFA_ATTRIBUTE eAttribute) {} | 3738 XFA_ATTRIBUTE eAttribute) {} |
3724 void CXFA_Node::Script_Script_Stateless(FXJSE_HVALUE hValue, | 3739 void CXFA_Node::Script_Script_Stateless(FXJSE_HVALUE hValue, |
3725 FX_BOOL bSetting, | 3740 FX_BOOL bSetting, |
3726 XFA_ATTRIBUTE eAttribute) { | 3741 XFA_ATTRIBUTE eAttribute) { |
3727 if (bSetting) { | 3742 if (bSetting) { |
3728 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 3743 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
3729 return; | 3744 return; |
3730 } | 3745 } |
3731 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(FX_WSTRC(L"0"))); | 3746 FXJSE_Value_SetUTF8String(hValue, |
| 3747 FX_UTF8Encode(FX_WSTRC(L"0")).AsByteStringC()); |
3732 } | 3748 } |
3733 void CXFA_Node::Script_Encrypt_Format(FXJSE_HVALUE hValue, | 3749 void CXFA_Node::Script_Encrypt_Format(FXJSE_HVALUE hValue, |
3734 FX_BOOL bSetting, | 3750 FX_BOOL bSetting, |
3735 XFA_ATTRIBUTE eAttribute) {} | 3751 XFA_ATTRIBUTE eAttribute) {} |
3736 enum XFA_KEYTYPE { | 3752 enum XFA_KEYTYPE { |
3737 XFA_KEYTYPE_Custom, | 3753 XFA_KEYTYPE_Custom, |
3738 XFA_KEYTYPE_Element, | 3754 XFA_KEYTYPE_Element, |
3739 }; | 3755 }; |
3740 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { | 3756 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { |
3741 uint32_t dwKey = FX_HashCode_String_GetW(wsKey.GetPtr(), wsKey.GetLength()); | 3757 uint32_t dwKey = FX_HashCode_String_GetW(wsKey.GetPtr(), wsKey.GetLength()); |
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5407 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5423 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
5408 } | 5424 } |
5409 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5425 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
5410 return m_pAttachNode->RemoveChild(pNode); | 5426 return m_pAttachNode->RemoveChild(pNode); |
5411 } | 5427 } |
5412 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5428 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
5413 return m_pAttachNode->GetChild( | 5429 return m_pAttachNode->GetChild( |
5414 iIndex, XFA_ELEMENT_UNKNOWN, | 5430 iIndex, XFA_ELEMENT_UNKNOWN, |
5415 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); | 5431 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); |
5416 } | 5432 } |
OLD | NEW |