| 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/fgas/crt/fgas_codepage.h" | 11 #include "xfa/fgas/crt/fgas_codepage.h" |
| 11 #include "xfa/fgas/crt/fgas_system.h" | 12 #include "xfa/fgas/crt/fgas_system.h" |
| 12 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 13 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
| 13 #include "xfa/fxfa/parser/xfa_basic_imp.h" | 14 #include "xfa/fxfa/parser/xfa_basic_imp.h" |
| 14 #include "xfa/fxfa/parser/xfa_docdata.h" | 15 #include "xfa/fxfa/parser/xfa_docdata.h" |
| 15 #include "xfa/fxfa/parser/xfa_doclayout.h" | 16 #include "xfa/fxfa/parser/xfa_doclayout.h" |
| 16 #include "xfa/fxfa/parser/xfa_document.h" | 17 #include "xfa/fxfa/parser/xfa_document.h" |
| 17 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" | 18 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" |
| 18 #include "xfa/fxfa/parser/xfa_localemgr.h" | 19 #include "xfa/fxfa/parser/xfa_localemgr.h" |
| 19 #include "xfa/fxfa/parser/xfa_parser.h" | 20 #include "xfa/fxfa/parser/xfa_parser.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 118 } |
| 118 CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) { | 119 CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) { |
| 119 IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); | 120 IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); |
| 120 CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass); | 121 CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass); |
| 121 if (!pClone) { | 122 if (!pClone) { |
| 122 return NULL; | 123 return NULL; |
| 123 } | 124 } |
| 124 MergeAllData(pClone); | 125 MergeAllData(pClone); |
| 125 pClone->UpdateNameHash(); | 126 pClone->UpdateNameHash(); |
| 126 if (IsNeedSavingXMLNode()) { | 127 if (IsNeedSavingXMLNode()) { |
| 127 IFDE_XMLNode* pCloneXML = NULL; | 128 CFDE_XMLNode* pCloneXML = NULL; |
| 128 if (IsAttributeInXML()) { | 129 if (IsAttributeInXML()) { |
| 129 CFX_WideString wsName; | 130 CFX_WideString wsName; |
| 130 GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); | 131 GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); |
| 131 IFDE_XMLElement* pCloneXMLElement = IFDE_XMLElement::Create(wsName); | 132 CFDE_XMLElement* pCloneXMLElement = new CFDE_XMLElement(wsName); |
| 132 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); | 133 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); |
| 133 if (!wsValue.IsEmpty()) { | 134 if (!wsValue.IsEmpty()) { |
| 134 pCloneXMLElement->SetTextData(wsValue); | 135 pCloneXMLElement->SetTextData(wsValue); |
| 135 } | 136 } |
| 136 pCloneXML = pCloneXMLElement; | 137 pCloneXML = pCloneXMLElement; |
| 137 pCloneXMLElement = NULL; | 138 pCloneXMLElement = NULL; |
| 138 pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); | 139 pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); |
| 139 } else { | 140 } else { |
| 140 pCloneXML = m_pXMLNode->Clone(FALSE); | 141 pCloneXML = m_pXMLNode->Clone(FALSE); |
| 141 } | 142 } |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 if (iLength >= 2) { | 956 if (iLength >= 2) { |
| 956 bIgnoreRoot = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; | 957 bIgnoreRoot = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; |
| 957 } | 958 } |
| 958 if (iLength >= 3) { | 959 if (iLength >= 3) { |
| 959 bOverwrite = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; | 960 bOverwrite = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; |
| 960 } | 961 } |
| 961 IXFA_Parser* pParser = IXFA_Parser::Create(m_pDocument); | 962 IXFA_Parser* pParser = IXFA_Parser::Create(m_pDocument); |
| 962 if (!pParser) { | 963 if (!pParser) { |
| 963 return; | 964 return; |
| 964 } | 965 } |
| 965 IFDE_XMLNode* pXMLNode = NULL; | 966 CFDE_XMLNode* pXMLNode = NULL; |
| 966 int32_t iParserStatus = pParser->ParseXMLData(wsExpression, pXMLNode, NULL); | 967 int32_t iParserStatus = pParser->ParseXMLData(wsExpression, pXMLNode, NULL); |
| 967 if (iParserStatus != XFA_PARSESTATUS_Done || !pXMLNode) { | 968 if (iParserStatus != XFA_PARSESTATUS_Done || !pXMLNode) { |
| 968 pParser->Release(); | 969 pParser->Release(); |
| 969 pParser = NULL; | 970 pParser = NULL; |
| 970 return; | 971 return; |
| 971 } | 972 } |
| 972 if (bIgnoreRoot && (pXMLNode->GetType() != FDE_XMLNODE_Element || | 973 if (bIgnoreRoot && |
| 973 XFA_RecognizeRichText((IFDE_XMLElement*)pXMLNode))) { | 974 (pXMLNode->GetType() != FDE_XMLNODE_Element || |
| 975 XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLNode)))) { |
| 974 bIgnoreRoot = FALSE; | 976 bIgnoreRoot = FALSE; |
| 975 } | 977 } |
| 976 CXFA_Node* pFakeRoot = Clone(FALSE); | 978 CXFA_Node* pFakeRoot = Clone(FALSE); |
| 977 CFX_WideStringC wsContentType = GetCData(XFA_ATTRIBUTE_ContentType); | 979 CFX_WideStringC wsContentType = GetCData(XFA_ATTRIBUTE_ContentType); |
| 978 if (!wsContentType.IsEmpty()) { | 980 if (!wsContentType.IsEmpty()) { |
| 979 pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); | 981 pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); |
| 980 } | 982 } |
| 981 IFDE_XMLNode* pFakeXMLRoot = pFakeRoot->GetXMLMappingNode(); | 983 CFDE_XMLNode* pFakeXMLRoot = pFakeRoot->GetXMLMappingNode(); |
| 982 if (!pFakeXMLRoot) { | 984 if (!pFakeXMLRoot) { |
| 983 IFDE_XMLNode* pThisXMLRoot = GetXMLMappingNode(); | 985 CFDE_XMLNode* pThisXMLRoot = GetXMLMappingNode(); |
| 984 pFakeXMLRoot = pThisXMLRoot ? pThisXMLRoot->Clone(FALSE) : NULL; | 986 pFakeXMLRoot = pThisXMLRoot ? pThisXMLRoot->Clone(FALSE) : NULL; |
| 985 } | 987 } |
| 986 if (!pFakeXMLRoot) { | 988 if (!pFakeXMLRoot) { |
| 987 CFX_WideStringC wsClassName; | 989 CFX_WideStringC wsClassName; |
| 988 GetClassName(wsClassName); | 990 GetClassName(wsClassName); |
| 989 pFakeXMLRoot = IFDE_XMLElement::Create(wsClassName); | 991 pFakeXMLRoot = new CFDE_XMLElement(wsClassName); |
| 990 } | 992 } |
| 991 if (bIgnoreRoot) { | 993 if (bIgnoreRoot) { |
| 992 IFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(IFDE_XMLNode::FirstChild); | 994 CFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); |
| 993 while (pXMLChild) { | 995 while (pXMLChild) { |
| 994 IFDE_XMLNode* pXMLSibling = | 996 CFDE_XMLNode* pXMLSibling = |
| 995 pXMLChild->GetNodeItem(IFDE_XMLNode::NextSibling); | 997 pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling); |
| 996 pXMLNode->RemoveChildNode(pXMLChild); | 998 pXMLNode->RemoveChildNode(pXMLChild); |
| 997 pFakeXMLRoot->InsertChildNode(pXMLChild); | 999 pFakeXMLRoot->InsertChildNode(pXMLChild); |
| 998 pXMLChild = pXMLSibling; | 1000 pXMLChild = pXMLSibling; |
| 999 } | 1001 } |
| 1000 } else { | 1002 } else { |
| 1001 IFDE_XMLNode* pXMLParent = pXMLNode->GetNodeItem(IFDE_XMLNode::Parent); | 1003 CFDE_XMLNode* pXMLParent = pXMLNode->GetNodeItem(CFDE_XMLNode::Parent); |
| 1002 if (pXMLParent) { | 1004 if (pXMLParent) { |
| 1003 pXMLParent->RemoveChildNode(pXMLNode); | 1005 pXMLParent->RemoveChildNode(pXMLNode); |
| 1004 } | 1006 } |
| 1005 pFakeXMLRoot->InsertChildNode(pXMLNode); | 1007 pFakeXMLRoot->InsertChildNode(pXMLNode); |
| 1006 } | 1008 } |
| 1007 pParser->ConstructXFANode(pFakeRoot, pFakeXMLRoot); | 1009 pParser->ConstructXFANode(pFakeRoot, pFakeXMLRoot); |
| 1008 pFakeRoot = pParser->GetRootNode(); | 1010 pFakeRoot = pParser->GetRootNode(); |
| 1009 if (pFakeRoot) { | 1011 if (pFakeRoot) { |
| 1010 if (bOverwrite) { | 1012 if (bOverwrite) { |
| 1011 CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); | 1013 CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1012 CXFA_Node* pNewChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild); | 1014 CXFA_Node* pNewChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1013 int32_t index = 0; | 1015 int32_t index = 0; |
| 1014 while (pNewChild) { | 1016 while (pNewChild) { |
| 1015 CXFA_Node* pItem = pNewChild->GetNodeItem(XFA_NODEITEM_NextSibling); | 1017 CXFA_Node* pItem = pNewChild->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 1016 pFakeRoot->RemoveChild(pNewChild); | 1018 pFakeRoot->RemoveChild(pNewChild); |
| 1017 InsertChild(index++, pNewChild); | 1019 InsertChild(index++, pNewChild); |
| 1018 pNewChild->SetFlag(XFA_NODEFLAG_Initialized); | 1020 pNewChild->SetFlag(XFA_NODEFLAG_Initialized); |
| 1019 pNewChild = pItem; | 1021 pNewChild = pItem; |
| 1020 } | 1022 } |
| 1021 while (pChild) { | 1023 while (pChild) { |
| 1022 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); | 1024 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 1023 RemoveChild(pChild); | 1025 RemoveChild(pChild); |
| 1024 pFakeRoot->InsertChild(pChild); | 1026 pFakeRoot->InsertChild(pChild); |
| 1025 pChild = pItem; | 1027 pChild = pItem; |
| 1026 } | 1028 } |
| 1027 if (GetPacketID() == XFA_XDPPACKET_Form && | 1029 if (GetPacketID() == XFA_XDPPACKET_Form && |
| 1028 GetClassID() == XFA_ELEMENT_ExData) { | 1030 GetClassID() == XFA_ELEMENT_ExData) { |
| 1029 IFDE_XMLNode* pTempXMLNode = GetXMLMappingNode(); | 1031 CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode(); |
| 1030 SetXMLMappingNode(pFakeXMLRoot); | 1032 SetXMLMappingNode(pFakeXMLRoot); |
| 1031 SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); | 1033 SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); |
| 1032 if (pTempXMLNode && | 1034 if (pTempXMLNode && |
| 1033 pTempXMLNode->GetNodeItem(IFDE_XMLNode::Parent) == NULL) { | 1035 pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL) { |
| 1034 pFakeXMLRoot = pTempXMLNode; | 1036 pFakeXMLRoot = pTempXMLNode; |
| 1035 } else { | 1037 } else { |
| 1036 pFakeXMLRoot = NULL; | 1038 pFakeXMLRoot = NULL; |
| 1037 } | 1039 } |
| 1038 } | 1040 } |
| 1039 MoveBufferMapData(pFakeRoot, this, XFA_CalcData, TRUE); | 1041 MoveBufferMapData(pFakeRoot, this, XFA_CalcData, TRUE); |
| 1040 } else { | 1042 } else { |
| 1041 CXFA_Node* pChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild); | 1043 CXFA_Node* pChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1042 while (pChild) { | 1044 while (pChild) { |
| 1043 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); | 1045 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 CFX_ByteStringC(pMemoryStream->GetBuffer(), pMemoryStream->GetSize())); | 1101 CFX_ByteStringC(pMemoryStream->GetBuffer(), pMemoryStream->GetSize())); |
| 1100 pStream->Release(); | 1102 pStream->Release(); |
| 1101 pStream = NULL; | 1103 pStream = NULL; |
| 1102 if (pMemoryStream) { | 1104 if (pMemoryStream) { |
| 1103 pMemoryStream->Release(); | 1105 pMemoryStream->Release(); |
| 1104 pMemoryStream = NULL; | 1106 pMemoryStream = NULL; |
| 1105 } | 1107 } |
| 1106 return; | 1108 return; |
| 1107 } | 1109 } |
| 1108 if (GetPacketID() == XFA_XDPPACKET_Datasets) { | 1110 if (GetPacketID() == XFA_XDPPACKET_Datasets) { |
| 1109 IFDE_XMLNode* pElement = GetXMLMappingNode(); | 1111 CFDE_XMLNode* pElement = GetXMLMappingNode(); |
| 1110 if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) { | 1112 if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) { |
| 1111 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), bsXMLHeader); | 1113 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), bsXMLHeader); |
| 1112 return; | 1114 return; |
| 1113 } | 1115 } |
| 1114 XFA_DataExporter_DealWithDataGroupNode(this); | 1116 XFA_DataExporter_DealWithDataGroupNode(this); |
| 1115 IFX_MemoryStream* pMemoryStream = FX_CreateMemoryStream(TRUE); | 1117 IFX_MemoryStream* pMemoryStream = FX_CreateMemoryStream(TRUE); |
| 1116 IFX_Stream* pStream = IFX_Stream::CreateStream( | 1118 IFX_Stream* pStream = IFX_Stream::CreateStream( |
| 1117 (IFX_FileWrite*)pMemoryStream, | 1119 (IFX_FileWrite*)pMemoryStream, |
| 1118 FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append); | 1120 FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append); |
| 1119 if (pStream) { | 1121 if (pStream) { |
| (...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3493 GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); | 3495 GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); |
| 3494 FXJSE_Value_SetUTF8String( | 3496 FXJSE_Value_SetUTF8String( |
| 3495 hValue, FX_UTF8Encode(wsChecksum, wsChecksum.GetLength())); | 3497 hValue, FX_UTF8Encode(wsChecksum, wsChecksum.GetLength())); |
| 3496 } | 3498 } |
| 3497 } | 3499 } |
| 3498 void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { | 3500 void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { |
| 3499 int32_t argc = pArguments->GetLength(); | 3501 int32_t argc = pArguments->GetLength(); |
| 3500 if (argc == 1) { | 3502 if (argc == 1) { |
| 3501 CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0); | 3503 CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0); |
| 3502 CFX_WideString wsAttributeValue; | 3504 CFX_WideString wsAttributeValue; |
| 3503 IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3505 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
| 3504 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3506 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
| 3505 ((IFDE_XMLElement*)pXMLNode) | 3507 static_cast<CFDE_XMLElement*>(pXMLNode) |
| 3506 ->GetString(CFX_WideString::FromUTF8(bsAttributeName, | 3508 ->GetString(CFX_WideString::FromUTF8(bsAttributeName, |
| 3507 bsAttributeName.GetLength()), | 3509 bsAttributeName.GetLength()), |
| 3508 wsAttributeValue); | 3510 wsAttributeValue); |
| 3509 } | 3511 } |
| 3510 FXJSE_Value_SetUTF8String( | 3512 FXJSE_Value_SetUTF8String( |
| 3511 pArguments->GetReturnValue(), | 3513 pArguments->GetReturnValue(), |
| 3512 FX_UTF8Encode(wsAttributeValue, wsAttributeValue.GetLength())); | 3514 FX_UTF8Encode(wsAttributeValue, wsAttributeValue.GetLength())); |
| 3513 } else { | 3515 } else { |
| 3514 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3516 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 3515 L"getAttribute"); | 3517 L"getAttribute"); |
| 3516 } | 3518 } |
| 3517 } | 3519 } |
| 3518 void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { | 3520 void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { |
| 3519 int32_t argc = pArguments->GetLength(); | 3521 int32_t argc = pArguments->GetLength(); |
| 3520 if (argc == 2) { | 3522 if (argc == 2) { |
| 3521 CFX_ByteString bsValue = pArguments->GetUTF8String(0); | 3523 CFX_ByteString bsValue = pArguments->GetUTF8String(0); |
| 3522 CFX_ByteString bsName = pArguments->GetUTF8String(1); | 3524 CFX_ByteString bsName = pArguments->GetUTF8String(1); |
| 3523 IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3525 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
| 3524 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3526 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
| 3525 ((IFDE_XMLElement*)pXMLNode) | 3527 static_cast<CFDE_XMLElement*>(pXMLNode) |
| 3526 ->SetString(CFX_WideString::FromUTF8(bsName, bsName.GetLength()), | 3528 ->SetString(CFX_WideString::FromUTF8(bsName, bsName.GetLength()), |
| 3527 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength())); | 3529 CFX_WideString::FromUTF8(bsValue, bsValue.GetLength())); |
| 3528 } | 3530 } |
| 3529 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 3531 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
| 3530 } else { | 3532 } else { |
| 3531 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3533 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 3532 L"setAttribute"); | 3534 L"setAttribute"); |
| 3533 } | 3535 } |
| 3534 } | 3536 } |
| 3535 void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { | 3537 void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { |
| 3536 int32_t argc = pArguments->GetLength(); | 3538 int32_t argc = pArguments->GetLength(); |
| 3537 if (argc == 1) { | 3539 if (argc == 1) { |
| 3538 CFX_ByteString bsName = pArguments->GetUTF8String(0); | 3540 CFX_ByteString bsName = pArguments->GetUTF8String(0); |
| 3539 CFX_WideString wsName = | 3541 CFX_WideString wsName = |
| 3540 CFX_WideString::FromUTF8(bsName, bsName.GetLength()); | 3542 CFX_WideString::FromUTF8(bsName, bsName.GetLength()); |
| 3541 IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3543 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
| 3542 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3544 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
| 3543 IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)pXMLNode; | 3545 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
| 3544 if (pXMLElement->HasAttribute(wsName)) { | 3546 if (pXMLElement->HasAttribute(wsName)) { |
| 3545 pXMLElement->RemoveAttribute(wsName); | 3547 pXMLElement->RemoveAttribute(wsName); |
| 3546 } | 3548 } |
| 3547 } | 3549 } |
| 3548 FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 3550 FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
| 3549 } else { | 3551 } else { |
| 3550 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3552 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 3551 L"removeAttribute"); | 3553 L"removeAttribute"); |
| 3552 } | 3554 } |
| 3553 } | 3555 } |
| 3554 void CXFA_Node::Script_Packet_Content(FXJSE_HVALUE hValue, | 3556 void CXFA_Node::Script_Packet_Content(FXJSE_HVALUE hValue, |
| 3555 FX_BOOL bSetting, | 3557 FX_BOOL bSetting, |
| 3556 XFA_ATTRIBUTE eAttribute) { | 3558 XFA_ATTRIBUTE eAttribute) { |
| 3557 if (bSetting) { | 3559 if (bSetting) { |
| 3558 CFX_ByteString bsNewContent; | 3560 CFX_ByteString bsNewContent; |
| 3559 FXJSE_Value_ToUTF8String(hValue, bsNewContent); | 3561 FXJSE_Value_ToUTF8String(hValue, bsNewContent); |
| 3560 IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3562 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
| 3561 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3563 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
| 3562 IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)pXMLNode; | 3564 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
| 3563 pXMLElement->SetTextData( | 3565 pXMLElement->SetTextData( |
| 3564 CFX_WideString::FromUTF8(bsNewContent, bsNewContent.GetLength())); | 3566 CFX_WideString::FromUTF8(bsNewContent, bsNewContent.GetLength())); |
| 3565 } | 3567 } |
| 3566 } else { | 3568 } else { |
| 3567 CFX_WideString wsTextData; | 3569 CFX_WideString wsTextData; |
| 3568 IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 3570 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
| 3569 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { | 3571 if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { |
| 3570 IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)pXMLNode; | 3572 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
| 3571 pXMLElement->GetTextData(wsTextData); | 3573 pXMLElement->GetTextData(wsTextData); |
| 3572 } | 3574 } |
| 3573 FXJSE_Value_SetUTF8String( | 3575 FXJSE_Value_SetUTF8String( |
| 3574 hValue, FX_UTF8Encode(wsTextData, wsTextData.GetLength())); | 3576 hValue, FX_UTF8Encode(wsTextData, wsTextData.GetLength())); |
| 3575 } | 3577 } |
| 3576 } | 3578 } |
| 3577 void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) { | 3579 void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) { |
| 3578 int32_t argc = pArguments->GetLength(); | 3580 int32_t argc = pArguments->GetLength(); |
| 3579 if (argc == 0) { | 3581 if (argc == 0) { |
| 3580 } else { | 3582 } else { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3953 if (eAttr == XFA_ATTRIBUTE_Name && | 3955 if (eAttr == XFA_ATTRIBUTE_Name && |
| 3954 (m_eNodeClass == XFA_ELEMENT_DataValue || | 3956 (m_eNodeClass == XFA_ELEMENT_DataValue || |
| 3955 m_eNodeClass == XFA_ELEMENT_DataGroup)) { | 3957 m_eNodeClass == XFA_ELEMENT_DataGroup)) { |
| 3956 return TRUE; | 3958 return TRUE; |
| 3957 } | 3959 } |
| 3958 if (eAttr == XFA_ATTRIBUTE_Value) { | 3960 if (eAttr == XFA_ATTRIBUTE_Value) { |
| 3959 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); | 3961 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); |
| 3960 switch (eXMLType) { | 3962 switch (eXMLType) { |
| 3961 case FDE_XMLNODE_Element: | 3963 case FDE_XMLNODE_Element: |
| 3962 if (IsAttributeInXML()) { | 3964 if (IsAttributeInXML()) { |
| 3963 ((IFDE_XMLElement*)m_pXMLNode) | 3965 static_cast<CFDE_XMLElement*>(m_pXMLNode) |
| 3964 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsValue); | 3966 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsValue); |
| 3965 } else { | 3967 } else { |
| 3966 FX_BOOL bDeleteChildren = TRUE; | 3968 FX_BOOL bDeleteChildren = TRUE; |
| 3967 if (GetPacketID() == XFA_XDPPACKET_Datasets) { | 3969 if (GetPacketID() == XFA_XDPPACKET_Datasets) { |
| 3968 for (CXFA_Node* pChildDataNode = | 3970 for (CXFA_Node* pChildDataNode = |
| 3969 GetNodeItem(XFA_NODEITEM_FirstChild); | 3971 GetNodeItem(XFA_NODEITEM_FirstChild); |
| 3970 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem( | 3972 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem( |
| 3971 XFA_NODEITEM_NextSibling)) { | 3973 XFA_NODEITEM_NextSibling)) { |
| 3972 CXFA_NodeArray formNodes; | 3974 CXFA_NodeArray formNodes; |
| 3973 if (pChildDataNode->GetBindItems(formNodes) > 0) { | 3975 if (pChildDataNode->GetBindItems(formNodes) > 0) { |
| 3974 bDeleteChildren = FALSE; | 3976 bDeleteChildren = FALSE; |
| 3975 break; | 3977 break; |
| 3976 } | 3978 } |
| 3977 } | 3979 } |
| 3978 } | 3980 } |
| 3979 if (bDeleteChildren) { | 3981 if (bDeleteChildren) { |
| 3980 ((IFDE_XMLElement*)m_pXMLNode)->DeleteChildren(); | 3982 static_cast<CFDE_XMLElement*>(m_pXMLNode)->DeleteChildren(); |
| 3981 } | 3983 } |
| 3982 ((IFDE_XMLElement*)m_pXMLNode)->SetTextData(wsValue); | 3984 static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetTextData(wsValue); |
| 3983 } | 3985 } |
| 3984 break; | 3986 break; |
| 3985 case FDE_XMLNODE_Text: | 3987 case FDE_XMLNODE_Text: |
| 3986 ((IFDE_XMLText*)m_pXMLNode)->SetText(wsValue); | 3988 static_cast<CFDE_XMLText*>(m_pXMLNode)->SetText(wsValue); |
| 3987 break; | 3989 break; |
| 3988 default: | 3990 default: |
| 3989 FXSYS_assert(0); | 3991 FXSYS_assert(0); |
| 3990 } | 3992 } |
| 3991 return TRUE; | 3993 return TRUE; |
| 3992 } | 3994 } |
| 3993 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); | 3995 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); |
| 3994 if (pInfo) { | 3996 if (pInfo) { |
| 3995 FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element); | 3997 FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element); |
| 3996 CFX_WideString wsAttrName = pInfo->pName; | 3998 CFX_WideString wsAttrName = pInfo->pName; |
| 3997 if (pInfo->eName == XFA_ATTRIBUTE_ContentType) { | 3999 if (pInfo->eName == XFA_ATTRIBUTE_ContentType) { |
| 3998 wsAttrName = FX_WSTRC(L"xfa:") + wsAttrName; | 4000 wsAttrName = FX_WSTRC(L"xfa:") + wsAttrName; |
| 3999 } | 4001 } |
| 4000 ((IFDE_XMLElement*)m_pXMLNode)->SetString(wsAttrName, wsValue); | 4002 static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue); |
| 4001 } | 4003 } |
| 4002 } | 4004 } |
| 4003 return TRUE; | 4005 return TRUE; |
| 4004 } | 4006 } |
| 4005 FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, | 4007 FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, |
| 4006 const CFX_WideString& wsXMLValue, | 4008 const CFX_WideString& wsXMLValue, |
| 4007 FX_BOOL bNotify, | 4009 FX_BOOL bNotify, |
| 4008 FX_BOOL bScriptModify) { | 4010 FX_BOOL bScriptModify) { |
| 4009 void* pKey = XFA_GetMapKey_Element(GetClassID(), XFA_ATTRIBUTE_Value); | 4011 void* pKey = XFA_GetMapKey_Element(GetClassID(), XFA_ATTRIBUTE_Value); |
| 4010 OnChanging(XFA_ATTRIBUTE_Value, (void*)(const FX_WCHAR*)wsValue, bNotify); | 4012 OnChanging(XFA_ATTRIBUTE_Value, (void*)(const FX_WCHAR*)wsValue, bNotify); |
| 4011 CFX_WideString* pClone = new CFX_WideString(wsValue); | 4013 CFX_WideString* pClone = new CFX_WideString(wsValue); |
| 4012 SetUserData(pKey, pClone, &deleteWideStringCallBack); | 4014 SetUserData(pKey, pClone, &deleteWideStringCallBack); |
| 4013 OnChanged(XFA_ATTRIBUTE_Value, (void*)(const FX_WCHAR*)wsValue, bNotify, | 4015 OnChanged(XFA_ATTRIBUTE_Value, (void*)(const FX_WCHAR*)wsValue, bNotify, |
| 4014 bScriptModify); | 4016 bScriptModify); |
| 4015 if (IsNeedSavingXMLNode()) { | 4017 if (IsNeedSavingXMLNode()) { |
| 4016 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); | 4018 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); |
| 4017 switch (eXMLType) { | 4019 switch (eXMLType) { |
| 4018 case FDE_XMLNODE_Element: | 4020 case FDE_XMLNODE_Element: |
| 4019 if (IsAttributeInXML()) { | 4021 if (IsAttributeInXML()) { |
| 4020 ((IFDE_XMLElement*)m_pXMLNode) | 4022 static_cast<CFDE_XMLElement*>(m_pXMLNode) |
| 4021 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsXMLValue); | 4023 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsXMLValue); |
| 4022 } else { | 4024 } else { |
| 4023 FX_BOOL bDeleteChildren = TRUE; | 4025 FX_BOOL bDeleteChildren = TRUE; |
| 4024 if (GetPacketID() == XFA_XDPPACKET_Datasets) { | 4026 if (GetPacketID() == XFA_XDPPACKET_Datasets) { |
| 4025 for (CXFA_Node* pChildDataNode = | 4027 for (CXFA_Node* pChildDataNode = |
| 4026 GetNodeItem(XFA_NODEITEM_FirstChild); | 4028 GetNodeItem(XFA_NODEITEM_FirstChild); |
| 4027 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem( | 4029 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem( |
| 4028 XFA_NODEITEM_NextSibling)) { | 4030 XFA_NODEITEM_NextSibling)) { |
| 4029 CXFA_NodeArray formNodes; | 4031 CXFA_NodeArray formNodes; |
| 4030 if (pChildDataNode->GetBindItems(formNodes) > 0) { | 4032 if (pChildDataNode->GetBindItems(formNodes) > 0) { |
| 4031 bDeleteChildren = FALSE; | 4033 bDeleteChildren = FALSE; |
| 4032 break; | 4034 break; |
| 4033 } | 4035 } |
| 4034 } | 4036 } |
| 4035 } | 4037 } |
| 4036 if (bDeleteChildren) { | 4038 if (bDeleteChildren) { |
| 4037 ((IFDE_XMLElement*)m_pXMLNode)->DeleteChildren(); | 4039 static_cast<CFDE_XMLElement*>(m_pXMLNode)->DeleteChildren(); |
| 4038 } | 4040 } |
| 4039 ((IFDE_XMLElement*)m_pXMLNode)->SetTextData(wsXMLValue); | 4041 static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetTextData(wsXMLValue); |
| 4040 } | 4042 } |
| 4041 break; | 4043 break; |
| 4042 case FDE_XMLNODE_Text: | 4044 case FDE_XMLNODE_Text: |
| 4043 ((IFDE_XMLText*)m_pXMLNode)->SetText(wsXMLValue); | 4045 static_cast<CFDE_XMLText*>(m_pXMLNode)->SetText(wsXMLValue); |
| 4044 break; | 4046 break; |
| 4045 default: | 4047 default: |
| 4046 FXSYS_assert(0); | 4048 FXSYS_assert(0); |
| 4047 } | 4049 } |
| 4048 } | 4050 } |
| 4049 return TRUE; | 4051 return TRUE; |
| 4050 } | 4052 } |
| 4051 FX_BOOL CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, | 4053 FX_BOOL CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, |
| 4052 CFX_WideString& wsValue, | 4054 CFX_WideString& wsValue, |
| 4053 FX_BOOL bUseDefault, | 4055 FX_BOOL bUseDefault, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4122 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 4124 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); |
| 4123 OnChanging(eAttr, pValue, bNotify); | 4125 OnChanging(eAttr, pValue, bNotify); |
| 4124 SetMapModuleValue(pKey, pValue); | 4126 SetMapModuleValue(pKey, pValue); |
| 4125 OnChanged(eAttr, pValue, bNotify); | 4127 OnChanged(eAttr, pValue, bNotify); |
| 4126 if (IsNeedSavingXMLNode()) { | 4128 if (IsNeedSavingXMLNode()) { |
| 4127 FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element); | 4129 FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element); |
| 4128 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); | 4130 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); |
| 4129 if (pInfo) { | 4131 if (pInfo) { |
| 4130 switch (eType) { | 4132 switch (eType) { |
| 4131 case XFA_ATTRIBUTETYPE_Enum: | 4133 case XFA_ATTRIBUTETYPE_Enum: |
| 4132 ((IFDE_XMLElement*)m_pXMLNode) | 4134 static_cast<CFDE_XMLElement*>(m_pXMLNode) |
| 4133 ->SetString( | 4135 ->SetString( |
| 4134 pInfo->pName, | 4136 pInfo->pName, |
| 4135 XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue) | 4137 XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue) |
| 4136 ->pName); | 4138 ->pName); |
| 4137 break; | 4139 break; |
| 4138 case XFA_ATTRIBUTETYPE_Boolean: | 4140 case XFA_ATTRIBUTETYPE_Boolean: |
| 4139 ((IFDE_XMLElement*)m_pXMLNode) | 4141 static_cast<CFDE_XMLElement*>(m_pXMLNode) |
| 4140 ->SetString(pInfo->pName, | 4142 ->SetString(pInfo->pName, |
| 4141 pValue ? FX_WSTRC(L"1") : FX_WSTRC(L"0")); | 4143 pValue ? FX_WSTRC(L"1") : FX_WSTRC(L"0")); |
| 4142 break; | 4144 break; |
| 4143 case XFA_ATTRIBUTETYPE_Integer: | 4145 case XFA_ATTRIBUTETYPE_Integer: |
| 4144 ((IFDE_XMLElement*)m_pXMLNode) | 4146 static_cast<CFDE_XMLElement*>(m_pXMLNode) |
| 4145 ->SetInteger(pInfo->pName, (int32_t)(uintptr_t)pValue); | 4147 ->SetInteger(pInfo->pName, (int32_t)(uintptr_t)pValue); |
| 4146 break; | 4148 break; |
| 4147 default: | 4149 default: |
| 4148 FXSYS_assert(0); | 4150 FXSYS_assert(0); |
| 4149 } | 4151 } |
| 4150 } | 4152 } |
| 4151 } | 4153 } |
| 4152 return TRUE; | 4154 return TRUE; |
| 4153 } | 4155 } |
| 4154 FX_BOOL CXFA_Node::GetValue(XFA_ATTRIBUTE eAttr, | 4156 FX_BOOL CXFA_Node::GetValue(XFA_ATTRIBUTE eAttr, |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4457 case XFA_XDPPACKET_Xdc: | 4459 case XFA_XDPPACKET_Xdc: |
| 4458 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc)); | 4460 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc)); |
| 4459 default: | 4461 default: |
| 4460 return this; | 4462 return this; |
| 4461 } | 4463 } |
| 4462 } | 4464 } |
| 4463 FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { | 4465 FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { |
| 4464 wsNamespace.Empty(); | 4466 wsNamespace.Empty(); |
| 4465 if (GetObjectType() == XFA_OBJECTTYPE_ModelNode || | 4467 if (GetObjectType() == XFA_OBJECTTYPE_ModelNode || |
| 4466 GetClassID() == XFA_ELEMENT_Packet) { | 4468 GetClassID() == XFA_ELEMENT_Packet) { |
| 4467 IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 4469 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
| 4468 if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) { | 4470 if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) { |
| 4469 return FALSE; | 4471 return FALSE; |
| 4470 } | 4472 } |
| 4471 ((IFDE_XMLElement*)pXMLNode)->GetNamespaceURI(wsNamespace); | 4473 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); |
| 4472 return TRUE; | 4474 return TRUE; |
| 4473 } else if (GetPacketID() == XFA_XDPPACKET_Datasets) { | 4475 } else if (GetPacketID() == XFA_XDPPACKET_Datasets) { |
| 4474 IFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 4476 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
| 4475 if (!pXMLNode) { | 4477 if (!pXMLNode) { |
| 4476 return FALSE; | 4478 return FALSE; |
| 4477 } | 4479 } |
| 4478 if (pXMLNode->GetType() != FDE_XMLNODE_Element) { | 4480 if (pXMLNode->GetType() != FDE_XMLNODE_Element) { |
| 4479 return TRUE; | 4481 return TRUE; |
| 4480 } | 4482 } |
| 4481 if (GetClassID() == XFA_ELEMENT_DataValue && | 4483 if (GetClassID() == XFA_ELEMENT_DataValue && |
| 4482 GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) { | 4484 GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) { |
| 4483 return XFA_FDEExtension_ResolveNamespaceQualifier( | 4485 return XFA_FDEExtension_ResolveNamespaceQualifier( |
| 4484 (IFDE_XMLElement*)pXMLNode, GetCData(XFA_ATTRIBUTE_QualifiedName), | 4486 static_cast<CFDE_XMLElement*>(pXMLNode), |
| 4485 wsNamespace); | 4487 GetCData(XFA_ATTRIBUTE_QualifiedName), wsNamespace); |
| 4486 } | 4488 } |
| 4487 ((IFDE_XMLElement*)pXMLNode)->GetNamespaceURI(wsNamespace); | 4489 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); |
| 4488 return TRUE; | 4490 return TRUE; |
| 4489 } else { | 4491 } else { |
| 4490 CXFA_Node* pModelNode = GetModelNode(); | 4492 CXFA_Node* pModelNode = GetModelNode(); |
| 4491 return pModelNode->TryNamespace(wsNamespace); | 4493 return pModelNode->TryNamespace(wsNamespace); |
| 4492 } | 4494 } |
| 4493 } | 4495 } |
| 4494 CXFA_Node* CXFA_Node::GetProperty(int32_t index, | 4496 CXFA_Node* CXFA_Node::GetProperty(int32_t index, |
| 4495 XFA_ELEMENT eProperty, | 4497 XFA_ELEMENT eProperty, |
| 4496 FX_BOOL bCreateProperty) { | 4498 FX_BOOL bCreateProperty) { |
| 4497 XFA_ELEMENT eElement = GetClassID(); | 4499 XFA_ELEMENT eElement = GetClassID(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4610 m_pLastChild = pNode; | 4612 m_pLastChild = pNode; |
| 4611 } | 4613 } |
| 4612 ASSERT(m_pLastChild); | 4614 ASSERT(m_pLastChild); |
| 4613 ASSERT(m_pLastChild->m_pNext == NULL); | 4615 ASSERT(m_pLastChild->m_pNext == NULL); |
| 4614 pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); | 4616 pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); |
| 4615 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 4617 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 4616 if (pNotify) { | 4618 if (pNotify) { |
| 4617 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode); | 4619 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode); |
| 4618 } | 4620 } |
| 4619 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { | 4621 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { |
| 4620 FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(IFDE_XMLNode::Parent) == NULL); | 4622 FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL); |
| 4621 m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, index); | 4623 m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, index); |
| 4622 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, FALSE, FALSE); | 4624 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, FALSE, FALSE); |
| 4623 } | 4625 } |
| 4624 return index; | 4626 return index; |
| 4625 } | 4627 } |
| 4626 FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { | 4628 FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { |
| 4627 if (!pNode || pNode->m_pParent || | 4629 if (!pNode || pNode->m_pParent || |
| 4628 (pBeforeNode && pBeforeNode->m_pParent != this)) { | 4630 (pBeforeNode && pBeforeNode->m_pParent != this)) { |
| 4629 FXSYS_assert(false); | 4631 FXSYS_assert(false); |
| 4630 return FALSE; | 4632 return FALSE; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 4656 m_pLastChild = pNode; | 4658 m_pLastChild = pNode; |
| 4657 } | 4659 } |
| 4658 ASSERT(m_pLastChild); | 4660 ASSERT(m_pLastChild); |
| 4659 ASSERT(m_pLastChild->m_pNext == NULL); | 4661 ASSERT(m_pLastChild->m_pNext == NULL); |
| 4660 pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); | 4662 pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); |
| 4661 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 4663 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 4662 if (pNotify) { | 4664 if (pNotify) { |
| 4663 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode); | 4665 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode); |
| 4664 } | 4666 } |
| 4665 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { | 4667 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { |
| 4666 FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(IFDE_XMLNode::Parent) == NULL); | 4668 FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL); |
| 4667 m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, nIndex); | 4669 m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, nIndex); |
| 4668 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, FALSE, FALSE); | 4670 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, FALSE, FALSE); |
| 4669 } | 4671 } |
| 4670 return TRUE; | 4672 return TRUE; |
| 4671 } | 4673 } |
| 4672 CXFA_Node* CXFA_Node::Deprecated_GetPrevSibling() { | 4674 CXFA_Node* CXFA_Node::Deprecated_GetPrevSibling() { |
| 4673 if (!m_pParent) { | 4675 if (!m_pParent) { |
| 4674 return NULL; | 4676 return NULL; |
| 4675 } | 4677 } |
| 4676 for (CXFA_Node* pSibling = m_pParent->m_pChild; pSibling; | 4678 for (CXFA_Node* pSibling = m_pParent->m_pChild; pSibling; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4704 } | 4706 } |
| 4705 ASSERT(m_pLastChild == NULL || m_pLastChild->m_pNext == NULL); | 4707 ASSERT(m_pLastChild == NULL || m_pLastChild->m_pNext == NULL); |
| 4706 OnRemoved(this, pNode, bNotify); | 4708 OnRemoved(this, pNode, bNotify); |
| 4707 pNode->SetFlag(XFA_NODEFLAG_HasRemoved); | 4709 pNode->SetFlag(XFA_NODEFLAG_HasRemoved); |
| 4708 m_pDocument->AddPurgeNode(pNode); | 4710 m_pDocument->AddPurgeNode(pNode); |
| 4709 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { | 4711 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { |
| 4710 if (pNode->IsAttributeInXML()) { | 4712 if (pNode->IsAttributeInXML()) { |
| 4711 FXSYS_assert(pNode->m_pXMLNode == m_pXMLNode && | 4713 FXSYS_assert(pNode->m_pXMLNode == m_pXMLNode && |
| 4712 m_pXMLNode->GetType() == FDE_XMLNODE_Element); | 4714 m_pXMLNode->GetType() == FDE_XMLNODE_Element); |
| 4713 if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) { | 4715 if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) { |
| 4714 IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)(pNode->m_pXMLNode); | 4716 CFDE_XMLElement* pXMLElement = |
| 4717 static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode); |
| 4715 CFX_WideStringC wsAttributeName = | 4718 CFX_WideStringC wsAttributeName = |
| 4716 pNode->GetCData(XFA_ATTRIBUTE_QualifiedName); | 4719 pNode->GetCData(XFA_ATTRIBUTE_QualifiedName); |
| 4717 pXMLElement->RemoveAttribute(wsAttributeName.GetPtr()); | 4720 pXMLElement->RemoveAttribute(wsAttributeName.GetPtr()); |
| 4718 } | 4721 } |
| 4719 CFX_WideString wsName; | 4722 CFX_WideString wsName; |
| 4720 pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); | 4723 pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); |
| 4721 IFDE_XMLElement* pNewXMLElement = IFDE_XMLElement::Create(wsName); | 4724 CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName); |
| 4722 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); | 4725 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); |
| 4723 if (!wsValue.IsEmpty()) { | 4726 if (!wsValue.IsEmpty()) { |
| 4724 pNewXMLElement->SetTextData(wsValue); | 4727 pNewXMLElement->SetTextData(wsValue); |
| 4725 } | 4728 } |
| 4726 pNode->m_pXMLNode = pNewXMLElement; | 4729 pNode->m_pXMLNode = pNewXMLElement; |
| 4727 pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); | 4730 pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); |
| 4728 } else { | 4731 } else { |
| 4729 m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode); | 4732 m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode); |
| 4730 } | 4733 } |
| 4731 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); | 4734 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4964 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), | 4967 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), |
| 4965 wsName.GetLength()); | 4968 wsName.GetLength()); |
| 4966 } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) { | 4969 } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) { |
| 4967 CFX_WideStringC wsName = | 4970 CFX_WideStringC wsName = |
| 4968 XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName; | 4971 XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName; |
| 4969 m_dwNameHash = | 4972 m_dwNameHash = |
| 4970 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), | 4973 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), |
| 4971 wsName.GetLength()); | 4974 wsName.GetLength()); |
| 4972 } | 4975 } |
| 4973 } | 4976 } |
| 4974 IFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { | 4977 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { |
| 4975 if (!m_pXMLNode) { | 4978 if (!m_pXMLNode) { |
| 4976 CFX_WideStringC wsTag = GetCData(XFA_ATTRIBUTE_Name); | 4979 CFX_WideStringC wsTag = GetCData(XFA_ATTRIBUTE_Name); |
| 4977 m_pXMLNode = IFDE_XMLElement::Create(wsTag); | 4980 m_pXMLNode = new CFDE_XMLElement(wsTag); |
| 4978 SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); | 4981 SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); |
| 4979 } | 4982 } |
| 4980 return m_pXMLNode; | 4983 return m_pXMLNode; |
| 4981 } | 4984 } |
| 4982 FX_BOOL CXFA_Node::IsNeedSavingXMLNode() { | 4985 FX_BOOL CXFA_Node::IsNeedSavingXMLNode() { |
| 4983 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets || | 4986 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets || |
| 4984 GetClassID() == XFA_ELEMENT_Xfa); | 4987 GetClassID() == XFA_ELEMENT_Xfa); |
| 4985 } | 4988 } |
| 4986 | 4989 |
| 4987 XFA_MAPMODULEDATA* CXFA_Node::CreateMapModuleData() { | 4990 XFA_MAPMODULEDATA* CXFA_Node::CreateMapModuleData() { |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5402 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5405 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
| 5403 } | 5406 } |
| 5404 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5407 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
| 5405 return m_pAttachNode->RemoveChild(pNode); | 5408 return m_pAttachNode->RemoveChild(pNode); |
| 5406 } | 5409 } |
| 5407 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5410 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
| 5408 return m_pAttachNode->GetChild( | 5411 return m_pAttachNode->GetChild( |
| 5409 iIndex, XFA_ELEMENT_UNKNOWN, | 5412 iIndex, XFA_ELEMENT_UNKNOWN, |
| 5410 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); | 5413 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); |
| 5411 } | 5414 } |
| OLD | NEW |