| 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/fgas/crt/fgas_codepage.h" | 10 #include "xfa/fgas/crt/fgas_codepage.h" |
| 11 #include "xfa/fgas/crt/fgas_system.h" | 11 #include "xfa/fgas/crt/fgas_system.h" |
| 12 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 12 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
| 13 #include "xfa/fxfa/parser/xfa_basic_imp.h" | 13 #include "xfa/fxfa/parser/xfa_basic_imp.h" |
| 14 #include "xfa/fxfa/parser/xfa_docdata.h" | 14 #include "xfa/fxfa/parser/xfa_docdata.h" |
| 15 #include "xfa/fxfa/parser/xfa_doclayout.h" | 15 #include "xfa/fxfa/parser/xfa_doclayout.h" |
| 16 #include "xfa/fxfa/parser/xfa_document.h" | 16 #include "xfa/fxfa/parser/xfa_document.h" |
| 17 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" | 17 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" |
| 18 #include "xfa/fxfa/parser/xfa_localemgr.h" | 18 #include "xfa/fxfa/parser/xfa_localemgr.h" |
| 19 #include "xfa/fxfa/parser/xfa_parser.h" | 19 #include "xfa/fxfa/parser/xfa_parser.h" |
| 20 #include "xfa/fxfa/parser/xfa_script.h" | 20 #include "xfa/fxfa/parser/xfa_script.h" |
| 21 #include "xfa/fxfa/parser/xfa_utils.h" | 21 #include "xfa/fxfa/parser/xfa_utils.h" |
| 22 #include "xfa/fxjse/cfxjse_arguments.h" | 22 #include "xfa/fxjse/cfxjse_arguments.h" |
| 23 | 23 |
| 24 CXFA_Object::CXFA_Object(CXFA_Document* pDocument, FX_DWORD uFlags) | 24 CXFA_Object::CXFA_Object(CXFA_Document* pDocument, uint32_t uFlags) |
| 25 : m_pDocument(pDocument), m_uFlags(uFlags) {} | 25 : m_pDocument(pDocument), m_uFlags(uFlags) {} |
| 26 void CXFA_Object::GetClassName(CFX_WideStringC& wsName) const { | 26 void CXFA_Object::GetClassName(CFX_WideStringC& wsName) const { |
| 27 wsName = XFA_GetElementByID(GetClassID())->pName; | 27 wsName = XFA_GetElementByID(GetClassID())->pName; |
| 28 } | 28 } |
| 29 uint32_t CXFA_Object::GetClassHashCode() const { | 29 uint32_t CXFA_Object::GetClassHashCode() const { |
| 30 return XFA_GetElementByID(GetClassID())->uHash; | 30 return XFA_GetElementByID(GetClassID())->uHash; |
| 31 } | 31 } |
| 32 XFA_ELEMENT CXFA_Object::GetClassID() const { | 32 XFA_ELEMENT CXFA_Object::GetClassID() const { |
| 33 if (IsNode()) { | 33 if (IsNode()) { |
| 34 return AsNode()->GetClassID(); | 34 return AsNode()->GetClassID(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 pSibling = pSibling->m_pNext; | 215 pSibling = pSibling->m_pNext; |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 break; | 218 break; |
| 219 default: | 219 default: |
| 220 break; | 220 break; |
| 221 } | 221 } |
| 222 return pNode; | 222 return pNode; |
| 223 } | 223 } |
| 224 int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, | 224 int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, |
| 225 FX_DWORD dwTypeFilter, | 225 uint32_t dwTypeFilter, |
| 226 XFA_ELEMENT eElementFilter, | 226 XFA_ELEMENT eElementFilter, |
| 227 int32_t iLevel) { | 227 int32_t iLevel) { |
| 228 if (--iLevel < 0) { | 228 if (--iLevel < 0) { |
| 229 return nodes.GetSize(); | 229 return nodes.GetSize(); |
| 230 } | 230 } |
| 231 if (eElementFilter != XFA_ELEMENT_UNKNOWN) { | 231 if (eElementFilter != XFA_ELEMENT_UNKNOWN) { |
| 232 CXFA_Node* pChild = m_pChild; | 232 CXFA_Node* pChild = m_pChild; |
| 233 while (pChild) { | 233 while (pChild) { |
| 234 if (pChild->GetClassID() == eElementFilter) { | 234 if (pChild->GetClassID() == eElementFilter) { |
| 235 nodes.Add(pChild); | 235 nodes.Add(pChild); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 pNewNode->SetFlag(XFA_NODEFLAG_Initialized); | 296 pNewNode->SetFlag(XFA_NODEFLAG_Initialized); |
| 297 nodes.Add(pNewNode); | 297 nodes.Add(pNewNode); |
| 298 break; | 298 break; |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 return nodes.GetSize(); | 303 return nodes.GetSize(); |
| 304 } | 304 } |
| 305 CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_ELEMENT eElement, | 305 CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_ELEMENT eElement, |
| 306 FX_DWORD dwFlags) { | 306 uint32_t dwFlags) { |
| 307 IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); | 307 IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); |
| 308 CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eElement); | 308 CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eElement); |
| 309 pNode->SetFlag(dwFlags); | 309 pNode->SetFlag(dwFlags); |
| 310 return pNode; | 310 return pNode; |
| 311 } | 311 } |
| 312 CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) { | 312 CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) { |
| 313 FXSYS_assert(m_ePacket == XFA_XDPPACKET_Template); | 313 FXSYS_assert(m_ePacket == XFA_XDPPACKET_Template); |
| 314 IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); | 314 IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); |
| 315 CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_eNodeClass); | 315 CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_eNodeClass); |
| 316 if (!pClone) { | 316 if (!pClone) { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 wsExpression = | 631 wsExpression = |
| 632 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | 632 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); |
| 633 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 633 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 634 if (!pScriptContext) { | 634 if (!pScriptContext) { |
| 635 return; | 635 return; |
| 636 } | 636 } |
| 637 CXFA_Node* refNode = this; | 637 CXFA_Node* refNode = this; |
| 638 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { | 638 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { |
| 639 refNode = ToNode(pScriptContext->GetThisObject()); | 639 refNode = ToNode(pScriptContext->GetThisObject()); |
| 640 } | 640 } |
| 641 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | | 641 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | |
| 642 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | | 642 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | |
| 643 XFA_RESOLVENODE_Siblings; | 643 XFA_RESOLVENODE_Siblings; |
| 644 XFA_RESOLVENODE_RS resoveNodeRS; | 644 XFA_RESOLVENODE_RS resoveNodeRS; |
| 645 int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, | 645 int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, |
| 646 resoveNodeRS, dwFlag); | 646 resoveNodeRS, dwFlag); |
| 647 if (iRet < 1) { | 647 if (iRet < 1) { |
| 648 return FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 648 return FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
| 649 } | 649 } |
| 650 FXJSE_HVALUE hValue = NULL; | 650 FXJSE_HVALUE hValue = NULL; |
| 651 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | 651 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 674 return; | 674 return; |
| 675 } | 675 } |
| 676 CFX_WideString wsExpression; | 676 CFX_WideString wsExpression; |
| 677 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 677 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); |
| 678 wsExpression = | 678 wsExpression = |
| 679 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | 679 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); |
| 680 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 680 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
| 681 if (!hValue) { | 681 if (!hValue) { |
| 682 return; | 682 return; |
| 683 } | 683 } |
| 684 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | | 684 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | |
| 685 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | | 685 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | |
| 686 XFA_RESOLVENODE_Siblings; | 686 XFA_RESOLVENODE_Siblings; |
| 687 CXFA_Node* refNode = this; | 687 CXFA_Node* refNode = this; |
| 688 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { | 688 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { |
| 689 refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject()); | 689 refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject()); |
| 690 } | 690 } |
| 691 Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag, refNode); | 691 Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag, refNode); |
| 692 } | 692 } |
| 693 void CXFA_Node::Script_Som_ResolveNodeList(FXJSE_HVALUE hValue, | 693 void CXFA_Node::Script_Som_ResolveNodeList(FXJSE_HVALUE hValue, |
| 694 CFX_WideString wsExpression, | 694 CFX_WideString wsExpression, |
| 695 FX_DWORD dwFlag, | 695 uint32_t dwFlag, |
| 696 CXFA_Node* refNode) { | 696 CXFA_Node* refNode) { |
| 697 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 697 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 698 if (!pScriptContext) { | 698 if (!pScriptContext) { |
| 699 return; | 699 return; |
| 700 } | 700 } |
| 701 XFA_RESOLVENODE_RS resoveNodeRS; | 701 XFA_RESOLVENODE_RS resoveNodeRS; |
| 702 if (refNode == NULL) { | 702 if (refNode == NULL) { |
| 703 refNode = this; | 703 refNode = this; |
| 704 } | 704 } |
| 705 pScriptContext->ResolveObjects(refNode, wsExpression, resoveNodeRS, dwFlag); | 705 pScriptContext->ResolveObjects(refNode, wsExpression, resoveNodeRS, dwFlag); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 722 } | 722 } |
| 723 FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList, | 723 FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList, |
| 724 pScriptContext->GetJseNormalClass()); | 724 pScriptContext->GetJseNormalClass()); |
| 725 } | 725 } |
| 726 void CXFA_Node::Script_TreeClass_All(FXJSE_HVALUE hValue, | 726 void CXFA_Node::Script_TreeClass_All(FXJSE_HVALUE hValue, |
| 727 FX_BOOL bSetting, | 727 FX_BOOL bSetting, |
| 728 XFA_ATTRIBUTE eAttribute) { | 728 XFA_ATTRIBUTE eAttribute) { |
| 729 if (bSetting) { | 729 if (bSetting) { |
| 730 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 730 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
| 731 } else { | 731 } else { |
| 732 FX_DWORD dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL; | 732 uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL; |
| 733 CFX_WideString wsName; | 733 CFX_WideString wsName; |
| 734 GetAttribute(XFA_ATTRIBUTE_Name, wsName); | 734 GetAttribute(XFA_ATTRIBUTE_Name, wsName); |
| 735 CFX_WideString wsExpression = wsName + FX_WSTRC(L"[*]"); | 735 CFX_WideString wsExpression = wsName + FX_WSTRC(L"[*]"); |
| 736 Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag); | 736 Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag); |
| 737 } | 737 } |
| 738 } | 738 } |
| 739 void CXFA_Node::Script_TreeClass_Nodes(FXJSE_HVALUE hValue, | 739 void CXFA_Node::Script_TreeClass_Nodes(FXJSE_HVALUE hValue, |
| 740 FX_BOOL bSetting, | 740 FX_BOOL bSetting, |
| 741 XFA_ATTRIBUTE eAttribute) { | 741 XFA_ATTRIBUTE eAttribute) { |
| 742 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 742 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 754 FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList, | 754 FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList, |
| 755 pScriptContext->GetJseNormalClass()); | 755 pScriptContext->GetJseNormalClass()); |
| 756 } | 756 } |
| 757 } | 757 } |
| 758 void CXFA_Node::Script_TreeClass_ClassAll(FXJSE_HVALUE hValue, | 758 void CXFA_Node::Script_TreeClass_ClassAll(FXJSE_HVALUE hValue, |
| 759 FX_BOOL bSetting, | 759 FX_BOOL bSetting, |
| 760 XFA_ATTRIBUTE eAttribute) { | 760 XFA_ATTRIBUTE eAttribute) { |
| 761 if (bSetting) { | 761 if (bSetting) { |
| 762 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 762 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
| 763 } else { | 763 } else { |
| 764 FX_DWORD dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL; | 764 uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL; |
| 765 CFX_WideStringC wsName; | 765 CFX_WideStringC wsName; |
| 766 GetClassName(wsName); | 766 GetClassName(wsName); |
| 767 CFX_WideString wsExpression = FX_WSTRC(L"#") + wsName + FX_WSTRC(L"[*]"); | 767 CFX_WideString wsExpression = FX_WSTRC(L"#") + wsName + FX_WSTRC(L"[*]"); |
| 768 Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag); | 768 Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag); |
| 769 } | 769 } |
| 770 } | 770 } |
| 771 void CXFA_Node::Script_TreeClass_Parent(FXJSE_HVALUE hValue, | 771 void CXFA_Node::Script_TreeClass_Parent(FXJSE_HVALUE hValue, |
| 772 FX_BOOL bSetting, | 772 FX_BOOL bSetting, |
| 773 XFA_ATTRIBUTE eAttribute) { | 773 XFA_ATTRIBUTE eAttribute) { |
| 774 if (bSetting) { | 774 if (bSetting) { |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 void* eValue, | 1304 void* eValue, |
| 1305 FX_BOOL bScriptModify) { | 1305 FX_BOOL bScriptModify) { |
| 1306 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); | 1306 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); |
| 1307 if (!pLayoutPro) { | 1307 if (!pLayoutPro) { |
| 1308 return; | 1308 return; |
| 1309 } | 1309 } |
| 1310 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 1310 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 1311 if (!pNotify) { | 1311 if (!pNotify) { |
| 1312 return; | 1312 return; |
| 1313 } | 1313 } |
| 1314 FX_DWORD dwPacket = GetPacketID(); | 1314 uint32_t dwPacket = GetPacketID(); |
| 1315 if (dwPacket & XFA_XDPPACKET_Form) { | 1315 if (dwPacket & XFA_XDPPACKET_Form) { |
| 1316 FX_BOOL bNeedFindContainer = FALSE; | 1316 FX_BOOL bNeedFindContainer = FALSE; |
| 1317 XFA_ELEMENT eType = GetClassID(); | 1317 XFA_ELEMENT eType = GetClassID(); |
| 1318 switch (eType) { | 1318 switch (eType) { |
| 1319 case XFA_ELEMENT_Caption: | 1319 case XFA_ELEMENT_Caption: |
| 1320 bNeedFindContainer = TRUE; | 1320 bNeedFindContainer = TRUE; |
| 1321 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, | 1321 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, |
| 1322 eValue, this, GetNodeItem(XFA_NODEITEM_Parent)); | 1322 eValue, this, GetNodeItem(XFA_NODEITEM_Parent)); |
| 1323 break; | 1323 break; |
| 1324 case XFA_ELEMENT_Font: | 1324 case XFA_ELEMENT_Font: |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 if (wsUseVal[0] == '#') { | 1485 if (wsUseVal[0] == '#') { |
| 1486 wsID = CFX_WideString((const FX_WCHAR*)wsUseVal + 1, | 1486 wsID = CFX_WideString((const FX_WCHAR*)wsUseVal + 1, |
| 1487 wsUseVal.GetLength() - 1); | 1487 wsUseVal.GetLength() - 1); |
| 1488 } else { | 1488 } else { |
| 1489 wsSOM = | 1489 wsSOM = |
| 1490 CFX_WideString((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength()); | 1490 CFX_WideString((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength()); |
| 1491 } | 1491 } |
| 1492 } | 1492 } |
| 1493 CXFA_Node* pProtoNode = NULL; | 1493 CXFA_Node* pProtoNode = NULL; |
| 1494 if (!wsSOM.IsEmpty()) { | 1494 if (!wsSOM.IsEmpty()) { |
| 1495 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | | 1495 uint32_t dwFlag = XFA_RESOLVENODE_Children | |
| 1496 XFA_RESOLVENODE_Attributes | | 1496 XFA_RESOLVENODE_Attributes | |
| 1497 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | | 1497 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | |
| 1498 XFA_RESOLVENODE_Siblings; | 1498 XFA_RESOLVENODE_Siblings; |
| 1499 XFA_RESOLVENODE_RS resoveNodeRS; | 1499 XFA_RESOLVENODE_RS resoveNodeRS; |
| 1500 int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects( | 1500 int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects( |
| 1501 pProtoRoot, wsSOM, resoveNodeRS, dwFlag); | 1501 pProtoRoot, wsSOM, resoveNodeRS, dwFlag); |
| 1502 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { | 1502 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { |
| 1503 pProtoNode = resoveNodeRS.nodes[0]->AsNode(); | 1503 pProtoNode = resoveNodeRS.nodes[0]->AsNode(); |
| 1504 } | 1504 } |
| 1505 } else if (!wsID.IsEmpty()) { | 1505 } else if (!wsID.IsEmpty()) { |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2484 } | 2484 } |
| 2485 } else { | 2485 } else { |
| 2486 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2486 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 2487 L"execValidate"); | 2487 L"execValidate"); |
| 2488 } | 2488 } |
| 2489 } | 2489 } |
| 2490 static CXFA_Node* XFA_ScriptInstanceManager_GetItem(CXFA_Node* pInstMgrNode, | 2490 static CXFA_Node* XFA_ScriptInstanceManager_GetItem(CXFA_Node* pInstMgrNode, |
| 2491 int32_t iIndex) { | 2491 int32_t iIndex) { |
| 2492 ASSERT(pInstMgrNode); | 2492 ASSERT(pInstMgrNode); |
| 2493 int32_t iCount = 0; | 2493 int32_t iCount = 0; |
| 2494 FX_DWORD dwNameHash = 0; | 2494 uint32_t dwNameHash = 0; |
| 2495 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 2495 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 2496 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 2496 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 2497 XFA_ELEMENT eCurType = pNode->GetClassID(); | 2497 XFA_ELEMENT eCurType = pNode->GetClassID(); |
| 2498 if (eCurType == XFA_ELEMENT_InstanceManager) { | 2498 if (eCurType == XFA_ELEMENT_InstanceManager) { |
| 2499 break; | 2499 break; |
| 2500 } | 2500 } |
| 2501 if ((eCurType != XFA_ELEMENT_Subform) && | 2501 if ((eCurType != XFA_ELEMENT_Subform) && |
| 2502 (eCurType != XFA_ELEMENT_SubformSet)) { | 2502 (eCurType != XFA_ELEMENT_SubformSet)) { |
| 2503 continue; | 2503 continue; |
| 2504 } | 2504 } |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2814 if (bSetting) { | 2814 if (bSetting) { |
| 2815 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); | 2815 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); |
| 2816 return; | 2816 return; |
| 2817 } | 2817 } |
| 2818 CXFA_Occur nodeOccur(GetOccurNode()); | 2818 CXFA_Occur nodeOccur(GetOccurNode()); |
| 2819 FXJSE_Value_SetInteger(hValue, nodeOccur.GetMin()); | 2819 FXJSE_Value_SetInteger(hValue, nodeOccur.GetMin()); |
| 2820 } | 2820 } |
| 2821 static int32_t XFA_ScriptInstanceManager_GetCount(CXFA_Node* pInstMgrNode) { | 2821 static int32_t XFA_ScriptInstanceManager_GetCount(CXFA_Node* pInstMgrNode) { |
| 2822 ASSERT(pInstMgrNode); | 2822 ASSERT(pInstMgrNode); |
| 2823 int32_t iCount = 0; | 2823 int32_t iCount = 0; |
| 2824 FX_DWORD dwNameHash = 0; | 2824 uint32_t dwNameHash = 0; |
| 2825 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 2825 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 2826 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 2826 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 2827 XFA_ELEMENT eCurType = pNode->GetClassID(); | 2827 XFA_ELEMENT eCurType = pNode->GetClassID(); |
| 2828 if (eCurType == XFA_ELEMENT_InstanceManager) { | 2828 if (eCurType == XFA_ELEMENT_InstanceManager) { |
| 2829 break; | 2829 break; |
| 2830 } | 2830 } |
| 2831 if ((eCurType != XFA_ELEMENT_Subform) && | 2831 if ((eCurType != XFA_ELEMENT_Subform) && |
| 2832 (eCurType != XFA_ELEMENT_SubformSet)) { | 2832 (eCurType != XFA_ELEMENT_SubformSet)) { |
| 2833 continue; | 2833 continue; |
| 2834 } | 2834 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2876 } | 2876 } |
| 2877 } | 2877 } |
| 2878 struct CXFA_DualNodeArray { | 2878 struct CXFA_DualNodeArray { |
| 2879 CXFA_NodeSet firstNodeList; | 2879 CXFA_NodeSet firstNodeList; |
| 2880 CXFA_NodeSet secondNodeList; | 2880 CXFA_NodeSet secondNodeList; |
| 2881 }; | 2881 }; |
| 2882 static void XFA_ScriptInstanceManager_ReorderDataNodes(CXFA_NodeSet& sSet1, | 2882 static void XFA_ScriptInstanceManager_ReorderDataNodes(CXFA_NodeSet& sSet1, |
| 2883 CXFA_NodeSet& sSet2, | 2883 CXFA_NodeSet& sSet2, |
| 2884 FX_BOOL bInsertBefore) { | 2884 FX_BOOL bInsertBefore) { |
| 2885 CFX_MapPtrTemplate<CXFA_Node*, | 2885 CFX_MapPtrTemplate<CXFA_Node*, |
| 2886 CFX_MapPtrTemplate<FX_DWORD, CXFA_DualNodeArray*>*> | 2886 CFX_MapPtrTemplate<uint32_t, CXFA_DualNodeArray*>*> |
| 2887 rgNodeListMap; | 2887 rgNodeListMap; |
| 2888 FX_POSITION pos; | 2888 FX_POSITION pos; |
| 2889 pos = sSet1.GetStartPosition(); | 2889 pos = sSet1.GetStartPosition(); |
| 2890 while (pos) { | 2890 while (pos) { |
| 2891 CXFA_Node* pNode = NULL; | 2891 CXFA_Node* pNode = NULL; |
| 2892 sSet1.GetNextAssoc(pos, pNode); | 2892 sSet1.GetNextAssoc(pos, pNode); |
| 2893 CXFA_Node* pParentNode = pNode->GetNodeItem(XFA_NODEITEM_Parent); | 2893 CXFA_Node* pParentNode = pNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 2894 FX_DWORD dwNameHash = pNode->GetNameHash(); | 2894 uint32_t dwNameHash = pNode->GetNameHash(); |
| 2895 if (!pParentNode || !dwNameHash) { | 2895 if (!pParentNode || !dwNameHash) { |
| 2896 continue; | 2896 continue; |
| 2897 } | 2897 } |
| 2898 CFX_MapPtrTemplate<FX_DWORD, CXFA_DualNodeArray*>* pNodeListChildMap = | 2898 CFX_MapPtrTemplate<uint32_t, CXFA_DualNodeArray*>* pNodeListChildMap = |
| 2899 rgNodeListMap[pParentNode]; | 2899 rgNodeListMap[pParentNode]; |
| 2900 if (!pNodeListChildMap) { | 2900 if (!pNodeListChildMap) { |
| 2901 rgNodeListMap[pParentNode] = pNodeListChildMap = | 2901 rgNodeListMap[pParentNode] = pNodeListChildMap = |
| 2902 new CFX_MapPtrTemplate<FX_DWORD, CXFA_DualNodeArray*>; | 2902 new CFX_MapPtrTemplate<uint32_t, CXFA_DualNodeArray*>; |
| 2903 } | 2903 } |
| 2904 CXFA_DualNodeArray* pDualNodeArray = (*pNodeListChildMap)[dwNameHash]; | 2904 CXFA_DualNodeArray* pDualNodeArray = (*pNodeListChildMap)[dwNameHash]; |
| 2905 if (!pDualNodeArray) { | 2905 if (!pDualNodeArray) { |
| 2906 (*pNodeListChildMap)[dwNameHash] = pDualNodeArray = | 2906 (*pNodeListChildMap)[dwNameHash] = pDualNodeArray = |
| 2907 new CXFA_DualNodeArray; | 2907 new CXFA_DualNodeArray; |
| 2908 } | 2908 } |
| 2909 pDualNodeArray->firstNodeList.Add(pNode); | 2909 pDualNodeArray->firstNodeList.Add(pNode); |
| 2910 } | 2910 } |
| 2911 pos = sSet2.GetStartPosition(); | 2911 pos = sSet2.GetStartPosition(); |
| 2912 while (pos) { | 2912 while (pos) { |
| 2913 CXFA_Node* pNode = NULL; | 2913 CXFA_Node* pNode = NULL; |
| 2914 sSet2.GetNextAssoc(pos, pNode); | 2914 sSet2.GetNextAssoc(pos, pNode); |
| 2915 CXFA_Node* pParentNode = pNode->GetNodeItem(XFA_NODEITEM_Parent); | 2915 CXFA_Node* pParentNode = pNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 2916 FX_DWORD dwNameHash = pNode->GetNameHash(); | 2916 uint32_t dwNameHash = pNode->GetNameHash(); |
| 2917 if (!pParentNode || !dwNameHash) { | 2917 if (!pParentNode || !dwNameHash) { |
| 2918 continue; | 2918 continue; |
| 2919 } | 2919 } |
| 2920 CFX_MapPtrTemplate<FX_DWORD, CXFA_DualNodeArray*>* pNodeListChildMap = | 2920 CFX_MapPtrTemplate<uint32_t, CXFA_DualNodeArray*>* pNodeListChildMap = |
| 2921 rgNodeListMap[pParentNode]; | 2921 rgNodeListMap[pParentNode]; |
| 2922 if (!pNodeListChildMap) { | 2922 if (!pNodeListChildMap) { |
| 2923 rgNodeListMap[pParentNode] = pNodeListChildMap = | 2923 rgNodeListMap[pParentNode] = pNodeListChildMap = |
| 2924 new CFX_MapPtrTemplate<FX_DWORD, CXFA_DualNodeArray*>; | 2924 new CFX_MapPtrTemplate<uint32_t, CXFA_DualNodeArray*>; |
| 2925 } | 2925 } |
| 2926 CXFA_DualNodeArray* pDualNodeArray = (*pNodeListChildMap)[dwNameHash]; | 2926 CXFA_DualNodeArray* pDualNodeArray = (*pNodeListChildMap)[dwNameHash]; |
| 2927 if (!pDualNodeArray) { | 2927 if (!pDualNodeArray) { |
| 2928 (*pNodeListChildMap)[dwNameHash] = pDualNodeArray = | 2928 (*pNodeListChildMap)[dwNameHash] = pDualNodeArray = |
| 2929 new CXFA_DualNodeArray; | 2929 new CXFA_DualNodeArray; |
| 2930 } | 2930 } |
| 2931 if (pDualNodeArray->firstNodeList.Lookup(pNode)) { | 2931 if (pDualNodeArray->firstNodeList.Lookup(pNode)) { |
| 2932 pDualNodeArray->firstNodeList.RemoveKey(pNode); | 2932 pDualNodeArray->firstNodeList.RemoveKey(pNode); |
| 2933 } else { | 2933 } else { |
| 2934 pDualNodeArray->secondNodeList.Add(pNode); | 2934 pDualNodeArray->secondNodeList.Add(pNode); |
| 2935 } | 2935 } |
| 2936 } | 2936 } |
| 2937 pos = rgNodeListMap.GetStartPosition(); | 2937 pos = rgNodeListMap.GetStartPosition(); |
| 2938 while (pos) { | 2938 while (pos) { |
| 2939 CXFA_Node* pParentNode = NULL; | 2939 CXFA_Node* pParentNode = NULL; |
| 2940 CFX_MapPtrTemplate<FX_DWORD, CXFA_DualNodeArray*>* pNodeListChildMap = NULL; | 2940 CFX_MapPtrTemplate<uint32_t, CXFA_DualNodeArray*>* pNodeListChildMap = NULL; |
| 2941 rgNodeListMap.GetNextAssoc(pos, pParentNode, pNodeListChildMap); | 2941 rgNodeListMap.GetNextAssoc(pos, pParentNode, pNodeListChildMap); |
| 2942 if (!pNodeListChildMap) { | 2942 if (!pNodeListChildMap) { |
| 2943 continue; | 2943 continue; |
| 2944 } | 2944 } |
| 2945 FX_POSITION childpos = pNodeListChildMap->GetStartPosition(); | 2945 FX_POSITION childpos = pNodeListChildMap->GetStartPosition(); |
| 2946 while (childpos) { | 2946 while (childpos) { |
| 2947 FX_DWORD dwNameHash = 0; | 2947 uint32_t dwNameHash = 0; |
| 2948 CXFA_DualNodeArray* pDualNodeArray = NULL; | 2948 CXFA_DualNodeArray* pDualNodeArray = NULL; |
| 2949 pNodeListChildMap->GetNextAssoc(childpos, dwNameHash, pDualNodeArray); | 2949 pNodeListChildMap->GetNextAssoc(childpos, dwNameHash, pDualNodeArray); |
| 2950 if (!pDualNodeArray) { | 2950 if (!pDualNodeArray) { |
| 2951 continue; | 2951 continue; |
| 2952 } | 2952 } |
| 2953 if (pDualNodeArray->firstNodeList.GetCount() != 0 && | 2953 if (pDualNodeArray->firstNodeList.GetCount() != 0 && |
| 2954 pDualNodeArray->secondNodeList.GetCount() != 0) { | 2954 pDualNodeArray->secondNodeList.GetCount() != 0) { |
| 2955 CXFA_NodeArray rgNodeArray1, rgNodeArray2; | 2955 CXFA_NodeArray rgNodeArray1, rgNodeArray2; |
| 2956 CFX_ArrayTemplate<int32_t> rgIdxArray1, rgIdxArray2; | 2956 CFX_ArrayTemplate<int32_t> rgIdxArray1, rgIdxArray2; |
| 2957 XFA_ScriptInstanceManager_ReorderDataNodes_SortNodeArrayByDocumentIdx( | 2957 XFA_ScriptInstanceManager_ReorderDataNodes_SortNodeArrayByDocumentIdx( |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3287 } | 3287 } |
| 3288 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); | 3288 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); |
| 3289 if (iDesired == iCount) { | 3289 if (iDesired == iCount) { |
| 3290 return 0; | 3290 return 0; |
| 3291 } | 3291 } |
| 3292 if (iDesired < iCount) { | 3292 if (iDesired < iCount) { |
| 3293 CFX_WideStringC wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name); | 3293 CFX_WideStringC wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name); |
| 3294 CFX_WideString wsInstanceName = wsInstManagerName.IsEmpty() | 3294 CFX_WideString wsInstanceName = wsInstManagerName.IsEmpty() |
| 3295 ? wsInstManagerName | 3295 ? wsInstManagerName |
| 3296 : wsInstManagerName.Mid(1); | 3296 : wsInstManagerName.Mid(1); |
| 3297 FX_DWORD dInstanceNameHash = | 3297 uint32_t dInstanceNameHash = |
| 3298 wsInstanceName.IsEmpty() ? 0 : FX_HashCode_String_GetW( | 3298 wsInstanceName.IsEmpty() ? 0 : FX_HashCode_String_GetW( |
| 3299 wsInstanceName, | 3299 wsInstanceName, |
| 3300 wsInstanceName.GetLength()); | 3300 wsInstanceName.GetLength()); |
| 3301 CXFA_Node* pPrevSibling = | 3301 CXFA_Node* pPrevSibling = |
| 3302 (iDesired == 0) ? this | 3302 (iDesired == 0) ? this |
| 3303 : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1); | 3303 : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1); |
| 3304 while (iCount > iDesired) { | 3304 while (iCount > iDesired) { |
| 3305 CXFA_Node* pRemoveInstance = | 3305 CXFA_Node* pRemoveInstance = |
| 3306 pPrevSibling->GetNodeItem(XFA_NODEITEM_NextSibling); | 3306 pPrevSibling->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 3307 if (pRemoveInstance->GetClassID() != XFA_ELEMENT_Subform && | 3307 if (pRemoveInstance->GetClassID() != XFA_ELEMENT_Subform && |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3726 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(FX_WSTRC(L"0"))); | 3726 FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(FX_WSTRC(L"0"))); |
| 3727 } | 3727 } |
| 3728 void CXFA_Node::Script_Encrypt_Format(FXJSE_HVALUE hValue, | 3728 void CXFA_Node::Script_Encrypt_Format(FXJSE_HVALUE hValue, |
| 3729 FX_BOOL bSetting, | 3729 FX_BOOL bSetting, |
| 3730 XFA_ATTRIBUTE eAttribute) {} | 3730 XFA_ATTRIBUTE eAttribute) {} |
| 3731 enum XFA_KEYTYPE { | 3731 enum XFA_KEYTYPE { |
| 3732 XFA_KEYTYPE_Custom, | 3732 XFA_KEYTYPE_Custom, |
| 3733 XFA_KEYTYPE_Element, | 3733 XFA_KEYTYPE_Element, |
| 3734 }; | 3734 }; |
| 3735 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { | 3735 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { |
| 3736 FX_DWORD dwKey = FX_HashCode_String_GetW(wsKey.GetPtr(), wsKey.GetLength()); | 3736 uint32_t dwKey = FX_HashCode_String_GetW(wsKey.GetPtr(), wsKey.GetLength()); |
| 3737 return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom); | 3737 return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom); |
| 3738 } | 3738 } |
| 3739 void* XFA_GetMapKey_Element(XFA_ELEMENT eElement, XFA_ATTRIBUTE eAttribute) { | 3739 void* XFA_GetMapKey_Element(XFA_ELEMENT eElement, XFA_ATTRIBUTE eAttribute) { |
| 3740 return (void*)(uintptr_t)((eElement << 16) | (eAttribute << 8) | | 3740 return (void*)(uintptr_t)((eElement << 16) | (eAttribute << 8) | |
| 3741 XFA_KEYTYPE_Element); | 3741 XFA_KEYTYPE_Element); |
| 3742 } | 3742 } |
| 3743 FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) { | 3743 FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) { |
| 3744 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 3744 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); |
| 3745 return HasMapModuleKey(pKey, bCanInherit); | 3745 return HasMapModuleKey(pKey, bCanInherit); |
| 3746 } | 3746 } |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4488 return TRUE; | 4488 return TRUE; |
| 4489 } else { | 4489 } else { |
| 4490 CXFA_Node* pModelNode = GetModelNode(); | 4490 CXFA_Node* pModelNode = GetModelNode(); |
| 4491 return pModelNode->TryNamespace(wsNamespace); | 4491 return pModelNode->TryNamespace(wsNamespace); |
| 4492 } | 4492 } |
| 4493 } | 4493 } |
| 4494 CXFA_Node* CXFA_Node::GetProperty(int32_t index, | 4494 CXFA_Node* CXFA_Node::GetProperty(int32_t index, |
| 4495 XFA_ELEMENT eProperty, | 4495 XFA_ELEMENT eProperty, |
| 4496 FX_BOOL bCreateProperty) { | 4496 FX_BOOL bCreateProperty) { |
| 4497 XFA_ELEMENT eElement = GetClassID(); | 4497 XFA_ELEMENT eElement = GetClassID(); |
| 4498 FX_DWORD dwPacket = GetPacketID(); | 4498 uint32_t dwPacket = GetPacketID(); |
| 4499 const XFA_PROPERTY* pProperty = | 4499 const XFA_PROPERTY* pProperty = |
| 4500 XFA_GetPropertyOfElement(eElement, eProperty, dwPacket); | 4500 XFA_GetPropertyOfElement(eElement, eProperty, dwPacket); |
| 4501 if (pProperty == NULL || index >= pProperty->uOccur) { | 4501 if (pProperty == NULL || index >= pProperty->uOccur) { |
| 4502 return NULL; | 4502 return NULL; |
| 4503 } | 4503 } |
| 4504 CXFA_Node* pNode = m_pChild; | 4504 CXFA_Node* pNode = m_pChild; |
| 4505 int32_t iCount = 0; | 4505 int32_t iCount = 0; |
| 4506 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4506 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 4507 if (pNode->GetClassID() == eProperty) { | 4507 if (pNode->GetClassID() == eProperty) { |
| 4508 iCount++; | 4508 iCount++; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4730 } | 4730 } |
| 4731 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); | 4731 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); |
| 4732 } | 4732 } |
| 4733 return TRUE; | 4733 return TRUE; |
| 4734 } | 4734 } |
| 4735 CXFA_Node* CXFA_Node::GetFirstChildByName(const CFX_WideStringC& wsName) const { | 4735 CXFA_Node* CXFA_Node::GetFirstChildByName(const CFX_WideStringC& wsName) const { |
| 4736 return GetFirstChildByName( | 4736 return GetFirstChildByName( |
| 4737 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), | 4737 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), |
| 4738 wsName.GetLength())); | 4738 wsName.GetLength())); |
| 4739 } | 4739 } |
| 4740 CXFA_Node* CXFA_Node::GetFirstChildByName(FX_DWORD dwNameHash) const { | 4740 CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const { |
| 4741 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; | 4741 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; |
| 4742 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4742 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 4743 if (pNode->GetNameHash() == dwNameHash) { | 4743 if (pNode->GetNameHash() == dwNameHash) { |
| 4744 return pNode; | 4744 return pNode; |
| 4745 } | 4745 } |
| 4746 } | 4746 } |
| 4747 return NULL; | 4747 return NULL; |
| 4748 } | 4748 } |
| 4749 CXFA_Node* CXFA_Node::GetFirstChildByClass(XFA_ELEMENT eElement) const { | 4749 CXFA_Node* CXFA_Node::GetFirstChildByClass(XFA_ELEMENT eElement) const { |
| 4750 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; | 4750 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; |
| 4751 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4751 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 4752 if (pNode->GetClassID() == eElement) { | 4752 if (pNode->GetClassID() == eElement) { |
| 4753 return pNode; | 4753 return pNode; |
| 4754 } | 4754 } |
| 4755 } | 4755 } |
| 4756 return NULL; | 4756 return NULL; |
| 4757 } | 4757 } |
| 4758 CXFA_Node* CXFA_Node::GetNextSameNameSibling(FX_DWORD dwNameHash) const { | 4758 CXFA_Node* CXFA_Node::GetNextSameNameSibling(uint32_t dwNameHash) const { |
| 4759 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; | 4759 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; |
| 4760 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4760 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 4761 if (pNode->GetNameHash() == dwNameHash) { | 4761 if (pNode->GetNameHash() == dwNameHash) { |
| 4762 return pNode; | 4762 return pNode; |
| 4763 } | 4763 } |
| 4764 } | 4764 } |
| 4765 return NULL; | 4765 return NULL; |
| 4766 } | 4766 } |
| 4767 CXFA_Node* CXFA_Node::GetNextSameNameSibling( | 4767 CXFA_Node* CXFA_Node::GetNextSameNameSibling( |
| 4768 const CFX_WideStringC& wsNodeName) const { | 4768 const CFX_WideStringC& wsNodeName) const { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4824 } | 4824 } |
| 4825 break; | 4825 break; |
| 4826 } | 4826 } |
| 4827 } | 4827 } |
| 4828 } | 4828 } |
| 4829 return pInstanceMgr; | 4829 return pInstanceMgr; |
| 4830 } | 4830 } |
| 4831 CXFA_Node* CXFA_Node::GetOccurNode() { | 4831 CXFA_Node* CXFA_Node::GetOccurNode() { |
| 4832 return GetFirstChildByClass(XFA_ELEMENT_Occur); | 4832 return GetFirstChildByClass(XFA_ELEMENT_Occur); |
| 4833 } | 4833 } |
| 4834 FX_BOOL CXFA_Node::HasFlag(FX_DWORD dwFlag) const { | 4834 FX_BOOL CXFA_Node::HasFlag(uint32_t dwFlag) const { |
| 4835 if (m_uFlags & dwFlag) { | 4835 if (m_uFlags & dwFlag) { |
| 4836 return TRUE; | 4836 return TRUE; |
| 4837 } | 4837 } |
| 4838 switch (dwFlag) { | 4838 switch (dwFlag) { |
| 4839 case XFA_NODEFLAG_HasRemoved: | 4839 case XFA_NODEFLAG_HasRemoved: |
| 4840 return m_pParent && m_pParent->HasFlag(dwFlag); | 4840 return m_pParent && m_pParent->HasFlag(dwFlag); |
| 4841 default: | 4841 default: |
| 4842 break; | 4842 break; |
| 4843 } | 4843 } |
| 4844 return FALSE; | 4844 return FALSE; |
| 4845 } | 4845 } |
| 4846 void CXFA_Node::SetFlag(FX_DWORD dwFlag, FX_BOOL bOn, FX_BOOL bNotify) { | 4846 void CXFA_Node::SetFlag(uint32_t dwFlag, FX_BOOL bOn, FX_BOOL bNotify) { |
| 4847 if (bOn) { | 4847 if (bOn) { |
| 4848 switch (dwFlag) { | 4848 switch (dwFlag) { |
| 4849 case XFA_NODEFLAG_Initialized: | 4849 case XFA_NODEFLAG_Initialized: |
| 4850 if (bNotify && !HasFlag(XFA_NODEFLAG_Initialized)) { | 4850 if (bNotify && !HasFlag(XFA_NODEFLAG_Initialized)) { |
| 4851 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 4851 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 4852 if (pNotify) { | 4852 if (pNotify) { |
| 4853 pNotify->OnNodeEvent(this, XFA_NODEEVENT_Ready); | 4853 pNotify->OnNodeEvent(this, XFA_NODEEVENT_Ready); |
| 4854 } | 4854 } |
| 4855 } | 4855 } |
| 4856 break; | 4856 break; |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5234 } | 5234 } |
| 5235 } | 5235 } |
| 5236 pSrcModule->MoveBufferMapData(pDstModule, pKey); | 5236 pSrcModule->MoveBufferMapData(pDstModule, pKey); |
| 5237 } | 5237 } |
| 5238 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) | 5238 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) |
| 5239 : CXFA_Object(pDocument, XFA_OBJECTTYPE_NodeList) { | 5239 : CXFA_Object(pDocument, XFA_OBJECTTYPE_NodeList) { |
| 5240 m_pDocument->GetScriptContext()->CacheList(this); | 5240 m_pDocument->GetScriptContext()->CacheList(this); |
| 5241 } | 5241 } |
| 5242 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { | 5242 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { |
| 5243 int32_t iCount = GetLength(); | 5243 int32_t iCount = GetLength(); |
| 5244 FX_DWORD dwHashCode = | 5244 uint32_t dwHashCode = |
| 5245 FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength()); | 5245 FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength()); |
| 5246 for (int32_t i = 0; i < iCount; i++) { | 5246 for (int32_t i = 0; i < iCount; i++) { |
| 5247 CXFA_Node* ret = Item(i); | 5247 CXFA_Node* ret = Item(i); |
| 5248 if (dwHashCode == ret->GetNameHash()) { | 5248 if (dwHashCode == ret->GetNameHash()) { |
| 5249 return ret; | 5249 return ret; |
| 5250 } | 5250 } |
| 5251 } | 5251 } |
| 5252 return NULL; | 5252 return NULL; |
| 5253 } | 5253 } |
| 5254 void CXFA_NodeList::Script_ListClass_Append(CFXJSE_Arguments* pArguments) { | 5254 void CXFA_NodeList::Script_ListClass_Append(CFXJSE_Arguments* pArguments) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5402 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5402 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
| 5403 } | 5403 } |
| 5404 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5404 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
| 5405 return m_pAttachNode->RemoveChild(pNode); | 5405 return m_pAttachNode->RemoveChild(pNode); |
| 5406 } | 5406 } |
| 5407 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5407 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
| 5408 return m_pAttachNode->GetChild( | 5408 return m_pAttachNode->GetChild( |
| 5409 iIndex, XFA_ELEMENT_UNKNOWN, | 5409 iIndex, XFA_ELEMENT_UNKNOWN, |
| 5410 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); | 5410 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); |
| 5411 } | 5411 } |
| OLD | NEW |