Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Side by Side Diff: xfa/fxfa/parser/xfa_object_imp.cpp

Issue 2089443002: Convert XFA_ELEMENT to an enum class (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: More unknown checks Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_object.h ('k') | xfa/fxfa/parser/xfa_parser_imp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 25 matching lines...) Expand all
36 void XFA_CopyWideString(void*& pData) { 36 void XFA_CopyWideString(void*& pData) {
37 if (pData) { 37 if (pData) {
38 CFX_WideString* pNewData = new CFX_WideString(*(CFX_WideString*)pData); 38 CFX_WideString* pNewData = new CFX_WideString(*(CFX_WideString*)pData);
39 pData = pNewData; 39 pData = pNewData;
40 } 40 }
41 } 41 }
42 42
43 XFA_MAPDATABLOCKCALLBACKINFO deleteWideStringCallBack = {XFA_DeleteWideString, 43 XFA_MAPDATABLOCKCALLBACKINFO deleteWideStringCallBack = {XFA_DeleteWideString,
44 XFA_CopyWideString}; 44 XFA_CopyWideString};
45 45
46 XFA_ObjectType XFA_GetElementObjectType(XFA_ELEMENT eElement) { 46 XFA_ObjectType XFA_GetElementObjectType(XFA_Element eElement) {
47 return XFA_GetElementByID(eElement)->eObjectType; 47 return XFA_GetElementByID(eElement)->eObjectType;
48 } 48 }
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, XFA_ObjectType type)
60 : m_pDocument(pDocument), m_objectType(type) {} 60 : m_pDocument(pDocument), m_objectType(type) {}
61 61
62 CXFA_Object::~CXFA_Object() {} 62 CXFA_Object::~CXFA_Object() {}
63 63
64 void CXFA_Object::GetClassName(CFX_WideStringC& wsName) const { 64 void CXFA_Object::GetClassName(CFX_WideStringC& wsName) const {
65 wsName = XFA_GetElementByID(GetClassID())->pName; 65 wsName = XFA_GetElementByID(GetClassID())->pName;
66 } 66 }
67 67
68 uint32_t CXFA_Object::GetClassHashCode() const { 68 uint32_t CXFA_Object::GetClassHashCode() const {
69 return XFA_GetElementByID(GetClassID())->uHash; 69 return XFA_GetElementByID(GetClassID())->uHash;
70 } 70 }
71 71
72 XFA_ELEMENT CXFA_Object::GetClassID() const { 72 XFA_Element CXFA_Object::GetClassID() const {
73 if (IsNode()) 73 if (IsNode())
74 return AsNode()->GetClassID(); 74 return AsNode()->GetClassID();
75 if (IsOrdinaryObject()) 75 if (IsOrdinaryObject())
76 return AsOrdinaryObject()->GetClassID(); 76 return AsOrdinaryObject()->GetClassID();
77 if (IsNodeList()) 77 if (IsNodeList())
78 return AsNodeList()->GetClassID(); 78 return AsNodeList()->GetClassID();
79 if (IsOrdinaryList()) 79 if (IsOrdinaryList())
80 return XFA_ELEMENT_List; 80 return XFA_Element::List;
81 ASSERT(FALSE); 81 ASSERT(FALSE);
82 return (XFA_ELEMENT)0; 82 return XFA_Element::Unknown;
83 } 83 }
84 84
85 void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, 85 void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue,
86 FX_BOOL bSetting, 86 FX_BOOL bSetting,
87 XFA_ATTRIBUTE eAttribute) { 87 XFA_ATTRIBUTE eAttribute) {
88 if (!bSetting) { 88 if (!bSetting) {
89 CFX_WideStringC className; 89 CFX_WideStringC className;
90 GetClassName(className); 90 GetClassName(className);
91 pValue->SetString( 91 pValue->SetString(
92 FX_UTF8Encode(className.c_str(), className.GetLength()).AsStringC()); 92 FX_UTF8Encode(className.c_str(), className.GetLength()).AsStringC());
(...skipping 15 matching lines...) Expand all
108 FXJSE_ThrowMessage( 108 FXJSE_ThrowMessage(
109 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); 109 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC());
110 } 110 }
111 111
112 XFA_MAPMODULEDATA::XFA_MAPMODULEDATA() {} 112 XFA_MAPMODULEDATA::XFA_MAPMODULEDATA() {}
113 113
114 XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {} 114 XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {}
115 115
116 CXFA_Node::CXFA_Node(CXFA_Document* pDoc, 116 CXFA_Node::CXFA_Node(CXFA_Document* pDoc,
117 uint16_t ePacket, 117 uint16_t ePacket,
118 XFA_ELEMENT eElement) 118 XFA_Element eElement)
119 : CXFA_Object(pDoc, XFA_GetElementObjectType(eElement)), 119 : CXFA_Object(pDoc, XFA_GetElementObjectType(eElement)),
120 m_pNext(nullptr), 120 m_pNext(nullptr),
121 m_pChild(nullptr), 121 m_pChild(nullptr),
122 m_pLastChild(nullptr), 122 m_pLastChild(nullptr),
123 m_pParent(nullptr), 123 m_pParent(nullptr),
124 m_pXMLNode(nullptr), 124 m_pXMLNode(nullptr),
125 m_eNodeClass(eElement), 125 m_eNodeClass(eElement),
126 m_ePacket(ePacket), 126 m_ePacket(ePacket),
127 m_uNodeFlags(XFA_NodeFlag_None), 127 m_uNodeFlags(XFA_NodeFlag_None),
128 m_dwNameHash(0), 128 m_dwNameHash(0),
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 239 }
240 break; 240 break;
241 default: 241 default:
242 break; 242 break;
243 } 243 }
244 return pNode; 244 return pNode;
245 } 245 }
246 246
247 int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, 247 int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes,
248 uint32_t dwTypeFilter, 248 uint32_t dwTypeFilter,
249 XFA_ELEMENT eElementFilter, 249 XFA_Element eElementFilter,
250 int32_t iLevel) { 250 int32_t iLevel) {
251 if (--iLevel < 0) { 251 if (--iLevel < 0) {
252 return nodes.GetSize(); 252 return nodes.GetSize();
253 } 253 }
254 if (eElementFilter != XFA_ELEMENT_UNKNOWN) { 254 if (eElementFilter != XFA_Element::Unknown) {
255 CXFA_Node* pChild = m_pChild; 255 CXFA_Node* pChild = m_pChild;
256 while (pChild) { 256 while (pChild) {
257 if (pChild->GetClassID() == eElementFilter) { 257 if (pChild->GetClassID() == eElementFilter) {
258 nodes.Add(pChild); 258 nodes.Add(pChild);
259 if (iLevel > 0) { 259 if (iLevel > 0) {
260 GetNodeList(nodes, dwTypeFilter, eElementFilter, iLevel); 260 GetNodeList(nodes, dwTypeFilter, eElementFilter, iLevel);
261 } 261 }
262 } 262 }
263 pChild = pChild->m_pNext; 263 pChild = pChild->m_pNext;
264 } 264 }
(...skipping 16 matching lines...) Expand all
281 while (pChild) { 281 while (pChild) {
282 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( 282 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement(
283 GetClassID(), pChild->GetClassID(), XFA_XDPPACKET_UNKNOWN); 283 GetClassID(), pChild->GetClassID(), XFA_XDPPACKET_UNKNOWN);
284 if (pProperty) { 284 if (pProperty) {
285 if (bFilterProperties) { 285 if (bFilterProperties) {
286 nodes.Add(pChild); 286 nodes.Add(pChild);
287 } else if (bFilterOneOfProperties && 287 } else if (bFilterOneOfProperties &&
288 (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) { 288 (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) {
289 nodes.Add(pChild); 289 nodes.Add(pChild);
290 } else if (bFilterChildren && 290 } else if (bFilterChildren &&
291 (pChild->GetClassID() == XFA_ELEMENT_Variables || 291 (pChild->GetClassID() == XFA_Element::Variables ||
292 pChild->GetClassID() == XFA_ELEMENT_PageSet)) { 292 pChild->GetClassID() == XFA_Element::PageSet)) {
293 nodes.Add(pChild); 293 nodes.Add(pChild);
294 } 294 }
295 } else if (bFilterChildren) { 295 } else if (bFilterChildren) {
296 nodes.Add(pChild); 296 nodes.Add(pChild);
297 } 297 }
298 pChild = pChild->m_pNext; 298 pChild = pChild->m_pNext;
299 } 299 }
300 if (bFilterOneOfProperties && nodes.GetSize() < 1) { 300 if (bFilterOneOfProperties && nodes.GetSize() < 1) {
301 int32_t iProperties = 0; 301 int32_t iProperties = 0;
302 const XFA_PROPERTY* pProperty = 302 const XFA_PROPERTY* pProperty =
303 XFA_GetElementProperties(GetClassID(), iProperties); 303 XFA_GetElementProperties(GetClassID(), iProperties);
304 if (!pProperty || iProperties < 1) 304 if (!pProperty || iProperties < 1)
305 return 0; 305 return 0;
306 for (int32_t i = 0; i < iProperties; i++) { 306 for (int32_t i = 0; i < iProperties; i++) {
307 if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) { 307 if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) {
308 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); 308 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
309 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID()); 309 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID());
310 CXFA_Node* pNewNode = 310 CXFA_Node* pNewNode =
311 pFactory->CreateNode(pPacket, (XFA_ELEMENT)pProperty[i].eName); 311 pFactory->CreateNode(pPacket, pProperty[i].eName);
312 if (!pNewNode) 312 if (!pNewNode)
313 break; 313 break;
314 InsertChild(pNewNode, nullptr); 314 InsertChild(pNewNode, nullptr);
315 pNewNode->SetFlag(XFA_NodeFlag_Initialized, true); 315 pNewNode->SetFlag(XFA_NodeFlag_Initialized, true);
316 nodes.Add(pNewNode); 316 nodes.Add(pNewNode);
317 break; 317 break;
318 } 318 }
319 } 319 }
320 } 320 }
321 } 321 }
322 return nodes.GetSize(); 322 return nodes.GetSize();
323 } 323 }
324 324
325 CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_ELEMENT eElement, 325 CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_Element eElement,
326 uint32_t dwFlags) { 326 uint32_t dwFlags) {
327 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); 327 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
328 CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eElement); 328 CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eElement);
329 pNode->SetFlag(dwFlags, true); 329 pNode->SetFlag(dwFlags, true);
330 return pNode; 330 return pNode;
331 } 331 }
332 332
333 CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) { 333 CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) {
334 ASSERT(m_ePacket == XFA_XDPPACKET_Template); 334 ASSERT(m_ePacket == XFA_XDPPACKET_Template);
335 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); 335 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 GetObject(XFA_ATTRIBUTE_BindingNode); 438 GetObject(XFA_ATTRIBUTE_BindingNode);
439 } 439 }
440 440
441 CXFA_WidgetData* CXFA_Node::GetWidgetData() { 441 CXFA_WidgetData* CXFA_Node::GetWidgetData() {
442 return (CXFA_WidgetData*)GetObject(XFA_ATTRIBUTE_WidgetData); 442 return (CXFA_WidgetData*)GetObject(XFA_ATTRIBUTE_WidgetData);
443 } 443 }
444 444
445 CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { 445 CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() {
446 if (GetPacketID() != XFA_XDPPACKET_Form) 446 if (GetPacketID() != XFA_XDPPACKET_Form)
447 return nullptr; 447 return nullptr;
448 XFA_ELEMENT classID = GetClassID(); 448 XFA_Element classID = GetClassID();
449 if (classID == XFA_ELEMENT_ExclGroup) 449 if (classID == XFA_Element::ExclGroup)
450 return nullptr; 450 return nullptr;
451 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); 451 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
452 if (pParentNode && pParentNode->GetClassID() == XFA_ELEMENT_ExclGroup) 452 if (pParentNode && pParentNode->GetClassID() == XFA_Element::ExclGroup)
453 return nullptr; 453 return nullptr;
454 454
455 if (classID == XFA_ELEMENT_Field) { 455 if (classID == XFA_Element::Field) {
456 CXFA_WidgetData* pFieldWidgetData = GetWidgetData(); 456 CXFA_WidgetData* pFieldWidgetData = GetWidgetData();
457 if (pFieldWidgetData && 457 if (pFieldWidgetData &&
458 pFieldWidgetData->GetChoiceListOpen() == 458 pFieldWidgetData->GetChoiceListOpen() ==
459 XFA_ATTRIBUTEENUM_MultiSelect) { 459 XFA_ATTRIBUTEENUM_MultiSelect) {
460 return nullptr; 460 return nullptr;
461 } else { 461 } else {
462 CFX_WideString wsPicture; 462 CFX_WideString wsPicture;
463 if (pFieldWidgetData) { 463 if (pFieldWidgetData) {
464 pFieldWidgetData->GetPictureContent(wsPicture, 464 pFieldWidgetData->GetPictureContent(wsPicture,
465 XFA_VALUEPICTURE_DataBind); 465 XFA_VALUEPICTURE_DataBind);
(...skipping 18 matching lines...) Expand all
484 if (!wsPicture.IsEmpty()) 484 if (!wsPicture.IsEmpty())
485 break; 485 break;
486 pFieldWidgetData = nullptr; 486 pFieldWidgetData = nullptr;
487 } 487 }
488 return pFieldWidgetData; 488 return pFieldWidgetData;
489 } 489 }
490 } 490 }
491 CXFA_Node* pGrandNode = 491 CXFA_Node* pGrandNode =
492 pParentNode ? pParentNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr; 492 pParentNode ? pParentNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr;
493 CXFA_Node* pValueNode = 493 CXFA_Node* pValueNode =
494 (pParentNode && pParentNode->GetClassID() == XFA_ELEMENT_Value) 494 (pParentNode && pParentNode->GetClassID() == XFA_Element::Value)
495 ? pParentNode 495 ? pParentNode
496 : nullptr; 496 : nullptr;
497 if (!pValueNode) { 497 if (!pValueNode) {
498 pValueNode = (pGrandNode && pGrandNode->GetClassID() == XFA_ELEMENT_Value) 498 pValueNode = (pGrandNode && pGrandNode->GetClassID() == XFA_Element::Value)
499 ? pGrandNode 499 ? pGrandNode
500 : nullptr; 500 : nullptr;
501 } 501 }
502 CXFA_Node* pParentOfValueNode = 502 CXFA_Node* pParentOfValueNode =
503 pValueNode ? pValueNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr; 503 pValueNode ? pValueNode->GetNodeItem(XFA_NODEITEM_Parent) : nullptr;
504 return pParentOfValueNode ? pParentOfValueNode->GetContainerWidgetData() 504 return pParentOfValueNode ? pParentOfValueNode->GetContainerWidgetData()
505 : nullptr; 505 : nullptr;
506 } 506 }
507 507
508 FX_BOOL CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) { 508 FX_BOOL CXFA_Node::GetLocaleName(CFX_WideString& wsLocaleName) {
509 CXFA_Node* pForm = GetDocument()->GetXFAObject(XFA_HASHCODE_Form)->AsNode(); 509 CXFA_Node* pForm = GetDocument()->GetXFAObject(XFA_HASHCODE_Form)->AsNode();
510 CXFA_Node* pTopSubform = pForm->GetFirstChildByClass(XFA_ELEMENT_Subform); 510 CXFA_Node* pTopSubform = pForm->GetFirstChildByClass(XFA_Element::Subform);
511 ASSERT(pTopSubform); 511 ASSERT(pTopSubform);
512 CXFA_Node* pLocaleNode = this; 512 CXFA_Node* pLocaleNode = this;
513 FX_BOOL bLocale = FALSE; 513 FX_BOOL bLocale = FALSE;
514 do { 514 do {
515 bLocale = pLocaleNode->TryCData(XFA_ATTRIBUTE_Locale, wsLocaleName, FALSE); 515 bLocale = pLocaleNode->TryCData(XFA_ATTRIBUTE_Locale, wsLocaleName, FALSE);
516 if (!bLocale) { 516 if (!bLocale) {
517 pLocaleNode = pLocaleNode->GetNodeItem(XFA_NODEITEM_Parent); 517 pLocaleNode = pLocaleNode->GetNodeItem(XFA_NODEITEM_Parent);
518 } 518 }
519 } while (pLocaleNode && pLocaleNode != pTopSubform && !bLocale); 519 } while (pLocaleNode && pLocaleNode != pTopSubform && !bLocale);
520 if (bLocale) 520 if (bLocale)
521 return TRUE; 521 return TRUE;
522 CXFA_Node* pConfig = ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Config)); 522 CXFA_Node* pConfig = ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
523 wsLocaleName = GetDocument()->GetLocalMgr()->GetConfigLocaleName(pConfig); 523 wsLocaleName = GetDocument()->GetLocalMgr()->GetConfigLocaleName(pConfig);
524 if (!wsLocaleName.IsEmpty()) 524 if (!wsLocaleName.IsEmpty())
525 return TRUE; 525 return TRUE;
526 if (pTopSubform && 526 if (pTopSubform &&
527 pTopSubform->TryCData(XFA_ATTRIBUTE_Locale, wsLocaleName, FALSE)) { 527 pTopSubform->TryCData(XFA_ATTRIBUTE_Locale, wsLocaleName, FALSE)) {
528 return TRUE; 528 return TRUE;
529 } 529 }
530 IFX_Locale* pLocale = GetDocument()->GetLocalMgr()->GetDefLocale(); 530 IFX_Locale* pLocale = GetDocument()->GetLocalMgr()->GetDefLocale();
531 if (pLocale) { 531 if (pLocale) {
532 wsLocaleName = pLocale->GetName(); 532 wsLocaleName = pLocale->GetName();
533 return TRUE; 533 return TRUE;
534 } 534 }
535 return FALSE; 535 return FALSE;
536 } 536 }
537 537
538 XFA_ATTRIBUTEENUM CXFA_Node::GetIntact() { 538 XFA_ATTRIBUTEENUM CXFA_Node::GetIntact() {
539 XFA_ELEMENT eElement = GetClassID(); 539 XFA_Element eElement = GetClassID();
540 CXFA_Node* pKeep = GetFirstChildByClass(XFA_ELEMENT_Keep); 540 CXFA_Node* pKeep = GetFirstChildByClass(XFA_Element::Keep);
541 XFA_ATTRIBUTEENUM eLayoutType = GetEnum(XFA_ATTRIBUTE_Layout); 541 XFA_ATTRIBUTEENUM eLayoutType = GetEnum(XFA_ATTRIBUTE_Layout);
542 if (pKeep) { 542 if (pKeep) {
543 XFA_ATTRIBUTEENUM eIntact; 543 XFA_ATTRIBUTEENUM eIntact;
544 if (pKeep->TryEnum(XFA_ATTRIBUTE_Intact, eIntact, FALSE)) { 544 if (pKeep->TryEnum(XFA_ATTRIBUTE_Intact, eIntact, FALSE)) {
545 if (eIntact == XFA_ATTRIBUTEENUM_None && 545 if (eIntact == XFA_ATTRIBUTEENUM_None &&
546 eLayoutType == XFA_ATTRIBUTEENUM_Row && 546 eLayoutType == XFA_ATTRIBUTEENUM_Row &&
547 m_pDocument->GetCurVersionMode() < XFA_VERSION_208) { 547 m_pDocument->GetCurVersionMode() < XFA_VERSION_208) {
548 CXFA_Node* pPreviewRow = GetNodeItem(XFA_NODEITEM_PrevSibling, 548 CXFA_Node* pPreviewRow = GetNodeItem(XFA_NODEITEM_PrevSibling,
549 XFA_ObjectType::ContainerNode); 549 XFA_ObjectType::ContainerNode);
550 if (pPreviewRow && 550 if (pPreviewRow &&
551 pPreviewRow->GetEnum(XFA_ATTRIBUTE_Layout) == 551 pPreviewRow->GetEnum(XFA_ATTRIBUTE_Layout) ==
552 XFA_ATTRIBUTEENUM_Row) { 552 XFA_ATTRIBUTEENUM_Row) {
553 XFA_ATTRIBUTEENUM eValue; 553 XFA_ATTRIBUTEENUM eValue;
554 if (pKeep->TryEnum(XFA_ATTRIBUTE_Previous, eValue, FALSE) && 554 if (pKeep->TryEnum(XFA_ATTRIBUTE_Previous, eValue, FALSE) &&
555 (eValue == XFA_ATTRIBUTEENUM_ContentArea || 555 (eValue == XFA_ATTRIBUTEENUM_ContentArea ||
556 eValue == XFA_ATTRIBUTEENUM_PageArea)) { 556 eValue == XFA_ATTRIBUTEENUM_PageArea)) {
557 return XFA_ATTRIBUTEENUM_ContentArea; 557 return XFA_ATTRIBUTEENUM_ContentArea;
558 } 558 }
559 CXFA_Node* pNode = 559 CXFA_Node* pNode =
560 pPreviewRow->GetFirstChildByClass(XFA_ELEMENT_Keep); 560 pPreviewRow->GetFirstChildByClass(XFA_Element::Keep);
561 if (pNode && pNode->TryEnum(XFA_ATTRIBUTE_Next, eValue, FALSE) && 561 if (pNode && pNode->TryEnum(XFA_ATTRIBUTE_Next, eValue, FALSE) &&
562 (eValue == XFA_ATTRIBUTEENUM_ContentArea || 562 (eValue == XFA_ATTRIBUTEENUM_ContentArea ||
563 eValue == XFA_ATTRIBUTEENUM_PageArea)) { 563 eValue == XFA_ATTRIBUTEENUM_PageArea)) {
564 return XFA_ATTRIBUTEENUM_ContentArea; 564 return XFA_ATTRIBUTEENUM_ContentArea;
565 } 565 }
566 } 566 }
567 } 567 }
568 return eIntact; 568 return eIntact;
569 } 569 }
570 } 570 }
571 switch (eElement) { 571 switch (eElement) {
572 case XFA_ELEMENT_Subform: 572 case XFA_Element::Subform:
573 switch (eLayoutType) { 573 switch (eLayoutType) {
574 case XFA_ATTRIBUTEENUM_Position: 574 case XFA_ATTRIBUTEENUM_Position:
575 case XFA_ATTRIBUTEENUM_Row: 575 case XFA_ATTRIBUTEENUM_Row:
576 return XFA_ATTRIBUTEENUM_ContentArea; 576 return XFA_ATTRIBUTEENUM_ContentArea;
577 case XFA_ATTRIBUTEENUM_Tb: 577 case XFA_ATTRIBUTEENUM_Tb:
578 case XFA_ATTRIBUTEENUM_Table: 578 case XFA_ATTRIBUTEENUM_Table:
579 case XFA_ATTRIBUTEENUM_Lr_tb: 579 case XFA_ATTRIBUTEENUM_Lr_tb:
580 case XFA_ATTRIBUTEENUM_Rl_tb: 580 case XFA_ATTRIBUTEENUM_Rl_tb:
581 return XFA_ATTRIBUTEENUM_None; 581 return XFA_ATTRIBUTEENUM_None;
582 default: 582 default:
583 break; 583 break;
584 } 584 }
585 break; 585 break;
586 case XFA_ELEMENT_Field: { 586 case XFA_Element::Field: {
587 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); 587 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
588 if (!pParentNode || pParentNode->GetClassID() == XFA_ELEMENT_PageArea) 588 if (!pParentNode || pParentNode->GetClassID() == XFA_Element::PageArea)
589 return XFA_ATTRIBUTEENUM_ContentArea; 589 return XFA_ATTRIBUTEENUM_ContentArea;
590 if (pParentNode->GetIntact() == XFA_ATTRIBUTEENUM_None) { 590 if (pParentNode->GetIntact() == XFA_ATTRIBUTEENUM_None) {
591 XFA_ATTRIBUTEENUM eParLayout = 591 XFA_ATTRIBUTEENUM eParLayout =
592 pParentNode->GetEnum(XFA_ATTRIBUTE_Layout); 592 pParentNode->GetEnum(XFA_ATTRIBUTE_Layout);
593 if (eParLayout == XFA_ATTRIBUTEENUM_Position || 593 if (eParLayout == XFA_ATTRIBUTEENUM_Position ||
594 eParLayout == XFA_ATTRIBUTEENUM_Row || 594 eParLayout == XFA_ATTRIBUTEENUM_Row ||
595 eParLayout == XFA_ATTRIBUTEENUM_Table) { 595 eParLayout == XFA_ATTRIBUTEENUM_Table) {
596 return XFA_ATTRIBUTEENUM_None; 596 return XFA_ATTRIBUTEENUM_None;
597 } 597 }
598 XFA_VERSION version = m_pDocument->GetCurVersionMode(); 598 XFA_VERSION version = m_pDocument->GetCurVersionMode();
599 if (eParLayout == XFA_ATTRIBUTEENUM_Tb && version < XFA_VERSION_208) { 599 if (eParLayout == XFA_ATTRIBUTEENUM_Tb && version < XFA_VERSION_208) {
600 CXFA_Measurement measureH; 600 CXFA_Measurement measureH;
601 if (TryMeasure(XFA_ATTRIBUTE_H, measureH, FALSE)) 601 if (TryMeasure(XFA_ATTRIBUTE_H, measureH, FALSE))
602 return XFA_ATTRIBUTEENUM_ContentArea; 602 return XFA_ATTRIBUTEENUM_ContentArea;
603 } 603 }
604 return XFA_ATTRIBUTEENUM_None; 604 return XFA_ATTRIBUTEENUM_None;
605 } 605 }
606 return XFA_ATTRIBUTEENUM_ContentArea; 606 return XFA_ATTRIBUTEENUM_ContentArea;
607 } 607 }
608 case XFA_ELEMENT_Draw: 608 case XFA_Element::Draw:
609 return XFA_ATTRIBUTEENUM_ContentArea; 609 return XFA_ATTRIBUTEENUM_ContentArea;
610 default: 610 default:
611 break; 611 break;
612 } 612 }
613 return XFA_ATTRIBUTEENUM_None; 613 return XFA_ATTRIBUTEENUM_None;
614 } 614 }
615 615
616 CXFA_Node* CXFA_Node::GetDataDescriptionNode() { 616 CXFA_Node* CXFA_Node::GetDataDescriptionNode() {
617 if (m_ePacket == XFA_XDPPACKET_Datasets) 617 if (m_ePacket == XFA_XDPPACKET_Datasets)
618 return m_pAuxNode; 618 return m_pAuxNode;
(...skipping 10 matching lines...) Expand all
629 if (iLength != 1) { 629 if (iLength != 1) {
630 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resolveNode"); 630 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resolveNode");
631 return; 631 return;
632 } 632 }
633 CFX_WideString wsExpression = 633 CFX_WideString wsExpression =
634 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 634 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
635 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 635 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
636 if (!pScriptContext) 636 if (!pScriptContext)
637 return; 637 return;
638 CXFA_Node* refNode = this; 638 CXFA_Node* refNode = this;
639 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) 639 if (refNode->GetClassID() == XFA_Element::Xfa)
640 refNode = ToNode(pScriptContext->GetThisObject()); 640 refNode = ToNode(pScriptContext->GetThisObject());
641 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | 641 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes |
642 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | 642 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
643 XFA_RESOLVENODE_Siblings; 643 XFA_RESOLVENODE_Siblings;
644 XFA_RESOLVENODE_RS resoveNodeRS; 644 XFA_RESOLVENODE_RS resoveNodeRS;
645 int32_t iRet = pScriptContext->ResolveObjects( 645 int32_t iRet = pScriptContext->ResolveObjects(
646 refNode, wsExpression.AsStringC(), resoveNodeRS, dwFlag); 646 refNode, wsExpression.AsStringC(), resoveNodeRS, dwFlag);
647 if (iRet < 1) { 647 if (iRet < 1) {
648 pArguments->GetReturnValue()->SetNull(); 648 pArguments->GetReturnValue()->SetNull();
649 return; 649 return;
(...skipping 25 matching lines...) Expand all
675 } 675 }
676 CFX_WideString wsExpression = 676 CFX_WideString wsExpression =
677 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC()); 677 CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
678 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 678 CFXJSE_Value* pValue = pArguments->GetReturnValue();
679 if (!pValue) 679 if (!pValue)
680 return; 680 return;
681 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | 681 uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes |
682 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | 682 XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
683 XFA_RESOLVENODE_Siblings; 683 XFA_RESOLVENODE_Siblings;
684 CXFA_Node* refNode = this; 684 CXFA_Node* refNode = this;
685 if (refNode->GetClassID() == XFA_ELEMENT_Xfa) 685 if (refNode->GetClassID() == XFA_Element::Xfa)
686 refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject()); 686 refNode = ToNode(m_pDocument->GetScriptContext()->GetThisObject());
687 Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag, refNode); 687 Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag, refNode);
688 } 688 }
689 689
690 void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue, 690 void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue,
691 CFX_WideString wsExpression, 691 CFX_WideString wsExpression,
692 uint32_t dwFlag, 692 uint32_t dwFlag,
693 CXFA_Node* refNode) { 693 CXFA_Node* refNode) {
694 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 694 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
695 if (!pScriptContext) 695 if (!pScriptContext)
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 pNewChild->SetFlag(XFA_NodeFlag_Initialized, true); 1010 pNewChild->SetFlag(XFA_NodeFlag_Initialized, true);
1011 pNewChild = pItem; 1011 pNewChild = pItem;
1012 } 1012 }
1013 while (pChild) { 1013 while (pChild) {
1014 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1014 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1015 RemoveChild(pChild); 1015 RemoveChild(pChild);
1016 pFakeRoot->InsertChild(pChild); 1016 pFakeRoot->InsertChild(pChild);
1017 pChild = pItem; 1017 pChild = pItem;
1018 } 1018 }
1019 if (GetPacketID() == XFA_XDPPACKET_Form && 1019 if (GetPacketID() == XFA_XDPPACKET_Form &&
1020 GetClassID() == XFA_ELEMENT_ExData) { 1020 GetClassID() == XFA_Element::ExData) {
1021 CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode(); 1021 CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode();
1022 SetXMLMappingNode(pFakeXMLRoot); 1022 SetXMLMappingNode(pFakeXMLRoot);
1023 SetFlag(XFA_NodeFlag_OwnXMLNode, false); 1023 SetFlag(XFA_NodeFlag_OwnXMLNode, false);
1024 if (pTempXMLNode && !pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent)) { 1024 if (pTempXMLNode && !pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent)) {
1025 pFakeXMLRoot = pTempXMLNode; 1025 pFakeXMLRoot = pTempXMLNode;
1026 } else { 1026 } else {
1027 pFakeXMLRoot = nullptr; 1027 pFakeXMLRoot = nullptr;
1028 } 1028 }
1029 } 1029 }
1030 MoveBufferMapData(pFakeRoot, this, XFA_CalcData, TRUE); 1030 MoveBufferMapData(pFakeRoot, this, XFA_CalcData, TRUE);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 else 1169 else
1170 pValue->SetBoolean(IsContainerNode()); 1170 pValue->SetBoolean(IsContainerNode());
1171 } 1171 }
1172 1172
1173 void CXFA_Node::Script_NodeClass_IsNull(CFXJSE_Value* pValue, 1173 void CXFA_Node::Script_NodeClass_IsNull(CFXJSE_Value* pValue,
1174 FX_BOOL bSetting, 1174 FX_BOOL bSetting,
1175 XFA_ATTRIBUTE eAttribute) { 1175 XFA_ATTRIBUTE eAttribute) {
1176 if (bSetting) { 1176 if (bSetting) {
1177 ThrowException(XFA_IDS_INVAlID_PROP_SET); 1177 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1178 } else { 1178 } else {
1179 if (GetClassID() == XFA_ELEMENT_Subform) { 1179 if (GetClassID() == XFA_Element::Subform) {
1180 pValue->SetBoolean(FALSE); 1180 pValue->SetBoolean(FALSE);
1181 return; 1181 return;
1182 } 1182 }
1183 CFX_WideString strValue; 1183 CFX_WideString strValue;
1184 pValue->SetBoolean(!TryContent(strValue) || strValue.IsEmpty()); 1184 pValue->SetBoolean(!TryContent(strValue) || strValue.IsEmpty());
1185 } 1185 }
1186 } 1186 }
1187 1187
1188 void CXFA_Node::Script_NodeClass_OneOfChild(CFXJSE_Value* pValue, 1188 void CXFA_Node::Script_NodeClass_OneOfChild(CFXJSE_Value* pValue,
1189 FX_BOOL bSetting, 1189 FX_BOOL bSetting,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 if (!pNotify) 1283 if (!pNotify)
1284 return; 1284 return;
1285 1285
1286 uint32_t dwPacket = GetPacketID(); 1286 uint32_t dwPacket = GetPacketID();
1287 if (!(dwPacket & XFA_XDPPACKET_Form)) { 1287 if (!(dwPacket & XFA_XDPPACKET_Form)) {
1288 pNotify->OnValueChanged(this, eAttribute, this, this); 1288 pNotify->OnValueChanged(this, eAttribute, this, this);
1289 return; 1289 return;
1290 } 1290 }
1291 1291
1292 bool bNeedFindContainer = false; 1292 bool bNeedFindContainer = false;
1293 XFA_ELEMENT eType = GetClassID(); 1293 XFA_Element eType = GetClassID();
1294 switch (eType) { 1294 switch (eType) {
1295 case XFA_ELEMENT_Caption: 1295 case XFA_Element::Caption:
1296 bNeedFindContainer = true; 1296 bNeedFindContainer = true;
1297 pNotify->OnValueChanged(this, eAttribute, this, 1297 pNotify->OnValueChanged(this, eAttribute, this,
1298 GetNodeItem(XFA_NODEITEM_Parent)); 1298 GetNodeItem(XFA_NODEITEM_Parent));
1299 break; 1299 break;
1300 case XFA_ELEMENT_Font: 1300 case XFA_Element::Font:
1301 case XFA_ELEMENT_Para: { 1301 case XFA_Element::Para: {
1302 bNeedFindContainer = true; 1302 bNeedFindContainer = true;
1303 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); 1303 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
1304 if (pParentNode->GetClassID() == XFA_ELEMENT_Caption) { 1304 if (pParentNode->GetClassID() == XFA_Element::Caption) {
1305 pNotify->OnValueChanged(this, eAttribute, pParentNode, 1305 pNotify->OnValueChanged(this, eAttribute, pParentNode,
1306 pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); 1306 pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
1307 } else { 1307 } else {
1308 pNotify->OnValueChanged(this, eAttribute, this, pParentNode); 1308 pNotify->OnValueChanged(this, eAttribute, this, pParentNode);
1309 } 1309 }
1310 } break; 1310 } break;
1311 case XFA_ELEMENT_Margin: { 1311 case XFA_Element::Margin: {
1312 bNeedFindContainer = true; 1312 bNeedFindContainer = true;
1313 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); 1313 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
1314 XFA_ELEMENT eParentType = pParentNode->GetClassID(); 1314 XFA_Element eParentType = pParentNode->GetClassID();
1315 if (pParentNode->IsContainerNode()) { 1315 if (pParentNode->IsContainerNode()) {
1316 pNotify->OnValueChanged(this, eAttribute, this, pParentNode); 1316 pNotify->OnValueChanged(this, eAttribute, this, pParentNode);
1317 } else if (eParentType == XFA_ELEMENT_Caption) { 1317 } else if (eParentType == XFA_Element::Caption) {
1318 pNotify->OnValueChanged(this, eAttribute, pParentNode, 1318 pNotify->OnValueChanged(this, eAttribute, pParentNode,
1319 pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); 1319 pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
1320 } else { 1320 } else {
1321 CXFA_Node* pNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); 1321 CXFA_Node* pNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent);
1322 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Ui) { 1322 if (pNode && pNode->GetClassID() == XFA_Element::Ui) {
1323 pNotify->OnValueChanged(this, eAttribute, pNode, 1323 pNotify->OnValueChanged(this, eAttribute, pNode,
1324 pNode->GetNodeItem(XFA_NODEITEM_Parent)); 1324 pNode->GetNodeItem(XFA_NODEITEM_Parent));
1325 } 1325 }
1326 } 1326 }
1327 } break; 1327 } break;
1328 case XFA_ELEMENT_Comb: { 1328 case XFA_Element::Comb: {
1329 CXFA_Node* pEditNode = GetNodeItem(XFA_NODEITEM_Parent); 1329 CXFA_Node* pEditNode = GetNodeItem(XFA_NODEITEM_Parent);
1330 XFA_ELEMENT eUIType = pEditNode->GetClassID(); 1330 XFA_Element eUIType = pEditNode->GetClassID();
1331 if (pEditNode && (eUIType == XFA_ELEMENT_DateTimeEdit || 1331 if (pEditNode && (eUIType == XFA_Element::DateTimeEdit ||
1332 eUIType == XFA_ELEMENT_NumericEdit || 1332 eUIType == XFA_Element::NumericEdit ||
1333 eUIType == XFA_ELEMENT_TextEdit)) { 1333 eUIType == XFA_Element::TextEdit)) {
1334 CXFA_Node* pUINode = pEditNode->GetNodeItem(XFA_NODEITEM_Parent); 1334 CXFA_Node* pUINode = pEditNode->GetNodeItem(XFA_NODEITEM_Parent);
1335 if (pUINode) { 1335 if (pUINode) {
1336 pNotify->OnValueChanged(this, eAttribute, pUINode, 1336 pNotify->OnValueChanged(this, eAttribute, pUINode,
1337 pUINode->GetNodeItem(XFA_NODEITEM_Parent)); 1337 pUINode->GetNodeItem(XFA_NODEITEM_Parent));
1338 } 1338 }
1339 } 1339 }
1340 } break; 1340 } break;
1341 case XFA_ELEMENT_Button: 1341 case XFA_Element::Button:
1342 case XFA_ELEMENT_Barcode: 1342 case XFA_Element::Barcode:
1343 case XFA_ELEMENT_ChoiceList: 1343 case XFA_Element::ChoiceList:
1344 case XFA_ELEMENT_DateTimeEdit: 1344 case XFA_Element::DateTimeEdit:
1345 case XFA_ELEMENT_NumericEdit: 1345 case XFA_Element::NumericEdit:
1346 case XFA_ELEMENT_PasswordEdit: 1346 case XFA_Element::PasswordEdit:
1347 case XFA_ELEMENT_TextEdit: { 1347 case XFA_Element::TextEdit: {
1348 CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent); 1348 CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
1349 if (pUINode) { 1349 if (pUINode) {
1350 pNotify->OnValueChanged(this, eAttribute, pUINode, 1350 pNotify->OnValueChanged(this, eAttribute, pUINode,
1351 pUINode->GetNodeItem(XFA_NODEITEM_Parent)); 1351 pUINode->GetNodeItem(XFA_NODEITEM_Parent));
1352 } 1352 }
1353 } break; 1353 } break;
1354 case XFA_ELEMENT_CheckButton: { 1354 case XFA_Element::CheckButton: {
1355 bNeedFindContainer = true; 1355 bNeedFindContainer = true;
1356 CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent); 1356 CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
1357 if (pUINode) { 1357 if (pUINode) {
1358 pNotify->OnValueChanged(this, eAttribute, pUINode, 1358 pNotify->OnValueChanged(this, eAttribute, pUINode,
1359 pUINode->GetNodeItem(XFA_NODEITEM_Parent)); 1359 pUINode->GetNodeItem(XFA_NODEITEM_Parent));
1360 } 1360 }
1361 } break; 1361 } break;
1362 case XFA_ELEMENT_Keep: 1362 case XFA_Element::Keep:
1363 case XFA_ELEMENT_Bookend: 1363 case XFA_Element::Bookend:
1364 case XFA_ELEMENT_Break: 1364 case XFA_Element::Break:
1365 case XFA_ELEMENT_BreakAfter: 1365 case XFA_Element::BreakAfter:
1366 case XFA_ELEMENT_BreakBefore: 1366 case XFA_Element::BreakBefore:
1367 case XFA_ELEMENT_Overflow: 1367 case XFA_Element::Overflow:
1368 bNeedFindContainer = true; 1368 bNeedFindContainer = true;
1369 break; 1369 break;
1370 case XFA_ELEMENT_Area: 1370 case XFA_Element::Area:
1371 case XFA_ELEMENT_Draw: 1371 case XFA_Element::Draw:
1372 case XFA_ELEMENT_ExclGroup: 1372 case XFA_Element::ExclGroup:
1373 case XFA_ELEMENT_Field: 1373 case XFA_Element::Field:
1374 case XFA_ELEMENT_Subform: 1374 case XFA_Element::Subform:
1375 case XFA_ELEMENT_SubformSet: 1375 case XFA_Element::SubformSet:
1376 pLayoutPro->AddChangedContainer(this); 1376 pLayoutPro->AddChangedContainer(this);
1377 pNotify->OnValueChanged(this, eAttribute, this, this); 1377 pNotify->OnValueChanged(this, eAttribute, this, this);
1378 break; 1378 break;
1379 case XFA_ELEMENT_Sharptext: 1379 case XFA_Element::Sharptext:
1380 case XFA_ELEMENT_Sharpxml: 1380 case XFA_Element::Sharpxml:
1381 case XFA_ELEMENT_SharpxHTML: { 1381 case XFA_Element::SharpxHTML: {
1382 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent); 1382 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent);
1383 if (!pTextNode) { 1383 if (!pTextNode) {
1384 return; 1384 return;
1385 } 1385 }
1386 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent); 1386 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent);
1387 if (!pValueNode) { 1387 if (!pValueNode) {
1388 return; 1388 return;
1389 } 1389 }
1390 XFA_ELEMENT eNodeType = pValueNode->GetClassID(); 1390 XFA_Element eNodeType = pValueNode->GetClassID();
1391 if (eNodeType == XFA_ELEMENT_Value) { 1391 if (eNodeType == XFA_Element::Value) {
1392 bNeedFindContainer = true; 1392 bNeedFindContainer = true;
1393 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); 1393 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
1394 if (pNode && pNode->IsContainerNode()) { 1394 if (pNode && pNode->IsContainerNode()) {
1395 if (bScriptModify) { 1395 if (bScriptModify) {
1396 pValueNode = pNode; 1396 pValueNode = pNode;
1397 } 1397 }
1398 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); 1398 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode);
1399 } else { 1399 } else {
1400 pNotify->OnValueChanged(this, eAttribute, pNode, 1400 pNotify->OnValueChanged(this, eAttribute, pNode,
1401 pNode->GetNodeItem(XFA_NODEITEM_Parent)); 1401 pNode->GetNodeItem(XFA_NODEITEM_Parent));
1402 } 1402 }
1403 } else { 1403 } else {
1404 if (eNodeType == XFA_ELEMENT_Items) { 1404 if (eNodeType == XFA_Element::Items) {
1405 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); 1405 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
1406 if (pNode && pNode->IsContainerNode()) { 1406 if (pNode && pNode->IsContainerNode()) {
1407 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); 1407 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode);
1408 } 1408 }
1409 } 1409 }
1410 } 1410 }
1411 } break; 1411 } break;
1412 default: 1412 default:
1413 break; 1413 break;
1414 } 1414 }
(...skipping 10 matching lines...) Expand all
1425 } 1425 }
1426 } 1426 }
1427 } 1427 }
1428 1428
1429 void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, 1429 void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue,
1430 FX_BOOL bSetting, 1430 FX_BOOL bSetting,
1431 XFA_ATTRIBUTE eAttribute) { 1431 XFA_ATTRIBUTE eAttribute) {
1432 if (bSetting) { 1432 if (bSetting) {
1433 CFX_WideString wsValue = pValue->ToWideString(); 1433 CFX_WideString wsValue = pValue->ToWideString();
1434 SetAttribute(eAttribute, wsValue.AsStringC(), true); 1434 SetAttribute(eAttribute, wsValue.AsStringC(), true);
1435 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) { 1435 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_Element::Desc) {
1436 CXFA_Node* pTemplateNode = 1436 CXFA_Node* pTemplateNode =
1437 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); 1437 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template));
1438 CXFA_Node* pProtoRoot = 1438 CXFA_Node* pProtoRoot =
1439 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform) 1439 pTemplateNode->GetFirstChildByClass(XFA_Element::Subform)
1440 ->GetFirstChildByClass(XFA_ELEMENT_Proto); 1440 ->GetFirstChildByClass(XFA_Element::Proto);
1441 1441
1442 CFX_WideString wsID; 1442 CFX_WideString wsID;
1443 CFX_WideString wsSOM; 1443 CFX_WideString wsSOM;
1444 if (!wsValue.IsEmpty()) { 1444 if (!wsValue.IsEmpty()) {
1445 if (wsValue[0] == '#') { 1445 if (wsValue[0] == '#') {
1446 wsID = CFX_WideString(wsValue.c_str() + 1, wsValue.GetLength() - 1); 1446 wsID = CFX_WideString(wsValue.c_str() + 1, wsValue.GetLength() - 1);
1447 } else { 1447 } else {
1448 wsSOM = wsValue; 1448 wsSOM = wsValue;
1449 } 1449 }
1450 } 1450 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 if (!pWidgetData) { 1594 if (!pWidgetData) {
1595 pValue->SetInteger(0); 1595 pValue->SetInteger(0);
1596 return; 1596 return;
1597 } 1597 }
1598 pValue->SetInteger(pWidgetData->CountChoiceListItems(TRUE)); 1598 pValue->SetInteger(pWidgetData->CountChoiceListItems(TRUE));
1599 } 1599 }
1600 } 1600 }
1601 void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, 1601 void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue,
1602 FX_BOOL bSetting, 1602 FX_BOOL bSetting,
1603 XFA_ATTRIBUTE eAttribute) { 1603 XFA_ATTRIBUTE eAttribute) {
1604 XFA_ELEMENT classID = GetClassID(); 1604 XFA_Element classID = GetClassID();
1605 if (classID == XFA_ELEMENT_Field) { 1605 if (classID == XFA_Element::Field) {
1606 Script_Field_DefaultValue(pValue, bSetting, eAttribute); 1606 Script_Field_DefaultValue(pValue, bSetting, eAttribute);
1607 return; 1607 return;
1608 } else if (classID == XFA_ELEMENT_Draw) { 1608 } else if (classID == XFA_Element::Draw) {
1609 Script_Draw_DefaultValue(pValue, bSetting, eAttribute); 1609 Script_Draw_DefaultValue(pValue, bSetting, eAttribute);
1610 return; 1610 return;
1611 } else if (classID == XFA_ELEMENT_Boolean) { 1611 } else if (classID == XFA_Element::Boolean) {
1612 Script_Boolean_Value(pValue, bSetting, eAttribute); 1612 Script_Boolean_Value(pValue, bSetting, eAttribute);
1613 return; 1613 return;
1614 } 1614 }
1615 if (bSetting) { 1615 if (bSetting) {
1616 CFX_WideString wsNewValue; 1616 CFX_WideString wsNewValue;
1617 if (!(pValue && (pValue->IsNull() || pValue->IsUndefined()))) 1617 if (!(pValue && (pValue->IsNull() || pValue->IsUndefined())))
1618 wsNewValue = pValue->ToWideString(); 1618 wsNewValue = pValue->ToWideString();
1619 1619
1620 CFX_WideString wsFormatValue(wsNewValue); 1620 CFX_WideString wsFormatValue(wsNewValue);
1621 CXFA_WidgetData* pContainerWidgetData = nullptr; 1621 CXFA_WidgetData* pContainerWidgetData = nullptr;
(...skipping 18 matching lines...) Expand all
1640 } 1640 }
1641 } else if (GetPacketID() == XFA_XDPPACKET_Form) { 1641 } else if (GetPacketID() == XFA_XDPPACKET_Form) {
1642 pContainerWidgetData = GetContainerWidgetData(); 1642 pContainerWidgetData = GetContainerWidgetData();
1643 } 1643 }
1644 if (pContainerWidgetData) { 1644 if (pContainerWidgetData) {
1645 pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); 1645 pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue);
1646 } 1646 }
1647 SetScriptContent(wsNewValue, wsFormatValue, true, TRUE); 1647 SetScriptContent(wsNewValue, wsFormatValue, true, TRUE);
1648 } else { 1648 } else {
1649 CFX_WideString content = GetScriptContent(TRUE); 1649 CFX_WideString content = GetScriptContent(TRUE);
1650 if (content.IsEmpty() && classID != XFA_ELEMENT_Text && 1650 if (content.IsEmpty() && classID != XFA_Element::Text &&
1651 classID != XFA_ELEMENT_SubmitUrl) { 1651 classID != XFA_Element::SubmitUrl) {
1652 pValue->SetNull(); 1652 pValue->SetNull();
1653 } else if (classID == XFA_ELEMENT_Integer) { 1653 } else if (classID == XFA_Element::Integer) {
1654 pValue->SetInteger(FXSYS_wtoi(content.c_str())); 1654 pValue->SetInteger(FXSYS_wtoi(content.c_str()));
1655 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { 1655 } else if (classID == XFA_Element::Float ||
1656 classID == XFA_Element::Decimal) {
1656 CFX_Decimal decimal(content.AsStringC()); 1657 CFX_Decimal decimal(content.AsStringC());
1657 pValue->SetFloat((FX_FLOAT)(double)decimal); 1658 pValue->SetFloat((FX_FLOAT)(double)decimal);
1658 } else { 1659 } else {
1659 pValue->SetString( 1660 pValue->SetString(
1660 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); 1661 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC());
1661 } 1662 }
1662 } 1663 }
1663 } 1664 }
1664 void CXFA_Node::Script_Som_DefaultValue_Read(CFXJSE_Value* pValue, 1665 void CXFA_Node::Script_Som_DefaultValue_Read(CFXJSE_Value* pValue,
1665 FX_BOOL bSetting, 1666 FX_BOOL bSetting,
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 ThrowException(XFA_IDS_INVAlID_PROP_SET); 1886 ThrowException(XFA_IDS_INVAlID_PROP_SET);
1886 } 1887 }
1887 } 1888 }
1888 void CXFA_Node::Script_Draw_DefaultValue(CFXJSE_Value* pValue, 1889 void CXFA_Node::Script_Draw_DefaultValue(CFXJSE_Value* pValue,
1889 FX_BOOL bSetting, 1890 FX_BOOL bSetting,
1890 XFA_ATTRIBUTE eAttribute) { 1891 XFA_ATTRIBUTE eAttribute) {
1891 if (bSetting) { 1892 if (bSetting) {
1892 if (pValue && pValue->IsString()) { 1893 if (pValue && pValue->IsString()) {
1893 CXFA_WidgetData* pWidgetData = GetWidgetData(); 1894 CXFA_WidgetData* pWidgetData = GetWidgetData();
1894 ASSERT(pWidgetData); 1895 ASSERT(pWidgetData);
1895 XFA_ELEMENT uiType = pWidgetData->GetUIType(); 1896 XFA_Element uiType = pWidgetData->GetUIType();
1896 if (uiType == XFA_ELEMENT_Text) { 1897 if (uiType == XFA_Element::Text) {
1897 CFX_WideString wsNewValue = pValue->ToWideString(); 1898 CFX_WideString wsNewValue = pValue->ToWideString();
1898 CFX_WideString wsFormatValue(wsNewValue); 1899 CFX_WideString wsFormatValue(wsNewValue);
1899 SetScriptContent(wsNewValue, wsFormatValue, true, TRUE); 1900 SetScriptContent(wsNewValue, wsFormatValue, true, TRUE);
1900 } 1901 }
1901 } 1902 }
1902 } else { 1903 } else {
1903 CFX_WideString content = GetScriptContent(TRUE); 1904 CFX_WideString content = GetScriptContent(TRUE);
1904 if (content.IsEmpty()) { 1905 if (content.IsEmpty()) {
1905 pValue->SetNull(); 1906 pValue->SetNull();
1906 } else { 1907 } else {
(...skipping 15 matching lines...) Expand all
1922 pWidgetData->m_bIsNull = TRUE; 1923 pWidgetData->m_bIsNull = TRUE;
1923 } else { 1924 } else {
1924 pWidgetData->m_bPreNull = pWidgetData->m_bIsNull; 1925 pWidgetData->m_bPreNull = pWidgetData->m_bIsNull;
1925 pWidgetData->m_bIsNull = FALSE; 1926 pWidgetData->m_bIsNull = FALSE;
1926 } 1927 }
1927 CFX_WideString wsNewText; 1928 CFX_WideString wsNewText;
1928 if (!(pValue && (pValue->IsNull() || pValue->IsUndefined()))) 1929 if (!(pValue && (pValue->IsNull() || pValue->IsUndefined())))
1929 wsNewText = pValue->ToWideString(); 1930 wsNewText = pValue->ToWideString();
1930 1931
1931 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); 1932 CXFA_Node* pUIChild = pWidgetData->GetUIChild();
1932 if (pUIChild->GetClassID() == XFA_ELEMENT_NumericEdit) { 1933 if (pUIChild->GetClassID() == XFA_Element::NumericEdit) {
1933 int32_t iLeadDigits = 0; 1934 int32_t iLeadDigits = 0;
1934 int32_t iFracDigits = 0; 1935 int32_t iFracDigits = 0;
1935 pWidgetData->GetLeadDigits(iLeadDigits); 1936 pWidgetData->GetLeadDigits(iLeadDigits);
1936 pWidgetData->GetFracDigits(iFracDigits); 1937 pWidgetData->GetFracDigits(iFracDigits);
1937 wsNewText = 1938 wsNewText =
1938 pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits); 1939 pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits);
1939 } 1940 }
1940 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); 1941 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
1941 CFX_WideString wsFormatText(wsNewText); 1942 CFX_WideString wsFormatText(wsNewText);
1942 if (pContainerWidgetData) { 1943 if (pContainerWidgetData) {
1943 pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText); 1944 pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText);
1944 } 1945 }
1945 SetScriptContent(wsNewText, wsFormatText, true, TRUE); 1946 SetScriptContent(wsNewText, wsFormatText, true, TRUE);
1946 } else { 1947 } else {
1947 CFX_WideString content = GetScriptContent(TRUE); 1948 CFX_WideString content = GetScriptContent(TRUE);
1948 if (content.IsEmpty()) { 1949 if (content.IsEmpty()) {
1949 pValue->SetNull(); 1950 pValue->SetNull();
1950 } else { 1951 } else {
1951 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); 1952 CXFA_Node* pUIChild = pWidgetData->GetUIChild();
1952 XFA_ELEMENT eUI = pUIChild->GetClassID(); 1953 XFA_Element eUI = pUIChild->GetClassID();
1953 CXFA_Value defVal = pWidgetData->GetFormValue(); 1954 CXFA_Value defVal = pWidgetData->GetFormValue();
1954 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); 1955 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild);
1955 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Decimal) { 1956 if (pNode && pNode->GetClassID() == XFA_Element::Decimal) {
1956 if (eUI == XFA_ELEMENT_NumericEdit && 1957 if (eUI == XFA_Element::NumericEdit &&
1957 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { 1958 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) {
1958 pValue->SetString( 1959 pValue->SetString(
1959 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); 1960 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC());
1960 } else { 1961 } else {
1961 CFX_Decimal decimal(content.AsStringC()); 1962 CFX_Decimal decimal(content.AsStringC());
1962 pValue->SetFloat((FX_FLOAT)(double)decimal); 1963 pValue->SetFloat((FX_FLOAT)(double)decimal);
1963 } 1964 }
1964 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) { 1965 } else if (pNode && pNode->GetClassID() == XFA_Element::Integer) {
1965 pValue->SetInteger(FXSYS_wtoi(content.c_str())); 1966 pValue->SetInteger(FXSYS_wtoi(content.c_str()));
1966 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) { 1967 } else if (pNode && pNode->GetClassID() == XFA_Element::Boolean) {
1967 pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? FALSE : TRUE); 1968 pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? FALSE : TRUE);
1968 } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) { 1969 } else if (pNode && pNode->GetClassID() == XFA_Element::Float) {
1969 CFX_Decimal decimal(content.AsStringC()); 1970 CFX_Decimal decimal(content.AsStringC());
1970 pValue->SetFloat((FX_FLOAT)(double)decimal); 1971 pValue->SetFloat((FX_FLOAT)(double)decimal);
1971 } else { 1972 } else {
1972 pValue->SetString( 1973 pValue->SetString(
1973 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); 1974 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC());
1974 } 1975 }
1975 } 1976 }
1976 } 1977 }
1977 } 1978 }
1978 void CXFA_Node::Script_Field_EditValue(CFXJSE_Value* pValue, 1979 void CXFA_Node::Script_Field_EditValue(CFXJSE_Value* pValue,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 return; 2100 return;
2100 } 2101 }
2101 pWidgetData->DeleteItem(-1, TRUE); 2102 pWidgetData->DeleteItem(-1, TRUE);
2102 } 2103 }
2103 void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { 2104 void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) {
2104 int32_t argc = pArguments->GetLength(); 2105 int32_t argc = pArguments->GetLength();
2105 if (argc == 1) { 2106 if (argc == 1) {
2106 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2107 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2107 int32_t iRet = execSingleEventByName( 2108 int32_t iRet = execSingleEventByName(
2108 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), 2109 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
2109 XFA_ELEMENT_Field); 2110 XFA_Element::Field);
2110 if (eventString == "validate") { 2111 if (eventString == "validate") {
2111 pArguments->GetReturnValue()->SetBoolean( 2112 pArguments->GetReturnValue()->SetBoolean(
2112 (iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE); 2113 (iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE);
2113 } 2114 }
2114 } else { 2115 } else {
2115 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2116 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2116 } 2117 }
2117 } 2118 }
2118 void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) { 2119 void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) {
2119 int32_t argc = pArguments->GetLength(); 2120 int32_t argc = pArguments->GetLength();
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 } 2327 }
2327 void CXFA_Node::Script_ExclGroup_Transient(CFXJSE_Value* pValue, 2328 void CXFA_Node::Script_ExclGroup_Transient(CFXJSE_Value* pValue,
2328 FX_BOOL bSetting, 2329 FX_BOOL bSetting,
2329 XFA_ATTRIBUTE eAttribute) {} 2330 XFA_ATTRIBUTE eAttribute) {}
2330 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { 2331 void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) {
2331 int32_t argc = pArguments->GetLength(); 2332 int32_t argc = pArguments->GetLength();
2332 if (argc == 1) { 2333 if (argc == 1) {
2333 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2334 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2334 execSingleEventByName( 2335 execSingleEventByName(
2335 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), 2336 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
2336 XFA_ELEMENT_ExclGroup); 2337 XFA_Element::ExclGroup);
2337 } else { 2338 } else {
2338 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2339 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2339 } 2340 }
2340 } 2341 }
2341 2342
2342 void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { 2343 void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) {
2343 int32_t argc = pArguments->GetLength(); 2344 int32_t argc = pArguments->GetLength();
2344 if (argc < 0 || argc > 1) { 2345 if (argc < 0 || argc > 1) {
2345 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"selectedMember"); 2346 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"selectedMember");
2346 return; 2347 return;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2408 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate"); 2409 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate");
2409 } 2410 }
2410 } 2411 }
2411 static CXFA_Node* XFA_ScriptInstanceManager_GetItem(CXFA_Node* pInstMgrNode, 2412 static CXFA_Node* XFA_ScriptInstanceManager_GetItem(CXFA_Node* pInstMgrNode,
2412 int32_t iIndex) { 2413 int32_t iIndex) {
2413 ASSERT(pInstMgrNode); 2414 ASSERT(pInstMgrNode);
2414 int32_t iCount = 0; 2415 int32_t iCount = 0;
2415 uint32_t dwNameHash = 0; 2416 uint32_t dwNameHash = 0;
2416 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); 2417 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling);
2417 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 2418 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
2418 XFA_ELEMENT eCurType = pNode->GetClassID(); 2419 XFA_Element eCurType = pNode->GetClassID();
2419 if (eCurType == XFA_ELEMENT_InstanceManager) { 2420 if (eCurType == XFA_Element::InstanceManager) {
2420 break; 2421 break;
2421 } 2422 }
2422 if ((eCurType != XFA_ELEMENT_Subform) && 2423 if ((eCurType != XFA_Element::Subform) &&
2423 (eCurType != XFA_ELEMENT_SubformSet)) { 2424 (eCurType != XFA_Element::SubformSet)) {
2424 continue; 2425 continue;
2425 } 2426 }
2426 if (iCount == 0) { 2427 if (iCount == 0) {
2427 CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name); 2428 CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name);
2428 CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name); 2429 CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name);
2429 if (wsInstName.GetLength() < 1 || wsInstName.GetAt(0) != '_' || 2430 if (wsInstName.GetLength() < 1 || wsInstName.GetAt(0) != '_' ||
2430 wsInstName.Mid(1) != wsName) { 2431 wsInstName.Mid(1) != wsName) {
2431 return nullptr; 2432 return nullptr;
2432 } 2433 }
2433 dwNameHash = pNode->GetNameHash(); 2434 dwNameHash = pNode->GetNameHash();
(...skipping 10 matching lines...) Expand all
2444 } 2445 }
2445 void CXFA_Node::Script_Som_InstanceIndex(CFXJSE_Value* pValue, 2446 void CXFA_Node::Script_Som_InstanceIndex(CFXJSE_Value* pValue,
2446 FX_BOOL bSetting, 2447 FX_BOOL bSetting,
2447 XFA_ATTRIBUTE eAttribute) { 2448 XFA_ATTRIBUTE eAttribute) {
2448 if (bSetting) { 2449 if (bSetting) {
2449 int32_t iTo = pValue->ToInteger(); 2450 int32_t iTo = pValue->ToInteger();
2450 int32_t iFrom = Subform_and_SubformSet_InstanceIndex(); 2451 int32_t iFrom = Subform_and_SubformSet_InstanceIndex();
2451 CXFA_Node* pManagerNode = nullptr; 2452 CXFA_Node* pManagerNode = nullptr;
2452 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; 2453 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode;
2453 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { 2454 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) {
2454 if (pNode->GetClassID() == XFA_ELEMENT_InstanceManager) { 2455 if (pNode->GetClassID() == XFA_Element::InstanceManager) {
2455 pManagerNode = pNode; 2456 pManagerNode = pNode;
2456 break; 2457 break;
2457 } 2458 }
2458 } 2459 }
2459 if (pManagerNode) { 2460 if (pManagerNode) {
2460 pManagerNode->InstanceManager_MoveInstance(iTo, iFrom); 2461 pManagerNode->InstanceManager_MoveInstance(iTo, iFrom);
2461 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2462 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2462 if (!pNotify) { 2463 if (!pNotify) {
2463 return; 2464 return;
2464 } 2465 }
2465 CXFA_Node* pToInstance = 2466 CXFA_Node* pToInstance =
2466 XFA_ScriptInstanceManager_GetItem(pManagerNode, iTo); 2467 XFA_ScriptInstanceManager_GetItem(pManagerNode, iTo);
2467 if (pToInstance && pToInstance->GetClassID() == XFA_ELEMENT_Subform) { 2468 if (pToInstance && pToInstance->GetClassID() == XFA_Element::Subform) {
2468 pNotify->RunSubformIndexChange(pToInstance); 2469 pNotify->RunSubformIndexChange(pToInstance);
2469 } 2470 }
2470 CXFA_Node* pFromInstance = 2471 CXFA_Node* pFromInstance =
2471 XFA_ScriptInstanceManager_GetItem(pManagerNode, iFrom); 2472 XFA_ScriptInstanceManager_GetItem(pManagerNode, iFrom);
2472 if (pFromInstance && pFromInstance->GetClassID() == XFA_ELEMENT_Subform) { 2473 if (pFromInstance &&
2474 pFromInstance->GetClassID() == XFA_Element::Subform) {
2473 pNotify->RunSubformIndexChange(pFromInstance); 2475 pNotify->RunSubformIndexChange(pFromInstance);
2474 } 2476 }
2475 } 2477 }
2476 } else { 2478 } else {
2477 pValue->SetInteger(Subform_and_SubformSet_InstanceIndex()); 2479 pValue->SetInteger(Subform_and_SubformSet_InstanceIndex());
2478 } 2480 }
2479 } 2481 }
2480 void CXFA_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue, 2482 void CXFA_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue,
2481 FX_BOOL bSetting, 2483 FX_BOOL bSetting,
2482 XFA_ATTRIBUTE eAttribute) { 2484 XFA_ATTRIBUTE eAttribute) {
2483 if (!bSetting) { 2485 if (!bSetting) {
2484 CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); 2486 CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name);
2485 CXFA_Node* pInstanceMgr = nullptr; 2487 CXFA_Node* pInstanceMgr = nullptr;
2486 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; 2488 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode;
2487 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { 2489 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) {
2488 if (pNode->GetClassID() == XFA_ELEMENT_InstanceManager) { 2490 if (pNode->GetClassID() == XFA_Element::InstanceManager) {
2489 CFX_WideStringC wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name); 2491 CFX_WideStringC wsInstMgrName = pNode->GetCData(XFA_ATTRIBUTE_Name);
2490 if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName.GetAt(0) == '_' && 2492 if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName.GetAt(0) == '_' &&
2491 wsInstMgrName.Mid(1) == wsName) { 2493 wsInstMgrName.Mid(1) == wsName) {
2492 pInstanceMgr = pNode; 2494 pInstanceMgr = pNode;
2493 } 2495 }
2494 break; 2496 break;
2495 } 2497 }
2496 } 2498 }
2497 if (pInstanceMgr) { 2499 if (pInstanceMgr) {
2498 pValue->Assign( 2500 pValue->Assign(
(...skipping 17 matching lines...) Expand all
2516 FX_UTF8Encode(wsLocaleName.c_str(), wsLocaleName.GetLength()) 2518 FX_UTF8Encode(wsLocaleName.c_str(), wsLocaleName.GetLength())
2517 .AsStringC()); 2519 .AsStringC());
2518 } 2520 }
2519 } 2521 }
2520 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { 2522 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) {
2521 int32_t argc = pArguments->GetLength(); 2523 int32_t argc = pArguments->GetLength();
2522 if (argc == 1) { 2524 if (argc == 1) {
2523 CFX_ByteString eventString = pArguments->GetUTF8String(0); 2525 CFX_ByteString eventString = pArguments->GetUTF8String(0);
2524 execSingleEventByName( 2526 execSingleEventByName(
2525 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), 2527 CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(),
2526 XFA_ELEMENT_Subform); 2528 XFA_Element::Subform);
2527 } else { 2529 } else {
2528 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); 2530 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
2529 } 2531 }
2530 } 2532 }
2531 void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) { 2533 void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) {
2532 int32_t argc = pArguments->GetLength(); 2534 int32_t argc = pArguments->GetLength();
2533 if (argc == 0) { 2535 if (argc == 0) {
2534 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 2536 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
2535 if (!pNotify) { 2537 if (!pNotify) {
2536 return; 2538 return;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2571 int32_t argc = pArguments->GetLength(); 2573 int32_t argc = pArguments->GetLength();
2572 if (argc == 0) { 2574 if (argc == 0) {
2573 } else { 2575 } else {
2574 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getInvalidObjects"); 2576 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"getInvalidObjects");
2575 } 2577 }
2576 } 2578 }
2577 int32_t CXFA_Node::Subform_and_SubformSet_InstanceIndex() { 2579 int32_t CXFA_Node::Subform_and_SubformSet_InstanceIndex() {
2578 int32_t index = 0; 2580 int32_t index = 0;
2579 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; 2581 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode;
2580 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { 2582 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) {
2581 if ((pNode->GetClassID() == XFA_ELEMENT_Subform) || 2583 if ((pNode->GetClassID() == XFA_Element::Subform) ||
2582 (pNode->GetClassID() == XFA_ELEMENT_SubformSet)) { 2584 (pNode->GetClassID() == XFA_Element::SubformSet)) {
2583 index++; 2585 index++;
2584 } else { 2586 } else {
2585 break; 2587 break;
2586 } 2588 }
2587 } 2589 }
2588 return index; 2590 return index;
2589 } 2591 }
2590 void CXFA_Node::Script_Template_FormNodes(CFXJSE_Arguments* pArguments) { 2592 void CXFA_Node::Script_Template_FormNodes(CFXJSE_Arguments* pArguments) {
2591 int32_t argc = pArguments->GetLength(); 2593 int32_t argc = pArguments->GetLength();
2592 if (argc == 1) { 2594 if (argc == 1) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2725 } 2727 }
2726 CXFA_Occur nodeOccur(GetOccurNode()); 2728 CXFA_Occur nodeOccur(GetOccurNode());
2727 pValue->SetInteger(nodeOccur.GetMin()); 2729 pValue->SetInteger(nodeOccur.GetMin());
2728 } 2730 }
2729 static int32_t XFA_ScriptInstanceManager_GetCount(CXFA_Node* pInstMgrNode) { 2731 static int32_t XFA_ScriptInstanceManager_GetCount(CXFA_Node* pInstMgrNode) {
2730 ASSERT(pInstMgrNode); 2732 ASSERT(pInstMgrNode);
2731 int32_t iCount = 0; 2733 int32_t iCount = 0;
2732 uint32_t dwNameHash = 0; 2734 uint32_t dwNameHash = 0;
2733 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling); 2735 for (CXFA_Node* pNode = pInstMgrNode->GetNodeItem(XFA_NODEITEM_NextSibling);
2734 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 2736 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
2735 XFA_ELEMENT eCurType = pNode->GetClassID(); 2737 XFA_Element eCurType = pNode->GetClassID();
2736 if (eCurType == XFA_ELEMENT_InstanceManager) { 2738 if (eCurType == XFA_Element::InstanceManager) {
2737 break; 2739 break;
2738 } 2740 }
2739 if ((eCurType != XFA_ELEMENT_Subform) && 2741 if ((eCurType != XFA_Element::Subform) &&
2740 (eCurType != XFA_ELEMENT_SubformSet)) { 2742 (eCurType != XFA_Element::SubformSet)) {
2741 continue; 2743 continue;
2742 } 2744 }
2743 if (iCount == 0) { 2745 if (iCount == 0) {
2744 CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name); 2746 CFX_WideStringC wsName = pNode->GetCData(XFA_ATTRIBUTE_Name);
2745 CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name); 2747 CFX_WideStringC wsInstName = pInstMgrNode->GetCData(XFA_ATTRIBUTE_Name);
2746 if (wsInstName.GetLength() < 1 || wsInstName.GetAt(0) != '_' || 2748 if (wsInstName.GetLength() < 1 || wsInstName.GetAt(0) != '_' ||
2747 wsInstName.Mid(1) != wsName) { 2749 wsInstName.Mid(1) != wsName) {
2748 return iCount; 2750 return iCount;
2749 } 2751 }
2750 dwNameHash = pNode->GetNameHash(); 2752 dwNameHash = pNode->GetNameHash();
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
3016 return; 3018 return;
3017 } 3019 }
3018 int32_t iFrom = pArguments->GetInt32(0); 3020 int32_t iFrom = pArguments->GetInt32(0);
3019 int32_t iTo = pArguments->GetInt32(1); 3021 int32_t iTo = pArguments->GetInt32(1);
3020 InstanceManager_MoveInstance(iTo, iFrom); 3022 InstanceManager_MoveInstance(iTo, iFrom);
3021 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 3023 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
3022 if (!pNotify) { 3024 if (!pNotify) {
3023 return; 3025 return;
3024 } 3026 }
3025 CXFA_Node* pToInstance = XFA_ScriptInstanceManager_GetItem(this, iTo); 3027 CXFA_Node* pToInstance = XFA_ScriptInstanceManager_GetItem(this, iTo);
3026 if (pToInstance && pToInstance->GetClassID() == XFA_ELEMENT_Subform) { 3028 if (pToInstance && pToInstance->GetClassID() == XFA_Element::Subform) {
3027 pNotify->RunSubformIndexChange(pToInstance); 3029 pNotify->RunSubformIndexChange(pToInstance);
3028 } 3030 }
3029 CXFA_Node* pFromInstance = XFA_ScriptInstanceManager_GetItem(this, iFrom); 3031 CXFA_Node* pFromInstance = XFA_ScriptInstanceManager_GetItem(this, iFrom);
3030 if (pFromInstance && pFromInstance->GetClassID() == XFA_ELEMENT_Subform) { 3032 if (pFromInstance && pFromInstance->GetClassID() == XFA_Element::Subform) {
3031 pNotify->RunSubformIndexChange(pFromInstance); 3033 pNotify->RunSubformIndexChange(pFromInstance);
3032 } 3034 }
3033 } 3035 }
3034 void CXFA_Node::Script_InstanceManager_RemoveInstance( 3036 void CXFA_Node::Script_InstanceManager_RemoveInstance(
3035 CFXJSE_Arguments* pArguments) { 3037 CFXJSE_Arguments* pArguments) {
3036 int32_t argc = pArguments->GetLength(); 3038 int32_t argc = pArguments->GetLength();
3037 if (argc != 1) { 3039 if (argc != 1) {
3038 pArguments->GetReturnValue()->SetUndefined(); 3040 pArguments->GetReturnValue()->SetUndefined();
3039 return; 3041 return;
3040 } 3042 }
3041 int32_t iIndex = pArguments->GetInt32(0); 3043 int32_t iIndex = pArguments->GetInt32(0);
3042 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this); 3044 int32_t iCount = XFA_ScriptInstanceManager_GetCount(this);
3043 if (iIndex < 0 || iIndex >= iCount) { 3045 if (iIndex < 0 || iIndex >= iCount) {
3044 ThrowException(XFA_IDS_INDEX_OUT_OF_BOUNDS); 3046 ThrowException(XFA_IDS_INDEX_OUT_OF_BOUNDS);
3045 return; 3047 return;
3046 } 3048 }
3047 CXFA_Occur nodeOccur(GetOccurNode()); 3049 CXFA_Occur nodeOccur(GetOccurNode());
3048 int32_t iMin = nodeOccur.GetMin(); 3050 int32_t iMin = nodeOccur.GetMin();
3049 if (iCount - 1 < iMin) { 3051 if (iCount - 1 < iMin) {
3050 ThrowException(XFA_IDS_VIOLATE_BOUNDARY, L"min"); 3052 ThrowException(XFA_IDS_VIOLATE_BOUNDARY, L"min");
3051 return; 3053 return;
3052 } 3054 }
3053 CXFA_Node* pRemoveInstance = XFA_ScriptInstanceManager_GetItem(this, iIndex); 3055 CXFA_Node* pRemoveInstance = XFA_ScriptInstanceManager_GetItem(this, iIndex);
3054 XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance); 3056 XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance);
3055 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 3057 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
3056 if (pNotify) { 3058 if (pNotify) {
3057 for (int32_t i = iIndex; i < iCount - 1; i++) { 3059 for (int32_t i = iIndex; i < iCount - 1; i++) {
3058 CXFA_Node* pSubformInstance = XFA_ScriptInstanceManager_GetItem(this, i); 3060 CXFA_Node* pSubformInstance = XFA_ScriptInstanceManager_GetItem(this, i);
3059 if (pSubformInstance && 3061 if (pSubformInstance &&
3060 pSubformInstance->GetClassID() == XFA_ELEMENT_Subform) { 3062 pSubformInstance->GetClassID() == XFA_Element::Subform) {
3061 pNotify->RunSubformIndexChange(pSubformInstance); 3063 pNotify->RunSubformIndexChange(pSubformInstance);
3062 } 3064 }
3063 } 3065 }
3064 } 3066 }
3065 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); 3067 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor();
3066 if (!pLayoutPro) { 3068 if (!pLayoutPro) {
3067 return; 3069 return;
3068 } 3070 }
3069 pLayoutPro->AddChangedContainer( 3071 pLayoutPro->AddChangedContainer(
3070 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form))); 3072 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Form)));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3178 CFX_WideString(wsInstManagerName.IsEmpty() ? wsInstManagerName 3180 CFX_WideString(wsInstManagerName.IsEmpty() ? wsInstManagerName
3179 : wsInstManagerName.Mid(1)); 3181 : wsInstManagerName.Mid(1));
3180 uint32_t dInstanceNameHash = 3182 uint32_t dInstanceNameHash =
3181 FX_HashCode_GetW(wsInstanceName.AsStringC(), false); 3183 FX_HashCode_GetW(wsInstanceName.AsStringC(), false);
3182 CXFA_Node* pPrevSibling = 3184 CXFA_Node* pPrevSibling =
3183 (iDesired == 0) ? this 3185 (iDesired == 0) ? this
3184 : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1); 3186 : XFA_ScriptInstanceManager_GetItem(this, iDesired - 1);
3185 while (iCount > iDesired) { 3187 while (iCount > iDesired) {
3186 CXFA_Node* pRemoveInstance = 3188 CXFA_Node* pRemoveInstance =
3187 pPrevSibling->GetNodeItem(XFA_NODEITEM_NextSibling); 3189 pPrevSibling->GetNodeItem(XFA_NODEITEM_NextSibling);
3188 if (pRemoveInstance->GetClassID() != XFA_ELEMENT_Subform && 3190 if (pRemoveInstance->GetClassID() != XFA_Element::Subform &&
3189 pRemoveInstance->GetClassID() != XFA_ELEMENT_SubformSet) { 3191 pRemoveInstance->GetClassID() != XFA_Element::SubformSet) {
3190 continue; 3192 continue;
3191 } 3193 }
3192 if (pRemoveInstance->GetClassID() == XFA_ELEMENT_InstanceManager) { 3194 if (pRemoveInstance->GetClassID() == XFA_Element::InstanceManager) {
3193 ASSERT(FALSE); 3195 ASSERT(FALSE);
3194 break; 3196 break;
3195 } 3197 }
3196 if (pRemoveInstance->GetNameHash() == dInstanceNameHash) { 3198 if (pRemoveInstance->GetNameHash() == dInstanceNameHash) {
3197 XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance); 3199 XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance);
3198 iCount--; 3200 iCount--;
3199 } 3201 }
3200 } 3202 }
3201 } else if (iDesired > iCount) { 3203 } else if (iDesired > iCount) {
3202 while (iCount < iDesired) { 3204 while (iCount < iDesired) {
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
3593 FX_BOOL bSetting, 3595 FX_BOOL bSetting,
3594 XFA_ATTRIBUTE eAttribute) {} 3596 XFA_ATTRIBUTE eAttribute) {}
3595 enum XFA_KEYTYPE { 3597 enum XFA_KEYTYPE {
3596 XFA_KEYTYPE_Custom, 3598 XFA_KEYTYPE_Custom,
3597 XFA_KEYTYPE_Element, 3599 XFA_KEYTYPE_Element,
3598 }; 3600 };
3599 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { 3601 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) {
3600 uint32_t dwKey = FX_HashCode_GetW(wsKey, false); 3602 uint32_t dwKey = FX_HashCode_GetW(wsKey, false);
3601 return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom); 3603 return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom);
3602 } 3604 }
3603 void* XFA_GetMapKey_Element(XFA_ELEMENT eElement, XFA_ATTRIBUTE eAttribute) { 3605 void* XFA_GetMapKey_Element(XFA_Element eElement, XFA_ATTRIBUTE eAttribute) {
3604 return (void*)(uintptr_t)((eElement << 16) | (eAttribute << 8) | 3606 return (void*)(uintptr_t)((static_cast<int32_t>(eElement) << 16) |
3605 XFA_KEYTYPE_Element); 3607 (eAttribute << 8) | XFA_KEYTYPE_Element);
3606 } 3608 }
3607 FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) { 3609 FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) {
3608 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); 3610 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
3609 return HasMapModuleKey(pKey, bCanInherit); 3611 return HasMapModuleKey(pKey, bCanInherit);
3610 } 3612 }
3611 FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, 3613 FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr,
3612 const CFX_WideStringC& wsValue, 3614 const CFX_WideStringC& wsValue,
3613 bool bNotify) { 3615 bool bNotify) {
3614 const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); 3616 const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr);
3615 if (!pAttr) 3617 if (!pAttr)
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
3810 if (eAttr == XFA_ATTRIBUTE_Name) 3812 if (eAttr == XFA_ATTRIBUTE_Name)
3811 UpdateNameHash(); 3813 UpdateNameHash();
3812 } 3814 }
3813 OnChanged(eAttr, bNotify, bScriptModify); 3815 OnChanged(eAttr, bNotify, bScriptModify);
3814 3816
3815 if (!IsNeedSavingXMLNode() || eAttr == XFA_ATTRIBUTE_QualifiedName || 3817 if (!IsNeedSavingXMLNode() || eAttr == XFA_ATTRIBUTE_QualifiedName ||
3816 eAttr == XFA_ATTRIBUTE_BindingNode) { 3818 eAttr == XFA_ATTRIBUTE_BindingNode) {
3817 return TRUE; 3819 return TRUE;
3818 } 3820 }
3819 3821
3820 if (eAttr == XFA_ATTRIBUTE_Name && (m_eNodeClass == XFA_ELEMENT_DataValue || 3822 if (eAttr == XFA_ATTRIBUTE_Name && (m_eNodeClass == XFA_Element::DataValue ||
3821 m_eNodeClass == XFA_ELEMENT_DataGroup)) { 3823 m_eNodeClass == XFA_Element::DataGroup)) {
3822 return TRUE; 3824 return TRUE;
3823 } 3825 }
3824 3826
3825 if (eAttr == XFA_ATTRIBUTE_Value) { 3827 if (eAttr == XFA_ATTRIBUTE_Value) {
3826 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); 3828 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
3827 switch (eXMLType) { 3829 switch (eXMLType) {
3828 case FDE_XMLNODE_Element: 3830 case FDE_XMLNODE_Element:
3829 if (IsAttributeInXML()) { 3831 if (IsAttributeInXML()) {
3830 static_cast<CFDE_XMLElement*>(m_pXMLNode) 3832 static_cast<CFDE_XMLElement*>(m_pXMLNode)
3831 ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), 3833 ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)),
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
4053 FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, 4055 FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
4054 const CFX_WideString& wsXMLValue, 4056 const CFX_WideString& wsXMLValue,
4055 bool bNotify, 4057 bool bNotify,
4056 FX_BOOL bScriptModify, 4058 FX_BOOL bScriptModify,
4057 FX_BOOL bSyncData) { 4059 FX_BOOL bSyncData) {
4058 CXFA_Node* pNode = nullptr; 4060 CXFA_Node* pNode = nullptr;
4059 CXFA_Node* pBindNode = nullptr; 4061 CXFA_Node* pBindNode = nullptr;
4060 switch (GetObjectType()) { 4062 switch (GetObjectType()) {
4061 case XFA_ObjectType::ContainerNode: { 4063 case XFA_ObjectType::ContainerNode: {
4062 if (XFA_FieldIsMultiListBox(this)) { 4064 if (XFA_FieldIsMultiListBox(this)) {
4063 CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value); 4065 CXFA_Node* pValue = GetProperty(0, XFA_Element::Value);
4064 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); 4066 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild);
4065 ASSERT(pChildValue); 4067 ASSERT(pChildValue);
4066 pChildValue->SetCData(XFA_ATTRIBUTE_ContentType, L"text/xml"); 4068 pChildValue->SetCData(XFA_ATTRIBUTE_ContentType, L"text/xml");
4067 pChildValue->SetScriptContent(wsContent, wsContent, bNotify, 4069 pChildValue->SetScriptContent(wsContent, wsContent, bNotify,
4068 bScriptModify, FALSE); 4070 bScriptModify, FALSE);
4069 CXFA_Node* pBind = GetBindData(); 4071 CXFA_Node* pBind = GetBindData();
4070 if (bSyncData && pBind) { 4072 if (bSyncData && pBind) {
4071 CFX_WideStringArray wsSaveTextArray; 4073 CFX_WideStringArray wsSaveTextArray;
4072 int32_t iSize = 0; 4074 int32_t iSize = 0;
4073 if (!wsContent.IsEmpty()) { 4075 if (!wsContent.IsEmpty()) {
(...skipping 15 matching lines...) Expand all
4089 iSize = wsSaveTextArray.GetSize(); 4091 iSize = wsSaveTextArray.GetSize();
4090 } 4092 }
4091 if (iSize == 0) { 4093 if (iSize == 0) {
4092 while (CXFA_Node* pChildNode = 4094 while (CXFA_Node* pChildNode =
4093 pBind->GetNodeItem(XFA_NODEITEM_FirstChild)) { 4095 pBind->GetNodeItem(XFA_NODEITEM_FirstChild)) {
4094 pBind->RemoveChild(pChildNode); 4096 pBind->RemoveChild(pChildNode);
4095 } 4097 }
4096 } else { 4098 } else {
4097 CXFA_NodeArray valueNodes; 4099 CXFA_NodeArray valueNodes;
4098 int32_t iDatas = pBind->GetNodeList( 4100 int32_t iDatas = pBind->GetNodeList(
4099 valueNodes, XFA_NODEFILTER_Children, XFA_ELEMENT_DataValue); 4101 valueNodes, XFA_NODEFILTER_Children, XFA_Element::DataValue);
4100 if (iDatas < iSize) { 4102 if (iDatas < iSize) {
4101 int32_t iAddNodes = iSize - iDatas; 4103 int32_t iAddNodes = iSize - iDatas;
4102 CXFA_Node* pValueNodes = nullptr; 4104 CXFA_Node* pValueNodes = nullptr;
4103 while (iAddNodes-- > 0) { 4105 while (iAddNodes-- > 0) {
4104 pValueNodes = 4106 pValueNodes =
4105 pBind->CreateSamePacketNode(XFA_ELEMENT_DataValue); 4107 pBind->CreateSamePacketNode(XFA_Element::DataValue);
4106 pValueNodes->SetCData(XFA_ATTRIBUTE_Name, L"value"); 4108 pValueNodes->SetCData(XFA_ATTRIBUTE_Name, L"value");
4107 pValueNodes->CreateXMLMappingNode(); 4109 pValueNodes->CreateXMLMappingNode();
4108 pBind->InsertChild(pValueNodes); 4110 pBind->InsertChild(pValueNodes);
4109 } 4111 }
4110 pValueNodes = nullptr; 4112 pValueNodes = nullptr;
4111 } else if (iDatas > iSize) { 4113 } else if (iDatas > iSize) {
4112 int32_t iDelNodes = iDatas - iSize; 4114 int32_t iDelNodes = iDatas - iSize;
4113 while (iDelNodes-- > 0) { 4115 while (iDelNodes-- > 0) {
4114 pBind->RemoveChild(pBind->GetNodeItem(XFA_NODEITEM_FirstChild)); 4116 pBind->RemoveChild(pBind->GetNodeItem(XFA_NODEITEM_FirstChild));
4115 } 4117 }
(...skipping 11 matching lines...) Expand all
4127 CXFA_NodeArray nodeArray; 4129 CXFA_NodeArray nodeArray;
4128 pBind->GetBindItems(nodeArray); 4130 pBind->GetBindItems(nodeArray);
4129 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { 4131 for (int32_t i = 0; i < nodeArray.GetSize(); i++) {
4130 if (nodeArray[i] != this) { 4132 if (nodeArray[i] != this) {
4131 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, 4133 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify,
4132 bScriptModify, FALSE); 4134 bScriptModify, FALSE);
4133 } 4135 }
4134 } 4136 }
4135 } 4137 }
4136 break; 4138 break;
4137 } else if (GetClassID() == XFA_ELEMENT_ExclGroup) { 4139 } else if (GetClassID() == XFA_Element::ExclGroup) {
4138 pNode = this; 4140 pNode = this;
4139 } else { 4141 } else {
4140 CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value); 4142 CXFA_Node* pValue = GetProperty(0, XFA_Element::Value);
4141 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); 4143 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild);
4142 ASSERT(pChildValue); 4144 ASSERT(pChildValue);
4143 pChildValue->SetScriptContent(wsContent, wsContent, bNotify, 4145 pChildValue->SetScriptContent(wsContent, wsContent, bNotify,
4144 bScriptModify, FALSE); 4146 bScriptModify, FALSE);
4145 } 4147 }
4146 pBindNode = GetBindData(); 4148 pBindNode = GetBindData();
4147 if (pBindNode && bSyncData) { 4149 if (pBindNode && bSyncData) {
4148 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify, 4150 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify,
4149 bScriptModify, FALSE); 4151 bScriptModify, FALSE);
4150 CXFA_NodeArray nodeArray; 4152 CXFA_NodeArray nodeArray;
4151 pBindNode->GetBindItems(nodeArray); 4153 pBindNode->GetBindItems(nodeArray);
4152 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { 4154 for (int32_t i = 0; i < nodeArray.GetSize(); i++) {
4153 if (nodeArray[i] != this) { 4155 if (nodeArray[i] != this) {
4154 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, true, 4156 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, true,
4155 FALSE); 4157 FALSE);
4156 } 4158 }
4157 } 4159 }
4158 } 4160 }
4159 pBindNode = nullptr; 4161 pBindNode = nullptr;
4160 break; 4162 break;
4161 } 4163 }
4162 case XFA_ObjectType::ContentNode: { 4164 case XFA_ObjectType::ContentNode: {
4163 CFX_WideString wsContentType; 4165 CFX_WideString wsContentType;
4164 if (GetClassID() == XFA_ELEMENT_ExData) { 4166 if (GetClassID() == XFA_Element::ExData) {
4165 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); 4167 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE);
4166 if (wsContentType == FX_WSTRC(L"text/html")) { 4168 if (wsContentType == FX_WSTRC(L"text/html")) {
4167 wsContentType = FX_WSTRC(L""); 4169 wsContentType = FX_WSTRC(L"");
4168 SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType.AsStringC()); 4170 SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType.AsStringC());
4169 } 4171 }
4170 } 4172 }
4171 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); 4173 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild);
4172 if (!pContentRawDataNode) { 4174 if (!pContentRawDataNode) {
4173 pContentRawDataNode = CreateSamePacketNode( 4175 pContentRawDataNode = CreateSamePacketNode(
4174 (wsContentType == FX_WSTRC(L"text/xml")) ? XFA_ELEMENT_Sharpxml 4176 (wsContentType == FX_WSTRC(L"text/xml")) ? XFA_Element::Sharpxml
4175 : XFA_ELEMENT_Sharptext); 4177 : XFA_Element::Sharptext);
4176 InsertChild(pContentRawDataNode); 4178 InsertChild(pContentRawDataNode);
4177 } 4179 }
4178 return pContentRawDataNode->SetScriptContent( 4180 return pContentRawDataNode->SetScriptContent(
4179 wsContent, wsXMLValue, bNotify, bScriptModify, bSyncData); 4181 wsContent, wsXMLValue, bNotify, bScriptModify, bSyncData);
4180 } break; 4182 } break;
4181 case XFA_ObjectType::NodeC: 4183 case XFA_ObjectType::NodeC:
4182 case XFA_ObjectType::TextNode: 4184 case XFA_ObjectType::TextNode:
4183 pNode = this; 4185 pNode = this;
4184 break; 4186 break;
4185 case XFA_ObjectType::NodeV: 4187 case XFA_ObjectType::NodeV:
4186 pNode = this; 4188 pNode = this;
4187 if (bSyncData && GetPacketID() == XFA_XDPPACKET_Form) { 4189 if (bSyncData && GetPacketID() == XFA_XDPPACKET_Form) {
4188 CXFA_Node* pParent = GetNodeItem(XFA_NODEITEM_Parent); 4190 CXFA_Node* pParent = GetNodeItem(XFA_NODEITEM_Parent);
4189 if (pParent) { 4191 if (pParent) {
4190 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); 4192 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent);
4191 } 4193 }
4192 if (pParent && pParent->GetClassID() == XFA_ELEMENT_Value) { 4194 if (pParent && pParent->GetClassID() == XFA_Element::Value) {
4193 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); 4195 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent);
4194 if (pParent && pParent->IsContainerNode()) { 4196 if (pParent && pParent->IsContainerNode()) {
4195 pBindNode = pParent->GetBindData(); 4197 pBindNode = pParent->GetBindData();
4196 if (pBindNode) { 4198 if (pBindNode) {
4197 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify, 4199 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify,
4198 bScriptModify, FALSE); 4200 bScriptModify, FALSE);
4199 } 4201 }
4200 } 4202 }
4201 } 4203 }
4202 } 4204 }
4203 break; 4205 break;
4204 default: 4206 default:
4205 if (GetClassID() == XFA_ELEMENT_DataValue) { 4207 if (GetClassID() == XFA_Element::DataValue) {
4206 pNode = this; 4208 pNode = this;
4207 pBindNode = this; 4209 pBindNode = this;
4208 } 4210 }
4209 break; 4211 break;
4210 } 4212 }
4211 if (pNode) { 4213 if (pNode) {
4212 SetAttributeValue(wsContent, wsXMLValue, bNotify, bScriptModify); 4214 SetAttributeValue(wsContent, wsXMLValue, bNotify, bScriptModify);
4213 if (pBindNode && bSyncData) { 4215 if (pBindNode && bSyncData) {
4214 CXFA_NodeArray nodeArray; 4216 CXFA_NodeArray nodeArray;
4215 pBindNode->GetBindItems(nodeArray); 4217 pBindNode->GetBindItems(nodeArray);
(...skipping 20 matching lines...) Expand all
4236 } 4238 }
4237 CFX_WideString CXFA_Node::GetContent() { 4239 CFX_WideString CXFA_Node::GetContent() {
4238 return GetScriptContent(); 4240 return GetScriptContent();
4239 } 4241 }
4240 FX_BOOL CXFA_Node::TryContent(CFX_WideString& wsContent, 4242 FX_BOOL CXFA_Node::TryContent(CFX_WideString& wsContent,
4241 FX_BOOL bScriptModify, 4243 FX_BOOL bScriptModify,
4242 FX_BOOL bProto) { 4244 FX_BOOL bProto) {
4243 CXFA_Node* pNode = nullptr; 4245 CXFA_Node* pNode = nullptr;
4244 switch (GetObjectType()) { 4246 switch (GetObjectType()) {
4245 case XFA_ObjectType::ContainerNode: 4247 case XFA_ObjectType::ContainerNode:
4246 if (GetClassID() == XFA_ELEMENT_ExclGroup) { 4248 if (GetClassID() == XFA_Element::ExclGroup) {
4247 pNode = this; 4249 pNode = this;
4248 } else { 4250 } else {
4249 CXFA_Node* pValue = GetChild(0, XFA_ELEMENT_Value); 4251 CXFA_Node* pValue = GetChild(0, XFA_Element::Value);
4250 if (!pValue) { 4252 if (!pValue) {
4251 return FALSE; 4253 return FALSE;
4252 } 4254 }
4253 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); 4255 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild);
4254 if (pChildValue && XFA_FieldIsMultiListBox(this)) { 4256 if (pChildValue && XFA_FieldIsMultiListBox(this)) {
4255 pChildValue->SetAttribute(XFA_ATTRIBUTE_ContentType, 4257 pChildValue->SetAttribute(XFA_ATTRIBUTE_ContentType,
4256 FX_WSTRC(L"text/xml")); 4258 FX_WSTRC(L"text/xml"));
4257 } 4259 }
4258 return pChildValue 4260 return pChildValue
4259 ? pChildValue->TryContent(wsContent, bScriptModify, bProto) 4261 ? pChildValue->TryContent(wsContent, bScriptModify, bProto)
4260 : FALSE; 4262 : FALSE;
4261 } 4263 }
4262 break; 4264 break;
4263 case XFA_ObjectType::ContentNode: { 4265 case XFA_ObjectType::ContentNode: {
4264 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); 4266 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild);
4265 if (!pContentRawDataNode) { 4267 if (!pContentRawDataNode) {
4266 XFA_ELEMENT element = XFA_ELEMENT_Sharptext; 4268 XFA_Element element = XFA_Element::Sharptext;
4267 if (GetClassID() == XFA_ELEMENT_ExData) { 4269 if (GetClassID() == XFA_Element::ExData) {
4268 CFX_WideString wsContentType; 4270 CFX_WideString wsContentType;
4269 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); 4271 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE);
4270 if (wsContentType == FX_WSTRC(L"text/html")) { 4272 if (wsContentType == FX_WSTRC(L"text/html")) {
4271 element = XFA_ELEMENT_SharpxHTML; 4273 element = XFA_Element::SharpxHTML;
4272 } else if (wsContentType == FX_WSTRC(L"text/xml")) { 4274 } else if (wsContentType == FX_WSTRC(L"text/xml")) {
4273 element = XFA_ELEMENT_Sharpxml; 4275 element = XFA_Element::Sharpxml;
4274 } 4276 }
4275 } 4277 }
4276 pContentRawDataNode = CreateSamePacketNode(element); 4278 pContentRawDataNode = CreateSamePacketNode(element);
4277 InsertChild(pContentRawDataNode); 4279 InsertChild(pContentRawDataNode);
4278 } 4280 }
4279 return pContentRawDataNode->TryContent(wsContent, bScriptModify, bProto); 4281 return pContentRawDataNode->TryContent(wsContent, bScriptModify, bProto);
4280 } 4282 }
4281 case XFA_ObjectType::NodeC: 4283 case XFA_ObjectType::NodeC:
4282 case XFA_ObjectType::NodeV: 4284 case XFA_ObjectType::NodeV:
4283 case XFA_ObjectType::TextNode: 4285 case XFA_ObjectType::TextNode:
4284 pNode = this; 4286 pNode = this;
4285 default: 4287 default:
4286 if (GetClassID() == XFA_ELEMENT_DataValue) { 4288 if (GetClassID() == XFA_Element::DataValue) {
4287 pNode = this; 4289 pNode = this;
4288 } 4290 }
4289 break; 4291 break;
4290 } 4292 }
4291 if (pNode) { 4293 if (pNode) {
4292 if (bScriptModify) { 4294 if (bScriptModify) {
4293 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 4295 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
4294 if (pScriptContext) { 4296 if (pScriptContext) {
4295 m_pDocument->GetScriptContext()->AddNodesOfRunScript(this); 4297 m_pDocument->GetScriptContext()->AddNodesOfRunScript(this);
4296 } 4298 }
(...skipping 21 matching lines...) Expand all
4318 case XFA_XDPPACKET_SourceSet: 4320 case XFA_XDPPACKET_SourceSet:
4319 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet)); 4321 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet));
4320 case XFA_XDPPACKET_Xdc: 4322 case XFA_XDPPACKET_Xdc:
4321 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc)); 4323 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc));
4322 default: 4324 default:
4323 return this; 4325 return this;
4324 } 4326 }
4325 } 4327 }
4326 FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { 4328 FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) {
4327 wsNamespace.clear(); 4329 wsNamespace.clear();
4328 if (IsModelNode() || GetClassID() == XFA_ELEMENT_Packet) { 4330 if (IsModelNode() || GetClassID() == XFA_Element::Packet) {
4329 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); 4331 CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
4330 if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) { 4332 if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) {
4331 return FALSE; 4333 return FALSE;
4332 } 4334 }
4333 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); 4335 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace);
4334 return TRUE; 4336 return TRUE;
4335 } else if (GetPacketID() == XFA_XDPPACKET_Datasets) { 4337 } else if (GetPacketID() == XFA_XDPPACKET_Datasets) {
4336 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); 4338 CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
4337 if (!pXMLNode) { 4339 if (!pXMLNode) {
4338 return FALSE; 4340 return FALSE;
4339 } 4341 }
4340 if (pXMLNode->GetType() != FDE_XMLNODE_Element) { 4342 if (pXMLNode->GetType() != FDE_XMLNODE_Element) {
4341 return TRUE; 4343 return TRUE;
4342 } 4344 }
4343 if (GetClassID() == XFA_ELEMENT_DataValue && 4345 if (GetClassID() == XFA_Element::DataValue &&
4344 GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) { 4346 GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) {
4345 return XFA_FDEExtension_ResolveNamespaceQualifier( 4347 return XFA_FDEExtension_ResolveNamespaceQualifier(
4346 static_cast<CFDE_XMLElement*>(pXMLNode), 4348 static_cast<CFDE_XMLElement*>(pXMLNode),
4347 GetCData(XFA_ATTRIBUTE_QualifiedName), wsNamespace); 4349 GetCData(XFA_ATTRIBUTE_QualifiedName), wsNamespace);
4348 } 4350 }
4349 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); 4351 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace);
4350 return TRUE; 4352 return TRUE;
4351 } else { 4353 } else {
4352 CXFA_Node* pModelNode = GetModelNode(); 4354 CXFA_Node* pModelNode = GetModelNode();
4353 return pModelNode->TryNamespace(wsNamespace); 4355 return pModelNode->TryNamespace(wsNamespace);
4354 } 4356 }
4355 } 4357 }
4356 CXFA_Node* CXFA_Node::GetProperty(int32_t index, 4358 CXFA_Node* CXFA_Node::GetProperty(int32_t index,
4357 XFA_ELEMENT eProperty, 4359 XFA_Element eProperty,
4358 FX_BOOL bCreateProperty) { 4360 FX_BOOL bCreateProperty) {
4359 XFA_ELEMENT eElement = GetClassID(); 4361 XFA_Element eElement = GetClassID();
4360 uint32_t dwPacket = GetPacketID(); 4362 uint32_t dwPacket = GetPacketID();
4361 const XFA_PROPERTY* pProperty = 4363 const XFA_PROPERTY* pProperty =
4362 XFA_GetPropertyOfElement(eElement, eProperty, dwPacket); 4364 XFA_GetPropertyOfElement(eElement, eProperty, dwPacket);
4363 if (!pProperty || index >= pProperty->uOccur) 4365 if (!pProperty || index >= pProperty->uOccur)
4364 return nullptr; 4366 return nullptr;
4365 4367
4366 CXFA_Node* pNode = m_pChild; 4368 CXFA_Node* pNode = m_pChild;
4367 int32_t iCount = 0; 4369 int32_t iCount = 0;
4368 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4370 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4369 if (pNode->GetClassID() == eProperty) { 4371 if (pNode->GetClassID() == eProperty) {
(...skipping 20 matching lines...) Expand all
4390 CXFA_Node* pNewNode = nullptr; 4392 CXFA_Node* pNewNode = nullptr;
4391 for (; iCount <= index; iCount++) { 4393 for (; iCount <= index; iCount++) {
4392 pNewNode = pFactory->CreateNode(pPacket, eProperty); 4394 pNewNode = pFactory->CreateNode(pPacket, eProperty);
4393 if (!pNewNode) 4395 if (!pNewNode)
4394 return nullptr; 4396 return nullptr;
4395 InsertChild(pNewNode, nullptr); 4397 InsertChild(pNewNode, nullptr);
4396 pNewNode->SetFlag(XFA_NodeFlag_Initialized, true); 4398 pNewNode->SetFlag(XFA_NodeFlag_Initialized, true);
4397 } 4399 }
4398 return pNewNode; 4400 return pNewNode;
4399 } 4401 }
4400 int32_t CXFA_Node::CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild) { 4402 int32_t CXFA_Node::CountChildren(XFA_Element eElement, FX_BOOL bOnlyChild) {
4401 CXFA_Node* pNode = m_pChild; 4403 CXFA_Node* pNode = m_pChild;
4402 int32_t iCount = 0; 4404 int32_t iCount = 0;
4403 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4405 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4404 if (pNode->GetClassID() == eElement || eElement == XFA_ELEMENT_UNKNOWN) { 4406 if (pNode->GetClassID() == eElement || eElement == XFA_Element::Unknown) {
4405 if (bOnlyChild) { 4407 if (bOnlyChild) {
4406 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( 4408 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement(
4407 GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN); 4409 GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN);
4408 if (pProperty) { 4410 if (pProperty) {
4409 continue; 4411 continue;
4410 } 4412 }
4411 } 4413 }
4412 iCount++; 4414 iCount++;
4413 } 4415 }
4414 } 4416 }
4415 return iCount; 4417 return iCount;
4416 } 4418 }
4417 CXFA_Node* CXFA_Node::GetChild(int32_t index, 4419 CXFA_Node* CXFA_Node::GetChild(int32_t index,
4418 XFA_ELEMENT eElement, 4420 XFA_Element eElement,
4419 FX_BOOL bOnlyChild) { 4421 FX_BOOL bOnlyChild) {
4420 ASSERT(index > -1); 4422 ASSERT(index > -1);
4421 CXFA_Node* pNode = m_pChild; 4423 CXFA_Node* pNode = m_pChild;
4422 int32_t iCount = 0; 4424 int32_t iCount = 0;
4423 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4425 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4424 if (pNode->GetClassID() == eElement || eElement == XFA_ELEMENT_UNKNOWN) { 4426 if (pNode->GetClassID() == eElement || eElement == XFA_Element::Unknown) {
4425 if (bOnlyChild) { 4427 if (bOnlyChild) {
4426 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( 4428 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement(
4427 GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN); 4429 GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN);
4428 if (pProperty) { 4430 if (pProperty) {
4429 continue; 4431 continue;
4430 } 4432 }
4431 } 4433 }
4432 iCount++; 4434 iCount++;
4433 if (iCount > index) { 4435 if (iCount > index) {
4434 return pNode; 4436 return pNode;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
4599 } 4601 }
4600 CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const { 4602 CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const {
4601 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; 4603 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
4602 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4604 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4603 if (pNode->GetNameHash() == dwNameHash) { 4605 if (pNode->GetNameHash() == dwNameHash) {
4604 return pNode; 4606 return pNode;
4605 } 4607 }
4606 } 4608 }
4607 return nullptr; 4609 return nullptr;
4608 } 4610 }
4609 CXFA_Node* CXFA_Node::GetFirstChildByClass(XFA_ELEMENT eElement) const { 4611 CXFA_Node* CXFA_Node::GetFirstChildByClass(XFA_Element eElement) const {
4610 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; 4612 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
4611 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4613 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4612 if (pNode->GetClassID() == eElement) { 4614 if (pNode->GetClassID() == eElement) {
4613 return pNode; 4615 return pNode;
4614 } 4616 }
4615 } 4617 }
4616 return nullptr; 4618 return nullptr;
4617 } 4619 }
4618 CXFA_Node* CXFA_Node::GetNextSameNameSibling(uint32_t dwNameHash) const { 4620 CXFA_Node* CXFA_Node::GetNextSameNameSibling(uint32_t dwNameHash) const {
4619 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; 4621 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode;
4620 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4622 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4621 if (pNode->GetNameHash() == dwNameHash) { 4623 if (pNode->GetNameHash() == dwNameHash) {
4622 return pNode; 4624 return pNode;
4623 } 4625 }
4624 } 4626 }
4625 return nullptr; 4627 return nullptr;
4626 } 4628 }
4627 CXFA_Node* CXFA_Node::GetNextSameNameSibling( 4629 CXFA_Node* CXFA_Node::GetNextSameNameSibling(
4628 const CFX_WideStringC& wsNodeName) const { 4630 const CFX_WideStringC& wsNodeName) const {
4629 return GetNextSameNameSibling(FX_HashCode_GetW(wsNodeName, false)); 4631 return GetNextSameNameSibling(FX_HashCode_GetW(wsNodeName, false));
4630 } 4632 }
4631 CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_ELEMENT eElement) const { 4633 CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_Element eElement) const {
4632 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; 4634 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode;
4633 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4635 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4634 if (pNode->GetClassID() == eElement) { 4636 if (pNode->GetClassID() == eElement) {
4635 return pNode; 4637 return pNode;
4636 } 4638 }
4637 } 4639 }
4638 return nullptr; 4640 return nullptr;
4639 } 4641 }
4640 int32_t CXFA_Node::GetNodeSameNameIndex() const { 4642 int32_t CXFA_Node::GetNodeSameNameIndex() const {
4641 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 4643 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
(...skipping 13 matching lines...) Expand all
4655 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 4657 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
4656 if (!pScriptContext) { 4658 if (!pScriptContext) {
4657 return; 4659 return;
4658 } 4660 }
4659 pScriptContext->GetSomExpression(this, wsSOMExpression); 4661 pScriptContext->GetSomExpression(this, wsSOMExpression);
4660 } 4662 }
4661 CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() { 4663 CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() {
4662 CXFA_Node* pInstanceMgr = nullptr; 4664 CXFA_Node* pInstanceMgr = nullptr;
4663 if (m_ePacket == XFA_XDPPACKET_Form) { 4665 if (m_ePacket == XFA_XDPPACKET_Form) {
4664 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); 4666 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
4665 if (!pParentNode || pParentNode->GetClassID() == XFA_ELEMENT_Area) { 4667 if (!pParentNode || pParentNode->GetClassID() == XFA_Element::Area) {
4666 return pInstanceMgr; 4668 return pInstanceMgr;
4667 } 4669 }
4668 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; 4670 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode;
4669 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) { 4671 pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) {
4670 XFA_ELEMENT eType = pNode->GetClassID(); 4672 XFA_Element eType = pNode->GetClassID();
4671 if ((eType == XFA_ELEMENT_Subform || eType == XFA_ELEMENT_SubformSet) && 4673 if ((eType == XFA_Element::Subform || eType == XFA_Element::SubformSet) &&
4672 pNode->m_dwNameHash != m_dwNameHash) { 4674 pNode->m_dwNameHash != m_dwNameHash) {
4673 break; 4675 break;
4674 } 4676 }
4675 if (eType == XFA_ELEMENT_InstanceManager) { 4677 if (eType == XFA_Element::InstanceManager) {
4676 CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); 4678 CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name);
4677 CFX_WideStringC wsInstName = pNode->GetCData(XFA_ATTRIBUTE_Name); 4679 CFX_WideStringC wsInstName = pNode->GetCData(XFA_ATTRIBUTE_Name);
4678 if (wsInstName.GetLength() > 0 && wsInstName.GetAt(0) == '_' && 4680 if (wsInstName.GetLength() > 0 && wsInstName.GetAt(0) == '_' &&
4679 wsInstName.Mid(1) == wsName) { 4681 wsInstName.Mid(1) == wsName) {
4680 pInstanceMgr = pNode; 4682 pInstanceMgr = pNode;
4681 } 4683 }
4682 break; 4684 break;
4683 } 4685 }
4684 } 4686 }
4685 } 4687 }
4686 return pInstanceMgr; 4688 return pInstanceMgr;
4687 } 4689 }
4688 CXFA_Node* CXFA_Node::GetOccurNode() { 4690 CXFA_Node* CXFA_Node::GetOccurNode() {
4689 return GetFirstChildByClass(XFA_ELEMENT_Occur); 4691 return GetFirstChildByClass(XFA_Element::Occur);
4690 } 4692 }
4691 bool CXFA_Node::HasFlag(XFA_NodeFlag dwFlag) const { 4693 bool CXFA_Node::HasFlag(XFA_NodeFlag dwFlag) const {
4692 if (m_uNodeFlags & dwFlag) 4694 if (m_uNodeFlags & dwFlag)
4693 return true; 4695 return true;
4694 if (dwFlag == XFA_NodeFlag_HasRemovedChildren) 4696 if (dwFlag == XFA_NodeFlag_HasRemovedChildren)
4695 return m_pParent && m_pParent->HasFlag(dwFlag); 4697 return m_pParent && m_pParent->HasFlag(dwFlag);
4696 return false; 4698 return false;
4697 } 4699 }
4698 4700
4699 void CXFA_Node::SetFlag(uint32_t dwFlag, bool bNotify) { 4701 void CXFA_Node::SetFlag(uint32_t dwFlag, bool bNotify) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4734 4736
4735 void CXFA_Node::OnChanged(XFA_ATTRIBUTE eAttr, 4737 void CXFA_Node::OnChanged(XFA_ATTRIBUTE eAttr,
4736 bool bNotify, 4738 bool bNotify,
4737 FX_BOOL bScriptModify) { 4739 FX_BOOL bScriptModify) {
4738 if (bNotify && IsInitialized()) { 4740 if (bNotify && IsInitialized()) {
4739 Script_Attribute_SendAttributeChangeMessage(eAttr, bScriptModify); 4741 Script_Attribute_SendAttributeChangeMessage(eAttr, bScriptModify);
4740 } 4742 }
4741 } 4743 }
4742 4744
4743 int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, 4745 int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName,
4744 XFA_ELEMENT eElementType) { 4746 XFA_Element eElementType) {
4745 int32_t iRet = XFA_EVENTERROR_NotExist; 4747 int32_t iRet = XFA_EVENTERROR_NotExist;
4746 const XFA_ExecEventParaInfo* eventParaInfo = 4748 const XFA_ExecEventParaInfo* eventParaInfo =
4747 GetEventParaInfoByName(wsEventName); 4749 GetEventParaInfoByName(wsEventName);
4748 if (eventParaInfo) { 4750 if (eventParaInfo) {
4749 uint32_t validFlags = eventParaInfo->m_validFlags; 4751 uint32_t validFlags = eventParaInfo->m_validFlags;
4750 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 4752 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
4751 if (!pNotify) { 4753 if (!pNotify) {
4752 return iRet; 4754 return iRet;
4753 } 4755 }
4754 if (validFlags == 1) { 4756 if (validFlags == 1) {
4755 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType); 4757 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType);
4756 } else if (validFlags == 2) { 4758 } else if (validFlags == 2) {
4757 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, 4759 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType,
4758 FALSE, FALSE); 4760 FALSE, FALSE);
4759 } else if (validFlags == 3) { 4761 } else if (validFlags == 3) {
4760 if (eElementType == XFA_ELEMENT_Subform) { 4762 if (eElementType == XFA_Element::Subform) {
4761 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, 4763 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType,
4762 FALSE, FALSE); 4764 FALSE, FALSE);
4763 } 4765 }
4764 } else if (validFlags == 4) { 4766 } else if (validFlags == 4) {
4765 if (eElementType == XFA_ELEMENT_ExclGroup || 4767 if (eElementType == XFA_Element::ExclGroup ||
4766 eElementType == XFA_ELEMENT_Field) { 4768 eElementType == XFA_Element::Field) {
4767 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); 4769 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
4768 if (pParentNode && pParentNode->GetClassID() == XFA_ELEMENT_ExclGroup) { 4770 if (pParentNode &&
4771 pParentNode->GetClassID() == XFA_Element::ExclGroup) {
4769 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, 4772 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType,
4770 FALSE, FALSE); 4773 FALSE, FALSE);
4771 } 4774 }
4772 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, 4775 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType,
4773 FALSE, FALSE); 4776 FALSE, FALSE);
4774 } 4777 }
4775 } else if (validFlags == 5) { 4778 } else if (validFlags == 5) {
4776 if (eElementType == XFA_ELEMENT_Field) { 4779 if (eElementType == XFA_Element::Field) {
4777 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, 4780 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType,
4778 FALSE, FALSE); 4781 FALSE, FALSE);
4779 } 4782 }
4780 } else if (validFlags == 6) { 4783 } else if (validFlags == 6) {
4781 CXFA_WidgetData* pWidgetData = GetWidgetData(); 4784 CXFA_WidgetData* pWidgetData = GetWidgetData();
4782 if (pWidgetData) { 4785 if (pWidgetData) {
4783 CXFA_Node* pUINode = pWidgetData->GetUIChild(); 4786 CXFA_Node* pUINode = pWidgetData->GetUIChild();
4784 if (pUINode->m_eNodeClass == XFA_ELEMENT_Signature) { 4787 if (pUINode->m_eNodeClass == XFA_Element::Signature) {
4785 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, 4788 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType,
4786 FALSE, FALSE); 4789 FALSE, FALSE);
4787 } 4790 }
4788 } 4791 }
4789 } else if (validFlags == 7) { 4792 } else if (validFlags == 7) {
4790 CXFA_WidgetData* pWidgetData = GetWidgetData(); 4793 CXFA_WidgetData* pWidgetData = GetWidgetData();
4791 if (pWidgetData) { 4794 if (pWidgetData) {
4792 CXFA_Node* pUINode = pWidgetData->GetUIChild(); 4795 CXFA_Node* pUINode = pWidgetData->GetUIChild();
4793 if ((pUINode->m_eNodeClass == XFA_ELEMENT_ChoiceList) && 4796 if ((pUINode->m_eNodeClass == XFA_Element::ChoiceList) &&
4794 (!pWidgetData->IsListBox())) { 4797 (!pWidgetData->IsListBox())) {
4795 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, 4798 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType,
4796 FALSE, FALSE); 4799 FALSE, FALSE);
4797 } 4800 }
4798 } 4801 }
4799 } 4802 }
4800 } 4803 }
4801 return iRet; 4804 return iRet;
4802 } 4805 }
4803 void CXFA_Node::UpdateNameHash() { 4806 void CXFA_Node::UpdateNameHash() {
(...skipping 11 matching lines...) Expand all
4815 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { 4818 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() {
4816 if (!m_pXMLNode) { 4819 if (!m_pXMLNode) {
4817 CFX_WideString wsTag(GetCData(XFA_ATTRIBUTE_Name)); 4820 CFX_WideString wsTag(GetCData(XFA_ATTRIBUTE_Name));
4818 m_pXMLNode = new CFDE_XMLElement(wsTag); 4821 m_pXMLNode = new CFDE_XMLElement(wsTag);
4819 SetFlag(XFA_NodeFlag_OwnXMLNode, false); 4822 SetFlag(XFA_NodeFlag_OwnXMLNode, false);
4820 } 4823 }
4821 return m_pXMLNode; 4824 return m_pXMLNode;
4822 } 4825 }
4823 FX_BOOL CXFA_Node::IsNeedSavingXMLNode() { 4826 FX_BOOL CXFA_Node::IsNeedSavingXMLNode() {
4824 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets || 4827 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets ||
4825 GetClassID() == XFA_ELEMENT_Xfa); 4828 GetClassID() == XFA_Element::Xfa);
4826 } 4829 }
4827 4830
4828 XFA_MAPMODULEDATA* CXFA_Node::CreateMapModuleData() { 4831 XFA_MAPMODULEDATA* CXFA_Node::CreateMapModuleData() {
4829 if (!m_pMapModuleData) 4832 if (!m_pMapModuleData)
4830 m_pMapModuleData = new XFA_MAPMODULEDATA; 4833 m_pMapModuleData = new XFA_MAPMODULEDATA;
4831 return m_pMapModuleData; 4834 return m_pMapModuleData;
4832 } 4835 }
4833 4836
4834 XFA_MAPMODULEDATA* CXFA_Node::GetMapModuleData() const { 4837 XFA_MAPMODULEDATA* CXFA_Node::GetMapModuleData() const {
4835 return m_pMapModuleData; 4838 return m_pMapModuleData;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
5071 for (; pSrcChild && pDstChild; 5074 for (; pSrcChild && pDstChild;
5072 pSrcChild = pSrcChild->GetNodeItem(XFA_NODEITEM_NextSibling), 5075 pSrcChild = pSrcChild->GetNodeItem(XFA_NODEITEM_NextSibling),
5073 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { 5076 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
5074 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE); 5077 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE);
5075 } 5078 }
5076 } 5079 }
5077 pSrcModule->MoveBufferMapData(pDstModule, pKey); 5080 pSrcModule->MoveBufferMapData(pDstModule, pKey);
5078 } 5081 }
5079 5082
5080 CXFA_OrdinaryObject::CXFA_OrdinaryObject(CXFA_Document* pDocument, 5083 CXFA_OrdinaryObject::CXFA_OrdinaryObject(CXFA_Document* pDocument,
5081 XFA_ELEMENT eElement) 5084 XFA_Element eElement)
5082 : CXFA_Object(pDocument, XFA_ObjectType::OrdinaryObject), m_uScriptHash(0) { 5085 : CXFA_Object(pDocument, XFA_ObjectType::OrdinaryObject), m_uScriptHash(0) {
5083 m_eNodeClass = eElement; 5086 m_eNodeClass = eElement;
5084 } 5087 }
5085 5088
5086 CXFA_OrdinaryObject::~CXFA_OrdinaryObject() {} 5089 CXFA_OrdinaryObject::~CXFA_OrdinaryObject() {}
5087 5090
5088 XFA_ELEMENT CXFA_OrdinaryObject::GetClassID() const { 5091 XFA_Element CXFA_OrdinaryObject::GetClassID() const {
5089 return m_eNodeClass; 5092 return m_eNodeClass;
5090 } 5093 }
5091 5094
5092 uint32_t CXFA_OrdinaryObject::GetScriptObjHash() const { 5095 uint32_t CXFA_OrdinaryObject::GetScriptObjHash() const {
5093 return m_uScriptHash; 5096 return m_uScriptHash;
5094 } 5097 }
5095 5098
5096 CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) 5099 CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode)
5097 : CXFA_Object(pThisNode->GetDocument(), XFA_ObjectType::VariablesThis), 5100 : CXFA_Object(pThisNode->GetDocument(), XFA_ObjectType::VariablesThis),
5098 m_pThisNode(NULL), 5101 m_pThisNode(NULL),
(...skipping 11 matching lines...) Expand all
5110 CXFA_Node* CXFA_ThisProxy::GetScriptNode() const { 5113 CXFA_Node* CXFA_ThisProxy::GetScriptNode() const {
5111 return m_pScriptNode; 5114 return m_pScriptNode;
5112 } 5115 }
5113 5116
5114 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) 5117 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument)
5115 : CXFA_Object(pDocument, XFA_ObjectType::NodeList) { 5118 : CXFA_Object(pDocument, XFA_ObjectType::NodeList) {
5116 m_pDocument->GetScriptContext()->AddToCacheList( 5119 m_pDocument->GetScriptContext()->AddToCacheList(
5117 std::unique_ptr<CXFA_NodeList>(this)); 5120 std::unique_ptr<CXFA_NodeList>(this));
5118 } 5121 }
5119 CXFA_NodeList::~CXFA_NodeList() {} 5122 CXFA_NodeList::~CXFA_NodeList() {}
5120 XFA_ELEMENT CXFA_NodeList::GetClassID() const { 5123 XFA_Element CXFA_NodeList::GetClassID() const {
5121 return XFA_ELEMENT_NodeList; 5124 return XFA_Element::NodeList;
5122 } 5125 }
5123 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { 5126 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) {
5124 uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); 5127 uint32_t dwHashCode = FX_HashCode_GetW(wsName, false);
5125 int32_t iCount = GetLength(); 5128 int32_t iCount = GetLength();
5126 for (int32_t i = 0; i < iCount; i++) { 5129 for (int32_t i = 0; i < iCount; i++) {
5127 CXFA_Node* ret = Item(i); 5130 CXFA_Node* ret = Item(i);
5128 if (dwHashCode == ret->GetNameHash()) 5131 if (dwHashCode == ret->GetNameHash())
5129 return ret; 5132 return ret;
5130 } 5133 }
5131 return nullptr; 5134 return nullptr;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
5258 } 5261 }
5259 return nullptr; 5262 return nullptr;
5260 } 5263 }
5261 CXFA_AttachNodeList::CXFA_AttachNodeList(CXFA_Document* pDocument, 5264 CXFA_AttachNodeList::CXFA_AttachNodeList(CXFA_Document* pDocument,
5262 CXFA_Node* pAttachNode) 5265 CXFA_Node* pAttachNode)
5263 : CXFA_NodeList(pDocument) { 5266 : CXFA_NodeList(pDocument) {
5264 m_pAttachNode = pAttachNode; 5267 m_pAttachNode = pAttachNode;
5265 } 5268 }
5266 int32_t CXFA_AttachNodeList::GetLength() { 5269 int32_t CXFA_AttachNodeList::GetLength() {
5267 return m_pAttachNode->CountChildren( 5270 return m_pAttachNode->CountChildren(
5268 XFA_ELEMENT_UNKNOWN, m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5271 XFA_Element::Unknown,
5272 m_pAttachNode->GetClassID() == XFA_Element::Subform);
5269 } 5273 }
5270 FX_BOOL CXFA_AttachNodeList::Append(CXFA_Node* pNode) { 5274 FX_BOOL CXFA_AttachNodeList::Append(CXFA_Node* pNode) {
5271 CXFA_Node* pParent = pNode->GetNodeItem(XFA_NODEITEM_Parent); 5275 CXFA_Node* pParent = pNode->GetNodeItem(XFA_NODEITEM_Parent);
5272 if (pParent) { 5276 if (pParent) {
5273 pParent->RemoveChild(pNode); 5277 pParent->RemoveChild(pNode);
5274 } 5278 }
5275 return m_pAttachNode->InsertChild(pNode); 5279 return m_pAttachNode->InsertChild(pNode);
5276 } 5280 }
5277 FX_BOOL CXFA_AttachNodeList::Insert(CXFA_Node* pNewNode, 5281 FX_BOOL CXFA_AttachNodeList::Insert(CXFA_Node* pNewNode,
5278 CXFA_Node* pBeforeNode) { 5282 CXFA_Node* pBeforeNode) {
5279 CXFA_Node* pParent = pNewNode->GetNodeItem(XFA_NODEITEM_Parent); 5283 CXFA_Node* pParent = pNewNode->GetNodeItem(XFA_NODEITEM_Parent);
5280 if (pParent) { 5284 if (pParent) {
5281 pParent->RemoveChild(pNewNode); 5285 pParent->RemoveChild(pNewNode);
5282 } 5286 }
5283 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); 5287 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
5284 } 5288 }
5285 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { 5289 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
5286 return m_pAttachNode->RemoveChild(pNode); 5290 return m_pAttachNode->RemoveChild(pNode);
5287 } 5291 }
5288 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { 5292 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
5289 return m_pAttachNode->GetChild( 5293 return m_pAttachNode->GetChild(
5290 iIndex, XFA_ELEMENT_UNKNOWN, 5294 iIndex, XFA_Element::Unknown,
5291 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5295 m_pAttachNode->GetClassID() == XFA_Element::Subform);
5292 } 5296 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_object.h ('k') | xfa/fxfa/parser/xfa_parser_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698