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/src/foxitlib.h" | 7 #include "xfa/src/foxitlib.h" |
8 #include "xfa/src/fxfa/src/common/xfa_utils.h" | 8 #include "xfa/src/fxfa/src/common/xfa_utils.h" |
9 #include "xfa/src/fxfa/src/common/xfa_object.h" | 9 #include "xfa/src/fxfa/src/common/xfa_object.h" |
10 #include "xfa/src/fxfa/src/common/xfa_document.h" | 10 #include "xfa/src/fxfa/src/common/xfa_document.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 ASSERT(pElement != NULL); | 23 ASSERT(pElement != NULL); |
24 wsName = pElement->pName; | 24 wsName = pElement->pName; |
25 } | 25 } |
26 uint32_t CXFA_Object::GetClassHashCode() const { | 26 uint32_t CXFA_Object::GetClassHashCode() const { |
27 XFA_LPCELEMENTINFO pElement = XFA_GetElementByID(GetClassID()); | 27 XFA_LPCELEMENTINFO pElement = XFA_GetElementByID(GetClassID()); |
28 ASSERT(pElement != NULL); | 28 ASSERT(pElement != NULL); |
29 return pElement->uHash; | 29 return pElement->uHash; |
30 } | 30 } |
31 XFA_ELEMENT CXFA_Object::GetClassID() const { | 31 XFA_ELEMENT CXFA_Object::GetClassID() const { |
32 if (IsNode()) { | 32 if (IsNode()) { |
33 return ((const CXFA_Node*)this)->GetClassID(); | 33 return AsNode()->GetClassID(); |
34 } else if (IsOrdinaryObject()) { | 34 } |
35 return ((const CXFA_OrdinaryObject*)this)->GetClassID(); | 35 if (IsOrdinaryObject()) { |
36 } else if (IsNodeList()) { | 36 return AsOrdinaryObject()->GetClassID(); |
37 return ((const CXFA_NodeList*)this)->GetClassID(); | 37 } |
38 } else if (IsOrdinaryList()) { | 38 if (IsNodeList()) { |
| 39 return AsNodeList()->GetClassID(); |
| 40 } |
| 41 if (IsOrdinaryList()) { |
39 return XFA_ELEMENT_List; | 42 return XFA_ELEMENT_List; |
40 } | 43 } |
41 ASSERT(FALSE); | 44 ASSERT(FALSE); |
42 return (XFA_ELEMENT)0; | 45 return (XFA_ELEMENT)0; |
43 } | 46 } |
44 void CXFA_Object::Script_ObjectClass_ClassName(FXJSE_HVALUE hValue, | 47 void CXFA_Object::Script_ObjectClass_ClassName(FXJSE_HVALUE hValue, |
45 FX_BOOL bSetting, | 48 FX_BOOL bSetting, |
46 XFA_ATTRIBUTE eAttribute) { | 49 XFA_ATTRIBUTE eAttribute) { |
47 if (!bSetting) { | 50 if (!bSetting) { |
48 CFX_WideStringC className; | 51 CFX_WideStringC className; |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 return pClone; | 325 return pClone; |
323 } | 326 } |
324 CXFA_Node* CXFA_Node::GetTemplateNode() { | 327 CXFA_Node* CXFA_Node::GetTemplateNode() { |
325 return m_pAuxNode; | 328 return m_pAuxNode; |
326 } | 329 } |
327 void CXFA_Node::SetTemplateNode(CXFA_Node* pTemplateNode) { | 330 void CXFA_Node::SetTemplateNode(CXFA_Node* pTemplateNode) { |
328 m_pAuxNode = pTemplateNode; | 331 m_pAuxNode = pTemplateNode; |
329 } | 332 } |
330 CXFA_Node* CXFA_Node::GetBindData() { | 333 CXFA_Node* CXFA_Node::GetBindData() { |
331 ASSERT(GetPacketID() == XFA_XDPPACKET_Form); | 334 ASSERT(GetPacketID() == XFA_XDPPACKET_Form); |
332 return (CXFA_Node*)GetObject(XFA_ATTRIBUTE_BindingNode); | 335 return static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode)); |
333 } | 336 } |
334 int32_t CXFA_Node::GetBindItems(CXFA_NodeArray& formItems) { | 337 int32_t CXFA_Node::GetBindItems(CXFA_NodeArray& formItems) { |
335 if (m_uFlags & XFA_NODEFLAG_BindFormItems) { | 338 if (m_uFlags & XFA_NODEFLAG_BindFormItems) { |
336 CXFA_NodeArray* pItems = NULL; | 339 CXFA_NodeArray* pItems = NULL; |
337 TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems); | 340 TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems); |
338 formItems.Copy(*pItems); | 341 formItems.Copy(*pItems); |
339 return formItems.GetSize(); | 342 return formItems.GetSize(); |
340 } | 343 } |
341 CXFA_Node* pFormNode = (CXFA_Node*)GetObject(XFA_ATTRIBUTE_BindingNode); | 344 CXFA_Node* pFormNode = |
| 345 static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode)); |
342 if (pFormNode) { | 346 if (pFormNode) { |
343 formItems.Add(pFormNode); | 347 formItems.Add(pFormNode); |
344 } | 348 } |
345 return formItems.GetSize(); | 349 return formItems.GetSize(); |
346 } | 350 } |
347 static void XFA_DataNodeDeleteBindItem(void* pData) { | 351 static void XFA_DataNodeDeleteBindItem(void* pData) { |
348 if (pData) { | 352 if (pData) { |
349 delete ((CXFA_NodeArray*)pData); | 353 delete ((CXFA_NodeArray*)pData); |
350 } | 354 } |
351 } | 355 } |
352 static XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = { | 356 static XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = { |
353 XFA_DataNodeDeleteBindItem, NULL}; | 357 XFA_DataNodeDeleteBindItem, NULL}; |
354 int32_t CXFA_Node::AddBindItem(CXFA_Node* pFormNode) { | 358 int32_t CXFA_Node::AddBindItem(CXFA_Node* pFormNode) { |
355 ASSERT(pFormNode); | 359 ASSERT(pFormNode); |
356 if (m_uFlags & XFA_NODEFLAG_BindFormItems) { | 360 if (m_uFlags & XFA_NODEFLAG_BindFormItems) { |
357 CXFA_NodeArray* pItems = NULL; | 361 CXFA_NodeArray* pItems = NULL; |
358 TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems); | 362 TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems); |
359 ASSERT(pItems); | 363 ASSERT(pItems); |
360 if (pItems->Find(pFormNode) < 0) { | 364 if (pItems->Find(pFormNode) < 0) { |
361 pItems->Add(pFormNode); | 365 pItems->Add(pFormNode); |
362 } | 366 } |
363 return pItems->GetSize(); | 367 return pItems->GetSize(); |
364 } | 368 } |
365 CXFA_Node* pOldFormItem = (CXFA_Node*)GetObject(XFA_ATTRIBUTE_BindingNode); | 369 CXFA_Node* pOldFormItem = |
| 370 static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode)); |
366 if (!pOldFormItem) { | 371 if (!pOldFormItem) { |
367 SetObject(XFA_ATTRIBUTE_BindingNode, pFormNode); | 372 SetObject(XFA_ATTRIBUTE_BindingNode, pFormNode); |
368 return 1; | 373 return 1; |
369 } else if (pOldFormItem == pFormNode) { | 374 } else if (pOldFormItem == pFormNode) { |
370 return 1; | 375 return 1; |
371 } | 376 } |
372 CXFA_NodeArray* pItems = new CXFA_NodeArray; | 377 CXFA_NodeArray* pItems = new CXFA_NodeArray; |
373 SetObject(XFA_ATTRIBUTE_BindingNode, pItems, &deleteBindItemCallBack); | 378 SetObject(XFA_ATTRIBUTE_BindingNode, pItems, &deleteBindItemCallBack); |
374 pItems->Add(pOldFormItem); | 379 pItems->Add(pOldFormItem); |
375 pItems->Add(pFormNode); | 380 pItems->Add(pFormNode); |
(...skipping 14 matching lines...) Expand all Loading... |
390 pItems->RemoveAt(iCount - 1); | 395 pItems->RemoveAt(iCount - 1); |
391 if (iCount == 2) { | 396 if (iCount == 2) { |
392 CXFA_Node* pLastFormNode = pItems->GetAt(0); | 397 CXFA_Node* pLastFormNode = pItems->GetAt(0); |
393 SetObject(XFA_ATTRIBUTE_BindingNode, pLastFormNode); | 398 SetObject(XFA_ATTRIBUTE_BindingNode, pLastFormNode); |
394 m_uFlags &= ~XFA_NODEFLAG_BindFormItems; | 399 m_uFlags &= ~XFA_NODEFLAG_BindFormItems; |
395 } | 400 } |
396 iCount--; | 401 iCount--; |
397 } | 402 } |
398 return iCount; | 403 return iCount; |
399 } | 404 } |
400 CXFA_Node* pOldFormItem = (CXFA_Node*)GetObject(XFA_ATTRIBUTE_BindingNode); | 405 CXFA_Node* pOldFormItem = |
| 406 static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode)); |
401 if (pOldFormItem == pFormNode) { | 407 if (pOldFormItem == pFormNode) { |
402 SetObject(XFA_ATTRIBUTE_BindingNode, NULL); | 408 SetObject(XFA_ATTRIBUTE_BindingNode, NULL); |
403 pOldFormItem = NULL; | 409 pOldFormItem = NULL; |
404 } | 410 } |
405 return pOldFormItem == NULL ? 0 : 1; | 411 return pOldFormItem == NULL ? 0 : 1; |
406 } | 412 } |
407 FX_BOOL CXFA_Node::HasBindItem() { | 413 FX_BOOL CXFA_Node::HasBindItem() { |
408 return (GetPacketID() == XFA_XDPPACKET_Datasets) && | 414 return (GetPacketID() == XFA_XDPPACKET_Datasets) && |
409 GetObject(XFA_ATTRIBUTE_BindingNode) != NULL; | 415 GetObject(XFA_ATTRIBUTE_BindingNode) != NULL; |
410 } | 416 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 pValueNode = (pGrandNode && pGrandNode->GetClassID() == XFA_ELEMENT_Value) | 479 pValueNode = (pGrandNode && pGrandNode->GetClassID() == XFA_ELEMENT_Value) |
474 ? pGrandNode | 480 ? pGrandNode |
475 : NULL; | 481 : NULL; |
476 } | 482 } |
477 CXFA_Node* pParentOfValueNode = | 483 CXFA_Node* pParentOfValueNode = |
478 pValueNode ? pValueNode->GetNodeItem(XFA_NODEITEM_Parent) : NULL; | 484 pValueNode ? pValueNode->GetNodeItem(XFA_NODEITEM_Parent) : NULL; |
479 return pParentOfValueNode ? pParentOfValueNode->GetContainerWidgetData() | 485 return pParentOfValueNode ? pParentOfValueNode->GetContainerWidgetData() |
480 : NULL; | 486 : NULL; |
481 } | 487 } |
482 FX_BOOL CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) { | 488 FX_BOOL CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) { |
483 CXFA_Node* pForm = (CXFA_Node*)GetDocument()->GetXFAObject(XFA_HASHCODE_Form); | 489 CXFA_Node* pForm = GetDocument()->GetXFAObject(XFA_HASHCODE_Form)->AsNode(); |
484 CXFA_Node* pTopSubform = pForm->GetFirstChildByClass(XFA_ELEMENT_Subform); | 490 CXFA_Node* pTopSubform = pForm->GetFirstChildByClass(XFA_ELEMENT_Subform); |
485 FXSYS_assert(pTopSubform); | 491 FXSYS_assert(pTopSubform); |
486 CXFA_Node* pLocaleNode = this; | 492 CXFA_Node* pLocaleNode = this; |
487 FX_BOOL bLocale = FALSE; | 493 FX_BOOL bLocale = FALSE; |
488 do { | 494 do { |
489 bLocale = pLocaleNode->TryCData(XFA_ATTRIBUTE_Locale, wsLocaleName, FALSE); | 495 bLocale = pLocaleNode->TryCData(XFA_ATTRIBUTE_Locale, wsLocaleName, FALSE); |
490 if (!bLocale) { | 496 if (!bLocale) { |
491 pLocaleNode = pLocaleNode->GetNodeItem(XFA_NODEITEM_Parent); | 497 pLocaleNode = pLocaleNode->GetNodeItem(XFA_NODEITEM_Parent); |
492 } | 498 } |
493 } while (pLocaleNode && pLocaleNode != pTopSubform && !bLocale); | 499 } while (pLocaleNode && pLocaleNode != pTopSubform && !bLocale); |
494 if (bLocale) { | 500 if (bLocale) { |
495 return bLocale; | 501 return bLocale; |
496 } | 502 } |
497 CXFA_Node* pConfig = | 503 CXFA_Node* pConfig = ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Config)); |
498 (CXFA_Node*)GetDocument()->GetXFAObject(XFA_HASHCODE_Config); | |
499 wsLocaleName = GetDocument()->GetLocalMgr()->GetConfigLocaleName(pConfig); | 504 wsLocaleName = GetDocument()->GetLocalMgr()->GetConfigLocaleName(pConfig); |
500 if (!wsLocaleName.IsEmpty()) { | 505 if (!wsLocaleName.IsEmpty()) { |
501 bLocale = TRUE; | 506 bLocale = TRUE; |
502 } | 507 } |
503 if (bLocale) { | 508 if (bLocale) { |
504 return bLocale; | 509 return bLocale; |
505 } | 510 } |
506 if (pTopSubform) { | 511 if (pTopSubform) { |
507 bLocale = pTopSubform->TryCData(XFA_ATTRIBUTE_Locale, wsLocaleName, FALSE); | 512 bLocale = pTopSubform->TryCData(XFA_ATTRIBUTE_Locale, wsLocaleName, FALSE); |
508 } | 513 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 CFX_WideString wsExpression; | 623 CFX_WideString wsExpression; |
619 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); | 624 CFX_ByteString bsExpression = pArguments->GetUTF8String(0); |
620 wsExpression = | 625 wsExpression = |
621 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | 626 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); |
622 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 627 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
623 if (!pScriptContext) { | 628 if (!pScriptContext) { |
624 return; | 629 return; |
625 } | 630 } |
626 CXFA_Node* refNode = this; | 631 CXFA_Node* refNode = this; |
627 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { | 632 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { |
628 refNode = (CXFA_Node*)pScriptContext->GetThisObject(); | 633 refNode = ToNode(pScriptContext->GetThisObject()); |
629 } | 634 } |
630 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | | 635 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | |
631 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | | 636 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | |
632 XFA_RESOLVENODE_Siblings; | 637 XFA_RESOLVENODE_Siblings; |
633 XFA_RESOLVENODE_RS resoveNodeRS; | 638 XFA_RESOLVENODE_RS resoveNodeRS; |
634 int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, | 639 int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, |
635 resoveNodeRS, dwFlag); | 640 resoveNodeRS, dwFlag); |
636 if (iRet < 1) { | 641 if (iRet < 1) { |
637 return FXJSE_Value_SetNull(pArguments->GetReturnValue()); | 642 return FXJSE_Value_SetNull(pArguments->GetReturnValue()); |
638 } | 643 } |
(...skipping 28 matching lines...) Expand all Loading... |
667 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); | 672 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); |
668 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 673 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
669 if (!hValue) { | 674 if (!hValue) { |
670 return; | 675 return; |
671 } | 676 } |
672 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | | 677 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | |
673 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | | 678 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | |
674 XFA_RESOLVENODE_Siblings; | 679 XFA_RESOLVENODE_Siblings; |
675 CXFA_Node* refNode = this; | 680 CXFA_Node* refNode = this; |
676 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { | 681 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) { |
677 refNode = (CXFA_Node*)m_pDocument->GetScriptContext()->GetThisObject(); | 682 refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject()); |
678 } | 683 } |
679 Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag, refNode); | 684 Script_Som_ResolveNodeList(hValue, wsExpression, dwFlag, refNode); |
680 } | 685 } |
681 void CXFA_Node::Script_Som_ResolveNodeList(FXJSE_HVALUE hValue, | 686 void CXFA_Node::Script_Som_ResolveNodeList(FXJSE_HVALUE hValue, |
682 CFX_WideString wsExpression, | 687 CFX_WideString wsExpression, |
683 FX_DWORD dwFlag, | 688 FX_DWORD dwFlag, |
684 CXFA_Node* refNode) { | 689 CXFA_Node* refNode) { |
685 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 690 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
686 if (!pScriptContext) { | 691 if (!pScriptContext) { |
687 return; | 692 return; |
688 } | 693 } |
689 XFA_RESOLVENODE_RS resoveNodeRS; | 694 XFA_RESOLVENODE_RS resoveNodeRS; |
690 if (refNode == NULL) { | 695 if (refNode == NULL) { |
691 refNode = this; | 696 refNode = this; |
692 } | 697 } |
693 pScriptContext->ResolveObjects(refNode, wsExpression, | 698 pScriptContext->ResolveObjects(refNode, wsExpression, |
694 resoveNodeRS, dwFlag); | 699 resoveNodeRS, dwFlag); |
695 CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument); | 700 CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument); |
696 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | 701 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { |
697 for (int32_t i = 0; i < resoveNodeRS.nodes.GetSize(); i++) { | 702 for (int32_t i = 0; i < resoveNodeRS.nodes.GetSize(); i++) { |
698 if (resoveNodeRS.nodes[i]->IsNode()) { | 703 if (resoveNodeRS.nodes[i]->IsNode()) |
699 pNodeList->Append((CXFA_Node*)resoveNodeRS.nodes[i]); | 704 pNodeList->Append(resoveNodeRS.nodes[i]->AsNode()); |
700 } | |
701 } | 705 } |
702 } else { | 706 } else { |
703 CXFA_HVALUEArray hValueArray(pScriptContext->GetRuntime()); | 707 CXFA_HVALUEArray hValueArray(pScriptContext->GetRuntime()); |
704 if (resoveNodeRS.GetAttributeResult(hValueArray) > 0) { | 708 if (resoveNodeRS.GetAttributeResult(hValueArray) > 0) { |
705 CXFA_ObjArray objectArray; | 709 CXFA_ObjArray objectArray; |
706 hValueArray.GetAttributeObject(objectArray); | 710 hValueArray.GetAttributeObject(objectArray); |
707 for (int32_t i = 0; i < objectArray.GetSize(); i++) { | 711 for (int32_t i = 0; i < objectArray.GetSize(); i++) { |
708 if (objectArray[i]->IsNode()) { | 712 if (objectArray[i]->IsNode()) |
709 pNodeList->Append((CXFA_Node*)objectArray[i]); | 713 pNodeList->Append(objectArray[i]->AsNode()); |
710 } | |
711 } | 714 } |
712 } | 715 } |
713 } | 716 } |
714 FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList, | 717 FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList, |
715 pScriptContext->GetJseNormalClass()); | 718 pScriptContext->GetJseNormalClass()); |
716 } | 719 } |
717 void CXFA_Node::Script_TreeClass_All(FXJSE_HVALUE hValue, | 720 void CXFA_Node::Script_TreeClass_All(FXJSE_HVALUE hValue, |
718 FX_BOOL bSetting, | 721 FX_BOOL bSetting, |
719 XFA_ATTRIBUTE eAttribute) { | 722 XFA_ATTRIBUTE eAttribute) { |
720 if (bSetting) { | 723 if (bSetting) { |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 } | 1156 } |
1154 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { | 1157 void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { |
1155 int32_t iLength = pArguments->GetLength(); | 1158 int32_t iLength = pArguments->GetLength(); |
1156 if (iLength != 1 && iLength != 2) { | 1159 if (iLength != 1 && iLength != 2) { |
1157 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement"); | 1160 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement"); |
1158 return; | 1161 return; |
1159 } | 1162 } |
1160 CXFA_Node* pNode = NULL; | 1163 CXFA_Node* pNode = NULL; |
1161 CFX_WideString wsName; | 1164 CFX_WideString wsName; |
1162 if (iLength >= 1) { | 1165 if (iLength >= 1) { |
1163 pNode = (CXFA_Node*)pArguments->GetObject(0); | 1166 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
1164 } | 1167 } |
1165 if (iLength >= 2) { | 1168 if (iLength >= 2) { |
1166 CFX_ByteString bsName = pArguments->GetUTF8String(1); | 1169 CFX_ByteString bsName = pArguments->GetUTF8String(1); |
1167 wsName = CFX_WideString::FromUTF8(bsName, bsName.GetLength()); | 1170 wsName = CFX_WideString::FromUTF8(bsName, bsName.GetLength()); |
1168 } | 1171 } |
1169 } | 1172 } |
1170 void CXFA_Node::Script_NodeClass_Ns(FXJSE_HVALUE hValue, | 1173 void CXFA_Node::Script_NodeClass_Ns(FXJSE_HVALUE hValue, |
1171 FX_BOOL bSetting, | 1174 FX_BOOL bSetting, |
1172 XFA_ATTRIBUTE eAttribute) { | 1175 XFA_ATTRIBUTE eAttribute) { |
1173 if (bSetting) { | 1176 if (bSetting) { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 if (bSetting) { | 1475 if (bSetting) { |
1473 CFX_ByteString szValue; | 1476 CFX_ByteString szValue; |
1474 FXJSE_Value_ToUTF8String(hValue, szValue); | 1477 FXJSE_Value_ToUTF8String(hValue, szValue); |
1475 CFX_WideString wsValue = | 1478 CFX_WideString wsValue = |
1476 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); | 1479 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); |
1477 SetAttribute(eAttribute, wsValue, TRUE); | 1480 SetAttribute(eAttribute, wsValue, TRUE); |
1478 if (eAttribute == XFA_ATTRIBUTE_Use && | 1481 if (eAttribute == XFA_ATTRIBUTE_Use && |
1479 this->GetClassID() == XFA_ELEMENT_Desc) { | 1482 this->GetClassID() == XFA_ELEMENT_Desc) { |
1480 CFX_WideString wsUseVal = wsValue, wsID, wsSOM; | 1483 CFX_WideString wsUseVal = wsValue, wsID, wsSOM; |
1481 CXFA_Node* pTemplateNode = | 1484 CXFA_Node* pTemplateNode = |
1482 (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Template); | 1485 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); |
1483 CXFA_Node* pProtoRoot = | 1486 CXFA_Node* pProtoRoot = |
1484 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform) | 1487 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform) |
1485 ->GetFirstChildByClass(XFA_ELEMENT_Proto); | 1488 ->GetFirstChildByClass(XFA_ELEMENT_Proto); |
1486 if (!wsUseVal.IsEmpty()) { | 1489 if (!wsUseVal.IsEmpty()) { |
1487 if (wsUseVal[0] == '#') { | 1490 if (wsUseVal[0] == '#') { |
1488 wsID = CFX_WideString((const FX_WCHAR*)wsUseVal + 1, | 1491 wsID = CFX_WideString((const FX_WCHAR*)wsUseVal + 1, |
1489 wsUseVal.GetLength() - 1); | 1492 wsUseVal.GetLength() - 1); |
1490 } else { | 1493 } else { |
1491 wsSOM = | 1494 wsSOM = |
1492 CFX_WideString((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength()); | 1495 CFX_WideString((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength()); |
1493 } | 1496 } |
1494 } | 1497 } |
1495 CXFA_Node* pProtoNode = NULL; | 1498 CXFA_Node* pProtoNode = NULL; |
1496 if (!wsSOM.IsEmpty()) { | 1499 if (!wsSOM.IsEmpty()) { |
1497 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | | 1500 FX_DWORD dwFlag = XFA_RESOLVENODE_Children | |
1498 XFA_RESOLVENODE_Attributes | | 1501 XFA_RESOLVENODE_Attributes | |
1499 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | | 1502 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | |
1500 XFA_RESOLVENODE_Siblings; | 1503 XFA_RESOLVENODE_Siblings; |
1501 XFA_RESOLVENODE_RS resoveNodeRS; | 1504 XFA_RESOLVENODE_RS resoveNodeRS; |
1502 int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects( | 1505 int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects( |
1503 pProtoRoot, wsSOM, resoveNodeRS, dwFlag); | 1506 pProtoRoot, wsSOM, resoveNodeRS, dwFlag); |
1504 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { | 1507 if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { |
1505 pProtoNode = (CXFA_Node*)resoveNodeRS.nodes[0]; | 1508 pProtoNode = resoveNodeRS.nodes[0]->AsNode(); |
1506 } | 1509 } |
1507 } else if (!wsID.IsEmpty()) { | 1510 } else if (!wsID.IsEmpty()) { |
1508 pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID); | 1511 pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID); |
1509 } | 1512 } |
1510 if (pProtoNode) { | 1513 if (pProtoNode) { |
1511 CXFA_Node* pHeadChild = GetNodeItem(XFA_NODEITEM_FirstChild); | 1514 CXFA_Node* pHeadChild = GetNodeItem(XFA_NODEITEM_FirstChild); |
1512 while (pHeadChild) { | 1515 while (pHeadChild) { |
1513 CXFA_Node* pSibling = | 1516 CXFA_Node* pSibling = |
1514 pHeadChild->GetNodeItem(XFA_NODEITEM_NextSibling); | 1517 pHeadChild->GetNodeItem(XFA_NODEITEM_NextSibling); |
1515 RemoveChild(pHeadChild); | 1518 RemoveChild(pHeadChild); |
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3101 for (CXFA_Node* pRootBoundNode = pFormParent; | 3104 for (CXFA_Node* pRootBoundNode = pFormParent; |
3102 pRootBoundNode && | 3105 pRootBoundNode && |
3103 pRootBoundNode->GetObjectType() == XFA_OBJECTTYPE_ContainerNode; | 3106 pRootBoundNode->GetObjectType() == XFA_OBJECTTYPE_ContainerNode; |
3104 pRootBoundNode = pRootBoundNode->GetNodeItem(XFA_NODEITEM_Parent)) { | 3107 pRootBoundNode = pRootBoundNode->GetNodeItem(XFA_NODEITEM_Parent)) { |
3105 pDataScope = pRootBoundNode->GetBindData(); | 3108 pDataScope = pRootBoundNode->GetBindData(); |
3106 if (pDataScope) { | 3109 if (pDataScope) { |
3107 break; | 3110 break; |
3108 } | 3111 } |
3109 } | 3112 } |
3110 if (!pDataScope) { | 3113 if (!pDataScope) { |
3111 pDataScope = (CXFA_Node*)pDocument->GetXFAObject(XFA_HASHCODE_Record); | 3114 pDataScope = ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record)); |
3112 ASSERT(pDataScope); | 3115 ASSERT(pDataScope); |
3113 } | 3116 } |
3114 CXFA_Node* pInstance = pDocument->DataMerge_CopyContainer( | 3117 CXFA_Node* pInstance = pDocument->DataMerge_CopyContainer( |
3115 pTemplateNode, pFormParent, pDataScope, TRUE, bDataMerge); | 3118 pTemplateNode, pFormParent, pDataScope, TRUE, bDataMerge); |
3116 if (pInstance) { | 3119 if (pInstance) { |
3117 pDocument->DataMerge_UpdateBindingRelations(pInstance); | 3120 pDocument->DataMerge_UpdateBindingRelations(pInstance); |
3118 pFormParent->RemoveChild(pInstance); | 3121 pFormParent->RemoveChild(pInstance); |
3119 } | 3122 } |
3120 return pInstance; | 3123 return pInstance; |
3121 } | 3124 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3181 pSubformInstance->GetClassID() == XFA_ELEMENT_Subform) { | 3184 pSubformInstance->GetClassID() == XFA_ELEMENT_Subform) { |
3182 pNotify->RunSubformIndexChange(pSubformInstance); | 3185 pNotify->RunSubformIndexChange(pSubformInstance); |
3183 } | 3186 } |
3184 } | 3187 } |
3185 } | 3188 } |
3186 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); | 3189 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); |
3187 if (!pLayoutPro) { | 3190 if (!pLayoutPro) { |
3188 return; | 3191 return; |
3189 } | 3192 } |
3190 pLayoutPro->AddChangedContainer( | 3193 pLayoutPro->AddChangedContainer( |
3191 (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); | 3194 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); |
3192 } | 3195 } |
3193 void CXFA_Node::Script_InstanceManager_SetInstances( | 3196 void CXFA_Node::Script_InstanceManager_SetInstances( |
3194 CFXJSE_Arguments* pArguments) { | 3197 CFXJSE_Arguments* pArguments) { |
3195 int32_t argc = pArguments->GetLength(); | 3198 int32_t argc = pArguments->GetLength(); |
3196 if (argc != 1) { | 3199 if (argc != 1) { |
3197 FXJSE_Value_SetUndefined(pArguments->GetReturnValue()); | 3200 FXJSE_Value_SetUndefined(pArguments->GetReturnValue()); |
3198 return; | 3201 return; |
3199 } | 3202 } |
3200 int32_t iDesired = pArguments->GetInt32(0); | 3203 int32_t iDesired = pArguments->GetInt32(0); |
3201 InstanceManager_SetInstances(iDesired); | 3204 InstanceManager_SetInstances(iDesired); |
(...skipping 26 matching lines...) Expand all Loading... |
3228 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 3231 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); |
3229 if (!pNotify) { | 3232 if (!pNotify) { |
3230 return; | 3233 return; |
3231 } | 3234 } |
3232 pNotify->RunNodeInitialize(pNewInstance); | 3235 pNotify->RunNodeInitialize(pNewInstance); |
3233 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); | 3236 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); |
3234 if (!pLayoutPro) { | 3237 if (!pLayoutPro) { |
3235 return; | 3238 return; |
3236 } | 3239 } |
3237 pLayoutPro->AddChangedContainer( | 3240 pLayoutPro->AddChangedContainer( |
3238 (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); | 3241 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); |
3239 } | 3242 } |
3240 void CXFA_Node::Script_InstanceManager_InsertInstance( | 3243 void CXFA_Node::Script_InstanceManager_InsertInstance( |
3241 CFXJSE_Arguments* pArguments) { | 3244 CFXJSE_Arguments* pArguments) { |
3242 int32_t argc = pArguments->GetLength(); | 3245 int32_t argc = pArguments->GetLength(); |
3243 if ((argc != 1) && (argc != 2)) { | 3246 if ((argc != 1) && (argc != 2)) { |
3244 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3247 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3245 L"insertInstance"); | 3248 L"insertInstance"); |
3246 return; | 3249 return; |
3247 } | 3250 } |
3248 int32_t iIndex = pArguments->GetInt32(0); | 3251 int32_t iIndex = pArguments->GetInt32(0); |
(...skipping 22 matching lines...) Expand all Loading... |
3271 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 3274 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); |
3272 if (!pNotify) { | 3275 if (!pNotify) { |
3273 return; | 3276 return; |
3274 } | 3277 } |
3275 pNotify->RunNodeInitialize(pNewInstance); | 3278 pNotify->RunNodeInitialize(pNewInstance); |
3276 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); | 3279 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); |
3277 if (!pLayoutPro) { | 3280 if (!pLayoutPro) { |
3278 return; | 3281 return; |
3279 } | 3282 } |
3280 pLayoutPro->AddChangedContainer( | 3283 pLayoutPro->AddChangedContainer( |
3281 (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); | 3284 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); |
3282 } | 3285 } |
3283 int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { | 3286 int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { |
3284 CXFA_Occur nodeOccur(GetOccurNode()); | 3287 CXFA_Occur nodeOccur(GetOccurNode()); |
3285 int32_t iMax = nodeOccur.GetMax(); | 3288 int32_t iMax = nodeOccur.GetMax(); |
3286 int32_t iMin = nodeOccur.GetMin(); | 3289 int32_t iMin = nodeOccur.GetMin(); |
3287 if (iDesired < iMin) { | 3290 if (iDesired < iMin) { |
3288 ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"min"); | 3291 ThrowScriptErrorMessage(XFA_IDS_VIOLATE_BOUNDARY, L"min"); |
3289 return 1; | 3292 return 1; |
3290 } | 3293 } |
3291 if ((iMax >= 0) && (iDesired > iMax)) { | 3294 if ((iMax >= 0) && (iDesired > iMax)) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3332 FALSE); | 3335 FALSE); |
3333 iCount++; | 3336 iCount++; |
3334 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 3337 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); |
3335 if (!pNotify) { | 3338 if (!pNotify) { |
3336 return 0; | 3339 return 0; |
3337 } | 3340 } |
3338 pNotify->RunNodeInitialize(pNewInstance); | 3341 pNotify->RunNodeInitialize(pNewInstance); |
3339 } | 3342 } |
3340 } | 3343 } |
3341 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); | 3344 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); |
3342 if (!pLayoutPro) { | 3345 if (pLayoutPro) { |
3343 return 0; | 3346 pLayoutPro->AddChangedContainer( |
| 3347 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); |
3344 } | 3348 } |
3345 pLayoutPro->AddChangedContainer( | |
3346 (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); | |
3347 return 0; | 3349 return 0; |
3348 } | 3350 } |
3349 int32_t CXFA_Node::InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom) { | 3351 int32_t CXFA_Node::InstanceManager_MoveInstance(int32_t iTo, int32_t iFrom) { |
3350 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); | 3352 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); |
3351 if (iFrom > iCount || iTo > iCount - 1) { | 3353 if (iFrom > iCount || iTo > iCount - 1) { |
3352 ThrowScriptErrorMessage(XFA_IDS_INDEX_OUT_OF_BOUNDS); | 3354 ThrowScriptErrorMessage(XFA_IDS_INDEX_OUT_OF_BOUNDS); |
3353 return 1; | 3355 return 1; |
3354 } | 3356 } |
3355 if (iFrom < 0 || iTo < 0 || iFrom == iTo) { | 3357 if (iFrom < 0 || iTo < 0 || iFrom == iTo) { |
3356 return 0; | 3358 return 0; |
3357 } | 3359 } |
3358 CXFA_Node* pMoveInstance = XFA_ScriptInstanceManager_GetItem(this, iFrom); | 3360 CXFA_Node* pMoveInstance = XFA_ScriptInstanceManager_GetItem(this, iFrom); |
3359 XFA_ScriptInstanceManager_RemoveItem(this, pMoveInstance, FALSE); | 3361 XFA_ScriptInstanceManager_RemoveItem(this, pMoveInstance, FALSE); |
3360 XFA_ScriptInstanceManager_InsertItem(this, pMoveInstance, iTo, iCount - 1, | 3362 XFA_ScriptInstanceManager_InsertItem(this, pMoveInstance, iTo, iCount - 1, |
3361 TRUE); | 3363 TRUE); |
3362 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); | 3364 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); |
3363 if (!pLayoutPro) { | 3365 if (pLayoutPro) { |
3364 return 0; | 3366 pLayoutPro->AddChangedContainer( |
| 3367 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); |
3365 } | 3368 } |
3366 pLayoutPro->AddChangedContainer( | |
3367 (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); | |
3368 return 0; | 3369 return 0; |
3369 } | 3370 } |
3370 void CXFA_Node::Script_Occur_Max(FXJSE_HVALUE hValue, | 3371 void CXFA_Node::Script_Occur_Max(FXJSE_HVALUE hValue, |
3371 FX_BOOL bSetting, | 3372 FX_BOOL bSetting, |
3372 XFA_ATTRIBUTE eAttribute) { | 3373 XFA_ATTRIBUTE eAttribute) { |
3373 CXFA_Occur occur(this); | 3374 CXFA_Occur occur(this); |
3374 if (bSetting) { | 3375 if (bSetting) { |
3375 int32_t iMax = FXJSE_Value_ToInteger(hValue); | 3376 int32_t iMax = FXJSE_Value_ToInteger(hValue); |
3376 occur.SetMax(iMax); | 3377 occur.SetMax(iMax); |
3377 } else { | 3378 } else { |
(...skipping 15 matching lines...) Expand all Loading... |
3393 int32_t argc = pArguments->GetLength(); | 3394 int32_t argc = pArguments->GetLength(); |
3394 if ((argc == 0) || (argc == 1)) { | 3395 if ((argc == 0) || (argc == 1)) { |
3395 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), ""); | 3396 FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), ""); |
3396 } else { | 3397 } else { |
3397 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"metadata"); | 3398 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"metadata"); |
3398 } | 3399 } |
3399 } | 3400 } |
3400 void CXFA_Node::Script_Form_FormNodes(CFXJSE_Arguments* pArguments) { | 3401 void CXFA_Node::Script_Form_FormNodes(CFXJSE_Arguments* pArguments) { |
3401 int32_t argc = pArguments->GetLength(); | 3402 int32_t argc = pArguments->GetLength(); |
3402 if (argc == 1) { | 3403 if (argc == 1) { |
3403 CXFA_Node* pDataNode = (CXFA_Node*)pArguments->GetObject(0); | 3404 CXFA_Node* pDataNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
3404 if (pDataNode) { | 3405 if (pDataNode) { |
3405 CXFA_NodeArray formItems; | 3406 CXFA_NodeArray formItems; |
3406 CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument); | 3407 CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument); |
3407 pFormNodes->SetArrayNodeList(formItems); | 3408 pFormNodes->SetArrayNodeList(formItems); |
3408 FXJSE_Value_SetObject( | 3409 FXJSE_Value_SetObject( |
3409 pArguments->GetReturnValue(), (CXFA_Object*)pFormNodes, | 3410 pArguments->GetReturnValue(), (CXFA_Object*)pFormNodes, |
3410 m_pDocument->GetScriptContext()->GetJseNormalClass()); | 3411 m_pDocument->GetScriptContext()->GetJseNormalClass()); |
3411 } else { | 3412 } else { |
3412 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); | 3413 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); |
3413 } | 3414 } |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4476 } | 4477 } |
4477 return TryCData(XFA_ATTRIBUTE_Value, wsContent, FALSE, bProto); | 4478 return TryCData(XFA_ATTRIBUTE_Value, wsContent, FALSE, bProto); |
4478 } | 4479 } |
4479 return FALSE; | 4480 return FALSE; |
4480 } | 4481 } |
4481 CXFA_Node* CXFA_Node::GetModelNode() { | 4482 CXFA_Node* CXFA_Node::GetModelNode() { |
4482 switch (GetPacketID()) { | 4483 switch (GetPacketID()) { |
4483 case XFA_XDPPACKET_XDP: | 4484 case XFA_XDPPACKET_XDP: |
4484 return m_pDocument->GetRoot(); | 4485 return m_pDocument->GetRoot(); |
4485 case XFA_XDPPACKET_Config: | 4486 case XFA_XDPPACKET_Config: |
4486 return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Config); | 4487 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Config)); |
4487 case XFA_XDPPACKET_Template: | 4488 case XFA_XDPPACKET_Template: |
4488 return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Template); | 4489 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); |
4489 case XFA_XDPPACKET_Form: | 4490 case XFA_XDPPACKET_Form: |
4490 return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Form); | 4491 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)); |
4491 case XFA_XDPPACKET_Datasets: | 4492 case XFA_XDPPACKET_Datasets: |
4492 return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets); | 4493 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets)); |
4493 case XFA_XDPPACKET_LocaleSet: | 4494 case XFA_XDPPACKET_LocaleSet: |
4494 return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_LocaleSet); | 4495 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_LocaleSet)); |
4495 case XFA_XDPPACKET_ConnectionSet: | 4496 case XFA_XDPPACKET_ConnectionSet: |
4496 return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_ConnectionSet); | 4497 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_ConnectionSet)); |
4497 case XFA_XDPPACKET_SourceSet: | 4498 case XFA_XDPPACKET_SourceSet: |
4498 return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet); | 4499 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet)); |
4499 case XFA_XDPPACKET_Xdc: | 4500 case XFA_XDPPACKET_Xdc: |
4500 return (CXFA_Node*)m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc); | 4501 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc)); |
4501 default: | 4502 default: |
4502 return this; | 4503 return this; |
4503 } | 4504 } |
4504 } | 4505 } |
4505 FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { | 4506 FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { |
4506 wsNamespace.Empty(); | 4507 wsNamespace.Empty(); |
4507 if (this->GetObjectType() == XFA_OBJECTTYPE_ModelNode || | 4508 if (this->GetObjectType() == XFA_OBJECTTYPE_ModelNode || |
4508 this->GetClassID() == XFA_ELEMENT_Packet) { | 4509 this->GetClassID() == XFA_ELEMENT_Packet) { |
4509 IFDE_XMLNode* pXMLNode = this->GetXMLMappingNode(); | 4510 IFDE_XMLNode* pXMLNode = this->GetXMLMappingNode(); |
4510 if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) { | 4511 if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) { |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4814 return pNode; | 4815 return pNode; |
4815 } | 4816 } |
4816 } | 4817 } |
4817 return NULL; | 4818 return NULL; |
4818 } | 4819 } |
4819 int32_t CXFA_Node::GetNodeSameNameIndex() const { | 4820 int32_t CXFA_Node::GetNodeSameNameIndex() const { |
4820 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 4821 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
4821 if (!pScriptContext) { | 4822 if (!pScriptContext) { |
4822 return -1; | 4823 return -1; |
4823 } | 4824 } |
4824 return pScriptContext->GetIndexByName((CXFA_Node*)this); | 4825 return pScriptContext->GetIndexByName(const_cast<CXFA_Node*>(this)); |
4825 } | 4826 } |
4826 int32_t CXFA_Node::GetNodeSameClassIndex() const { | 4827 int32_t CXFA_Node::GetNodeSameClassIndex() const { |
4827 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 4828 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
4828 if (!pScriptContext) { | 4829 if (!pScriptContext) { |
4829 return -1; | 4830 return -1; |
4830 } | 4831 } |
4831 return pScriptContext->GetIndexByClassName((CXFA_Node*)this); | 4832 return pScriptContext->GetIndexByClassName(const_cast<CXFA_Node*>(this)); |
4832 } | 4833 } |
4833 void CXFA_Node::GetSOMExpression(CFX_WideString& wsSOMExpression) { | 4834 void CXFA_Node::GetSOMExpression(CFX_WideString& wsSOMExpression) { |
4834 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 4835 IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
4835 if (!pScriptContext) { | 4836 if (!pScriptContext) { |
4836 return; | 4837 return; |
4837 } | 4838 } |
4838 pScriptContext->GetSomExpression(this, wsSOMExpression); | 4839 pScriptContext->GetSomExpression(this, wsSOMExpression); |
4839 } | 4840 } |
4840 CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() { | 4841 CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() { |
4841 CXFA_Node* pInstanceMgr = NULL; | 4842 CXFA_Node* pInstanceMgr = NULL; |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5156 pMoudle->m_BufferMap.RemoveAll(); | 5157 pMoudle->m_BufferMap.RemoveAll(); |
5157 pMoudle->m_ValueMap.RemoveAll(); | 5158 pMoudle->m_ValueMap.RemoveAll(); |
5158 if (pMoudle) { | 5159 if (pMoudle) { |
5159 delete pMoudle; | 5160 delete pMoudle; |
5160 pMoudle = NULL; | 5161 pMoudle = NULL; |
5161 } | 5162 } |
5162 } | 5163 } |
5163 } | 5164 } |
5164 void CXFA_Node::MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr) { | 5165 void CXFA_Node::MergeAllData(void* pDstModule, FX_BOOL bUseSrcAttr) { |
5165 XFA_LPMAPMODULEDATA pDstModuleData = | 5166 XFA_LPMAPMODULEDATA pDstModuleData = |
5166 ((CXFA_Node*)pDstModule)->GetMapModuleData(TRUE); | 5167 static_cast<CXFA_Node*>(pDstModule)->GetMapModuleData(TRUE); |
5167 if (!pDstModuleData) { | 5168 if (!pDstModuleData) { |
5168 return; | 5169 return; |
5169 } | 5170 } |
5170 XFA_LPMAPMODULEDATA pSrcModuleData = this->GetMapModuleData(FALSE); | 5171 XFA_LPMAPMODULEDATA pSrcModuleData = this->GetMapModuleData(FALSE); |
5171 if (!pSrcModuleData) { | 5172 if (!pSrcModuleData) { |
5172 return; | 5173 return; |
5173 } | 5174 } |
5174 FX_POSITION psValue = pSrcModuleData->m_ValueMap.GetStartPosition(); | 5175 FX_POSITION psValue = pSrcModuleData->m_ValueMap.GetStartPosition(); |
5175 while (psValue) { | 5176 while (psValue) { |
5176 void* pKey; | 5177 void* pKey; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5292 CXFA_Node* ret = Item(i); | 5293 CXFA_Node* ret = Item(i); |
5293 if (dwHashCode == ret->GetNameHash()) { | 5294 if (dwHashCode == ret->GetNameHash()) { |
5294 return ret; | 5295 return ret; |
5295 } | 5296 } |
5296 } | 5297 } |
5297 return NULL; | 5298 return NULL; |
5298 } | 5299 } |
5299 void CXFA_NodeList::Script_ListClass_Append(CFXJSE_Arguments* pArguments) { | 5300 void CXFA_NodeList::Script_ListClass_Append(CFXJSE_Arguments* pArguments) { |
5300 int32_t argc = pArguments->GetLength(); | 5301 int32_t argc = pArguments->GetLength(); |
5301 if (argc == 1) { | 5302 if (argc == 1) { |
5302 CXFA_Node* pNode = (CXFA_Node*)pArguments->GetObject(0); | 5303 CXFA_Node* pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
5303 if (pNode) { | 5304 if (pNode) { |
5304 Append(pNode); | 5305 Append(pNode); |
5305 } else { | 5306 } else { |
5306 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); | 5307 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); |
5307 } | 5308 } |
5308 } else { | 5309 } else { |
5309 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"append"); | 5310 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"append"); |
5310 } | 5311 } |
5311 } | 5312 } |
5312 void CXFA_NodeList::Script_ListClass_Insert(CFXJSE_Arguments* pArguments) { | 5313 void CXFA_NodeList::Script_ListClass_Insert(CFXJSE_Arguments* pArguments) { |
5313 int32_t argc = pArguments->GetLength(); | 5314 int32_t argc = pArguments->GetLength(); |
5314 if (argc == 2) { | 5315 if (argc == 2) { |
5315 CXFA_Node* pNewNode = (CXFA_Node*)pArguments->GetObject(0); | 5316 CXFA_Node* pNewNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
5316 CXFA_Node* pBeforeNode = (CXFA_Node*)pArguments->GetObject(1); | 5317 CXFA_Node* pBeforeNode = static_cast<CXFA_Node*>(pArguments->GetObject(1)); |
5317 if (pNewNode) { | 5318 if (pNewNode) { |
5318 Insert(pNewNode, pBeforeNode); | 5319 Insert(pNewNode, pBeforeNode); |
5319 } else { | 5320 } else { |
5320 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); | 5321 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); |
5321 } | 5322 } |
5322 } else { | 5323 } else { |
5323 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"insert"); | 5324 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"insert"); |
5324 } | 5325 } |
5325 } | 5326 } |
5326 void CXFA_NodeList::Script_ListClass_Remove(CFXJSE_Arguments* pArguments) { | 5327 void CXFA_NodeList::Script_ListClass_Remove(CFXJSE_Arguments* pArguments) { |
5327 int32_t argc = pArguments->GetLength(); | 5328 int32_t argc = pArguments->GetLength(); |
5328 if (argc == 1) { | 5329 if (argc == 1) { |
5329 CXFA_Node* pNode = (CXFA_Node*)pArguments->GetObject(0); | 5330 CXFA_Node* pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
5330 if (pNode) { | 5331 if (pNode) { |
5331 Remove(pNode); | 5332 Remove(pNode); |
5332 } else { | 5333 } else { |
5333 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); | 5334 ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); |
5334 } | 5335 } |
5335 } else { | 5336 } else { |
5336 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"remove"); | 5337 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"remove"); |
5337 } | 5338 } |
5338 } | 5339 } |
5339 void CXFA_NodeList::Script_ListClass_Item(CFXJSE_Arguments* pArguments) { | 5340 void CXFA_NodeList::Script_ListClass_Item(CFXJSE_Arguments* pArguments) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5447 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5448 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
5448 } | 5449 } |
5449 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5450 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
5450 return m_pAttachNode->RemoveChild(pNode); | 5451 return m_pAttachNode->RemoveChild(pNode); |
5451 } | 5452 } |
5452 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5453 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
5453 return m_pAttachNode->GetChild( | 5454 return m_pAttachNode->GetChild( |
5454 iIndex, XFA_ELEMENT_UNKNOWN, | 5455 iIndex, XFA_ELEMENT_UNKNOWN, |
5455 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); | 5456 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); |
5456 } | 5457 } |
OLD | NEW |