| 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 <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 void XFA_DataNodeDeleteBindItem(void* pData) { | 50 void XFA_DataNodeDeleteBindItem(void* pData) { |
| 51 delete static_cast<CXFA_NodeArray*>(pData); | 51 delete static_cast<CXFA_NodeArray*>(pData); |
| 52 } | 52 } |
| 53 | 53 |
| 54 XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = { | 54 XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = { |
| 55 XFA_DataNodeDeleteBindItem, nullptr}; | 55 XFA_DataNodeDeleteBindItem, nullptr}; |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 CXFA_Object::CXFA_Object(CXFA_Document* pDocument, XFA_ObjectType type) | 59 CXFA_Object::CXFA_Object(CXFA_Document* pDocument, |
| 60 : m_pDocument(pDocument), m_objectType(type) {} | 60 XFA_ObjectType objectType, |
| 61 XFA_Element elementType) |
| 62 : m_pDocument(pDocument), |
| 63 m_objectType(objectType), |
| 64 m_elementType(elementType) {} |
| 61 | 65 |
| 62 CXFA_Object::~CXFA_Object() {} | 66 CXFA_Object::~CXFA_Object() {} |
| 63 | 67 |
| 64 void CXFA_Object::GetClassName(CFX_WideStringC& wsName) const { | 68 void CXFA_Object::GetClassName(CFX_WideStringC& wsName) const { |
| 65 wsName = XFA_GetElementByID(GetClassID())->pName; | 69 wsName = XFA_GetElementByID(GetElementType())->pName; |
| 66 } | 70 } |
| 67 | 71 |
| 68 uint32_t CXFA_Object::GetClassHashCode() const { | 72 uint32_t CXFA_Object::GetClassHashCode() const { |
| 69 return XFA_GetElementByID(GetClassID())->uHash; | 73 return XFA_GetElementByID(GetElementType())->uHash; |
| 70 } | 74 } |
| 71 | 75 |
| 72 XFA_Element CXFA_Object::GetClassID() const { | 76 XFA_Element CXFA_Object::GetElementType() const { |
| 73 if (IsNode()) | 77 return m_elementType; |
| 74 return AsNode()->GetClassID(); | |
| 75 if (IsOrdinaryObject()) | |
| 76 return AsOrdinaryObject()->GetClassID(); | |
| 77 if (IsNodeList()) | |
| 78 return AsNodeList()->GetClassID(); | |
| 79 if (IsOrdinaryList()) | |
| 80 return XFA_Element::List; | |
| 81 ASSERT(FALSE); | |
| 82 return XFA_Element::Unknown; | |
| 83 } | 78 } |
| 84 | 79 |
| 85 void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, | 80 void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, |
| 86 FX_BOOL bSetting, | 81 FX_BOOL bSetting, |
| 87 XFA_ATTRIBUTE eAttribute) { | 82 XFA_ATTRIBUTE eAttribute) { |
| 88 if (!bSetting) { | 83 if (!bSetting) { |
| 89 CFX_WideStringC className; | 84 CFX_WideStringC className; |
| 90 GetClassName(className); | 85 GetClassName(className); |
| 91 pValue->SetString( | 86 pValue->SetString( |
| 92 FX_UTF8Encode(className.c_str(), className.GetLength()).AsStringC()); | 87 FX_UTF8Encode(className.c_str(), className.GetLength()).AsStringC()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 109 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); | 104 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); |
| 110 } | 105 } |
| 111 | 106 |
| 112 XFA_MAPMODULEDATA::XFA_MAPMODULEDATA() {} | 107 XFA_MAPMODULEDATA::XFA_MAPMODULEDATA() {} |
| 113 | 108 |
| 114 XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {} | 109 XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {} |
| 115 | 110 |
| 116 CXFA_Node::CXFA_Node(CXFA_Document* pDoc, | 111 CXFA_Node::CXFA_Node(CXFA_Document* pDoc, |
| 117 uint16_t ePacket, | 112 uint16_t ePacket, |
| 118 XFA_Element eElement) | 113 XFA_Element eElement) |
| 119 : CXFA_Object(pDoc, XFA_GetElementObjectType(eElement)), | 114 : CXFA_Object(pDoc, XFA_GetElementObjectType(eElement), eElement), |
| 120 m_pNext(nullptr), | 115 m_pNext(nullptr), |
| 121 m_pChild(nullptr), | 116 m_pChild(nullptr), |
| 122 m_pLastChild(nullptr), | 117 m_pLastChild(nullptr), |
| 123 m_pParent(nullptr), | 118 m_pParent(nullptr), |
| 124 m_pXMLNode(nullptr), | 119 m_pXMLNode(nullptr), |
| 125 m_eNodeClass(eElement), | |
| 126 m_ePacket(ePacket), | 120 m_ePacket(ePacket), |
| 127 m_uNodeFlags(XFA_NodeFlag_None), | 121 m_uNodeFlags(XFA_NodeFlag_None), |
| 128 m_dwNameHash(0), | 122 m_dwNameHash(0), |
| 129 m_pAuxNode(nullptr), | 123 m_pAuxNode(nullptr), |
| 130 m_pMapModuleData(nullptr) { | 124 m_pMapModuleData(nullptr) { |
| 131 ASSERT(m_pDocument); | 125 ASSERT(m_pDocument); |
| 132 } | 126 } |
| 133 | 127 |
| 134 CXFA_Node::~CXFA_Node() { | 128 CXFA_Node::~CXFA_Node() { |
| 135 ASSERT(!m_pParent); | 129 ASSERT(!m_pParent); |
| 136 RemoveMapModuleKey(); | 130 RemoveMapModuleKey(); |
| 137 CXFA_Node* pNode = m_pChild; | 131 CXFA_Node* pNode = m_pChild; |
| 138 while (pNode) { | 132 while (pNode) { |
| 139 CXFA_Node* pNext = pNode->m_pNext; | 133 CXFA_Node* pNext = pNode->m_pNext; |
| 140 pNode->m_pParent = nullptr; | 134 pNode->m_pParent = nullptr; |
| 141 delete pNode; | 135 delete pNode; |
| 142 pNode = pNext; | 136 pNode = pNext; |
| 143 } | 137 } |
| 144 if (m_pXMLNode && IsOwnXMLNode()) | 138 if (m_pXMLNode && IsOwnXMLNode()) |
| 145 m_pXMLNode->Release(); | 139 m_pXMLNode->Release(); |
| 146 } | 140 } |
| 147 | 141 |
| 148 CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) { | 142 CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) { |
| 149 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); | 143 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); |
| 150 CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass); | 144 CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_elementType); |
| 151 if (!pClone) | 145 if (!pClone) |
| 152 return nullptr; | 146 return nullptr; |
| 153 | 147 |
| 154 MergeAllData(pClone); | 148 MergeAllData(pClone); |
| 155 pClone->UpdateNameHash(); | 149 pClone->UpdateNameHash(); |
| 156 if (IsNeedSavingXMLNode()) { | 150 if (IsNeedSavingXMLNode()) { |
| 157 CFDE_XMLNode* pCloneXML = nullptr; | 151 CFDE_XMLNode* pCloneXML = nullptr; |
| 158 if (IsAttributeInXML()) { | 152 if (IsAttributeInXML()) { |
| 159 CFX_WideString wsName; | 153 CFX_WideString wsName; |
| 160 GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); | 154 GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, | 241 int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, |
| 248 uint32_t dwTypeFilter, | 242 uint32_t dwTypeFilter, |
| 249 XFA_Element eElementFilter, | 243 XFA_Element eElementFilter, |
| 250 int32_t iLevel) { | 244 int32_t iLevel) { |
| 251 if (--iLevel < 0) { | 245 if (--iLevel < 0) { |
| 252 return nodes.GetSize(); | 246 return nodes.GetSize(); |
| 253 } | 247 } |
| 254 if (eElementFilter != XFA_Element::Unknown) { | 248 if (eElementFilter != XFA_Element::Unknown) { |
| 255 CXFA_Node* pChild = m_pChild; | 249 CXFA_Node* pChild = m_pChild; |
| 256 while (pChild) { | 250 while (pChild) { |
| 257 if (pChild->GetClassID() == eElementFilter) { | 251 if (pChild->GetElementType() == eElementFilter) { |
| 258 nodes.Add(pChild); | 252 nodes.Add(pChild); |
| 259 if (iLevel > 0) { | 253 if (iLevel > 0) { |
| 260 GetNodeList(nodes, dwTypeFilter, eElementFilter, iLevel); | 254 GetNodeList(nodes, dwTypeFilter, eElementFilter, iLevel); |
| 261 } | 255 } |
| 262 } | 256 } |
| 263 pChild = pChild->m_pNext; | 257 pChild = pChild->m_pNext; |
| 264 } | 258 } |
| 265 } else if (dwTypeFilter == | 259 } else if (dwTypeFilter == |
| 266 (XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties)) { | 260 (XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties)) { |
| 267 CXFA_Node* pChild = m_pChild; | 261 CXFA_Node* pChild = m_pChild; |
| 268 while (pChild) { | 262 while (pChild) { |
| 269 nodes.Add(pChild); | 263 nodes.Add(pChild); |
| 270 if (iLevel > 0) { | 264 if (iLevel > 0) { |
| 271 GetNodeList(nodes, dwTypeFilter, eElementFilter, iLevel); | 265 GetNodeList(nodes, dwTypeFilter, eElementFilter, iLevel); |
| 272 } | 266 } |
| 273 pChild = pChild->m_pNext; | 267 pChild = pChild->m_pNext; |
| 274 } | 268 } |
| 275 } else if (dwTypeFilter != 0) { | 269 } else if (dwTypeFilter != 0) { |
| 276 bool bFilterChildren = !!(dwTypeFilter & XFA_NODEFILTER_Children); | 270 bool bFilterChildren = !!(dwTypeFilter & XFA_NODEFILTER_Children); |
| 277 bool bFilterProperties = !!(dwTypeFilter & XFA_NODEFILTER_Properties); | 271 bool bFilterProperties = !!(dwTypeFilter & XFA_NODEFILTER_Properties); |
| 278 bool bFilterOneOfProperties = | 272 bool bFilterOneOfProperties = |
| 279 !!(dwTypeFilter & XFA_NODEFILTER_OneOfProperty); | 273 !!(dwTypeFilter & XFA_NODEFILTER_OneOfProperty); |
| 280 CXFA_Node* pChild = m_pChild; | 274 CXFA_Node* pChild = m_pChild; |
| 281 while (pChild) { | 275 while (pChild) { |
| 282 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( | 276 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( |
| 283 GetClassID(), pChild->GetClassID(), XFA_XDPPACKET_UNKNOWN); | 277 GetElementType(), pChild->GetElementType(), XFA_XDPPACKET_UNKNOWN); |
| 284 if (pProperty) { | 278 if (pProperty) { |
| 285 if (bFilterProperties) { | 279 if (bFilterProperties) { |
| 286 nodes.Add(pChild); | 280 nodes.Add(pChild); |
| 287 } else if (bFilterOneOfProperties && | 281 } else if (bFilterOneOfProperties && |
| 288 (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) { | 282 (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) { |
| 289 nodes.Add(pChild); | 283 nodes.Add(pChild); |
| 290 } else if (bFilterChildren && | 284 } else if (bFilterChildren && |
| 291 (pChild->GetClassID() == XFA_Element::Variables || | 285 (pChild->GetElementType() == XFA_Element::Variables || |
| 292 pChild->GetClassID() == XFA_Element::PageSet)) { | 286 pChild->GetElementType() == XFA_Element::PageSet)) { |
| 293 nodes.Add(pChild); | 287 nodes.Add(pChild); |
| 294 } | 288 } |
| 295 } else if (bFilterChildren) { | 289 } else if (bFilterChildren) { |
| 296 nodes.Add(pChild); | 290 nodes.Add(pChild); |
| 297 } | 291 } |
| 298 pChild = pChild->m_pNext; | 292 pChild = pChild->m_pNext; |
| 299 } | 293 } |
| 300 if (bFilterOneOfProperties && nodes.GetSize() < 1) { | 294 if (bFilterOneOfProperties && nodes.GetSize() < 1) { |
| 301 int32_t iProperties = 0; | 295 int32_t iProperties = 0; |
| 302 const XFA_PROPERTY* pProperty = | 296 const XFA_PROPERTY* pProperty = |
| 303 XFA_GetElementProperties(GetClassID(), iProperties); | 297 XFA_GetElementProperties(GetElementType(), iProperties); |
| 304 if (!pProperty || iProperties < 1) | 298 if (!pProperty || iProperties < 1) |
| 305 return 0; | 299 return 0; |
| 306 for (int32_t i = 0; i < iProperties; i++) { | 300 for (int32_t i = 0; i < iProperties; i++) { |
| 307 if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) { | 301 if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) { |
| 308 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); | 302 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); |
| 309 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID()); | 303 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID()); |
| 310 CXFA_Node* pNewNode = | 304 CXFA_Node* pNewNode = |
| 311 pFactory->CreateNode(pPacket, pProperty[i].eName); | 305 pFactory->CreateNode(pPacket, pProperty[i].eName); |
| 312 if (!pNewNode) | 306 if (!pNewNode) |
| 313 break; | 307 break; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 326 uint32_t dwFlags) { | 320 uint32_t dwFlags) { |
| 327 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); | 321 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); |
| 328 CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eElement); | 322 CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eElement); |
| 329 pNode->SetFlag(dwFlags, true); | 323 pNode->SetFlag(dwFlags, true); |
| 330 return pNode; | 324 return pNode; |
| 331 } | 325 } |
| 332 | 326 |
| 333 CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) { | 327 CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) { |
| 334 ASSERT(m_ePacket == XFA_XDPPACKET_Template); | 328 ASSERT(m_ePacket == XFA_XDPPACKET_Template); |
| 335 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); | 329 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); |
| 336 CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_eNodeClass); | 330 CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_elementType); |
| 337 if (!pClone) | 331 if (!pClone) |
| 338 return nullptr; | 332 return nullptr; |
| 339 | 333 |
| 340 pClone->SetTemplateNode(this); | 334 pClone->SetTemplateNode(this); |
| 341 pClone->UpdateNameHash(); | 335 pClone->UpdateNameHash(); |
| 342 pClone->SetXMLMappingNode(GetXMLMappingNode()); | 336 pClone->SetXMLMappingNode(GetXMLMappingNode()); |
| 343 if (bRecursive) { | 337 if (bRecursive) { |
| 344 for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild; | 338 for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild; |
| 345 pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 339 pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 346 pClone->InsertChild(pChild->CloneTemplateToForm(bRecursive)); | 340 pClone->InsertChild(pChild->CloneTemplateToForm(bRecursive)); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 GetObject(XFA_ATTRIBUTE_BindingNode); | 432 GetObject(XFA_ATTRIBUTE_BindingNode); |
| 439 } | 433 } |
| 440 | 434 |
| 441 CXFA_WidgetData* CXFA_Node::GetWidgetData() { | 435 CXFA_WidgetData* CXFA_Node::GetWidgetData() { |
| 442 return (CXFA_WidgetData*)GetObject(XFA_ATTRIBUTE_WidgetData); | 436 return (CXFA_WidgetData*)GetObject(XFA_ATTRIBUTE_WidgetData); |
| 443 } | 437 } |
| 444 | 438 |
| 445 CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { | 439 CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { |
| 446 if (GetPacketID() != XFA_XDPPACKET_Form) | 440 if (GetPacketID() != XFA_XDPPACKET_Form) |
| 447 return nullptr; | 441 return nullptr; |
| 448 XFA_Element classID = GetClassID(); | 442 XFA_Element classID = GetElementType(); |
| 449 if (classID == XFA_Element::ExclGroup) | 443 if (classID == XFA_Element::ExclGroup) |
| 450 return nullptr; | 444 return nullptr; |
| 451 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); | 445 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); |
| 452 if (pParentNode && pParentNode->GetClassID() == XFA_Element::ExclGroup) | 446 if (pParentNode && pParentNode->GetElementType() == XFA_Element::ExclGroup) |
| 453 return nullptr; | 447 return nullptr; |
| 454 | 448 |
| 455 if (classID == XFA_Element::Field) { | 449 if (classID == XFA_Element::Field) { |
| 456 CXFA_WidgetData* pFieldWidgetData = GetWidgetData(); | 450 CXFA_WidgetData* pFieldWidgetData = GetWidgetData(); |
| 457 if (pFieldWidgetData && | 451 if (pFieldWidgetData && |
| 458 pFieldWidgetData->GetChoiceListOpen() == | 452 pFieldWidgetData->GetChoiceListOpen() == |
| 459 XFA_ATTRIBUTEENUM_MultiSelect) { | 453 XFA_ATTRIBUTEENUM_MultiSelect) { |
| 460 return nullptr; | 454 return nullptr; |
| 461 } else { | 455 } else { |
| 462 CFX_WideString wsPicture; | 456 CFX_WideString wsPicture; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 484 if (!wsPicture.IsEmpty()) | 478 if (!wsPicture.IsEmpty()) |
| 485 break; | 479 break; |
| 486 pFieldWidgetData = nullptr; | 480 pFieldWidgetData = nullptr; |
| 487 } | 481 } |
| 488 return pFieldWidgetData; | 482 return pFieldWidgetData; |
| 489 } | 483 } |
| 490 } | 484 } |
| 491 CXFA_Node* pGrandNode = | 485 CXFA_Node* pGrandNode = |
| 492 pParentNode ? pParentNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr; | 486 pParentNode ? pParentNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr; |
| 493 CXFA_Node* pValueNode = | 487 CXFA_Node* pValueNode = |
| 494 (pParentNode && pParentNode->GetClassID() == XFA_Element::Value) | 488 (pParentNode && pParentNode->GetElementType() == XFA_Element::Value) |
| 495 ? pParentNode | 489 ? pParentNode |
| 496 : nullptr; | 490 : nullptr; |
| 497 if (!pValueNode) { | 491 if (!pValueNode) { |
| 498 pValueNode = (pGrandNode && pGrandNode->GetClassID() == XFA_Element::Value) | 492 pValueNode = |
| 499 ? pGrandNode | 493 (pGrandNode && pGrandNode->GetElementType() == XFA_Element::Value) |
| 500 : nullptr; | 494 ? pGrandNode |
| 495 : nullptr; |
| 501 } | 496 } |
| 502 CXFA_Node* pParentOfValueNode = | 497 CXFA_Node* pParentOfValueNode = |
| 503 pValueNode ? pValueNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr; | 498 pValueNode ? pValueNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr; |
| 504 return pParentOfValueNode ? pParentOfValueNode->GetContainerWidgetData() | 499 return pParentOfValueNode ? pParentOfValueNode->GetContainerWidgetData() |
| 505 : nullptr; | 500 : nullptr; |
| 506 } | 501 } |
| 507 | 502 |
| 508 FX_BOOL CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) { | 503 FX_BOOL CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) { |
| 509 CXFA_Node* pForm = GetDocument()->GetXFAObject(XFA_HASHCODE_Form)->AsNode(); | 504 CXFA_Node* pForm = GetDocument()->GetXFAObject(XFA_HASHCODE_Form)->AsNode(); |
| 510 CXFA_Node* pTopSubform = pForm->GetFirstChildByClass(XFA_Element::Subform); | 505 CXFA_Node* pTopSubform = pForm->GetFirstChildByClass(XFA_Element::Subform); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 529 } | 524 } |
| 530 IFX_Locale* pLocale = GetDocument()->GetLocalMgr()->GetDefLocale(); | 525 IFX_Locale* pLocale = GetDocument()->GetLocalMgr()->GetDefLocale(); |
| 531 if (pLocale) { | 526 if (pLocale) { |
| 532 wsLocaleName = pLocale->GetName(); | 527 wsLocaleName = pLocale->GetName(); |
| 533 return TRUE; | 528 return TRUE; |
| 534 } | 529 } |
| 535 return FALSE; | 530 return FALSE; |
| 536 } | 531 } |
| 537 | 532 |
| 538 XFA_ATTRIBUTEENUM CXFA_Node::GetIntact() { | 533 XFA_ATTRIBUTEENUM CXFA_Node::GetIntact() { |
| 539 XFA_Element eElement = GetClassID(); | 534 XFA_Element eElement = GetElementType(); |
| 540 CXFA_Node* pKeep = GetFirstChildByClass(XFA_Element::Keep); | 535 CXFA_Node* pKeep = GetFirstChildByClass(XFA_Element::Keep); |
| 541 XFA_ATTRIBUTEENUM eLayoutType = GetEnum(XFA_ATTRIBUTE_Layout); | 536 XFA_ATTRIBUTEENUM eLayoutType = GetEnum(XFA_ATTRIBUTE_Layout); |
| 542 if (pKeep) { | 537 if (pKeep) { |
| 543 XFA_ATTRIBUTEENUM eIntact; | 538 XFA_ATTRIBUTEENUM eIntact; |
| 544 if (pKeep->TryEnum(XFA_ATTRIBUTE_Intact, eIntact, FALSE)) { | 539 if (pKeep->TryEnum(XFA_ATTRIBUTE_Intact, eIntact, FALSE)) { |
| 545 if (eIntact == XFA_ATTRIBUTEENUM_None && | 540 if (eIntact == XFA_ATTRIBUTEENUM_None && |
| 546 eLayoutType == XFA_ATTRIBUTEENUM_Row && | 541 eLayoutType == XFA_ATTRIBUTEENUM_Row && |
| 547 m_pDocument->GetCurVersionMode() < XFA_VERSION_208) { | 542 m_pDocument->GetCurVersionMode() < XFA_VERSION_208) { |
| 548 CXFA_Node* pPreviewRow = GetNodeItem(XFA_NODEITEM_PrevSibling, | 543 CXFA_Node* pPreviewRow = GetNodeItem(XFA_NODEITEM_PrevSibling, |
| 549 XFA_ObjectType::ContainerNode); | 544 XFA_ObjectType::ContainerNode); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 578 case XFA_ATTRIBUTEENUM_Table: | 573 case XFA_ATTRIBUTEENUM_Table: |
| 579 case XFA_ATTRIBUTEENUM_Lr_tb: | 574 case XFA_ATTRIBUTEENUM_Lr_tb: |
| 580 case XFA_ATTRIBUTEENUM_Rl_tb: | 575 case XFA_ATTRIBUTEENUM_Rl_tb: |
| 581 return XFA_ATTRIBUTEENUM_None; | 576 return XFA_ATTRIBUTEENUM_None; |
| 582 default: | 577 default: |
| 583 break; | 578 break; |
| 584 } | 579 } |
| 585 break; | 580 break; |
| 586 case XFA_Element::Field: { | 581 case XFA_Element::Field: { |
| 587 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); | 582 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); |
| 588 if (!pParentNode || pParentNode->GetClassID() == XFA_Element::PageArea) | 583 if (!pParentNode || |
| 584 pParentNode->GetElementType() == XFA_Element::PageArea) |
| 589 return XFA_ATTRIBUTEENUM_ContentArea; | 585 return XFA_ATTRIBUTEENUM_ContentArea; |
| 590 if (pParentNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { | 586 if (pParentNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { |
| 591 XFA_ATTRIBUTEENUM eParLayout = | 587 XFA_ATTRIBUTEENUM eParLayout = |
| 592 pParentNode->GetEnum(XFA_ATTRIBUTE_Layout); | 588 pParentNode->GetEnum(XFA_ATTRIBUTE_Layout); |
| 593 if (eParLayout == XFA_ATTRIBUTEENUM_Position || | 589 if (eParLayout == XFA_ATTRIBUTEENUM_Position || |
| 594 eParLayout == XFA_ATTRIBUTEENUM_Row || | 590 eParLayout == XFA_ATTRIBUTEENUM_Row || |
| 595 eParLayout == XFA_ATTRIBUTEENUM_Table) { | 591 eParLayout == XFA_ATTRIBUTEENUM_Table) { |
| 596 return XFA_ATTRIBUTEENUM_None; | 592 return XFA_ATTRIBUTEENUM_None; |
| 597 } | 593 } |
| 598 XFA_VERSION version = m_pDocument->GetCurVersionMode(); | 594 XFA_VERSION version = m_pDocument->GetCurVersionMode(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 629 if (iLength != 1) { | 625 if (iLength != 1) { |
| 630 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resolveNode"); | 626 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resolveNode"); |
| 631 return; | 627 return; |
| 632 } | 628 } |
| 633 CFX_WideString wsExpression = | 629 CFX_WideString wsExpression = |
| 634 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); | 630 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); |
| 635 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 631 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 636 if (!pScriptContext) | 632 if (!pScriptContext) |
| 637 return; | 633 return; |
| 638 CXFA_Node* refNode = this; | 634 CXFA_Node* refNode = this; |
| 639 if (refNode->GetClassID() == XFA_Element::Xfa) | 635 if (refNode->GetElementType() == XFA_Element::Xfa) |
| 640 refNode = ToNode(pScriptContext->GetThisObject()); | 636 refNode = ToNode(pScriptContext->GetThisObject()); |
| 641 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | | 637 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | |
| 642 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | | 638 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | |
| 643 XFA_RESOLVENODE_Siblings; | 639 XFA_RESOLVENODE_Siblings; |
| 644 XFA_RESOLVENODE_RS resoveNodeRS; | 640 XFA_RESOLVENODE_RS resoveNodeRS; |
| 645 int32_t iRet = pScriptContext->ResolveObjects( | 641 int32_t iRet = pScriptContext->ResolveObjects( |
| 646 refNode, wsExpression.AsStringC(), resoveNodeRS, dwFlag); | 642 refNode, wsExpression.AsStringC(), resoveNodeRS, dwFlag); |
| 647 if (iRet < 1) { | 643 if (iRet < 1) { |
| 648 pArguments->GetReturnValue()->SetNull(); | 644 pArguments->GetReturnValue()->SetNull(); |
| 649 return; | 645 return; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 675 } | 671 } |
| 676 CFX_WideString wsExpression = | 672 CFX_WideString wsExpression = |
| 677 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); | 673 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); |
| 678 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 674 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 679 if (!pValue) | 675 if (!pValue) |
| 680 return; | 676 return; |
| 681 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | | 677 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | |
| 682 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | | 678 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | |
| 683 XFA_RESOLVENODE_Siblings; | 679 XFA_RESOLVENODE_Siblings; |
| 684 CXFA_Node* refNode = this; | 680 CXFA_Node* refNode = this; |
| 685 if (refNode->GetClassID() == XFA_Element::Xfa) | 681 if (refNode->GetElementType() == XFA_Element::Xfa) |
| 686 refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject()); | 682 refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject()); |
| 687 Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag, refNode); | 683 Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag, refNode); |
| 688 } | 684 } |
| 689 | 685 |
| 690 void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue, | 686 void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue, |
| 691 CFX_WideString wsExpression, | 687 CFX_WideString wsExpression, |
| 692 uint32_t dwFlag, | 688 uint32_t dwFlag, |
| 693 CXFA_Node* refNode) { | 689 CXFA_Node* refNode) { |
| 694 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 690 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 695 if (!pScriptContext) | 691 if (!pScriptContext) |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 pNewChild->SetFlag(XFA_NodeFlag_Initialized, true); | 1006 pNewChild->SetFlag(XFA_NodeFlag_Initialized, true); |
| 1011 pNewChild = pItem; | 1007 pNewChild = pItem; |
| 1012 } | 1008 } |
| 1013 while (pChild) { | 1009 while (pChild) { |
| 1014 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); | 1010 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 1015 RemoveChild(pChild); | 1011 RemoveChild(pChild); |
| 1016 pFakeRoot->InsertChild(pChild); | 1012 pFakeRoot->InsertChild(pChild); |
| 1017 pChild = pItem; | 1013 pChild = pItem; |
| 1018 } | 1014 } |
| 1019 if (GetPacketID() == XFA_XDPPACKET_Form && | 1015 if (GetPacketID() == XFA_XDPPACKET_Form && |
| 1020 GetClassID() == XFA_Element::ExData) { | 1016 GetElementType() == XFA_Element::ExData) { |
| 1021 CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode(); | 1017 CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode(); |
| 1022 SetXMLMappingNode(pFakeXMLRoot); | 1018 SetXMLMappingNode(pFakeXMLRoot); |
| 1023 SetFlag(XFA_NodeFlag_OwnXMLNode, false); | 1019 SetFlag(XFA_NodeFlag_OwnXMLNode, false); |
| 1024 if (pTempXMLNode && !pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent)) { | 1020 if (pTempXMLNode && !pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent)) { |
| 1025 pFakeXMLRoot = pTempXMLNode; | 1021 pFakeXMLRoot = pTempXMLNode; |
| 1026 } else { | 1022 } else { |
| 1027 pFakeXMLRoot = nullptr; | 1023 pFakeXMLRoot = nullptr; |
| 1028 } | 1024 } |
| 1029 } | 1025 } |
| 1030 MoveBufferMapData(pFakeRoot, this, XFA_CalcData, TRUE); | 1026 MoveBufferMapData(pFakeRoot, this, XFA_CalcData, TRUE); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 else | 1165 else |
| 1170 pValue->SetBoolean(IsContainerNode()); | 1166 pValue->SetBoolean(IsContainerNode()); |
| 1171 } | 1167 } |
| 1172 | 1168 |
| 1173 void CXFA_Node::Script_NodeClass_IsNull(CFXJSE_Value* pValue, | 1169 void CXFA_Node::Script_NodeClass_IsNull(CFXJSE_Value* pValue, |
| 1174 FX_BOOL bSetting, | 1170 FX_BOOL bSetting, |
| 1175 XFA_ATTRIBUTE eAttribute) { | 1171 XFA_ATTRIBUTE eAttribute) { |
| 1176 if (bSetting) { | 1172 if (bSetting) { |
| 1177 ThrowException(XFA_IDS_INVAlID_PROP_SET); | 1173 ThrowException(XFA_IDS_INVAlID_PROP_SET); |
| 1178 } else { | 1174 } else { |
| 1179 if (GetClassID() == XFA_Element::Subform) { | 1175 if (GetElementType() == XFA_Element::Subform) { |
| 1180 pValue->SetBoolean(FALSE); | 1176 pValue->SetBoolean(FALSE); |
| 1181 return; | 1177 return; |
| 1182 } | 1178 } |
| 1183 CFX_WideString strValue; | 1179 CFX_WideString strValue; |
| 1184 pValue->SetBoolean(!TryContent(strValue) || strValue.IsEmpty()); | 1180 pValue->SetBoolean(!TryContent(strValue) || strValue.IsEmpty()); |
| 1185 } | 1181 } |
| 1186 } | 1182 } |
| 1187 | 1183 |
| 1188 void CXFA_Node::Script_NodeClass_OneOfChild(CFXJSE_Value* pValue, | 1184 void CXFA_Node::Script_NodeClass_OneOfChild(CFXJSE_Value* pValue, |
| 1189 FX_BOOL bSetting, | 1185 FX_BOOL bSetting, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 if (!pNotify) | 1279 if (!pNotify) |
| 1284 return; | 1280 return; |
| 1285 | 1281 |
| 1286 uint32_t dwPacket = GetPacketID(); | 1282 uint32_t dwPacket = GetPacketID(); |
| 1287 if (!(dwPacket & XFA_XDPPACKET_Form)) { | 1283 if (!(dwPacket & XFA_XDPPACKET_Form)) { |
| 1288 pNotify->OnValueChanged(this, eAttribute, this, this); | 1284 pNotify->OnValueChanged(this, eAttribute, this, this); |
| 1289 return; | 1285 return; |
| 1290 } | 1286 } |
| 1291 | 1287 |
| 1292 bool bNeedFindContainer = false; | 1288 bool bNeedFindContainer = false; |
| 1293 XFA_Element eType = GetClassID(); | 1289 XFA_Element eType = GetElementType(); |
| 1294 switch (eType) { | 1290 switch (eType) { |
| 1295 case XFA_Element::Caption: | 1291 case XFA_Element::Caption: |
| 1296 bNeedFindContainer = true; | 1292 bNeedFindContainer = true; |
| 1297 pNotify->OnValueChanged(this, eAttribute, this, | 1293 pNotify->OnValueChanged(this, eAttribute, this, |
| 1298 GetNodeItem(XFA_NODEITEM_Parent)); | 1294 GetNodeItem(XFA_NODEITEM_Parent)); |
| 1299 break; | 1295 break; |
| 1300 case XFA_Element::Font: | 1296 case XFA_Element::Font: |
| 1301 case XFA_Element::Para: { | 1297 case XFA_Element::Para: { |
| 1302 bNeedFindContainer = true; | 1298 bNeedFindContainer = true; |
| 1303 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); | 1299 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); |
| 1304 if (pParentNode->GetClassID() == XFA_Element::Caption) { | 1300 if (pParentNode->GetElementType() == XFA_Element::Caption) { |
| 1305 pNotify->OnValueChanged(this, eAttribute, pParentNode, | 1301 pNotify->OnValueChanged(this, eAttribute, pParentNode, |
| 1306 pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); | 1302 pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); |
| 1307 } else { | 1303 } else { |
| 1308 pNotify->OnValueChanged(this, eAttribute, this, pParentNode); | 1304 pNotify->OnValueChanged(this, eAttribute, this, pParentNode); |
| 1309 } | 1305 } |
| 1310 } break; | 1306 } break; |
| 1311 case XFA_Element::Margin: { | 1307 case XFA_Element::Margin: { |
| 1312 bNeedFindContainer = true; | 1308 bNeedFindContainer = true; |
| 1313 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); | 1309 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); |
| 1314 XFA_Element eParentType = pParentNode->GetClassID(); | 1310 XFA_Element eParentType = pParentNode->GetElementType(); |
| 1315 if (pParentNode->IsContainerNode()) { | 1311 if (pParentNode->IsContainerNode()) { |
| 1316 pNotify->OnValueChanged(this, eAttribute, this, pParentNode); | 1312 pNotify->OnValueChanged(this, eAttribute, this, pParentNode); |
| 1317 } else if (eParentType == XFA_Element::Caption) { | 1313 } else if (eParentType == XFA_Element::Caption) { |
| 1318 pNotify->OnValueChanged(this, eAttribute, pParentNode, | 1314 pNotify->OnValueChanged(this, eAttribute, pParentNode, |
| 1319 pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); | 1315 pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); |
| 1320 } else { | 1316 } else { |
| 1321 CXFA_Node* pNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); | 1317 CXFA_Node* pNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 1322 if (pNode && pNode->GetClassID() == XFA_Element::Ui) { | 1318 if (pNode && pNode->GetElementType() == XFA_Element::Ui) { |
| 1323 pNotify->OnValueChanged(this, eAttribute, pNode, | 1319 pNotify->OnValueChanged(this, eAttribute, pNode, |
| 1324 pNode->GetNodeItem(XFA_NODEITEM_Parent)); | 1320 pNode->GetNodeItem(XFA_NODEITEM_Parent)); |
| 1325 } | 1321 } |
| 1326 } | 1322 } |
| 1327 } break; | 1323 } break; |
| 1328 case XFA_Element::Comb: { | 1324 case XFA_Element::Comb: { |
| 1329 CXFA_Node* pEditNode = GetNodeItem(XFA_NODEITEM_Parent); | 1325 CXFA_Node* pEditNode = GetNodeItem(XFA_NODEITEM_Parent); |
| 1330 XFA_Element eUIType = pEditNode->GetClassID(); | 1326 XFA_Element eUIType = pEditNode->GetElementType(); |
| 1331 if (pEditNode && (eUIType == XFA_Element::DateTimeEdit || | 1327 if (pEditNode && (eUIType == XFA_Element::DateTimeEdit || |
| 1332 eUIType == XFA_Element::NumericEdit || | 1328 eUIType == XFA_Element::NumericEdit || |
| 1333 eUIType == XFA_Element::TextEdit)) { | 1329 eUIType == XFA_Element::TextEdit)) { |
| 1334 CXFA_Node* pUINode = pEditNode->GetNodeItem(XFA_NODEITEM_Parent); | 1330 CXFA_Node* pUINode = pEditNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 1335 if (pUINode) { | 1331 if (pUINode) { |
| 1336 pNotify->OnValueChanged(this, eAttribute, pUINode, | 1332 pNotify->OnValueChanged(this, eAttribute, pUINode, |
| 1337 pUINode->GetNodeItem(XFA_NODEITEM_Parent)); | 1333 pUINode->GetNodeItem(XFA_NODEITEM_Parent)); |
| 1338 } | 1334 } |
| 1339 } | 1335 } |
| 1340 } break; | 1336 } break; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 case XFA_Element::Sharpxml: | 1376 case XFA_Element::Sharpxml: |
| 1381 case XFA_Element::SharpxHTML: { | 1377 case XFA_Element::SharpxHTML: { |
| 1382 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent); | 1378 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent); |
| 1383 if (!pTextNode) { | 1379 if (!pTextNode) { |
| 1384 return; | 1380 return; |
| 1385 } | 1381 } |
| 1386 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent); | 1382 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 1387 if (!pValueNode) { | 1383 if (!pValueNode) { |
| 1388 return; | 1384 return; |
| 1389 } | 1385 } |
| 1390 XFA_Element eNodeType = pValueNode->GetClassID(); | 1386 XFA_Element eNodeType = pValueNode->GetElementType(); |
| 1391 if (eNodeType == XFA_Element::Value) { | 1387 if (eNodeType == XFA_Element::Value) { |
| 1392 bNeedFindContainer = true; | 1388 bNeedFindContainer = true; |
| 1393 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); | 1389 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 1394 if (pNode && pNode->IsContainerNode()) { | 1390 if (pNode && pNode->IsContainerNode()) { |
| 1395 if (bScriptModify) { | 1391 if (bScriptModify) { |
| 1396 pValueNode = pNode; | 1392 pValueNode = pNode; |
| 1397 } | 1393 } |
| 1398 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); | 1394 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); |
| 1399 } else { | 1395 } else { |
| 1400 pNotify->OnValueChanged(this, eAttribute, pNode, | 1396 pNotify->OnValueChanged(this, eAttribute, pNode, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1425 } | 1421 } |
| 1426 } | 1422 } |
| 1427 } | 1423 } |
| 1428 | 1424 |
| 1429 void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, | 1425 void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, |
| 1430 FX_BOOL bSetting, | 1426 FX_BOOL bSetting, |
| 1431 XFA_ATTRIBUTE eAttribute) { | 1427 XFA_ATTRIBUTE eAttribute) { |
| 1432 if (bSetting) { | 1428 if (bSetting) { |
| 1433 CFX_WideString wsValue = pValue->ToWideString(); | 1429 CFX_WideString wsValue = pValue->ToWideString(); |
| 1434 SetAttribute(eAttribute, wsValue.AsStringC(), true); | 1430 SetAttribute(eAttribute, wsValue.AsStringC(), true); |
| 1435 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_Element::Desc) { | 1431 if (eAttribute == XFA_ATTRIBUTE_Use && |
| 1432 GetElementType() == XFA_Element::Desc) { |
| 1436 CXFA_Node* pTemplateNode = | 1433 CXFA_Node* pTemplateNode = |
| 1437 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); | 1434 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); |
| 1438 CXFA_Node* pProtoRoot = | 1435 CXFA_Node* pProtoRoot = |
| 1439 pTemplateNode->GetFirstChildByClass(XFA_Element::Subform) | 1436 pTemplateNode->GetFirstChildByClass(XFA_Element::Subform) |
| 1440 ->GetFirstChildByClass(XFA_Element::Proto); | 1437 ->GetFirstChildByClass(XFA_Element::Proto); |
| 1441 | 1438 |
| 1442 CFX_WideString wsID; | 1439 CFX_WideString wsID; |
| 1443 CFX_WideString wsSOM; | 1440 CFX_WideString wsSOM; |
| 1444 if (!wsValue.IsEmpty()) { | 1441 if (!wsValue.IsEmpty()) { |
| 1445 if (wsValue[0] == '#') { | 1442 if (wsValue[0] == '#') { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 if (!pWidgetData) { | 1591 if (!pWidgetData) { |
| 1595 pValue->SetInteger(0); | 1592 pValue->SetInteger(0); |
| 1596 return; | 1593 return; |
| 1597 } | 1594 } |
| 1598 pValue->SetInteger(pWidgetData->CountChoiceListItems(TRUE)); | 1595 pValue->SetInteger(pWidgetData->CountChoiceListItems(TRUE)); |
| 1599 } | 1596 } |
| 1600 } | 1597 } |
| 1601 void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, | 1598 void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, |
| 1602 FX_BOOL bSetting, | 1599 FX_BOOL bSetting, |
| 1603 XFA_ATTRIBUTE eAttribute) { | 1600 XFA_ATTRIBUTE eAttribute) { |
| 1604 XFA_Element classID = GetClassID(); | 1601 XFA_Element classID = GetElementType(); |
| 1605 if (classID == XFA_Element::Field) { | 1602 if (classID == XFA_Element::Field) { |
| 1606 Script_Field_DefaultValue(pValue, bSetting, eAttribute); | 1603 Script_Field_DefaultValue(pValue, bSetting, eAttribute); |
| 1607 return; | 1604 return; |
| 1608 } else if (classID == XFA_Element::Draw) { | 1605 } else if (classID == XFA_Element::Draw) { |
| 1609 Script_Draw_DefaultValue(pValue, bSetting, eAttribute); | 1606 Script_Draw_DefaultValue(pValue, bSetting, eAttribute); |
| 1610 return; | 1607 return; |
| 1611 } else if (classID == XFA_Element::Boolean) { | 1608 } else if (classID == XFA_Element::Boolean) { |
| 1612 Script_Boolean_Value(pValue, bSetting, eAttribute); | 1609 Script_Boolean_Value(pValue, bSetting, eAttribute); |
| 1613 return; | 1610 return; |
| 1614 } | 1611 } |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1923 pWidgetData->m_bIsNull = TRUE; | 1920 pWidgetData->m_bIsNull = TRUE; |
| 1924 } else { | 1921 } else { |
| 1925 pWidgetData->m_bPreNull = pWidgetData->m_bIsNull; | 1922 pWidgetData->m_bPreNull = pWidgetData->m_bIsNull; |
| 1926 pWidgetData->m_bIsNull = FALSE; | 1923 pWidgetData->m_bIsNull = FALSE; |
| 1927 } | 1924 } |
| 1928 CFX_WideString wsNewText; | 1925 CFX_WideString wsNewText; |
| 1929 if (!(pValue && (pValue->IsNull() || pValue->IsUndefined()))) | 1926 if (!(pValue && (pValue->IsNull() || pValue->IsUndefined()))) |
| 1930 wsNewText = pValue->ToWideString(); | 1927 wsNewText = pValue->ToWideString(); |
| 1931 | 1928 |
| 1932 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); | 1929 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); |
| 1933 if (pUIChild->GetClassID() == XFA_Element::NumericEdit) { | 1930 if (pUIChild->GetElementType() == XFA_Element::NumericEdit) { |
| 1934 int32_t iLeadDigits = 0; | 1931 int32_t iLeadDigits = 0; |
| 1935 int32_t iFracDigits = 0; | 1932 int32_t iFracDigits = 0; |
| 1936 pWidgetData->GetLeadDigits(iLeadDigits); | 1933 pWidgetData->GetLeadDigits(iLeadDigits); |
| 1937 pWidgetData->GetFracDigits(iFracDigits); | 1934 pWidgetData->GetFracDigits(iFracDigits); |
| 1938 wsNewText = | 1935 wsNewText = |
| 1939 pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits); | 1936 pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits); |
| 1940 } | 1937 } |
| 1941 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); | 1938 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); |
| 1942 CFX_WideString wsFormatText(wsNewText); | 1939 CFX_WideString wsFormatText(wsNewText); |
| 1943 if (pContainerWidgetData) { | 1940 if (pContainerWidgetData) { |
| 1944 pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText); | 1941 pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText); |
| 1945 } | 1942 } |
| 1946 SetScriptContent(wsNewText, wsFormatText, true, TRUE); | 1943 SetScriptContent(wsNewText, wsFormatText, true, TRUE); |
| 1947 } else { | 1944 } else { |
| 1948 CFX_WideString content = GetScriptContent(TRUE); | 1945 CFX_WideString content = GetScriptContent(TRUE); |
| 1949 if (content.IsEmpty()) { | 1946 if (content.IsEmpty()) { |
| 1950 pValue->SetNull(); | 1947 pValue->SetNull(); |
| 1951 } else { | 1948 } else { |
| 1952 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); | 1949 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); |
| 1953 XFA_Element eUI = pUIChild->GetClassID(); | 1950 XFA_Element eUI = pUIChild->GetElementType(); |
| 1954 CXFA_Value defVal = pWidgetData->GetFormValue(); | 1951 CXFA_Value defVal = pWidgetData->GetFormValue(); |
| 1955 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); | 1952 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1956 if (pNode && pNode->GetClassID() == XFA_Element::Decimal) { | 1953 if (pNode && pNode->GetElementType() == XFA_Element::Decimal) { |
| 1957 if (eUI == XFA_Element::NumericEdit && | 1954 if (eUI == XFA_Element::NumericEdit && |
| 1958 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { | 1955 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { |
| 1959 pValue->SetString( | 1956 pValue->SetString( |
| 1960 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); | 1957 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); |
| 1961 } else { | 1958 } else { |
| 1962 CFX_Decimal decimal(content.AsStringC()); | 1959 CFX_Decimal decimal(content.AsStringC()); |
| 1963 pValue->SetFloat((FX_FLOAT)(double)decimal); | 1960 pValue->SetFloat((FX_FLOAT)(double)decimal); |
| 1964 } | 1961 } |
| 1965 } else if (pNode && pNode->GetClassID() == XFA_Element::Integer) { | 1962 } else if (pNode && pNode->GetElementType() == XFA_Element::Integer) { |
| 1966 pValue->SetInteger(FXSYS_wtoi(content.c_str())); | 1963 pValue->SetInteger(FXSYS_wtoi(content.c_str())); |
| 1967 } else if (pNode && pNode->GetClassID() == XFA_Element::Boolean) { | 1964 } else if (pNode && pNode->GetElementType() == XFA_Element::Boolean) { |
| 1968 pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? FALSE : TRUE); | 1965 pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? FALSE : TRUE); |
| 1969 } else if (pNode && pNode->GetClassID() == XFA_Element::Float) { | 1966 } else if (pNode && pNode->GetElementType() == XFA_Element::Float) { |
| 1970 CFX_Decimal decimal(content.AsStringC()); | 1967 CFX_Decimal decimal(content.AsStringC()); |
| 1971 pValue->SetFloat((FX_FLOAT)(double)decimal); | 1968 pValue->SetFloat((FX_FLOAT)(double)decimal); |
| 1972 } else { | 1969 } else { |
| 1973 pValue->SetString( | 1970 pValue->SetString( |
| 1974 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); | 1971 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); |
| 1975 } | 1972 } |
| 1976 } | 1973 } |
| 1977 } | 1974 } |
| 1978 } | 1975 } |
| 1979 void CXFA_Node::Script_Field_EditValue(CFXJSE_Value* pValue, | 1976 void CXFA_Node::Script_Field_EditValue(CFXJSE_Value* pValue, |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2409 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate"); | 2406 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate"); |
| 2410 } | 2407 } |
| 2411 } | 2408 } |
| 2412 static CXFA_Node* XFA_ScriptInstanceManager_GetItem(CXFA_Node* pInstMgrNode, | 2409 static CXFA_Node* XFA_ScriptInstanceManager_GetItem(CXFA_Node* pInstMgrNode, |
| 2413 int32_t iIndex) { | 2410 int32_t iIndex) { |
| 2414 ASSERT(pInstMgrNode); | 2411 ASSERT(pInstMgrNode); |
| 2415 int32_t iCount = 0; | 2412 int32_t iCount = 0; |
| 2416 uint32_t dwNameHash = 0; | 2413 uint32_t dwNameHash = 0; |
| 2417 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 2414 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 2418 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 2415 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 2419 XFA_Element eCurType = pNode->GetClassID(); | 2416 XFA_Element eCurType = pNode->GetElementType(); |
| 2420 if (eCurType == XFA_Element::InstanceManager) { | 2417 if (eCurType == XFA_Element::InstanceManager) { |
| 2421 break; | 2418 break; |
| 2422 } | 2419 } |
| 2423 if ((eCurType != XFA_Element::Subform) && | 2420 if ((eCurType != XFA_Element::Subform) && |
| 2424 (eCurType != XFA_Element::SubformSet)) { | 2421 (eCurType != XFA_Element::SubformSet)) { |
| 2425 continue; | 2422 continue; |
| 2426 } | 2423 } |
| 2427 if (iCount == 0) { | 2424 if (iCount == 0) { |
| 2428 CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name); | 2425 CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name); |
| 2429 CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name); | 2426 CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2445 } | 2442 } |
| 2446 void CXFA_Node::Script_Som_InstanceIndex(CFXJSE_Value* pValue, | 2443 void CXFA_Node::Script_Som_InstanceIndex(CFXJSE_Value* pValue, |
| 2447 FX_BOOL bSetting, | 2444 FX_BOOL bSetting, |
| 2448 XFA_ATTRIBUTE eAttribute) { | 2445 XFA_ATTRIBUTE eAttribute) { |
| 2449 if (bSetting) { | 2446 if (bSetting) { |
| 2450 int32_t iTo = pValue->ToInteger(); | 2447 int32_t iTo = pValue->ToInteger(); |
| 2451 int32_t iFrom = Subform_and_SubformSet_InstanceIndex(); | 2448 int32_t iFrom = Subform_and_SubformSet_InstanceIndex(); |
| 2452 CXFA_Node* pManagerNode = nullptr; | 2449 CXFA_Node* pManagerNode = nullptr; |
| 2453 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; | 2450 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; |
| 2454 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { | 2451 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { |
| 2455 if (pNode->GetClassID() == XFA_Element::InstanceManager) { | 2452 if (pNode->GetElementType() == XFA_Element::InstanceManager) { |
| 2456 pManagerNode = pNode; | 2453 pManagerNode = pNode; |
| 2457 break; | 2454 break; |
| 2458 } | 2455 } |
| 2459 } | 2456 } |
| 2460 if (pManagerNode) { | 2457 if (pManagerNode) { |
| 2461 pManagerNode->InstanceManager_MoveInstance(iTo, iFrom); | 2458 pManagerNode->InstanceManager_MoveInstance(iTo, iFrom); |
| 2462 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 2459 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 2463 if (!pNotify) { | 2460 if (!pNotify) { |
| 2464 return; | 2461 return; |
| 2465 } | 2462 } |
| 2466 CXFA_Node* pToInstance = | 2463 CXFA_Node* pToInstance = |
| 2467 XFA_ScriptInstanceManager_GetItem(pManagerNode, iTo); | 2464 XFA_ScriptInstanceManager_GetItem(pManagerNode, iTo); |
| 2468 if (pToInstance && pToInstance->GetClassID() == XFA_Element::Subform) { | 2465 if (pToInstance && |
| 2466 pToInstance->GetElementType() == XFA_Element::Subform) { |
| 2469 pNotify->RunSubformIndexChange(pToInstance); | 2467 pNotify->RunSubformIndexChange(pToInstance); |
| 2470 } | 2468 } |
| 2471 CXFA_Node* pFromInstance = | 2469 CXFA_Node* pFromInstance = |
| 2472 XFA_ScriptInstanceManager_GetItem(pManagerNode, iFrom); | 2470 XFA_ScriptInstanceManager_GetItem(pManagerNode, iFrom); |
| 2473 if (pFromInstance && | 2471 if (pFromInstance && |
| 2474 pFromInstance->GetClassID() == XFA_Element::Subform) { | 2472 pFromInstance->GetElementType() == XFA_Element::Subform) { |
| 2475 pNotify->RunSubformIndexChange(pFromInstance); | 2473 pNotify->RunSubformIndexChange(pFromInstance); |
| 2476 } | 2474 } |
| 2477 } | 2475 } |
| 2478 } else { | 2476 } else { |
| 2479 pValue->SetInteger(Subform_and_SubformSet_InstanceIndex()); | 2477 pValue->SetInteger(Subform_and_SubformSet_InstanceIndex()); |
| 2480 } | 2478 } |
| 2481 } | 2479 } |
| 2482 void CXFA_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue, | 2480 void CXFA_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue, |
| 2483 FX_BOOL bSetting, | 2481 FX_BOOL bSetting, |
| 2484 XFA_ATTRIBUTE eAttribute) { | 2482 XFA_ATTRIBUTE eAttribute) { |
| 2485 if (!bSetting) { | 2483 if (!bSetting) { |
| 2486 CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); | 2484 CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); |
| 2487 CXFA_Node* pInstanceMgr = nullptr; | 2485 CXFA_Node* pInstanceMgr = nullptr; |
| 2488 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; | 2486 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; |
| 2489 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { | 2487 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { |
| 2490 if (pNode->GetClassID() == XFA_Element::InstanceManager) { | 2488 if (pNode->GetElementType() == XFA_Element::InstanceManager) { |
| 2491 CFX_WideStringC wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name); | 2489 CFX_WideStringC wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name); |
| 2492 if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName.GetAt(0) == '_' && | 2490 if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName.GetAt(0) == '_' && |
| 2493 wsInstMgrName.Mid(1) == wsName) { | 2491 wsInstMgrName.Mid(1) == wsName) { |
| 2494 pInstanceMgr = pNode; | 2492 pInstanceMgr = pNode; |
| 2495 } | 2493 } |
| 2496 break; | 2494 break; |
| 2497 } | 2495 } |
| 2498 } | 2496 } |
| 2499 if (pInstanceMgr) { | 2497 if (pInstanceMgr) { |
| 2500 pValue->Assign( | 2498 pValue->Assign( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 int32_t argc = pArguments->GetLength(); | 2571 int32_t argc = pArguments->GetLength(); |
| 2574 if (argc == 0) { | 2572 if (argc == 0) { |
| 2575 } else { | 2573 } else { |
| 2576 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getInvalidObjects"); | 2574 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getInvalidObjects"); |
| 2577 } | 2575 } |
| 2578 } | 2576 } |
| 2579 int32_t CXFA_Node::Subform_and_SubformSet_InstanceIndex() { | 2577 int32_t CXFA_Node::Subform_and_SubformSet_InstanceIndex() { |
| 2580 int32_t index = 0; | 2578 int32_t index = 0; |
| 2581 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; | 2579 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; |
| 2582 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { | 2580 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { |
| 2583 if ((pNode->GetClassID() == XFA_Element::Subform) || | 2581 if ((pNode->GetElementType() == XFA_Element::Subform) || |
| 2584 (pNode->GetClassID() == XFA_Element::SubformSet)) { | 2582 (pNode->GetElementType() == XFA_Element::SubformSet)) { |
| 2585 index++; | 2583 index++; |
| 2586 } else { | 2584 } else { |
| 2587 break; | 2585 break; |
| 2588 } | 2586 } |
| 2589 } | 2587 } |
| 2590 return index; | 2588 return index; |
| 2591 } | 2589 } |
| 2592 void CXFA_Node::Script_Template_FormNodes(CFXJSE_Arguments* pArguments) { | 2590 void CXFA_Node::Script_Template_FormNodes(CFXJSE_Arguments* pArguments) { |
| 2593 int32_t argc = pArguments->GetLength(); | 2591 int32_t argc = pArguments->GetLength(); |
| 2594 if (argc == 1) { | 2592 if (argc == 1) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2727 } | 2725 } |
| 2728 CXFA_Occur nodeOccur(GetOccurNode()); | 2726 CXFA_Occur nodeOccur(GetOccurNode()); |
| 2729 pValue->SetInteger(nodeOccur.GetMin()); | 2727 pValue->SetInteger(nodeOccur.GetMin()); |
| 2730 } | 2728 } |
| 2731 static int32_t XFA_ScriptInstanceManager_GetCount(CXFA_Node* pInstMgrNode) { | 2729 static int32_t XFA_ScriptInstanceManager_GetCount(CXFA_Node* pInstMgrNode) { |
| 2732 ASSERT(pInstMgrNode); | 2730 ASSERT(pInstMgrNode); |
| 2733 int32_t iCount = 0; | 2731 int32_t iCount = 0; |
| 2734 uint32_t dwNameHash = 0; | 2732 uint32_t dwNameHash = 0; |
| 2735 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 2733 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 2736 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 2734 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 2737 XFA_Element eCurType = pNode->GetClassID(); | 2735 XFA_Element eCurType = pNode->GetElementType(); |
| 2738 if (eCurType == XFA_Element::InstanceManager) { | 2736 if (eCurType == XFA_Element::InstanceManager) { |
| 2739 break; | 2737 break; |
| 2740 } | 2738 } |
| 2741 if ((eCurType != XFA_Element::Subform) && | 2739 if ((eCurType != XFA_Element::Subform) && |
| 2742 (eCurType != XFA_Element::SubformSet)) { | 2740 (eCurType != XFA_Element::SubformSet)) { |
| 2743 continue; | 2741 continue; |
| 2744 } | 2742 } |
| 2745 if (iCount == 0) { | 2743 if (iCount == 0) { |
| 2746 CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name); | 2744 CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name); |
| 2747 CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name); | 2745 CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3018 return; | 3016 return; |
| 3019 } | 3017 } |
| 3020 int32_t iFrom = pArguments->GetInt32(0); | 3018 int32_t iFrom = pArguments->GetInt32(0); |
| 3021 int32_t iTo = pArguments->GetInt32(1); | 3019 int32_t iTo = pArguments->GetInt32(1); |
| 3022 InstanceManager_MoveInstance(iTo, iFrom); | 3020 InstanceManager_MoveInstance(iTo, iFrom); |
| 3023 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 3021 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 3024 if (!pNotify) { | 3022 if (!pNotify) { |
| 3025 return; | 3023 return; |
| 3026 } | 3024 } |
| 3027 CXFA_Node* pToInstance = XFA_ScriptInstanceManager_GetItem(this, iTo); | 3025 CXFA_Node* pToInstance = XFA_ScriptInstanceManager_GetItem(this, iTo); |
| 3028 if (pToInstance && pToInstance->GetClassID() == XFA_Element::Subform) { | 3026 if (pToInstance && pToInstance->GetElementType() == XFA_Element::Subform) { |
| 3029 pNotify->RunSubformIndexChange(pToInstance); | 3027 pNotify->RunSubformIndexChange(pToInstance); |
| 3030 } | 3028 } |
| 3031 CXFA_Node* pFromInstance = XFA_ScriptInstanceManager_GetItem(this, iFrom); | 3029 CXFA_Node* pFromInstance = XFA_ScriptInstanceManager_GetItem(this, iFrom); |
| 3032 if (pFromInstance && pFromInstance->GetClassID() == XFA_Element::Subform) { | 3030 if (pFromInstance && |
| 3031 pFromInstance->GetElementType() == XFA_Element::Subform) { |
| 3033 pNotify->RunSubformIndexChange(pFromInstance); | 3032 pNotify->RunSubformIndexChange(pFromInstance); |
| 3034 } | 3033 } |
| 3035 } | 3034 } |
| 3036 void CXFA_Node::Script_InstanceManager_RemoveInstance( | 3035 void CXFA_Node::Script_InstanceManager_RemoveInstance( |
| 3037 CFXJSE_Arguments* pArguments) { | 3036 CFXJSE_Arguments* pArguments) { |
| 3038 int32_t argc = pArguments->GetLength(); | 3037 int32_t argc = pArguments->GetLength(); |
| 3039 if (argc != 1) { | 3038 if (argc != 1) { |
| 3040 pArguments->GetReturnValue()->SetUndefined(); | 3039 pArguments->GetReturnValue()->SetUndefined(); |
| 3041 return; | 3040 return; |
| 3042 } | 3041 } |
| 3043 int32_t iIndex = pArguments->GetInt32(0); | 3042 int32_t iIndex = pArguments->GetInt32(0); |
| 3044 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); | 3043 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); |
| 3045 if (iIndex < 0 || iIndex >= iCount) { | 3044 if (iIndex < 0 || iIndex >= iCount) { |
| 3046 ThrowException(XFA_IDS_INDEX_OUT_OF_BOUNDS); | 3045 ThrowException(XFA_IDS_INDEX_OUT_OF_BOUNDS); |
| 3047 return; | 3046 return; |
| 3048 } | 3047 } |
| 3049 CXFA_Occur nodeOccur(GetOccurNode()); | 3048 CXFA_Occur nodeOccur(GetOccurNode()); |
| 3050 int32_t iMin = nodeOccur.GetMin(); | 3049 int32_t iMin = nodeOccur.GetMin(); |
| 3051 if (iCount - 1 < iMin) { | 3050 if (iCount - 1 < iMin) { |
| 3052 ThrowException(XFA_IDS_VIOLATE_BOUNDARY, L"min"); | 3051 ThrowException(XFA_IDS_VIOLATE_BOUNDARY, L"min"); |
| 3053 return; | 3052 return; |
| 3054 } | 3053 } |
| 3055 CXFA_Node* pRemoveInstance = XFA_ScriptInstanceManager_GetItem(this, iIndex); | 3054 CXFA_Node* pRemoveInstance = XFA_ScriptInstanceManager_GetItem(this, iIndex); |
| 3056 XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance); | 3055 XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance); |
| 3057 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 3056 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 3058 if (pNotify) { | 3057 if (pNotify) { |
| 3059 for (int32_t i = iIndex; i < iCount - 1; i++) { | 3058 for (int32_t i = iIndex; i < iCount - 1; i++) { |
| 3060 CXFA_Node* pSubformInstance = XFA_ScriptInstanceManager_GetItem(this, i); | 3059 CXFA_Node* pSubformInstance = XFA_ScriptInstanceManager_GetItem(this, i); |
| 3061 if (pSubformInstance && | 3060 if (pSubformInstance && |
| 3062 pSubformInstance->GetClassID() == XFA_Element::Subform) { | 3061 pSubformInstance->GetElementType() == XFA_Element::Subform) { |
| 3063 pNotify->RunSubformIndexChange(pSubformInstance); | 3062 pNotify->RunSubformIndexChange(pSubformInstance); |
| 3064 } | 3063 } |
| 3065 } | 3064 } |
| 3066 } | 3065 } |
| 3067 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); | 3066 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); |
| 3068 if (!pLayoutPro) { | 3067 if (!pLayoutPro) { |
| 3069 return; | 3068 return; |
| 3070 } | 3069 } |
| 3071 pLayoutPro->AddChangedContainer( | 3070 pLayoutPro->AddChangedContainer( |
| 3072 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); | 3071 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3180 CFX_WideString(wsInstManagerName.IsEmpty() ? wsInstManagerName | 3179 CFX_WideString(wsInstManagerName.IsEmpty() ? wsInstManagerName |
| 3181 : wsInstManagerName.Mid(1)); | 3180 : wsInstManagerName.Mid(1)); |
| 3182 uint32_t dInstanceNameHash = | 3181 uint32_t dInstanceNameHash = |
| 3183 FX_HashCode_GetW(wsInstanceName.AsStringC(), false); | 3182 FX_HashCode_GetW(wsInstanceName.AsStringC(), false); |
| 3184 CXFA_Node* pPrevSibling = | 3183 CXFA_Node* pPrevSibling = |
| 3185 (iDesired == 0) ? this | 3184 (iDesired == 0) ? this |
| 3186 : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1); | 3185 : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1); |
| 3187 while (iCount > iDesired) { | 3186 while (iCount > iDesired) { |
| 3188 CXFA_Node* pRemoveInstance = | 3187 CXFA_Node* pRemoveInstance = |
| 3189 pPrevSibling->GetNodeItem(XFA_NODEITEM_NextSibling); | 3188 pPrevSibling->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 3190 if (pRemoveInstance->GetClassID() != XFA_Element::Subform && | 3189 if (pRemoveInstance->GetElementType() != XFA_Element::Subform && |
| 3191 pRemoveInstance->GetClassID() != XFA_Element::SubformSet) { | 3190 pRemoveInstance->GetElementType() != XFA_Element::SubformSet) { |
| 3192 continue; | 3191 continue; |
| 3193 } | 3192 } |
| 3194 if (pRemoveInstance->GetClassID() == XFA_Element::InstanceManager) { | 3193 if (pRemoveInstance->GetElementType() == XFA_Element::InstanceManager) { |
| 3195 ASSERT(FALSE); | 3194 ASSERT(FALSE); |
| 3196 break; | 3195 break; |
| 3197 } | 3196 } |
| 3198 if (pRemoveInstance->GetNameHash() == dInstanceNameHash) { | 3197 if (pRemoveInstance->GetNameHash() == dInstanceNameHash) { |
| 3199 XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance); | 3198 XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance); |
| 3200 iCount--; | 3199 iCount--; |
| 3201 } | 3200 } |
| 3202 } | 3201 } |
| 3203 } else if (iDesired > iCount) { | 3202 } else if (iDesired > iCount) { |
| 3204 while (iCount < iDesired) { | 3203 while (iCount < iDesired) { |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3600 }; | 3599 }; |
| 3601 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { | 3600 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { |
| 3602 uint32_t dwKey = FX_HashCode_GetW(wsKey, false); | 3601 uint32_t dwKey = FX_HashCode_GetW(wsKey, false); |
| 3603 return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom); | 3602 return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom); |
| 3604 } | 3603 } |
| 3605 void* XFA_GetMapKey_Element(XFA_Element eElement, XFA_ATTRIBUTE eAttribute) { | 3604 void* XFA_GetMapKey_Element(XFA_Element eElement, XFA_ATTRIBUTE eAttribute) { |
| 3606 return (void*)(uintptr_t)((static_cast<int32_t>(eElement) << 16) | | 3605 return (void*)(uintptr_t)((static_cast<int32_t>(eElement) << 16) | |
| 3607 (eAttribute << 8) | XFA_KEYTYPE_Element); | 3606 (eAttribute << 8) | XFA_KEYTYPE_Element); |
| 3608 } | 3607 } |
| 3609 FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) { | 3608 FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) { |
| 3610 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 3609 void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); |
| 3611 return HasMapModuleKey(pKey, bCanInherit); | 3610 return HasMapModuleKey(pKey, bCanInherit); |
| 3612 } | 3611 } |
| 3613 FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, | 3612 FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, |
| 3614 const CFX_WideStringC& wsValue, | 3613 const CFX_WideStringC& wsValue, |
| 3615 bool bNotify) { | 3614 bool bNotify) { |
| 3616 const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); | 3615 const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); |
| 3617 if (!pAttr) | 3616 if (!pAttr) |
| 3618 return FALSE; | 3617 return FALSE; |
| 3619 | 3618 |
| 3620 XFA_ATTRIBUTETYPE eType = pAttr->eType; | 3619 XFA_ATTRIBUTETYPE eType = pAttr->eType; |
| 3621 if (eType == XFA_ATTRIBUTETYPE_NOTSURE) { | 3620 if (eType == XFA_ATTRIBUTETYPE_NOTSURE) { |
| 3622 const XFA_NOTSUREATTRIBUTE* pNotsure = | 3621 const XFA_NOTSUREATTRIBUTE* pNotsure = |
| 3623 XFA_GetNotsureAttribute(GetClassID(), pAttr->eName); | 3622 XFA_GetNotsureAttribute(GetElementType(), pAttr->eName); |
| 3624 eType = pNotsure ? pNotsure->eType : XFA_ATTRIBUTETYPE_Cdata; | 3623 eType = pNotsure ? pNotsure->eType : XFA_ATTRIBUTETYPE_Cdata; |
| 3625 } | 3624 } |
| 3626 switch (eType) { | 3625 switch (eType) { |
| 3627 case XFA_ATTRIBUTETYPE_Enum: { | 3626 case XFA_ATTRIBUTETYPE_Enum: { |
| 3628 const XFA_ATTRIBUTEENUMINFO* pEnum = XFA_GetAttributeEnumByName(wsValue); | 3627 const XFA_ATTRIBUTEENUMINFO* pEnum = XFA_GetAttributeEnumByName(wsValue); |
| 3629 return SetEnum(pAttr->eName, | 3628 return SetEnum(pAttr->eName, |
| 3630 pEnum ? pEnum->eName | 3629 pEnum ? pEnum->eName |
| 3631 : (XFA_ATTRIBUTEENUM)(intptr_t)(pAttr->pDefValue), | 3630 : (XFA_ATTRIBUTEENUM)(intptr_t)(pAttr->pDefValue), |
| 3632 bNotify); | 3631 bNotify); |
| 3633 } break; | 3632 } break; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3650 FX_BOOL CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr, | 3649 FX_BOOL CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr, |
| 3651 CFX_WideString& wsValue, | 3650 CFX_WideString& wsValue, |
| 3652 FX_BOOL bUseDefault) { | 3651 FX_BOOL bUseDefault) { |
| 3653 const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); | 3652 const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); |
| 3654 if (!pAttr) { | 3653 if (!pAttr) { |
| 3655 return FALSE; | 3654 return FALSE; |
| 3656 } | 3655 } |
| 3657 XFA_ATTRIBUTETYPE eType = pAttr->eType; | 3656 XFA_ATTRIBUTETYPE eType = pAttr->eType; |
| 3658 if (eType == XFA_ATTRIBUTETYPE_NOTSURE) { | 3657 if (eType == XFA_ATTRIBUTETYPE_NOTSURE) { |
| 3659 const XFA_NOTSUREATTRIBUTE* pNotsure = | 3658 const XFA_NOTSUREATTRIBUTE* pNotsure = |
| 3660 XFA_GetNotsureAttribute(GetClassID(), pAttr->eName); | 3659 XFA_GetNotsureAttribute(GetElementType(), pAttr->eName); |
| 3661 eType = pNotsure ? pNotsure->eType : XFA_ATTRIBUTETYPE_Cdata; | 3660 eType = pNotsure ? pNotsure->eType : XFA_ATTRIBUTETYPE_Cdata; |
| 3662 } | 3661 } |
| 3663 switch (eType) { | 3662 switch (eType) { |
| 3664 case XFA_ATTRIBUTETYPE_Enum: { | 3663 case XFA_ATTRIBUTETYPE_Enum: { |
| 3665 XFA_ATTRIBUTEENUM eValue; | 3664 XFA_ATTRIBUTEENUM eValue; |
| 3666 if (!TryEnum(pAttr->eName, eValue, bUseDefault)) { | 3665 if (!TryEnum(pAttr->eName, eValue, bUseDefault)) { |
| 3667 return FALSE; | 3666 return FALSE; |
| 3668 } | 3667 } |
| 3669 wsValue = XFA_GetAttributeEnumByID(eValue)->pName; | 3668 wsValue = XFA_GetAttributeEnumByID(eValue)->pName; |
| 3670 return TRUE; | 3669 return TRUE; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3760 void* pValue = nullptr; | 3759 void* pValue = nullptr; |
| 3761 if (!GetValue(eAttr, XFA_ATTRIBUTETYPE_Enum, bUseDefault, pValue)) | 3760 if (!GetValue(eAttr, XFA_ATTRIBUTETYPE_Enum, bUseDefault, pValue)) |
| 3762 return FALSE; | 3761 return FALSE; |
| 3763 eValue = (XFA_ATTRIBUTEENUM)(uintptr_t)pValue; | 3762 eValue = (XFA_ATTRIBUTEENUM)(uintptr_t)pValue; |
| 3764 return TRUE; | 3763 return TRUE; |
| 3765 } | 3764 } |
| 3766 | 3765 |
| 3767 FX_BOOL CXFA_Node::SetMeasure(XFA_ATTRIBUTE eAttr, | 3766 FX_BOOL CXFA_Node::SetMeasure(XFA_ATTRIBUTE eAttr, |
| 3768 CXFA_Measurement mValue, | 3767 CXFA_Measurement mValue, |
| 3769 bool bNotify) { | 3768 bool bNotify) { |
| 3770 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 3769 void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); |
| 3771 OnChanging(eAttr, bNotify); | 3770 OnChanging(eAttr, bNotify); |
| 3772 SetMapModuleBuffer(pKey, &mValue, sizeof(CXFA_Measurement)); | 3771 SetMapModuleBuffer(pKey, &mValue, sizeof(CXFA_Measurement)); |
| 3773 OnChanged(eAttr, bNotify, FALSE); | 3772 OnChanged(eAttr, bNotify, FALSE); |
| 3774 return TRUE; | 3773 return TRUE; |
| 3775 } | 3774 } |
| 3776 | 3775 |
| 3777 FX_BOOL CXFA_Node::TryMeasure(XFA_ATTRIBUTE eAttr, | 3776 FX_BOOL CXFA_Node::TryMeasure(XFA_ATTRIBUTE eAttr, |
| 3778 CXFA_Measurement& mValue, | 3777 CXFA_Measurement& mValue, |
| 3779 FX_BOOL bUseDefault) const { | 3778 FX_BOOL bUseDefault) const { |
| 3780 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 3779 void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); |
| 3781 void* pValue; | 3780 void* pValue; |
| 3782 int32_t iBytes; | 3781 int32_t iBytes; |
| 3783 if (GetMapModuleBuffer(pKey, pValue, iBytes) && iBytes == sizeof(mValue)) { | 3782 if (GetMapModuleBuffer(pKey, pValue, iBytes) && iBytes == sizeof(mValue)) { |
| 3784 FXSYS_memcpy(&mValue, pValue, sizeof(mValue)); | 3783 FXSYS_memcpy(&mValue, pValue, sizeof(mValue)); |
| 3785 return TRUE; | 3784 return TRUE; |
| 3786 } | 3785 } |
| 3787 if (bUseDefault && | 3786 if (bUseDefault && |
| 3788 XFA_GetAttributeDefaultValue(pValue, GetClassID(), eAttr, | 3787 XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr, |
| 3789 XFA_ATTRIBUTETYPE_Measure, m_ePacket)) { | 3788 XFA_ATTRIBUTETYPE_Measure, m_ePacket)) { |
| 3790 FXSYS_memcpy(&mValue, pValue, sizeof(mValue)); | 3789 FXSYS_memcpy(&mValue, pValue, sizeof(mValue)); |
| 3791 return TRUE; | 3790 return TRUE; |
| 3792 } | 3791 } |
| 3793 return FALSE; | 3792 return FALSE; |
| 3794 } | 3793 } |
| 3795 | 3794 |
| 3796 CXFA_Measurement CXFA_Node::GetMeasure(XFA_ATTRIBUTE eAttr) const { | 3795 CXFA_Measurement CXFA_Node::GetMeasure(XFA_ATTRIBUTE eAttr) const { |
| 3797 CXFA_Measurement mValue; | 3796 CXFA_Measurement mValue; |
| 3798 return TryMeasure(eAttr, mValue, TRUE) ? mValue : CXFA_Measurement(); | 3797 return TryMeasure(eAttr, mValue, TRUE) ? mValue : CXFA_Measurement(); |
| 3799 } | 3798 } |
| 3800 | 3799 |
| 3801 FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, | 3800 FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, |
| 3802 const CFX_WideString& wsValue, | 3801 const CFX_WideString& wsValue, |
| 3803 bool bNotify, | 3802 bool bNotify, |
| 3804 FX_BOOL bScriptModify) { | 3803 FX_BOOL bScriptModify) { |
| 3805 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 3804 void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); |
| 3806 OnChanging(eAttr, bNotify); | 3805 OnChanging(eAttr, bNotify); |
| 3807 if (eAttr == XFA_ATTRIBUTE_Value) { | 3806 if (eAttr == XFA_ATTRIBUTE_Value) { |
| 3808 CFX_WideString* pClone = new CFX_WideString(wsValue); | 3807 CFX_WideString* pClone = new CFX_WideString(wsValue); |
| 3809 SetUserData(pKey, pClone, &deleteWideStringCallBack); | 3808 SetUserData(pKey, pClone, &deleteWideStringCallBack); |
| 3810 } else { | 3809 } else { |
| 3811 SetMapModuleString(pKey, wsValue.AsStringC()); | 3810 SetMapModuleString(pKey, wsValue.AsStringC()); |
| 3812 if (eAttr == XFA_ATTRIBUTE_Name) | 3811 if (eAttr == XFA_ATTRIBUTE_Name) |
| 3813 UpdateNameHash(); | 3812 UpdateNameHash(); |
| 3814 } | 3813 } |
| 3815 OnChanged(eAttr, bNotify, bScriptModify); | 3814 OnChanged(eAttr, bNotify, bScriptModify); |
| 3816 | 3815 |
| 3817 if (!IsNeedSavingXMLNode() || eAttr == XFA_ATTRIBUTE_QualifiedName || | 3816 if (!IsNeedSavingXMLNode() || eAttr == XFA_ATTRIBUTE_QualifiedName || |
| 3818 eAttr == XFA_ATTRIBUTE_BindingNode) { | 3817 eAttr == XFA_ATTRIBUTE_BindingNode) { |
| 3819 return TRUE; | 3818 return TRUE; |
| 3820 } | 3819 } |
| 3821 | 3820 |
| 3822 if (eAttr == XFA_ATTRIBUTE_Name && (m_eNodeClass == XFA_Element::DataValue || | 3821 if (eAttr == XFA_ATTRIBUTE_Name && |
| 3823 m_eNodeClass == XFA_Element::DataGroup)) { | 3822 (m_elementType == XFA_Element::DataValue || |
| 3823 m_elementType == XFA_Element::DataGroup)) { |
| 3824 return TRUE; | 3824 return TRUE; |
| 3825 } | 3825 } |
| 3826 | 3826 |
| 3827 if (eAttr == XFA_ATTRIBUTE_Value) { | 3827 if (eAttr == XFA_ATTRIBUTE_Value) { |
| 3828 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); | 3828 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); |
| 3829 switch (eXMLType) { | 3829 switch (eXMLType) { |
| 3830 case FDE_XMLNODE_Element: | 3830 case FDE_XMLNODE_Element: |
| 3831 if (IsAttributeInXML()) { | 3831 if (IsAttributeInXML()) { |
| 3832 static_cast<CFDE_XMLElement*>(m_pXMLNode) | 3832 static_cast<CFDE_XMLElement*>(m_pXMLNode) |
| 3833 ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), | 3833 ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3870 } | 3870 } |
| 3871 static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue); | 3871 static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue); |
| 3872 } | 3872 } |
| 3873 return TRUE; | 3873 return TRUE; |
| 3874 } | 3874 } |
| 3875 | 3875 |
| 3876 FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, | 3876 FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, |
| 3877 const CFX_WideString& wsXMLValue, | 3877 const CFX_WideString& wsXMLValue, |
| 3878 bool bNotify, | 3878 bool bNotify, |
| 3879 FX_BOOL bScriptModify) { | 3879 FX_BOOL bScriptModify) { |
| 3880 void* pKey = XFA_GetMapKey_Element(GetClassID(), XFA_ATTRIBUTE_Value); | 3880 void* pKey = XFA_GetMapKey_Element(GetElementType(), XFA_ATTRIBUTE_Value); |
| 3881 OnChanging(XFA_ATTRIBUTE_Value, bNotify); | 3881 OnChanging(XFA_ATTRIBUTE_Value, bNotify); |
| 3882 CFX_WideString* pClone = new CFX_WideString(wsValue); | 3882 CFX_WideString* pClone = new CFX_WideString(wsValue); |
| 3883 SetUserData(pKey, pClone, &deleteWideStringCallBack); | 3883 SetUserData(pKey, pClone, &deleteWideStringCallBack); |
| 3884 OnChanged(XFA_ATTRIBUTE_Value, bNotify, bScriptModify); | 3884 OnChanged(XFA_ATTRIBUTE_Value, bNotify, bScriptModify); |
| 3885 if (IsNeedSavingXMLNode()) { | 3885 if (IsNeedSavingXMLNode()) { |
| 3886 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); | 3886 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); |
| 3887 switch (eXMLType) { | 3887 switch (eXMLType) { |
| 3888 case FDE_XMLNODE_Element: | 3888 case FDE_XMLNODE_Element: |
| 3889 if (IsAttributeInXML()) { | 3889 if (IsAttributeInXML()) { |
| 3890 static_cast<CFDE_XMLElement*>(m_pXMLNode) | 3890 static_cast<CFDE_XMLElement*>(m_pXMLNode) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3916 default: | 3916 default: |
| 3917 ASSERT(0); | 3917 ASSERT(0); |
| 3918 } | 3918 } |
| 3919 } | 3919 } |
| 3920 return TRUE; | 3920 return TRUE; |
| 3921 } | 3921 } |
| 3922 FX_BOOL CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, | 3922 FX_BOOL CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, |
| 3923 CFX_WideString& wsValue, | 3923 CFX_WideString& wsValue, |
| 3924 FX_BOOL bUseDefault, | 3924 FX_BOOL bUseDefault, |
| 3925 FX_BOOL bProto) { | 3925 FX_BOOL bProto) { |
| 3926 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 3926 void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); |
| 3927 if (eAttr == XFA_ATTRIBUTE_Value) { | 3927 if (eAttr == XFA_ATTRIBUTE_Value) { |
| 3928 CFX_WideString* pStr = (CFX_WideString*)GetUserData(pKey, bProto); | 3928 CFX_WideString* pStr = (CFX_WideString*)GetUserData(pKey, bProto); |
| 3929 if (pStr) { | 3929 if (pStr) { |
| 3930 wsValue = *pStr; | 3930 wsValue = *pStr; |
| 3931 return TRUE; | 3931 return TRUE; |
| 3932 } | 3932 } |
| 3933 } else { | 3933 } else { |
| 3934 CFX_WideStringC wsValueC; | 3934 CFX_WideStringC wsValueC; |
| 3935 if (GetMapModuleString(pKey, wsValueC)) { | 3935 if (GetMapModuleString(pKey, wsValueC)) { |
| 3936 wsValue = wsValueC; | 3936 wsValue = wsValueC; |
| 3937 return TRUE; | 3937 return TRUE; |
| 3938 } | 3938 } |
| 3939 } | 3939 } |
| 3940 if (!bUseDefault) { | 3940 if (!bUseDefault) { |
| 3941 return FALSE; | 3941 return FALSE; |
| 3942 } | 3942 } |
| 3943 void* pValue = nullptr; | 3943 void* pValue = nullptr; |
| 3944 if (XFA_GetAttributeDefaultValue(pValue, GetClassID(), eAttr, | 3944 if (XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr, |
| 3945 XFA_ATTRIBUTETYPE_Cdata, m_ePacket)) { | 3945 XFA_ATTRIBUTETYPE_Cdata, m_ePacket)) { |
| 3946 wsValue = (const FX_WCHAR*)pValue; | 3946 wsValue = (const FX_WCHAR*)pValue; |
| 3947 return TRUE; | 3947 return TRUE; |
| 3948 } | 3948 } |
| 3949 return FALSE; | 3949 return FALSE; |
| 3950 } | 3950 } |
| 3951 FX_BOOL CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, | 3951 FX_BOOL CXFA_Node::TryCData(XFA_ATTRIBUTE eAttr, |
| 3952 CFX_WideStringC& wsValue, | 3952 CFX_WideStringC& wsValue, |
| 3953 FX_BOOL bUseDefault, | 3953 FX_BOOL bUseDefault, |
| 3954 FX_BOOL bProto) { | 3954 FX_BOOL bProto) { |
| 3955 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 3955 void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); |
| 3956 if (eAttr == XFA_ATTRIBUTE_Value) { | 3956 if (eAttr == XFA_ATTRIBUTE_Value) { |
| 3957 CFX_WideString* pStr = (CFX_WideString*)GetUserData(pKey, bProto); | 3957 CFX_WideString* pStr = (CFX_WideString*)GetUserData(pKey, bProto); |
| 3958 if (pStr) { | 3958 if (pStr) { |
| 3959 wsValue = pStr->AsStringC(); | 3959 wsValue = pStr->AsStringC(); |
| 3960 return TRUE; | 3960 return TRUE; |
| 3961 } | 3961 } |
| 3962 } else { | 3962 } else { |
| 3963 if (GetMapModuleString(pKey, wsValue)) { | 3963 if (GetMapModuleString(pKey, wsValue)) { |
| 3964 return TRUE; | 3964 return TRUE; |
| 3965 } | 3965 } |
| 3966 } | 3966 } |
| 3967 if (!bUseDefault) { | 3967 if (!bUseDefault) { |
| 3968 return FALSE; | 3968 return FALSE; |
| 3969 } | 3969 } |
| 3970 void* pValue = nullptr; | 3970 void* pValue = nullptr; |
| 3971 if (XFA_GetAttributeDefaultValue(pValue, GetClassID(), eAttr, | 3971 if (XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr, |
| 3972 XFA_ATTRIBUTETYPE_Cdata, m_ePacket)) { | 3972 XFA_ATTRIBUTETYPE_Cdata, m_ePacket)) { |
| 3973 wsValue = (CFX_WideStringC)(const FX_WCHAR*)pValue; | 3973 wsValue = (CFX_WideStringC)(const FX_WCHAR*)pValue; |
| 3974 return TRUE; | 3974 return TRUE; |
| 3975 } | 3975 } |
| 3976 return FALSE; | 3976 return FALSE; |
| 3977 } | 3977 } |
| 3978 FX_BOOL CXFA_Node::SetObject(XFA_ATTRIBUTE eAttr, | 3978 FX_BOOL CXFA_Node::SetObject(XFA_ATTRIBUTE eAttr, |
| 3979 void* pData, | 3979 void* pData, |
| 3980 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo) { | 3980 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo) { |
| 3981 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 3981 void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); |
| 3982 return SetUserData(pKey, pData, pCallbackInfo); | 3982 return SetUserData(pKey, pData, pCallbackInfo); |
| 3983 } | 3983 } |
| 3984 FX_BOOL CXFA_Node::TryObject(XFA_ATTRIBUTE eAttr, void*& pData) { | 3984 FX_BOOL CXFA_Node::TryObject(XFA_ATTRIBUTE eAttr, void*& pData) { |
| 3985 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 3985 void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); |
| 3986 pData = GetUserData(pKey); | 3986 pData = GetUserData(pKey); |
| 3987 return pData != nullptr; | 3987 return pData != nullptr; |
| 3988 } | 3988 } |
| 3989 FX_BOOL CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr, | 3989 FX_BOOL CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr, |
| 3990 XFA_ATTRIBUTETYPE eType, | 3990 XFA_ATTRIBUTETYPE eType, |
| 3991 void* pValue, | 3991 void* pValue, |
| 3992 bool bNotify) { | 3992 bool bNotify) { |
| 3993 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 3993 void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); |
| 3994 OnChanging(eAttr, bNotify); | 3994 OnChanging(eAttr, bNotify); |
| 3995 SetMapModuleValue(pKey, pValue); | 3995 SetMapModuleValue(pKey, pValue); |
| 3996 OnChanged(eAttr, bNotify, FALSE); | 3996 OnChanged(eAttr, bNotify, FALSE); |
| 3997 if (IsNeedSavingXMLNode()) { | 3997 if (IsNeedSavingXMLNode()) { |
| 3998 ASSERT(m_pXMLNode->GetType() == FDE_XMLNODE_Element); | 3998 ASSERT(m_pXMLNode->GetType() == FDE_XMLNODE_Element); |
| 3999 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); | 3999 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); |
| 4000 if (pInfo) { | 4000 if (pInfo) { |
| 4001 switch (eType) { | 4001 switch (eType) { |
| 4002 case XFA_ATTRIBUTETYPE_Enum: | 4002 case XFA_ATTRIBUTETYPE_Enum: |
| 4003 static_cast<CFDE_XMLElement*>(m_pXMLNode) | 4003 static_cast<CFDE_XMLElement*>(m_pXMLNode) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 4018 ASSERT(0); | 4018 ASSERT(0); |
| 4019 } | 4019 } |
| 4020 } | 4020 } |
| 4021 } | 4021 } |
| 4022 return TRUE; | 4022 return TRUE; |
| 4023 } | 4023 } |
| 4024 FX_BOOL CXFA_Node::GetValue(XFA_ATTRIBUTE eAttr, | 4024 FX_BOOL CXFA_Node::GetValue(XFA_ATTRIBUTE eAttr, |
| 4025 XFA_ATTRIBUTETYPE eType, | 4025 XFA_ATTRIBUTETYPE eType, |
| 4026 FX_BOOL bUseDefault, | 4026 FX_BOOL bUseDefault, |
| 4027 void*& pValue) { | 4027 void*& pValue) { |
| 4028 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); | 4028 void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); |
| 4029 if (GetMapModuleValue(pKey, pValue)) { | 4029 if (GetMapModuleValue(pKey, pValue)) { |
| 4030 return TRUE; | 4030 return TRUE; |
| 4031 } | 4031 } |
| 4032 if (!bUseDefault) { | 4032 if (!bUseDefault) { |
| 4033 return FALSE; | 4033 return FALSE; |
| 4034 } | 4034 } |
| 4035 return XFA_GetAttributeDefaultValue(pValue, GetClassID(), eAttr, eType, | 4035 return XFA_GetAttributeDefaultValue(pValue, GetElementType(), eAttr, eType, |
| 4036 m_ePacket); | 4036 m_ePacket); |
| 4037 } | 4037 } |
| 4038 static void XFA_DefaultFreeData(void* pData) {} | 4038 static void XFA_DefaultFreeData(void* pData) {} |
| 4039 static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADefaultFreeData = { | 4039 static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADefaultFreeData = { |
| 4040 XFA_DefaultFreeData, nullptr}; | 4040 XFA_DefaultFreeData, nullptr}; |
| 4041 FX_BOOL CXFA_Node::SetUserData(void* pKey, | 4041 FX_BOOL CXFA_Node::SetUserData(void* pKey, |
| 4042 void* pData, | 4042 void* pData, |
| 4043 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo) { | 4043 XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo) { |
| 4044 SetMapModuleBuffer(pKey, &pData, sizeof(void*), | 4044 SetMapModuleBuffer(pKey, &pData, sizeof(void*), |
| 4045 pCallbackInfo ? pCallbackInfo : &gs_XFADefaultFreeData); | 4045 pCallbackInfo ? pCallbackInfo : &gs_XFADefaultFreeData); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4129 CXFA_NodeArray nodeArray; | 4129 CXFA_NodeArray nodeArray; |
| 4130 pBind->GetBindItems(nodeArray); | 4130 pBind->GetBindItems(nodeArray); |
| 4131 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { | 4131 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { |
| 4132 if (nodeArray[i] != this) { | 4132 if (nodeArray[i] != this) { |
| 4133 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, | 4133 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, |
| 4134 bScriptModify, FALSE); | 4134 bScriptModify, FALSE); |
| 4135 } | 4135 } |
| 4136 } | 4136 } |
| 4137 } | 4137 } |
| 4138 break; | 4138 break; |
| 4139 } else if (GetClassID() == XFA_Element::ExclGroup) { | 4139 } else if (GetElementType() == XFA_Element::ExclGroup) { |
| 4140 pNode = this; | 4140 pNode = this; |
| 4141 } else { | 4141 } else { |
| 4142 CXFA_Node* pValue = GetProperty(0, XFA_Element::Value); | 4142 CXFA_Node* pValue = GetProperty(0, XFA_Element::Value); |
| 4143 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); | 4143 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 4144 ASSERT(pChildValue); | 4144 ASSERT(pChildValue); |
| 4145 pChildValue->SetScriptContent(wsContent, wsContent, bNotify, | 4145 pChildValue->SetScriptContent(wsContent, wsContent, bNotify, |
| 4146 bScriptModify, FALSE); | 4146 bScriptModify, FALSE); |
| 4147 } | 4147 } |
| 4148 pBindNode = GetBindData(); | 4148 pBindNode = GetBindData(); |
| 4149 if (pBindNode && bSyncData) { | 4149 if (pBindNode && bSyncData) { |
| 4150 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify, | 4150 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify, |
| 4151 bScriptModify, FALSE); | 4151 bScriptModify, FALSE); |
| 4152 CXFA_NodeArray nodeArray; | 4152 CXFA_NodeArray nodeArray; |
| 4153 pBindNode->GetBindItems(nodeArray); | 4153 pBindNode->GetBindItems(nodeArray); |
| 4154 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { | 4154 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { |
| 4155 if (nodeArray[i] != this) { | 4155 if (nodeArray[i] != this) { |
| 4156 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, true, | 4156 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, true, |
| 4157 FALSE); | 4157 FALSE); |
| 4158 } | 4158 } |
| 4159 } | 4159 } |
| 4160 } | 4160 } |
| 4161 pBindNode = nullptr; | 4161 pBindNode = nullptr; |
| 4162 break; | 4162 break; |
| 4163 } | 4163 } |
| 4164 case XFA_ObjectType::ContentNode: { | 4164 case XFA_ObjectType::ContentNode: { |
| 4165 CFX_WideString wsContentType; | 4165 CFX_WideString wsContentType; |
| 4166 if (GetClassID() == XFA_Element::ExData) { | 4166 if (GetElementType() == XFA_Element::ExData) { |
| 4167 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); | 4167 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); |
| 4168 if (wsContentType == FX_WSTRC(L"text/html")) { | 4168 if (wsContentType == FX_WSTRC(L"text/html")) { |
| 4169 wsContentType = FX_WSTRC(L""); | 4169 wsContentType = FX_WSTRC(L""); |
| 4170 SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType.AsStringC()); | 4170 SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType.AsStringC()); |
| 4171 } | 4171 } |
| 4172 } | 4172 } |
| 4173 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); | 4173 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); |
| 4174 if (!pContentRawDataNode) { | 4174 if (!pContentRawDataNode) { |
| 4175 pContentRawDataNode = CreateSamePacketNode( | 4175 pContentRawDataNode = CreateSamePacketNode( |
| 4176 (wsContentType == FX_WSTRC(L"text/xml")) ? XFA_Element::Sharpxml | 4176 (wsContentType == FX_WSTRC(L"text/xml")) ? XFA_Element::Sharpxml |
| 4177 : XFA_Element::Sharptext); | 4177 : XFA_Element::Sharptext); |
| 4178 InsertChild(pContentRawDataNode); | 4178 InsertChild(pContentRawDataNode); |
| 4179 } | 4179 } |
| 4180 return pContentRawDataNode->SetScriptContent( | 4180 return pContentRawDataNode->SetScriptContent( |
| 4181 wsContent, wsXMLValue, bNotify, bScriptModify, bSyncData); | 4181 wsContent, wsXMLValue, bNotify, bScriptModify, bSyncData); |
| 4182 } break; | 4182 } break; |
| 4183 case XFA_ObjectType::NodeC: | 4183 case XFA_ObjectType::NodeC: |
| 4184 case XFA_ObjectType::TextNode: | 4184 case XFA_ObjectType::TextNode: |
| 4185 pNode = this; | 4185 pNode = this; |
| 4186 break; | 4186 break; |
| 4187 case XFA_ObjectType::NodeV: | 4187 case XFA_ObjectType::NodeV: |
| 4188 pNode = this; | 4188 pNode = this; |
| 4189 if (bSyncData && GetPacketID() == XFA_XDPPACKET_Form) { | 4189 if (bSyncData && GetPacketID() == XFA_XDPPACKET_Form) { |
| 4190 CXFA_Node* pParent = GetNodeItem(XFA_NODEITEM_Parent); | 4190 CXFA_Node* pParent = GetNodeItem(XFA_NODEITEM_Parent); |
| 4191 if (pParent) { | 4191 if (pParent) { |
| 4192 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); | 4192 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); |
| 4193 } | 4193 } |
| 4194 if (pParent && pParent->GetClassID() == XFA_Element::Value) { | 4194 if (pParent && pParent->GetElementType() == XFA_Element::Value) { |
| 4195 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); | 4195 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); |
| 4196 if (pParent && pParent->IsContainerNode()) { | 4196 if (pParent && pParent->IsContainerNode()) { |
| 4197 pBindNode = pParent->GetBindData(); | 4197 pBindNode = pParent->GetBindData(); |
| 4198 if (pBindNode) { | 4198 if (pBindNode) { |
| 4199 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify, | 4199 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify, |
| 4200 bScriptModify, FALSE); | 4200 bScriptModify, FALSE); |
| 4201 } | 4201 } |
| 4202 } | 4202 } |
| 4203 } | 4203 } |
| 4204 } | 4204 } |
| 4205 break; | 4205 break; |
| 4206 default: | 4206 default: |
| 4207 if (GetClassID() == XFA_Element::DataValue) { | 4207 if (GetElementType() == XFA_Element::DataValue) { |
| 4208 pNode = this; | 4208 pNode = this; |
| 4209 pBindNode = this; | 4209 pBindNode = this; |
| 4210 } | 4210 } |
| 4211 break; | 4211 break; |
| 4212 } | 4212 } |
| 4213 if (pNode) { | 4213 if (pNode) { |
| 4214 SetAttributeValue(wsContent, wsXMLValue, bNotify, bScriptModify); | 4214 SetAttributeValue(wsContent, wsXMLValue, bNotify, bScriptModify); |
| 4215 if (pBindNode && bSyncData) { | 4215 if (pBindNode && bSyncData) { |
| 4216 CXFA_NodeArray nodeArray; | 4216 CXFA_NodeArray nodeArray; |
| 4217 pBindNode->GetBindItems(nodeArray); | 4217 pBindNode->GetBindItems(nodeArray); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 4238 } | 4238 } |
| 4239 CFX_WideString CXFA_Node::GetContent() { | 4239 CFX_WideString CXFA_Node::GetContent() { |
| 4240 return GetScriptContent(); | 4240 return GetScriptContent(); |
| 4241 } | 4241 } |
| 4242 FX_BOOL CXFA_Node::TryContent(CFX_WideString& wsContent, | 4242 FX_BOOL CXFA_Node::TryContent(CFX_WideString& wsContent, |
| 4243 FX_BOOL bScriptModify, | 4243 FX_BOOL bScriptModify, |
| 4244 FX_BOOL bProto) { | 4244 FX_BOOL bProto) { |
| 4245 CXFA_Node* pNode = nullptr; | 4245 CXFA_Node* pNode = nullptr; |
| 4246 switch (GetObjectType()) { | 4246 switch (GetObjectType()) { |
| 4247 case XFA_ObjectType::ContainerNode: | 4247 case XFA_ObjectType::ContainerNode: |
| 4248 if (GetClassID() == XFA_Element::ExclGroup) { | 4248 if (GetElementType() == XFA_Element::ExclGroup) { |
| 4249 pNode = this; | 4249 pNode = this; |
| 4250 } else { | 4250 } else { |
| 4251 CXFA_Node* pValue = GetChild(0, XFA_Element::Value); | 4251 CXFA_Node* pValue = GetChild(0, XFA_Element::Value); |
| 4252 if (!pValue) { | 4252 if (!pValue) { |
| 4253 return FALSE; | 4253 return FALSE; |
| 4254 } | 4254 } |
| 4255 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); | 4255 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 4256 if (pChildValue && XFA_FieldIsMultiListBox(this)) { | 4256 if (pChildValue && XFA_FieldIsMultiListBox(this)) { |
| 4257 pChildValue->SetAttribute(XFA_ATTRIBUTE_ContentType, | 4257 pChildValue->SetAttribute(XFA_ATTRIBUTE_ContentType, |
| 4258 FX_WSTRC(L"text/xml")); | 4258 FX_WSTRC(L"text/xml")); |
| 4259 } | 4259 } |
| 4260 return pChildValue | 4260 return pChildValue |
| 4261 ? pChildValue->TryContent(wsContent, bScriptModify, bProto) | 4261 ? pChildValue->TryContent(wsContent, bScriptModify, bProto) |
| 4262 : FALSE; | 4262 : FALSE; |
| 4263 } | 4263 } |
| 4264 break; | 4264 break; |
| 4265 case XFA_ObjectType::ContentNode: { | 4265 case XFA_ObjectType::ContentNode: { |
| 4266 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); | 4266 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); |
| 4267 if (!pContentRawDataNode) { | 4267 if (!pContentRawDataNode) { |
| 4268 XFA_Element element = XFA_Element::Sharptext; | 4268 XFA_Element element = XFA_Element::Sharptext; |
| 4269 if (GetClassID() == XFA_Element::ExData) { | 4269 if (GetElementType() == XFA_Element::ExData) { |
| 4270 CFX_WideString wsContentType; | 4270 CFX_WideString wsContentType; |
| 4271 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); | 4271 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); |
| 4272 if (wsContentType == FX_WSTRC(L"text/html")) { | 4272 if (wsContentType == FX_WSTRC(L"text/html")) { |
| 4273 element = XFA_Element::SharpxHTML; | 4273 element = XFA_Element::SharpxHTML; |
| 4274 } else if (wsContentType == FX_WSTRC(L"text/xml")) { | 4274 } else if (wsContentType == FX_WSTRC(L"text/xml")) { |
| 4275 element = XFA_Element::Sharpxml; | 4275 element = XFA_Element::Sharpxml; |
| 4276 } | 4276 } |
| 4277 } | 4277 } |
| 4278 pContentRawDataNode = CreateSamePacketNode(element); | 4278 pContentRawDataNode = CreateSamePacketNode(element); |
| 4279 InsertChild(pContentRawDataNode); | 4279 InsertChild(pContentRawDataNode); |
| 4280 } | 4280 } |
| 4281 return pContentRawDataNode->TryContent(wsContent, bScriptModify, bProto); | 4281 return pContentRawDataNode->TryContent(wsContent, bScriptModify, bProto); |
| 4282 } | 4282 } |
| 4283 case XFA_ObjectType::NodeC: | 4283 case XFA_ObjectType::NodeC: |
| 4284 case XFA_ObjectType::NodeV: | 4284 case XFA_ObjectType::NodeV: |
| 4285 case XFA_ObjectType::TextNode: | 4285 case XFA_ObjectType::TextNode: |
| 4286 pNode = this; | 4286 pNode = this; |
| 4287 default: | 4287 default: |
| 4288 if (GetClassID() == XFA_Element::DataValue) { | 4288 if (GetElementType() == XFA_Element::DataValue) { |
| 4289 pNode = this; | 4289 pNode = this; |
| 4290 } | 4290 } |
| 4291 break; | 4291 break; |
| 4292 } | 4292 } |
| 4293 if (pNode) { | 4293 if (pNode) { |
| 4294 if (bScriptModify) { | 4294 if (bScriptModify) { |
| 4295 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 4295 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 4296 if (pScriptContext) { | 4296 if (pScriptContext) { |
| 4297 m_pDocument->GetScriptContext()->AddNodesOfRunScript(this); | 4297 m_pDocument->GetScriptContext()->AddNodesOfRunScript(this); |
| 4298 } | 4298 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4320 case XFA_XDPPACKET_SourceSet: | 4320 case XFA_XDPPACKET_SourceSet: |
| 4321 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet)); | 4321 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet)); |
| 4322 case XFA_XDPPACKET_Xdc: | 4322 case XFA_XDPPACKET_Xdc: |
| 4323 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc)); | 4323 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc)); |
| 4324 default: | 4324 default: |
| 4325 return this; | 4325 return this; |
| 4326 } | 4326 } |
| 4327 } | 4327 } |
| 4328 FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { | 4328 FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { |
| 4329 wsNamespace.clear(); | 4329 wsNamespace.clear(); |
| 4330 if (IsModelNode() || GetClassID() == XFA_Element::Packet) { | 4330 if (IsModelNode() || GetElementType() == XFA_Element::Packet) { |
| 4331 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 4331 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
| 4332 if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) { | 4332 if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) { |
| 4333 return FALSE; | 4333 return FALSE; |
| 4334 } | 4334 } |
| 4335 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); | 4335 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); |
| 4336 return TRUE; | 4336 return TRUE; |
| 4337 } else if (GetPacketID() == XFA_XDPPACKET_Datasets) { | 4337 } else if (GetPacketID() == XFA_XDPPACKET_Datasets) { |
| 4338 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); | 4338 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); |
| 4339 if (!pXMLNode) { | 4339 if (!pXMLNode) { |
| 4340 return FALSE; | 4340 return FALSE; |
| 4341 } | 4341 } |
| 4342 if (pXMLNode->GetType() != FDE_XMLNODE_Element) { | 4342 if (pXMLNode->GetType() != FDE_XMLNODE_Element) { |
| 4343 return TRUE; | 4343 return TRUE; |
| 4344 } | 4344 } |
| 4345 if (GetClassID() == XFA_Element::DataValue && | 4345 if (GetElementType() == XFA_Element::DataValue && |
| 4346 GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) { | 4346 GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) { |
| 4347 return XFA_FDEExtension_ResolveNamespaceQualifier( | 4347 return XFA_FDEExtension_ResolveNamespaceQualifier( |
| 4348 static_cast<CFDE_XMLElement*>(pXMLNode), | 4348 static_cast<CFDE_XMLElement*>(pXMLNode), |
| 4349 GetCData(XFA_ATTRIBUTE_QualifiedName), wsNamespace); | 4349 GetCData(XFA_ATTRIBUTE_QualifiedName), wsNamespace); |
| 4350 } | 4350 } |
| 4351 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); | 4351 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); |
| 4352 return TRUE; | 4352 return TRUE; |
| 4353 } else { | 4353 } else { |
| 4354 CXFA_Node* pModelNode = GetModelNode(); | 4354 CXFA_Node* pModelNode = GetModelNode(); |
| 4355 return pModelNode->TryNamespace(wsNamespace); | 4355 return pModelNode->TryNamespace(wsNamespace); |
| 4356 } | 4356 } |
| 4357 } | 4357 } |
| 4358 CXFA_Node* CXFA_Node::GetProperty(int32_t index, | 4358 CXFA_Node* CXFA_Node::GetProperty(int32_t index, |
| 4359 XFA_Element eProperty, | 4359 XFA_Element eProperty, |
| 4360 FX_BOOL bCreateProperty) { | 4360 FX_BOOL bCreateProperty) { |
| 4361 XFA_Element eElement = GetClassID(); | 4361 XFA_Element eElement = GetElementType(); |
| 4362 uint32_t dwPacket = GetPacketID(); | 4362 uint32_t dwPacket = GetPacketID(); |
| 4363 const XFA_PROPERTY* pProperty = | 4363 const XFA_PROPERTY* pProperty = |
| 4364 XFA_GetPropertyOfElement(eElement, eProperty, dwPacket); | 4364 XFA_GetPropertyOfElement(eElement, eProperty, dwPacket); |
| 4365 if (!pProperty || index >= pProperty->uOccur) | 4365 if (!pProperty || index >= pProperty->uOccur) |
| 4366 return nullptr; | 4366 return nullptr; |
| 4367 | 4367 |
| 4368 CXFA_Node* pNode = m_pChild; | 4368 CXFA_Node* pNode = m_pChild; |
| 4369 int32_t iCount = 0; | 4369 int32_t iCount = 0; |
| 4370 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4370 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 4371 if (pNode->GetClassID() == eProperty) { | 4371 if (pNode->GetElementType() == eProperty) { |
| 4372 iCount++; | 4372 iCount++; |
| 4373 if (iCount > index) { | 4373 if (iCount > index) { |
| 4374 return pNode; | 4374 return pNode; |
| 4375 } | 4375 } |
| 4376 } | 4376 } |
| 4377 } | 4377 } |
| 4378 if (!bCreateProperty) | 4378 if (!bCreateProperty) |
| 4379 return nullptr; | 4379 return nullptr; |
| 4380 | 4380 |
| 4381 if (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf) { | 4381 if (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf) { |
| 4382 pNode = m_pChild; | 4382 pNode = m_pChild; |
| 4383 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4383 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 4384 const XFA_PROPERTY* pExistProperty = | 4384 const XFA_PROPERTY* pExistProperty = |
| 4385 XFA_GetPropertyOfElement(eElement, pNode->GetClassID(), dwPacket); | 4385 XFA_GetPropertyOfElement(eElement, pNode->GetElementType(), dwPacket); |
| 4386 if (pExistProperty && (pExistProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) | 4386 if (pExistProperty && (pExistProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) |
| 4387 return nullptr; | 4387 return nullptr; |
| 4388 } | 4388 } |
| 4389 } | 4389 } |
| 4390 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); | 4390 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); |
| 4391 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket); | 4391 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket); |
| 4392 CXFA_Node* pNewNode = nullptr; | 4392 CXFA_Node* pNewNode = nullptr; |
| 4393 for (; iCount <= index; iCount++) { | 4393 for (; iCount <= index; iCount++) { |
| 4394 pNewNode = pFactory->CreateNode(pPacket, eProperty); | 4394 pNewNode = pFactory->CreateNode(pPacket, eProperty); |
| 4395 if (!pNewNode) | 4395 if (!pNewNode) |
| 4396 return nullptr; | 4396 return nullptr; |
| 4397 InsertChild(pNewNode, nullptr); | 4397 InsertChild(pNewNode, nullptr); |
| 4398 pNewNode->SetFlag(XFA_NodeFlag_Initialized, true); | 4398 pNewNode->SetFlag(XFA_NodeFlag_Initialized, true); |
| 4399 } | 4399 } |
| 4400 return pNewNode; | 4400 return pNewNode; |
| 4401 } | 4401 } |
| 4402 int32_t CXFA_Node::CountChildren(XFA_Element eElement, FX_BOOL bOnlyChild) { | 4402 int32_t CXFA_Node::CountChildren(XFA_Element eElement, FX_BOOL bOnlyChild) { |
| 4403 CXFA_Node* pNode = m_pChild; | 4403 CXFA_Node* pNode = m_pChild; |
| 4404 int32_t iCount = 0; | 4404 int32_t iCount = 0; |
| 4405 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4405 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 4406 if (pNode->GetClassID() == eElement || eElement == XFA_Element::Unknown) { | 4406 if (pNode->GetElementType() == eElement || |
| 4407 eElement == XFA_Element::Unknown) { |
| 4407 if (bOnlyChild) { | 4408 if (bOnlyChild) { |
| 4408 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( | 4409 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( |
| 4409 GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN); | 4410 GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); |
| 4410 if (pProperty) { | 4411 if (pProperty) { |
| 4411 continue; | 4412 continue; |
| 4412 } | 4413 } |
| 4413 } | 4414 } |
| 4414 iCount++; | 4415 iCount++; |
| 4415 } | 4416 } |
| 4416 } | 4417 } |
| 4417 return iCount; | 4418 return iCount; |
| 4418 } | 4419 } |
| 4419 CXFA_Node* CXFA_Node::GetChild(int32_t index, | 4420 CXFA_Node* CXFA_Node::GetChild(int32_t index, |
| 4420 XFA_Element eElement, | 4421 XFA_Element eElement, |
| 4421 FX_BOOL bOnlyChild) { | 4422 FX_BOOL bOnlyChild) { |
| 4422 ASSERT(index > -1); | 4423 ASSERT(index > -1); |
| 4423 CXFA_Node* pNode = m_pChild; | 4424 CXFA_Node* pNode = m_pChild; |
| 4424 int32_t iCount = 0; | 4425 int32_t iCount = 0; |
| 4425 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4426 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 4426 if (pNode->GetClassID() == eElement || eElement == XFA_Element::Unknown) { | 4427 if (pNode->GetElementType() == eElement || |
| 4428 eElement == XFA_Element::Unknown) { |
| 4427 if (bOnlyChild) { | 4429 if (bOnlyChild) { |
| 4428 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( | 4430 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( |
| 4429 GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN); | 4431 GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); |
| 4430 if (pProperty) { | 4432 if (pProperty) { |
| 4431 continue; | 4433 continue; |
| 4432 } | 4434 } |
| 4433 } | 4435 } |
| 4434 iCount++; | 4436 iCount++; |
| 4435 if (iCount > index) { | 4437 if (iCount > index) { |
| 4436 return pNode; | 4438 return pNode; |
| 4437 } | 4439 } |
| 4438 } | 4440 } |
| 4439 } | 4441 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4604 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4606 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 4605 if (pNode->GetNameHash() == dwNameHash) { | 4607 if (pNode->GetNameHash() == dwNameHash) { |
| 4606 return pNode; | 4608 return pNode; |
| 4607 } | 4609 } |
| 4608 } | 4610 } |
| 4609 return nullptr; | 4611 return nullptr; |
| 4610 } | 4612 } |
| 4611 CXFA_Node* CXFA_Node::GetFirstChildByClass(XFA_Element eElement) const { | 4613 CXFA_Node* CXFA_Node::GetFirstChildByClass(XFA_Element eElement) const { |
| 4612 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; | 4614 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; |
| 4613 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4615 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 4614 if (pNode->GetClassID() == eElement) { | 4616 if (pNode->GetElementType() == eElement) { |
| 4615 return pNode; | 4617 return pNode; |
| 4616 } | 4618 } |
| 4617 } | 4619 } |
| 4618 return nullptr; | 4620 return nullptr; |
| 4619 } | 4621 } |
| 4620 CXFA_Node* CXFA_Node::GetNextSameNameSibling(uint32_t dwNameHash) const { | 4622 CXFA_Node* CXFA_Node::GetNextSameNameSibling(uint32_t dwNameHash) const { |
| 4621 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; | 4623 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; |
| 4622 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4624 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 4623 if (pNode->GetNameHash() == dwNameHash) { | 4625 if (pNode->GetNameHash() == dwNameHash) { |
| 4624 return pNode; | 4626 return pNode; |
| 4625 } | 4627 } |
| 4626 } | 4628 } |
| 4627 return nullptr; | 4629 return nullptr; |
| 4628 } | 4630 } |
| 4629 CXFA_Node* CXFA_Node::GetNextSameNameSibling( | 4631 CXFA_Node* CXFA_Node::GetNextSameNameSibling( |
| 4630 const CFX_WideStringC& wsNodeName) const { | 4632 const CFX_WideStringC& wsNodeName) const { |
| 4631 return GetNextSameNameSibling(FX_HashCode_GetW(wsNodeName, false)); | 4633 return GetNextSameNameSibling(FX_HashCode_GetW(wsNodeName, false)); |
| 4632 } | 4634 } |
| 4633 CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_Element eElement) const { | 4635 CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_Element eElement) const { |
| 4634 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; | 4636 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; |
| 4635 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4637 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 4636 if (pNode->GetClassID() == eElement) { | 4638 if (pNode->GetElementType() == eElement) { |
| 4637 return pNode; | 4639 return pNode; |
| 4638 } | 4640 } |
| 4639 } | 4641 } |
| 4640 return nullptr; | 4642 return nullptr; |
| 4641 } | 4643 } |
| 4642 int32_t CXFA_Node::GetNodeSameNameIndex() const { | 4644 int32_t CXFA_Node::GetNodeSameNameIndex() const { |
| 4643 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 4645 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 4644 if (!pScriptContext) { | 4646 if (!pScriptContext) { |
| 4645 return -1; | 4647 return -1; |
| 4646 } | 4648 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4657 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 4659 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
| 4658 if (!pScriptContext) { | 4660 if (!pScriptContext) { |
| 4659 return; | 4661 return; |
| 4660 } | 4662 } |
| 4661 pScriptContext->GetSomExpression(this, wsSOMExpression); | 4663 pScriptContext->GetSomExpression(this, wsSOMExpression); |
| 4662 } | 4664 } |
| 4663 CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() { | 4665 CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() { |
| 4664 CXFA_Node* pInstanceMgr = nullptr; | 4666 CXFA_Node* pInstanceMgr = nullptr; |
| 4665 if (m_ePacket == XFA_XDPPACKET_Form) { | 4667 if (m_ePacket == XFA_XDPPACKET_Form) { |
| 4666 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); | 4668 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); |
| 4667 if (!pParentNode || pParentNode->GetClassID() == XFA_Element::Area) { | 4669 if (!pParentNode || pParentNode->GetElementType() == XFA_Element::Area) { |
| 4668 return pInstanceMgr; | 4670 return pInstanceMgr; |
| 4669 } | 4671 } |
| 4670 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; | 4672 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; |
| 4671 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { | 4673 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { |
| 4672 XFA_Element eType = pNode->GetClassID(); | 4674 XFA_Element eType = pNode->GetElementType(); |
| 4673 if ((eType == XFA_Element::Subform || eType == XFA_Element::SubformSet) && | 4675 if ((eType == XFA_Element::Subform || eType == XFA_Element::SubformSet) && |
| 4674 pNode->m_dwNameHash != m_dwNameHash) { | 4676 pNode->m_dwNameHash != m_dwNameHash) { |
| 4675 break; | 4677 break; |
| 4676 } | 4678 } |
| 4677 if (eType == XFA_Element::InstanceManager) { | 4679 if (eType == XFA_Element::InstanceManager) { |
| 4678 CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); | 4680 CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); |
| 4679 CFX_WideStringC wsInstName = pNode->GetCData(XFA_ATTRIBUTE_Name); | 4681 CFX_WideStringC wsInstName = pNode->GetCData(XFA_ATTRIBUTE_Name); |
| 4680 if (wsInstName.GetLength() > 0 && wsInstName.GetAt(0) == '_' && | 4682 if (wsInstName.GetLength() > 0 && wsInstName.GetAt(0) == '_' && |
| 4681 wsInstName.Mid(1) == wsName) { | 4683 wsInstName.Mid(1) == wsName) { |
| 4682 pInstanceMgr = pNode; | 4684 pInstanceMgr = pNode; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4761 } else if (validFlags == 3) { | 4763 } else if (validFlags == 3) { |
| 4762 if (eElementType == XFA_Element::Subform) { | 4764 if (eElementType == XFA_Element::Subform) { |
| 4763 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, | 4765 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, |
| 4764 FALSE, FALSE); | 4766 FALSE, FALSE); |
| 4765 } | 4767 } |
| 4766 } else if (validFlags == 4) { | 4768 } else if (validFlags == 4) { |
| 4767 if (eElementType == XFA_Element::ExclGroup || | 4769 if (eElementType == XFA_Element::ExclGroup || |
| 4768 eElementType == XFA_Element::Field) { | 4770 eElementType == XFA_Element::Field) { |
| 4769 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); | 4771 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); |
| 4770 if (pParentNode && | 4772 if (pParentNode && |
| 4771 pParentNode->GetClassID() == XFA_Element::ExclGroup) { | 4773 pParentNode->GetElementType() == XFA_Element::ExclGroup) { |
| 4772 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, | 4774 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, |
| 4773 FALSE, FALSE); | 4775 FALSE, FALSE); |
| 4774 } | 4776 } |
| 4775 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, | 4777 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, |
| 4776 FALSE, FALSE); | 4778 FALSE, FALSE); |
| 4777 } | 4779 } |
| 4778 } else if (validFlags == 5) { | 4780 } else if (validFlags == 5) { |
| 4779 if (eElementType == XFA_Element::Field) { | 4781 if (eElementType == XFA_Element::Field) { |
| 4780 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, | 4782 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, |
| 4781 FALSE, FALSE); | 4783 FALSE, FALSE); |
| 4782 } | 4784 } |
| 4783 } else if (validFlags == 6) { | 4785 } else if (validFlags == 6) { |
| 4784 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 4786 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
| 4785 if (pWidgetData) { | 4787 if (pWidgetData) { |
| 4786 CXFA_Node* pUINode = pWidgetData->GetUIChild(); | 4788 CXFA_Node* pUINode = pWidgetData->GetUIChild(); |
| 4787 if (pUINode->m_eNodeClass == XFA_Element::Signature) { | 4789 if (pUINode->m_elementType == XFA_Element::Signature) { |
| 4788 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, | 4790 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, |
| 4789 FALSE, FALSE); | 4791 FALSE, FALSE); |
| 4790 } | 4792 } |
| 4791 } | 4793 } |
| 4792 } else if (validFlags == 7) { | 4794 } else if (validFlags == 7) { |
| 4793 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 4795 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
| 4794 if (pWidgetData) { | 4796 if (pWidgetData) { |
| 4795 CXFA_Node* pUINode = pWidgetData->GetUIChild(); | 4797 CXFA_Node* pUINode = pWidgetData->GetUIChild(); |
| 4796 if ((pUINode->m_eNodeClass == XFA_Element::ChoiceList) && | 4798 if ((pUINode->m_elementType == XFA_Element::ChoiceList) && |
| 4797 (!pWidgetData->IsListBox())) { | 4799 (!pWidgetData->IsListBox())) { |
| 4798 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, | 4800 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, |
| 4799 FALSE, FALSE); | 4801 FALSE, FALSE); |
| 4800 } | 4802 } |
| 4801 } | 4803 } |
| 4802 } | 4804 } |
| 4803 } | 4805 } |
| 4804 return iRet; | 4806 return iRet; |
| 4805 } | 4807 } |
| 4806 void CXFA_Node::UpdateNameHash() { | 4808 void CXFA_Node::UpdateNameHash() { |
| 4807 const XFA_NOTSUREATTRIBUTE* pNotsure = | 4809 const XFA_NOTSUREATTRIBUTE* pNotsure = |
| 4808 XFA_GetNotsureAttribute(GetClassID(), XFA_ATTRIBUTE_Name); | 4810 XFA_GetNotsureAttribute(GetElementType(), XFA_ATTRIBUTE_Name); |
| 4809 CFX_WideStringC wsName; | 4811 CFX_WideStringC wsName; |
| 4810 if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) { | 4812 if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) { |
| 4811 wsName = GetCData(XFA_ATTRIBUTE_Name); | 4813 wsName = GetCData(XFA_ATTRIBUTE_Name); |
| 4812 m_dwNameHash = FX_HashCode_GetW(wsName, false); | 4814 m_dwNameHash = FX_HashCode_GetW(wsName, false); |
| 4813 } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) { | 4815 } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) { |
| 4814 wsName = XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName; | 4816 wsName = XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName; |
| 4815 m_dwNameHash = FX_HashCode_GetW(wsName, false); | 4817 m_dwNameHash = FX_HashCode_GetW(wsName, false); |
| 4816 } | 4818 } |
| 4817 } | 4819 } |
| 4818 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { | 4820 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { |
| 4819 if (!m_pXMLNode) { | 4821 if (!m_pXMLNode) { |
| 4820 CFX_WideString wsTag(GetCData(XFA_ATTRIBUTE_Name)); | 4822 CFX_WideString wsTag(GetCData(XFA_ATTRIBUTE_Name)); |
| 4821 m_pXMLNode = new CFDE_XMLElement(wsTag); | 4823 m_pXMLNode = new CFDE_XMLElement(wsTag); |
| 4822 SetFlag(XFA_NodeFlag_OwnXMLNode, false); | 4824 SetFlag(XFA_NodeFlag_OwnXMLNode, false); |
| 4823 } | 4825 } |
| 4824 return m_pXMLNode; | 4826 return m_pXMLNode; |
| 4825 } | 4827 } |
| 4826 FX_BOOL CXFA_Node::IsNeedSavingXMLNode() { | 4828 FX_BOOL CXFA_Node::IsNeedSavingXMLNode() { |
| 4827 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets || | 4829 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets || |
| 4828 GetClassID() == XFA_Element::Xfa); | 4830 GetElementType() == XFA_Element::Xfa); |
| 4829 } | 4831 } |
| 4830 | 4832 |
| 4831 XFA_MAPMODULEDATA* CXFA_Node::CreateMapModuleData() { | 4833 XFA_MAPMODULEDATA* CXFA_Node::CreateMapModuleData() { |
| 4832 if (!m_pMapModuleData) | 4834 if (!m_pMapModuleData) |
| 4833 m_pMapModuleData = new XFA_MAPMODULEDATA; | 4835 m_pMapModuleData = new XFA_MAPMODULEDATA; |
| 4834 return m_pMapModuleData; | 4836 return m_pMapModuleData; |
| 4835 } | 4837 } |
| 4836 | 4838 |
| 4837 XFA_MAPMODULEDATA* CXFA_Node::GetMapModuleData() const { | 4839 XFA_MAPMODULEDATA* CXFA_Node::GetMapModuleData() const { |
| 4838 return m_pMapModuleData; | 4840 return m_pMapModuleData; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5023 } | 5025 } |
| 5024 } | 5026 } |
| 5025 void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) { | 5027 void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) { |
| 5026 if (!pDstModule) { | 5028 if (!pDstModule) { |
| 5027 return; | 5029 return; |
| 5028 } | 5030 } |
| 5029 FX_BOOL bNeedMove = TRUE; | 5031 FX_BOOL bNeedMove = TRUE; |
| 5030 if (!pKey) { | 5032 if (!pKey) { |
| 5031 bNeedMove = FALSE; | 5033 bNeedMove = FALSE; |
| 5032 } | 5034 } |
| 5033 if (pDstModule->GetClassID() != GetClassID()) { | 5035 if (pDstModule->GetElementType() != GetElementType()) { |
| 5034 bNeedMove = FALSE; | 5036 bNeedMove = FALSE; |
| 5035 } | 5037 } |
| 5036 XFA_MAPMODULEDATA* pSrcModuleData = nullptr; | 5038 XFA_MAPMODULEDATA* pSrcModuleData = nullptr; |
| 5037 XFA_MAPMODULEDATA* pDstModuleData = nullptr; | 5039 XFA_MAPMODULEDATA* pDstModuleData = nullptr; |
| 5038 if (bNeedMove) { | 5040 if (bNeedMove) { |
| 5039 pSrcModuleData = GetMapModuleData(); | 5041 pSrcModuleData = GetMapModuleData(); |
| 5040 if (!pSrcModuleData) { | 5042 if (!pSrcModuleData) { |
| 5041 bNeedMove = FALSE; | 5043 bNeedMove = FALSE; |
| 5042 } | 5044 } |
| 5043 pDstModuleData = pDstModule->CreateMapModuleData(); | 5045 pDstModuleData = pDstModule->CreateMapModuleData(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5075 pSrcChild = pSrcChild->GetNodeItem(XFA_NODEITEM_NextSibling), | 5077 pSrcChild = pSrcChild->GetNodeItem(XFA_NODEITEM_NextSibling), |
| 5076 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 5078 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 5077 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE); | 5079 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE); |
| 5078 } | 5080 } |
| 5079 } | 5081 } |
| 5080 pSrcModule->MoveBufferMapData(pDstModule, pKey); | 5082 pSrcModule->MoveBufferMapData(pDstModule, pKey); |
| 5081 } | 5083 } |
| 5082 | 5084 |
| 5083 CXFA_OrdinaryObject::CXFA_OrdinaryObject(CXFA_Document* pDocument, | 5085 CXFA_OrdinaryObject::CXFA_OrdinaryObject(CXFA_Document* pDocument, |
| 5084 XFA_Element eElement) | 5086 XFA_Element eElement) |
| 5085 : CXFA_Object(pDocument, XFA_ObjectType::OrdinaryObject) { | 5087 : CXFA_Object(pDocument, XFA_ObjectType::OrdinaryObject, eElement) {} |
| 5086 m_eNodeClass = eElement; | |
| 5087 } | |
| 5088 | 5088 |
| 5089 CXFA_OrdinaryObject::~CXFA_OrdinaryObject() {} | 5089 CXFA_OrdinaryObject::~CXFA_OrdinaryObject() {} |
| 5090 | 5090 |
| 5091 XFA_Element CXFA_OrdinaryObject::GetClassID() const { | |
| 5092 return m_eNodeClass; | |
| 5093 } | |
| 5094 | |
| 5095 CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) | 5091 CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) |
| 5096 : CXFA_Object(pThisNode->GetDocument(), XFA_ObjectType::VariablesThis), | 5092 : CXFA_Object(pThisNode->GetDocument(), |
| 5093 XFA_ObjectType::VariablesThis, |
| 5094 XFA_Element::Unknown), |
| 5097 m_pThisNode(NULL), | 5095 m_pThisNode(NULL), |
| 5098 m_pScriptNode(NULL) { | 5096 m_pScriptNode(NULL) { |
| 5099 m_pThisNode = pThisNode; | 5097 m_pThisNode = pThisNode; |
| 5100 m_pScriptNode = pScriptNode; | 5098 m_pScriptNode = pScriptNode; |
| 5101 } | 5099 } |
| 5102 | 5100 |
| 5103 CXFA_ThisProxy::~CXFA_ThisProxy() {} | 5101 CXFA_ThisProxy::~CXFA_ThisProxy() {} |
| 5104 | 5102 |
| 5105 CXFA_Node* CXFA_ThisProxy::GetThisNode() const { | 5103 CXFA_Node* CXFA_ThisProxy::GetThisNode() const { |
| 5106 return m_pThisNode; | 5104 return m_pThisNode; |
| 5107 } | 5105 } |
| 5108 | 5106 |
| 5109 CXFA_Node* CXFA_ThisProxy::GetScriptNode() const { | 5107 CXFA_Node* CXFA_ThisProxy::GetScriptNode() const { |
| 5110 return m_pScriptNode; | 5108 return m_pScriptNode; |
| 5111 } | 5109 } |
| 5112 | 5110 |
| 5113 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) | 5111 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) |
| 5114 : CXFA_Object(pDocument, XFA_ObjectType::NodeList) { | 5112 : CXFA_Object(pDocument, XFA_ObjectType::NodeList, XFA_Element::NodeList) { |
| 5115 m_pDocument->GetScriptContext()->AddToCacheList( | 5113 m_pDocument->GetScriptContext()->AddToCacheList( |
| 5116 std::unique_ptr<CXFA_NodeList>(this)); | 5114 std::unique_ptr<CXFA_NodeList>(this)); |
| 5117 } | 5115 } |
| 5116 |
| 5118 CXFA_NodeList::~CXFA_NodeList() {} | 5117 CXFA_NodeList::~CXFA_NodeList() {} |
| 5119 XFA_Element CXFA_NodeList::GetClassID() const { | 5118 |
| 5120 return XFA_Element::NodeList; | |
| 5121 } | |
| 5122 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { | 5119 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { |
| 5123 uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); | 5120 uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); |
| 5124 int32_t iCount = GetLength(); | 5121 int32_t iCount = GetLength(); |
| 5125 for (int32_t i = 0; i < iCount; i++) { | 5122 for (int32_t i = 0; i < iCount; i++) { |
| 5126 CXFA_Node* ret = Item(i); | 5123 CXFA_Node* ret = Item(i); |
| 5127 if (dwHashCode == ret->GetNameHash()) | 5124 if (dwHashCode == ret->GetNameHash()) |
| 5128 return ret; | 5125 return ret; |
| 5129 } | 5126 } |
| 5130 return nullptr; | 5127 return nullptr; |
| 5131 } | 5128 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5258 return nullptr; | 5255 return nullptr; |
| 5259 } | 5256 } |
| 5260 CXFA_AttachNodeList::CXFA_AttachNodeList(CXFA_Document* pDocument, | 5257 CXFA_AttachNodeList::CXFA_AttachNodeList(CXFA_Document* pDocument, |
| 5261 CXFA_Node* pAttachNode) | 5258 CXFA_Node* pAttachNode) |
| 5262 : CXFA_NodeList(pDocument) { | 5259 : CXFA_NodeList(pDocument) { |
| 5263 m_pAttachNode = pAttachNode; | 5260 m_pAttachNode = pAttachNode; |
| 5264 } | 5261 } |
| 5265 int32_t CXFA_AttachNodeList::GetLength() { | 5262 int32_t CXFA_AttachNodeList::GetLength() { |
| 5266 return m_pAttachNode->CountChildren( | 5263 return m_pAttachNode->CountChildren( |
| 5267 XFA_Element::Unknown, | 5264 XFA_Element::Unknown, |
| 5268 m_pAttachNode->GetClassID() == XFA_Element::Subform); | 5265 m_pAttachNode->GetElementType() == XFA_Element::Subform); |
| 5269 } | 5266 } |
| 5270 FX_BOOL CXFA_AttachNodeList::Append(CXFA_Node* pNode) { | 5267 FX_BOOL CXFA_AttachNodeList::Append(CXFA_Node* pNode) { |
| 5271 CXFA_Node* pParent = pNode->GetNodeItem(XFA_NODEITEM_Parent); | 5268 CXFA_Node* pParent = pNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 5272 if (pParent) { | 5269 if (pParent) { |
| 5273 pParent->RemoveChild(pNode); | 5270 pParent->RemoveChild(pNode); |
| 5274 } | 5271 } |
| 5275 return m_pAttachNode->InsertChild(pNode); | 5272 return m_pAttachNode->InsertChild(pNode); |
| 5276 } | 5273 } |
| 5277 FX_BOOL CXFA_AttachNodeList::Insert(CXFA_Node* pNewNode, | 5274 FX_BOOL CXFA_AttachNodeList::Insert(CXFA_Node* pNewNode, |
| 5278 CXFA_Node* pBeforeNode) { | 5275 CXFA_Node* pBeforeNode) { |
| 5279 CXFA_Node* pParent = pNewNode->GetNodeItem(XFA_NODEITEM_Parent); | 5276 CXFA_Node* pParent = pNewNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 5280 if (pParent) { | 5277 if (pParent) { |
| 5281 pParent->RemoveChild(pNewNode); | 5278 pParent->RemoveChild(pNewNode); |
| 5282 } | 5279 } |
| 5283 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5280 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
| 5284 } | 5281 } |
| 5285 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5282 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
| 5286 return m_pAttachNode->RemoveChild(pNode); | 5283 return m_pAttachNode->RemoveChild(pNode); |
| 5287 } | 5284 } |
| 5288 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5285 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
| 5289 return m_pAttachNode->GetChild( | 5286 return m_pAttachNode->GetChild( |
| 5290 iIndex, XFA_Element::Unknown, | 5287 iIndex, XFA_Element::Unknown, |
| 5291 m_pAttachNode->GetClassID() == XFA_Element::Subform); | 5288 m_pAttachNode->GetElementType() == XFA_Element::Subform); |
| 5292 } | 5289 } |
| OLD | NEW |