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

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

Issue 2083453003: Split the XFA_OBJECTTYPE enum into two parts. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Force to bool 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
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 static_cast<XFA_OBJECTTYPE>(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, uint32_t uFlags) 59 CXFA_Object::CXFA_Object(CXFA_Document* pDocument, XFA_ObjectType type)
60 : m_pDocument(pDocument), m_uFlags(uFlags) {} 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 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_dwNameHash(0), 128 m_dwNameHash(0),
128 m_pAuxNode(nullptr), 129 m_pAuxNode(nullptr),
129 m_pMapModuleData(nullptr) { 130 m_pMapModuleData(nullptr) {
130 ASSERT(m_pDocument); 131 ASSERT(m_pDocument);
131 } 132 }
132 133
133 CXFA_Node::~CXFA_Node() { 134 CXFA_Node::~CXFA_Node() {
134 ASSERT(!m_pParent); 135 ASSERT(!m_pParent);
135 RemoveMapModuleKey(); 136 RemoveMapModuleKey();
136 CXFA_Node* pNode = m_pChild; 137 CXFA_Node* pNode = m_pChild;
137 while (pNode) { 138 while (pNode) {
138 CXFA_Node* pNext = pNode->m_pNext; 139 CXFA_Node* pNext = pNode->m_pNext;
139 pNode->m_pParent = nullptr; 140 pNode->m_pParent = nullptr;
140 delete pNode; 141 delete pNode;
141 pNode = pNext; 142 pNode = pNext;
142 } 143 }
143 if (m_pXMLNode && HasFlag(XFA_NODEFLAG_OwnXMLNode)) 144 if (m_pXMLNode && IsOwnXMLNode())
144 m_pXMLNode->Release(); 145 m_pXMLNode->Release();
145 } 146 }
146 147
147 CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) { 148 CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) {
148 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); 149 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
149 CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass); 150 CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass);
150 if (!pClone) 151 if (!pClone)
151 return nullptr; 152 return nullptr;
152 153
153 MergeAllData(pClone); 154 MergeAllData(pClone);
154 pClone->UpdateNameHash(); 155 pClone->UpdateNameHash();
155 if (IsNeedSavingXMLNode()) { 156 if (IsNeedSavingXMLNode()) {
156 CFDE_XMLNode* pCloneXML = nullptr; 157 CFDE_XMLNode* pCloneXML = nullptr;
157 if (IsAttributeInXML()) { 158 if (IsAttributeInXML()) {
158 CFX_WideString wsName; 159 CFX_WideString wsName;
159 GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); 160 GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE);
160 CFDE_XMLElement* pCloneXMLElement = new CFDE_XMLElement(wsName); 161 CFDE_XMLElement* pCloneXMLElement = new CFDE_XMLElement(wsName);
161 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); 162 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
162 if (!wsValue.IsEmpty()) { 163 if (!wsValue.IsEmpty()) {
163 pCloneXMLElement->SetTextData(CFX_WideString(wsValue)); 164 pCloneXMLElement->SetTextData(CFX_WideString(wsValue));
164 } 165 }
165 pCloneXML = pCloneXMLElement; 166 pCloneXML = pCloneXMLElement;
166 pCloneXMLElement = nullptr; 167 pCloneXMLElement = nullptr;
167 pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); 168 pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown);
168 } else { 169 } else {
169 pCloneXML = m_pXMLNode->Clone(FALSE); 170 pCloneXML = m_pXMLNode->Clone(FALSE);
170 } 171 }
171 pClone->SetXMLMappingNode(pCloneXML); 172 pClone->SetXMLMappingNode(pCloneXML);
172 pClone->SetFlag(XFA_NODEFLAG_OwnXMLNode, false); 173 pClone->SetFlag(XFA_NodeFlag_OwnXMLNode, false);
173 } 174 }
174 if (bRecursive) { 175 if (bRecursive) {
175 for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild; 176 for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild;
176 pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { 177 pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
177 pClone->InsertChild(pChild->Clone(bRecursive)); 178 pClone->InsertChild(pChild->Clone(bRecursive));
178 } 179 }
179 } 180 }
180 pClone->SetFlag(XFA_NODEFLAG_Initialized, true); 181 pClone->SetFlag(XFA_NodeFlag_Initialized, true);
181 pClone->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); 182 pClone->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr);
182 return pClone; 183 return pClone;
183 } 184 }
184 185
185 CXFA_Node* CXFA_Node::GetNodeItem(XFA_NODEITEM eItem) const { 186 CXFA_Node* CXFA_Node::GetNodeItem(XFA_NODEITEM eItem) const {
186 switch (eItem) { 187 switch (eItem) {
187 case XFA_NODEITEM_NextSibling: 188 case XFA_NODEITEM_NextSibling:
188 return m_pNext; 189 return m_pNext;
189 case XFA_NODEITEM_FirstChild: 190 case XFA_NODEITEM_FirstChild:
190 return m_pChild; 191 return m_pChild;
(...skipping 10 matching lines...) Expand all
201 return pPrev; 202 return pPrev;
202 } 203 }
203 return nullptr; 204 return nullptr;
204 default: 205 default:
205 break; 206 break;
206 } 207 }
207 return nullptr; 208 return nullptr;
208 } 209 }
209 210
210 CXFA_Node* CXFA_Node::GetNodeItem(XFA_NODEITEM eItem, 211 CXFA_Node* CXFA_Node::GetNodeItem(XFA_NODEITEM eItem,
211 XFA_OBJECTTYPE eType) const { 212 XFA_ObjectType eType) const {
212 CXFA_Node* pNode = nullptr; 213 CXFA_Node* pNode = nullptr;
213 switch (eItem) { 214 switch (eItem) {
214 case XFA_NODEITEM_NextSibling: 215 case XFA_NODEITEM_NextSibling:
215 pNode = m_pNext; 216 pNode = m_pNext;
216 if (eType != XFA_OBJECTTYPEMASK) { 217 while (pNode && pNode->GetObjectType() != eType)
217 while (pNode && pNode->GetObjectType() != eType) 218 pNode = pNode->m_pNext;
218 pNode = pNode->m_pNext;
219 }
220 break; 219 break;
221 case XFA_NODEITEM_FirstChild: 220 case XFA_NODEITEM_FirstChild:
222 pNode = m_pChild; 221 pNode = m_pChild;
223 if (eType != XFA_OBJECTTYPEMASK) { 222 while (pNode && pNode->GetObjectType() != eType)
224 while (pNode && pNode->GetObjectType() != eType) 223 pNode = pNode->m_pNext;
225 pNode = pNode->m_pNext;
226 }
227 break; 224 break;
228 case XFA_NODEITEM_Parent: 225 case XFA_NODEITEM_Parent:
229 pNode = m_pParent; 226 pNode = m_pParent;
230 if (eType != XFA_OBJECTTYPEMASK) { 227 while (pNode && pNode->GetObjectType() != eType)
231 while (pNode && pNode->GetObjectType() != eType) 228 pNode = pNode->m_pParent;
232 pNode = pNode->m_pParent;
233 }
234 break; 229 break;
235 case XFA_NODEITEM_PrevSibling: 230 case XFA_NODEITEM_PrevSibling:
236 if (m_pParent) { 231 if (m_pParent) {
237 CXFA_Node* pSibling = m_pParent->m_pChild; 232 CXFA_Node* pSibling = m_pParent->m_pChild;
238 while (pSibling && pSibling != this) { 233 while (pSibling && pSibling != this) {
239 if (eType == XFA_OBJECTTYPEMASK || 234 if (eType == pSibling->GetObjectType())
240 eType == pSibling->GetObjectType()) {
241 pNode = pSibling; 235 pNode = pSibling;
242 } 236
243 pSibling = pSibling->m_pNext; 237 pSibling = pSibling->m_pNext;
244 } 238 }
245 } 239 }
246 break; 240 break;
247 default: 241 default:
248 break; 242 break;
249 } 243 }
250 return pNode; 244 return pNode;
251 } 245 }
252 246
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 return 0; 305 return 0;
312 for (int32_t i = 0; i < iProperties; i++) { 306 for (int32_t i = 0; i < iProperties; i++) {
313 if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) { 307 if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) {
314 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); 308 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
315 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID()); 309 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID());
316 CXFA_Node* pNewNode = 310 CXFA_Node* pNewNode =
317 pFactory->CreateNode(pPacket, (XFA_ELEMENT)pProperty[i].eName); 311 pFactory->CreateNode(pPacket, (XFA_ELEMENT)pProperty[i].eName);
318 if (!pNewNode) 312 if (!pNewNode)
319 break; 313 break;
320 InsertChild(pNewNode, nullptr); 314 InsertChild(pNewNode, nullptr);
321 pNewNode->SetFlag(XFA_NODEFLAG_Initialized, true); 315 pNewNode->SetFlag(XFA_NodeFlag_Initialized, true);
322 nodes.Add(pNewNode); 316 nodes.Add(pNewNode);
323 break; 317 break;
324 } 318 }
325 } 319 }
326 } 320 }
327 } 321 }
328 return nodes.GetSize(); 322 return nodes.GetSize();
329 } 323 }
330 324
331 CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_ELEMENT eElement, 325 CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_ELEMENT eElement,
(...skipping 13 matching lines...) Expand all
345 339
346 pClone->SetTemplateNode(this); 340 pClone->SetTemplateNode(this);
347 pClone->UpdateNameHash(); 341 pClone->UpdateNameHash();
348 pClone->SetXMLMappingNode(GetXMLMappingNode()); 342 pClone->SetXMLMappingNode(GetXMLMappingNode());
349 if (bRecursive) { 343 if (bRecursive) {
350 for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild; 344 for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild;
351 pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { 345 pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
352 pClone->InsertChild(pChild->CloneTemplateToForm(bRecursive)); 346 pClone->InsertChild(pChild->CloneTemplateToForm(bRecursive));
353 } 347 }
354 } 348 }
355 pClone->SetFlag(XFA_NODEFLAG_Initialized, true); 349 pClone->SetFlag(XFA_NodeFlag_Initialized, true);
356 return pClone; 350 return pClone;
357 } 351 }
358 352
359 CXFA_Node* CXFA_Node::GetTemplateNode() const { 353 CXFA_Node* CXFA_Node::GetTemplateNode() const {
360 return m_pAuxNode; 354 return m_pAuxNode;
361 } 355 }
362 356
363 void CXFA_Node::SetTemplateNode(CXFA_Node* pTemplateNode) { 357 void CXFA_Node::SetTemplateNode(CXFA_Node* pTemplateNode) {
364 m_pAuxNode = pTemplateNode; 358 m_pAuxNode = pTemplateNode;
365 } 359 }
366 360
367 CXFA_Node* CXFA_Node::GetBindData() { 361 CXFA_Node* CXFA_Node::GetBindData() {
368 ASSERT(GetPacketID() == XFA_XDPPACKET_Form); 362 ASSERT(GetPacketID() == XFA_XDPPACKET_Form);
369 return static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode)); 363 return static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode));
370 } 364 }
371 365
372 int32_t CXFA_Node::GetBindItems(CXFA_NodeArray& formItems) { 366 int32_t CXFA_Node::GetBindItems(CXFA_NodeArray& formItems) {
373 if (m_uFlags & XFA_NODEFLAG_BindFormItems) { 367 if (BindsFormItems()) {
374 CXFA_NodeArray* pItems = nullptr; 368 CXFA_NodeArray* pItems = nullptr;
375 TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems); 369 TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems);
376 formItems.Copy(*pItems); 370 formItems.Copy(*pItems);
377 return formItems.GetSize(); 371 return formItems.GetSize();
378 } 372 }
379 CXFA_Node* pFormNode = 373 CXFA_Node* pFormNode =
380 static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode)); 374 static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode));
381 if (pFormNode) 375 if (pFormNode)
382 formItems.Add(pFormNode); 376 formItems.Add(pFormNode);
383 return formItems.GetSize(); 377 return formItems.GetSize();
384 } 378 }
385 379
386 int32_t CXFA_Node::AddBindItem(CXFA_Node* pFormNode) { 380 int32_t CXFA_Node::AddBindItem(CXFA_Node* pFormNode) {
387 ASSERT(pFormNode); 381 ASSERT(pFormNode);
388 if (m_uFlags & XFA_NODEFLAG_BindFormItems) { 382 if (BindsFormItems()) {
389 CXFA_NodeArray* pItems = nullptr; 383 CXFA_NodeArray* pItems = nullptr;
390 TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems); 384 TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems);
391 ASSERT(pItems); 385 ASSERT(pItems);
392 if (pItems->Find(pFormNode) < 0) { 386 if (pItems->Find(pFormNode) < 0) {
393 pItems->Add(pFormNode); 387 pItems->Add(pFormNode);
394 } 388 }
395 return pItems->GetSize(); 389 return pItems->GetSize();
396 } 390 }
397 CXFA_Node* pOldFormItem = 391 CXFA_Node* pOldFormItem =
398 static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode)); 392 static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode));
399 if (!pOldFormItem) { 393 if (!pOldFormItem) {
400 SetObject(XFA_ATTRIBUTE_BindingNode, pFormNode); 394 SetObject(XFA_ATTRIBUTE_BindingNode, pFormNode);
401 return 1; 395 return 1;
402 } else if (pOldFormItem == pFormNode) { 396 } else if (pOldFormItem == pFormNode) {
403 return 1; 397 return 1;
404 } 398 }
405 CXFA_NodeArray* pItems = new CXFA_NodeArray; 399 CXFA_NodeArray* pItems = new CXFA_NodeArray;
406 SetObject(XFA_ATTRIBUTE_BindingNode, pItems, &deleteBindItemCallBack); 400 SetObject(XFA_ATTRIBUTE_BindingNode, pItems, &deleteBindItemCallBack);
407 pItems->Add(pOldFormItem); 401 pItems->Add(pOldFormItem);
408 pItems->Add(pFormNode); 402 pItems->Add(pFormNode);
409 m_uFlags |= XFA_NODEFLAG_BindFormItems; 403 m_uNodeFlags |= XFA_NodeFlag_BindFormItems;
410 return 2; 404 return 2;
411 } 405 }
412 406
413 int32_t CXFA_Node::RemoveBindItem(CXFA_Node* pFormNode) { 407 int32_t CXFA_Node::RemoveBindItem(CXFA_Node* pFormNode) {
414 if (m_uFlags & XFA_NODEFLAG_BindFormItems) { 408 if (BindsFormItems()) {
415 CXFA_NodeArray* pItems = nullptr; 409 CXFA_NodeArray* pItems = nullptr;
416 TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems); 410 TryObject(XFA_ATTRIBUTE_BindingNode, (void*&)pItems);
417 ASSERT(pItems); 411 ASSERT(pItems);
418 int32_t iIndex = pItems->Find(pFormNode); 412 int32_t iIndex = pItems->Find(pFormNode);
419 int32_t iCount = pItems->GetSize(); 413 int32_t iCount = pItems->GetSize();
420 if (iIndex >= 0) { 414 if (iIndex >= 0) {
421 if (iIndex != iCount - 1) 415 if (iIndex != iCount - 1)
422 pItems->SetAt(iIndex, pItems->GetAt(iCount - 1)); 416 pItems->SetAt(iIndex, pItems->GetAt(iCount - 1));
423 pItems->RemoveAt(iCount - 1); 417 pItems->RemoveAt(iCount - 1);
424 if (iCount == 2) { 418 if (iCount == 2) {
425 CXFA_Node* pLastFormNode = pItems->GetAt(0); 419 CXFA_Node* pLastFormNode = pItems->GetAt(0);
426 SetObject(XFA_ATTRIBUTE_BindingNode, pLastFormNode); 420 SetObject(XFA_ATTRIBUTE_BindingNode, pLastFormNode);
427 m_uFlags &= ~XFA_NODEFLAG_BindFormItems; 421 m_uNodeFlags &= ~XFA_NodeFlag_BindFormItems;
428 } 422 }
429 iCount--; 423 iCount--;
430 } 424 }
431 return iCount; 425 return iCount;
432 } 426 }
433 CXFA_Node* pOldFormItem = 427 CXFA_Node* pOldFormItem =
434 static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode)); 428 static_cast<CXFA_Node*>(GetObject(XFA_ATTRIBUTE_BindingNode));
435 if (pOldFormItem == pFormNode) { 429 if (pOldFormItem == pFormNode) {
436 SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); 430 SetObject(XFA_ATTRIBUTE_BindingNode, nullptr);
437 pOldFormItem = nullptr; 431 pOldFormItem = nullptr;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 if (!wsPicture.IsEmpty()) 467 if (!wsPicture.IsEmpty())
474 return pFieldWidgetData; 468 return pFieldWidgetData;
475 CXFA_Node* pDataNode = GetBindData(); 469 CXFA_Node* pDataNode = GetBindData();
476 if (!pDataNode) 470 if (!pDataNode)
477 return nullptr; 471 return nullptr;
478 pFieldWidgetData = nullptr; 472 pFieldWidgetData = nullptr;
479 CXFA_NodeArray formNodes; 473 CXFA_NodeArray formNodes;
480 pDataNode->GetBindItems(formNodes); 474 pDataNode->GetBindItems(formNodes);
481 for (int32_t i = 0; i < formNodes.GetSize(); i++) { 475 for (int32_t i = 0; i < formNodes.GetSize(); i++) {
482 CXFA_Node* pFormNode = formNodes.GetAt(i); 476 CXFA_Node* pFormNode = formNodes.GetAt(i);
483 if (!pFormNode || pFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) 477 if (!pFormNode || pFormNode->HasRemovedChildren())
484 continue; 478 continue;
485 pFieldWidgetData = pFormNode->GetWidgetData(); 479 pFieldWidgetData = pFormNode->GetWidgetData();
486 if (pFieldWidgetData) { 480 if (pFieldWidgetData) {
487 pFieldWidgetData->GetPictureContent(wsPicture, 481 pFieldWidgetData->GetPictureContent(wsPicture,
488 XFA_VALUEPICTURE_DataBind); 482 XFA_VALUEPICTURE_DataBind);
489 } 483 }
490 if (!wsPicture.IsEmpty()) 484 if (!wsPicture.IsEmpty())
491 break; 485 break;
492 pFieldWidgetData = nullptr; 486 pFieldWidgetData = nullptr;
493 } 487 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 XFA_ATTRIBUTEENUM CXFA_Node::GetIntact() { 538 XFA_ATTRIBUTEENUM CXFA_Node::GetIntact() {
545 XFA_ELEMENT eElement = GetClassID(); 539 XFA_ELEMENT eElement = GetClassID();
546 CXFA_Node* pKeep = GetFirstChildByClass(XFA_ELEMENT_Keep); 540 CXFA_Node* pKeep = GetFirstChildByClass(XFA_ELEMENT_Keep);
547 XFA_ATTRIBUTEENUM eLayoutType = GetEnum(XFA_ATTRIBUTE_Layout); 541 XFA_ATTRIBUTEENUM eLayoutType = GetEnum(XFA_ATTRIBUTE_Layout);
548 if (pKeep) { 542 if (pKeep) {
549 XFA_ATTRIBUTEENUM eIntact; 543 XFA_ATTRIBUTEENUM eIntact;
550 if (pKeep->TryEnum(XFA_ATTRIBUTE_Intact, eIntact, FALSE)) { 544 if (pKeep->TryEnum(XFA_ATTRIBUTE_Intact, eIntact, FALSE)) {
551 if (eIntact == XFA_ATTRIBUTEENUM_None && 545 if (eIntact == XFA_ATTRIBUTEENUM_None &&
552 eLayoutType == XFA_ATTRIBUTEENUM_Row && 546 eLayoutType == XFA_ATTRIBUTEENUM_Row &&
553 m_pDocument->GetCurVersionMode() < XFA_VERSION_208) { 547 m_pDocument->GetCurVersionMode() < XFA_VERSION_208) {
554 CXFA_Node* pPreviewRow = 548 CXFA_Node* pPreviewRow = GetNodeItem(XFA_NODEITEM_PrevSibling,
555 GetNodeItem(XFA_NODEITEM_PrevSibling, XFA_OBJECTTYPE_ContainerNode); 549 XFA_ObjectType::ContainerNode);
556 if (pPreviewRow && 550 if (pPreviewRow &&
557 pPreviewRow->GetEnum(XFA_ATTRIBUTE_Layout) == 551 pPreviewRow->GetEnum(XFA_ATTRIBUTE_Layout) ==
558 XFA_ATTRIBUTEENUM_Row) { 552 XFA_ATTRIBUTEENUM_Row) {
559 XFA_ATTRIBUTEENUM eValue; 553 XFA_ATTRIBUTEENUM eValue;
560 if (pKeep->TryEnum(XFA_ATTRIBUTE_Previous, eValue, FALSE) && 554 if (pKeep->TryEnum(XFA_ATTRIBUTE_Previous, eValue, FALSE) &&
561 (eValue == XFA_ATTRIBUTEENUM_ContentArea || 555 (eValue == XFA_ATTRIBUTEENUM_ContentArea ||
562 eValue == XFA_ATTRIBUTEENUM_PageArea)) { 556 eValue == XFA_ATTRIBUTEENUM_PageArea)) {
563 return XFA_ATTRIBUTEENUM_ContentArea; 557 return XFA_ATTRIBUTEENUM_ContentArea;
564 } 558 }
565 CXFA_Node* pNode = 559 CXFA_Node* pNode =
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 pFakeRoot = pParser->GetRootNode(); 1000 pFakeRoot = pParser->GetRootNode();
1007 if (pFakeRoot) { 1001 if (pFakeRoot) {
1008 if (bOverwrite) { 1002 if (bOverwrite) {
1009 CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); 1003 CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild);
1010 CXFA_Node* pNewChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild); 1004 CXFA_Node* pNewChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
1011 int32_t index = 0; 1005 int32_t index = 0;
1012 while (pNewChild) { 1006 while (pNewChild) {
1013 CXFA_Node* pItem = pNewChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1007 CXFA_Node* pItem = pNewChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1014 pFakeRoot->RemoveChild(pNewChild); 1008 pFakeRoot->RemoveChild(pNewChild);
1015 InsertChild(index++, pNewChild); 1009 InsertChild(index++, pNewChild);
1016 pNewChild->SetFlag(XFA_NODEFLAG_Initialized, true); 1010 pNewChild->SetFlag(XFA_NodeFlag_Initialized, true);
1017 pNewChild = pItem; 1011 pNewChild = pItem;
1018 } 1012 }
1019 while (pChild) { 1013 while (pChild) {
1020 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1014 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1021 RemoveChild(pChild); 1015 RemoveChild(pChild);
1022 pFakeRoot->InsertChild(pChild); 1016 pFakeRoot->InsertChild(pChild);
1023 pChild = pItem; 1017 pChild = pItem;
1024 } 1018 }
1025 if (GetPacketID() == XFA_XDPPACKET_Form && 1019 if (GetPacketID() == XFA_XDPPACKET_Form &&
1026 GetClassID() == XFA_ELEMENT_ExData) { 1020 GetClassID() == XFA_ELEMENT_ExData) {
1027 CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode(); 1021 CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode();
1028 SetXMLMappingNode(pFakeXMLRoot); 1022 SetXMLMappingNode(pFakeXMLRoot);
1029 SetFlag(XFA_NODEFLAG_OwnXMLNode, false); 1023 SetFlag(XFA_NodeFlag_OwnXMLNode, false);
1030 if (pTempXMLNode && !pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent)) { 1024 if (pTempXMLNode && !pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent)) {
1031 pFakeXMLRoot = pTempXMLNode; 1025 pFakeXMLRoot = pTempXMLNode;
1032 } else { 1026 } else {
1033 pFakeXMLRoot = nullptr; 1027 pFakeXMLRoot = nullptr;
1034 } 1028 }
1035 } 1029 }
1036 MoveBufferMapData(pFakeRoot, this, XFA_CalcData, TRUE); 1030 MoveBufferMapData(pFakeRoot, this, XFA_CalcData, TRUE);
1037 } else { 1031 } else {
1038 CXFA_Node* pChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild); 1032 CXFA_Node* pChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
1039 while (pChild) { 1033 while (pChild) {
1040 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1034 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1041 pFakeRoot->RemoveChild(pChild); 1035 pFakeRoot->RemoveChild(pChild);
1042 InsertChild(pChild); 1036 InsertChild(pChild);
1043 pChild->SetFlag(XFA_NODEFLAG_Initialized, true); 1037 pChild->SetFlag(XFA_NodeFlag_Initialized, true);
1044 pChild = pItem; 1038 pChild = pItem;
1045 } 1039 }
1046 } 1040 }
1047 if (pFakeXMLRoot) { 1041 if (pFakeXMLRoot) {
1048 pFakeRoot->SetXMLMappingNode(pFakeXMLRoot); 1042 pFakeRoot->SetXMLMappingNode(pFakeXMLRoot);
1049 pFakeRoot->SetFlag(XFA_NODEFLAG_OwnXMLNode, false); 1043 pFakeRoot->SetFlag(XFA_NodeFlag_OwnXMLNode, false);
1050 } 1044 }
1051 pFakeRoot->SetFlag(XFA_NODEFLAG_HasRemoved, false); 1045 pFakeRoot->SetFlag(XFA_NodeFlag_HasRemovedChildren, false);
1052 } else { 1046 } else {
1053 if (pFakeXMLRoot) { 1047 if (pFakeXMLRoot) {
1054 pFakeXMLRoot->Release(); 1048 pFakeXMLRoot->Release();
1055 pFakeXMLRoot = nullptr; 1049 pFakeXMLRoot = nullptr;
1056 } 1050 }
1057 } 1051 }
1058 } 1052 }
1059 1053
1060 void CXFA_Node::Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments) { 1054 void CXFA_Node::Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments) {
1061 // TODO(weili): Check whether we need to implement this, pdfium:501. 1055 // TODO(weili): Check whether we need to implement this, pdfium:501.
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 wsNewValue = pValue->ToWideString(); 1618 wsNewValue = pValue->ToWideString();
1625 1619
1626 CFX_WideString wsFormatValue(wsNewValue); 1620 CFX_WideString wsFormatValue(wsNewValue);
1627 CXFA_WidgetData* pContainerWidgetData = nullptr; 1621 CXFA_WidgetData* pContainerWidgetData = nullptr;
1628 if (GetPacketID() == XFA_XDPPACKET_Datasets) { 1622 if (GetPacketID() == XFA_XDPPACKET_Datasets) {
1629 CXFA_NodeArray formNodes; 1623 CXFA_NodeArray formNodes;
1630 GetBindItems(formNodes); 1624 GetBindItems(formNodes);
1631 CFX_WideString wsPicture; 1625 CFX_WideString wsPicture;
1632 for (int32_t i = 0; i < formNodes.GetSize(); i++) { 1626 for (int32_t i = 0; i < formNodes.GetSize(); i++) {
1633 CXFA_Node* pFormNode = formNodes.GetAt(i); 1627 CXFA_Node* pFormNode = formNodes.GetAt(i);
1634 if (!pFormNode || pFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) { 1628 if (!pFormNode || pFormNode->HasRemovedChildren()) {
1635 continue; 1629 continue;
1636 } 1630 }
1637 pContainerWidgetData = pFormNode->GetContainerWidgetData(); 1631 pContainerWidgetData = pFormNode->GetContainerWidgetData();
1638 if (pContainerWidgetData) { 1632 if (pContainerWidgetData) {
1639 pContainerWidgetData->GetPictureContent(wsPicture, 1633 pContainerWidgetData->GetPictureContent(wsPicture,
1640 XFA_VALUEPICTURE_DataBind); 1634 XFA_VALUEPICTURE_DataBind);
1641 } 1635 }
1642 if (!wsPicture.IsEmpty()) { 1636 if (!wsPicture.IsEmpty()) {
1643 break; 1637 break;
1644 } 1638 }
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2978 } 2972 }
2979 } 2973 }
2980 static CXFA_Node* XFA_ScriptInstanceManager_CreateInstance( 2974 static CXFA_Node* XFA_ScriptInstanceManager_CreateInstance(
2981 CXFA_Node* pInstMgrNode, 2975 CXFA_Node* pInstMgrNode,
2982 FX_BOOL bDataMerge) { 2976 FX_BOOL bDataMerge) {
2983 CXFA_Document* pDocument = pInstMgrNode->GetDocument(); 2977 CXFA_Document* pDocument = pInstMgrNode->GetDocument();
2984 CXFA_Node* pTemplateNode = pInstMgrNode->GetTemplateNode(); 2978 CXFA_Node* pTemplateNode = pInstMgrNode->GetTemplateNode();
2985 CXFA_Node* pFormParent = pInstMgrNode->GetNodeItem(XFA_NODEITEM_Parent); 2979 CXFA_Node* pFormParent = pInstMgrNode->GetNodeItem(XFA_NODEITEM_Parent);
2986 CXFA_Node* pDataScope = nullptr; 2980 CXFA_Node* pDataScope = nullptr;
2987 for (CXFA_Node* pRootBoundNode = pFormParent; 2981 for (CXFA_Node* pRootBoundNode = pFormParent;
2988 pRootBoundNode && 2982 pRootBoundNode && pRootBoundNode->IsContainerNode();
2989 pRootBoundNode->GetObjectType() == XFA_OBJECTTYPE_ContainerNode;
2990 pRootBoundNode = pRootBoundNode->GetNodeItem(XFA_NODEITEM_Parent)) { 2983 pRootBoundNode = pRootBoundNode->GetNodeItem(XFA_NODEITEM_Parent)) {
2991 pDataScope = pRootBoundNode->GetBindData(); 2984 pDataScope = pRootBoundNode->GetBindData();
2992 if (pDataScope) { 2985 if (pDataScope) {
2993 break; 2986 break;
2994 } 2987 }
2995 } 2988 }
2996 if (!pDataScope) { 2989 if (!pDataScope) {
2997 pDataScope = ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record)); 2990 pDataScope = ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record));
2998 ASSERT(pDataScope); 2991 ASSERT(pDataScope);
2999 } 2992 }
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
4058 return iBytes == sizeof(void*) && FXSYS_memcpy(&pData, pData, iBytes); 4051 return iBytes == sizeof(void*) && FXSYS_memcpy(&pData, pData, iBytes);
4059 } 4052 }
4060 FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, 4053 FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
4061 const CFX_WideString& wsXMLValue, 4054 const CFX_WideString& wsXMLValue,
4062 bool bNotify, 4055 bool bNotify,
4063 FX_BOOL bScriptModify, 4056 FX_BOOL bScriptModify,
4064 FX_BOOL bSyncData) { 4057 FX_BOOL bSyncData) {
4065 CXFA_Node* pNode = nullptr; 4058 CXFA_Node* pNode = nullptr;
4066 CXFA_Node* pBindNode = nullptr; 4059 CXFA_Node* pBindNode = nullptr;
4067 switch (GetObjectType()) { 4060 switch (GetObjectType()) {
4068 case XFA_OBJECTTYPE_ContainerNode: { 4061 case XFA_ObjectType::ContainerNode: {
4069 if (XFA_FieldIsMultiListBox(this)) { 4062 if (XFA_FieldIsMultiListBox(this)) {
4070 CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value); 4063 CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value);
4071 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); 4064 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild);
4072 ASSERT(pChildValue); 4065 ASSERT(pChildValue);
4073 pChildValue->SetCData(XFA_ATTRIBUTE_ContentType, L"text/xml"); 4066 pChildValue->SetCData(XFA_ATTRIBUTE_ContentType, L"text/xml");
4074 pChildValue->SetScriptContent(wsContent, wsContent, bNotify, 4067 pChildValue->SetScriptContent(wsContent, wsContent, bNotify,
4075 bScriptModify, FALSE); 4068 bScriptModify, FALSE);
4076 CXFA_Node* pBind = GetBindData(); 4069 CXFA_Node* pBind = GetBindData();
4077 if (bSyncData && pBind) { 4070 if (bSyncData && pBind) {
4078 CFX_WideStringArray wsSaveTextArray; 4071 CFX_WideStringArray wsSaveTextArray;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
4159 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { 4152 for (int32_t i = 0; i < nodeArray.GetSize(); i++) {
4160 if (nodeArray[i] != this) { 4153 if (nodeArray[i] != this) {
4161 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, true, 4154 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, true,
4162 FALSE); 4155 FALSE);
4163 } 4156 }
4164 } 4157 }
4165 } 4158 }
4166 pBindNode = nullptr; 4159 pBindNode = nullptr;
4167 break; 4160 break;
4168 } 4161 }
4169 case XFA_OBJECTTYPE_ContentNode: { 4162 case XFA_ObjectType::ContentNode: {
4170 CFX_WideString wsContentType; 4163 CFX_WideString wsContentType;
4171 if (GetClassID() == XFA_ELEMENT_ExData) { 4164 if (GetClassID() == XFA_ELEMENT_ExData) {
4172 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); 4165 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE);
4173 if (wsContentType == FX_WSTRC(L"text/html")) { 4166 if (wsContentType == FX_WSTRC(L"text/html")) {
4174 wsContentType = FX_WSTRC(L""); 4167 wsContentType = FX_WSTRC(L"");
4175 SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType.AsStringC()); 4168 SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType.AsStringC());
4176 } 4169 }
4177 } 4170 }
4178 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); 4171 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild);
4179 if (!pContentRawDataNode) { 4172 if (!pContentRawDataNode) {
4180 pContentRawDataNode = CreateSamePacketNode( 4173 pContentRawDataNode = CreateSamePacketNode(
4181 (wsContentType == FX_WSTRC(L"text/xml")) ? XFA_ELEMENT_Sharpxml 4174 (wsContentType == FX_WSTRC(L"text/xml")) ? XFA_ELEMENT_Sharpxml
4182 : XFA_ELEMENT_Sharptext); 4175 : XFA_ELEMENT_Sharptext);
4183 InsertChild(pContentRawDataNode); 4176 InsertChild(pContentRawDataNode);
4184 } 4177 }
4185 return pContentRawDataNode->SetScriptContent( 4178 return pContentRawDataNode->SetScriptContent(
4186 wsContent, wsXMLValue, bNotify, bScriptModify, bSyncData); 4179 wsContent, wsXMLValue, bNotify, bScriptModify, bSyncData);
4187 } break; 4180 } break;
4188 case XFA_OBJECTTYPE_NodeC: 4181 case XFA_ObjectType::NodeC:
4189 case XFA_OBJECTTYPE_TextNode: 4182 case XFA_ObjectType::TextNode:
4190 pNode = this; 4183 pNode = this;
4191 break; 4184 break;
4192 case XFA_OBJECTTYPE_NodeV: 4185 case XFA_ObjectType::NodeV:
4193 pNode = this; 4186 pNode = this;
4194 if (bSyncData && GetPacketID() == XFA_XDPPACKET_Form) { 4187 if (bSyncData && GetPacketID() == XFA_XDPPACKET_Form) {
4195 CXFA_Node* pParent = GetNodeItem(XFA_NODEITEM_Parent); 4188 CXFA_Node* pParent = GetNodeItem(XFA_NODEITEM_Parent);
4196 if (pParent) { 4189 if (pParent) {
4197 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); 4190 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent);
4198 } 4191 }
4199 if (pParent && pParent->GetClassID() == XFA_ELEMENT_Value) { 4192 if (pParent && pParent->GetClassID() == XFA_ELEMENT_Value) {
4200 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent); 4193 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent);
4201 if (pParent && pParent->IsContainerNode()) { 4194 if (pParent && pParent->IsContainerNode()) {
4202 pBindNode = pParent->GetBindData(); 4195 pBindNode = pParent->GetBindData();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4242 return TryContent(wsContent, bScriptModify) ? wsContent : CFX_WideString(); 4235 return TryContent(wsContent, bScriptModify) ? wsContent : CFX_WideString();
4243 } 4236 }
4244 CFX_WideString CXFA_Node::GetContent() { 4237 CFX_WideString CXFA_Node::GetContent() {
4245 return GetScriptContent(); 4238 return GetScriptContent();
4246 } 4239 }
4247 FX_BOOL CXFA_Node::TryContent(CFX_WideString& wsContent, 4240 FX_BOOL CXFA_Node::TryContent(CFX_WideString& wsContent,
4248 FX_BOOL bScriptModify, 4241 FX_BOOL bScriptModify,
4249 FX_BOOL bProto) { 4242 FX_BOOL bProto) {
4250 CXFA_Node* pNode = nullptr; 4243 CXFA_Node* pNode = nullptr;
4251 switch (GetObjectType()) { 4244 switch (GetObjectType()) {
4252 case XFA_OBJECTTYPE_ContainerNode: 4245 case XFA_ObjectType::ContainerNode:
4253 if (GetClassID() == XFA_ELEMENT_ExclGroup) { 4246 if (GetClassID() == XFA_ELEMENT_ExclGroup) {
4254 pNode = this; 4247 pNode = this;
4255 } else { 4248 } else {
4256 CXFA_Node* pValue = GetChild(0, XFA_ELEMENT_Value); 4249 CXFA_Node* pValue = GetChild(0, XFA_ELEMENT_Value);
4257 if (!pValue) { 4250 if (!pValue) {
4258 return FALSE; 4251 return FALSE;
4259 } 4252 }
4260 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); 4253 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild);
4261 if (pChildValue && XFA_FieldIsMultiListBox(this)) { 4254 if (pChildValue && XFA_FieldIsMultiListBox(this)) {
4262 pChildValue->SetAttribute(XFA_ATTRIBUTE_ContentType, 4255 pChildValue->SetAttribute(XFA_ATTRIBUTE_ContentType,
4263 FX_WSTRC(L"text/xml")); 4256 FX_WSTRC(L"text/xml"));
4264 } 4257 }
4265 return pChildValue 4258 return pChildValue
4266 ? pChildValue->TryContent(wsContent, bScriptModify, bProto) 4259 ? pChildValue->TryContent(wsContent, bScriptModify, bProto)
4267 : FALSE; 4260 : FALSE;
4268 } 4261 }
4269 break; 4262 break;
4270 case XFA_OBJECTTYPE_ContentNode: { 4263 case XFA_ObjectType::ContentNode: {
4271 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); 4264 CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild);
4272 if (!pContentRawDataNode) { 4265 if (!pContentRawDataNode) {
4273 XFA_ELEMENT element = XFA_ELEMENT_Sharptext; 4266 XFA_ELEMENT element = XFA_ELEMENT_Sharptext;
4274 if (GetClassID() == XFA_ELEMENT_ExData) { 4267 if (GetClassID() == XFA_ELEMENT_ExData) {
4275 CFX_WideString wsContentType; 4268 CFX_WideString wsContentType;
4276 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); 4269 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE);
4277 if (wsContentType == FX_WSTRC(L"text/html")) { 4270 if (wsContentType == FX_WSTRC(L"text/html")) {
4278 element = XFA_ELEMENT_SharpxHTML; 4271 element = XFA_ELEMENT_SharpxHTML;
4279 } else if (wsContentType == FX_WSTRC(L"text/xml")) { 4272 } else if (wsContentType == FX_WSTRC(L"text/xml")) {
4280 element = XFA_ELEMENT_Sharpxml; 4273 element = XFA_ELEMENT_Sharpxml;
4281 } 4274 }
4282 } 4275 }
4283 pContentRawDataNode = CreateSamePacketNode(element); 4276 pContentRawDataNode = CreateSamePacketNode(element);
4284 InsertChild(pContentRawDataNode); 4277 InsertChild(pContentRawDataNode);
4285 } 4278 }
4286 return pContentRawDataNode->TryContent(wsContent, bScriptModify, bProto); 4279 return pContentRawDataNode->TryContent(wsContent, bScriptModify, bProto);
4287 } 4280 }
4288 case XFA_OBJECTTYPE_NodeC: 4281 case XFA_ObjectType::NodeC:
4289 case XFA_OBJECTTYPE_NodeV: 4282 case XFA_ObjectType::NodeV:
4290 case XFA_OBJECTTYPE_TextNode: 4283 case XFA_ObjectType::TextNode:
4291 pNode = this; 4284 pNode = this;
4292 default: 4285 default:
4293 if (GetClassID() == XFA_ELEMENT_DataValue) { 4286 if (GetClassID() == XFA_ELEMENT_DataValue) {
4294 pNode = this; 4287 pNode = this;
4295 } 4288 }
4296 break; 4289 break;
4297 } 4290 }
4298 if (pNode) { 4291 if (pNode) {
4299 if (bScriptModify) { 4292 if (bScriptModify) {
4300 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 4293 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
(...skipping 24 matching lines...) Expand all
4325 case XFA_XDPPACKET_SourceSet: 4318 case XFA_XDPPACKET_SourceSet:
4326 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet)); 4319 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_SourceSet));
4327 case XFA_XDPPACKET_Xdc: 4320 case XFA_XDPPACKET_Xdc:
4328 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc)); 4321 return ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Xdc));
4329 default: 4322 default:
4330 return this; 4323 return this;
4331 } 4324 }
4332 } 4325 }
4333 FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) { 4326 FX_BOOL CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) {
4334 wsNamespace.clear(); 4327 wsNamespace.clear();
4335 if (GetObjectType() == XFA_OBJECTTYPE_ModelNode || 4328 if (IsModelNode() || GetClassID() == XFA_ELEMENT_Packet) {
4336 GetClassID() == XFA_ELEMENT_Packet) {
4337 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); 4329 CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
4338 if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) { 4330 if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) {
4339 return FALSE; 4331 return FALSE;
4340 } 4332 }
4341 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); 4333 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace);
4342 return TRUE; 4334 return TRUE;
4343 } else if (GetPacketID() == XFA_XDPPACKET_Datasets) { 4335 } else if (GetPacketID() == XFA_XDPPACKET_Datasets) {
4344 CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); 4336 CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
4345 if (!pXMLNode) { 4337 if (!pXMLNode) {
4346 return FALSE; 4338 return FALSE;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
4394 } 4386 }
4395 } 4387 }
4396 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); 4388 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
4397 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket); 4389 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket);
4398 CXFA_Node* pNewNode = nullptr; 4390 CXFA_Node* pNewNode = nullptr;
4399 for (; iCount <= index; iCount++) { 4391 for (; iCount <= index; iCount++) {
4400 pNewNode = pFactory->CreateNode(pPacket, eProperty); 4392 pNewNode = pFactory->CreateNode(pPacket, eProperty);
4401 if (!pNewNode) 4393 if (!pNewNode)
4402 return nullptr; 4394 return nullptr;
4403 InsertChild(pNewNode, nullptr); 4395 InsertChild(pNewNode, nullptr);
4404 pNewNode->SetFlag(XFA_NODEFLAG_Initialized, true); 4396 pNewNode->SetFlag(XFA_NodeFlag_Initialized, true);
4405 } 4397 }
4406 return pNewNode; 4398 return pNewNode;
4407 } 4399 }
4408 int32_t CXFA_Node::CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild) { 4400 int32_t CXFA_Node::CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild) {
4409 CXFA_Node* pNode = m_pChild; 4401 CXFA_Node* pNode = m_pChild;
4410 int32_t iCount = 0; 4402 int32_t iCount = 0;
4411 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4403 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4412 if (pNode->GetClassID() == eElement || eElement == XFA_ELEMENT_UNKNOWN) { 4404 if (pNode->GetClassID() == eElement || eElement == XFA_ELEMENT_UNKNOWN) {
4413 if (bOnlyChild) { 4405 if (bOnlyChild) {
4414 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( 4406 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4472 } 4464 }
4473 pNode->m_pNext = pPrev->m_pNext; 4465 pNode->m_pNext = pPrev->m_pNext;
4474 pPrev->m_pNext = pNode; 4466 pPrev->m_pNext = pNode;
4475 index = iCount; 4467 index = iCount;
4476 } 4468 }
4477 if (!pNode->m_pNext) { 4469 if (!pNode->m_pNext) {
4478 m_pLastChild = pNode; 4470 m_pLastChild = pNode;
4479 } 4471 }
4480 ASSERT(m_pLastChild); 4472 ASSERT(m_pLastChild);
4481 ASSERT(!m_pLastChild->m_pNext); 4473 ASSERT(!m_pLastChild->m_pNext);
4482 pNode->ClearFlag(XFA_NODEFLAG_HasRemoved); 4474 pNode->ClearFlag(XFA_NodeFlag_HasRemovedChildren);
4483 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 4475 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
4484 if (pNotify) 4476 if (pNotify)
4485 pNotify->OnChildAdded(this); 4477 pNotify->OnChildAdded(this);
4486 4478
4487 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { 4479 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
4488 ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent)); 4480 ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent));
4489 m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, index); 4481 m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, index);
4490 pNode->ClearFlag(XFA_NODEFLAG_OwnXMLNode); 4482 pNode->ClearFlag(XFA_NodeFlag_OwnXMLNode);
4491 } 4483 }
4492 return index; 4484 return index;
4493 } 4485 }
4494 4486
4495 FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { 4487 FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) {
4496 if (!pNode || pNode->m_pParent || 4488 if (!pNode || pNode->m_pParent ||
4497 (pBeforeNode && pBeforeNode->m_pParent != this)) { 4489 (pBeforeNode && pBeforeNode->m_pParent != this)) {
4498 ASSERT(false); 4490 ASSERT(false);
4499 return FALSE; 4491 return FALSE;
4500 } 4492 }
(...skipping 18 matching lines...) Expand all
4519 nIndex++; 4511 nIndex++;
4520 } 4512 }
4521 pNode->m_pNext = pPrev->m_pNext; 4513 pNode->m_pNext = pPrev->m_pNext;
4522 pPrev->m_pNext = pNode; 4514 pPrev->m_pNext = pNode;
4523 } 4515 }
4524 if (!pNode->m_pNext) { 4516 if (!pNode->m_pNext) {
4525 m_pLastChild = pNode; 4517 m_pLastChild = pNode;
4526 } 4518 }
4527 ASSERT(m_pLastChild); 4519 ASSERT(m_pLastChild);
4528 ASSERT(!m_pLastChild->m_pNext); 4520 ASSERT(!m_pLastChild->m_pNext);
4529 pNode->ClearFlag(XFA_NODEFLAG_HasRemoved); 4521 pNode->ClearFlag(XFA_NodeFlag_HasRemovedChildren);
4530 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 4522 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
4531 if (pNotify) 4523 if (pNotify)
4532 pNotify->OnChildAdded(this); 4524 pNotify->OnChildAdded(this);
4533 4525
4534 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { 4526 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
4535 ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent)); 4527 ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent));
4536 m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, nIndex); 4528 m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, nIndex);
4537 pNode->ClearFlag(XFA_NODEFLAG_OwnXMLNode); 4529 pNode->ClearFlag(XFA_NodeFlag_OwnXMLNode);
4538 } 4530 }
4539 return TRUE; 4531 return TRUE;
4540 } 4532 }
4541 CXFA_Node* CXFA_Node::Deprecated_GetPrevSibling() { 4533 CXFA_Node* CXFA_Node::Deprecated_GetPrevSibling() {
4542 if (!m_pParent) { 4534 if (!m_pParent) {
4543 return nullptr; 4535 return nullptr;
4544 } 4536 }
4545 for (CXFA_Node* pSibling = m_pParent->m_pChild; pSibling; 4537 for (CXFA_Node* pSibling = m_pParent->m_pChild; pSibling;
4546 pSibling = pSibling->m_pNext) { 4538 pSibling = pSibling->m_pNext) {
4547 if (pSibling->m_pNext == this) { 4539 if (pSibling->m_pNext == this) {
(...skipping 18 matching lines...) Expand all
4566 CXFA_Node* pPrev = pNode->Deprecated_GetPrevSibling(); 4558 CXFA_Node* pPrev = pNode->Deprecated_GetPrevSibling();
4567 pPrev->m_pNext = pNode->m_pNext; 4559 pPrev->m_pNext = pNode->m_pNext;
4568 if (m_pLastChild == pNode) { 4560 if (m_pLastChild == pNode) {
4569 m_pLastChild = pNode->m_pNext ? pNode->m_pNext : pPrev; 4561 m_pLastChild = pNode->m_pNext ? pNode->m_pNext : pPrev;
4570 } 4562 }
4571 pNode->m_pNext = nullptr; 4563 pNode->m_pNext = nullptr;
4572 pNode->m_pParent = nullptr; 4564 pNode->m_pParent = nullptr;
4573 } 4565 }
4574 ASSERT(!m_pLastChild || !m_pLastChild->m_pNext); 4566 ASSERT(!m_pLastChild || !m_pLastChild->m_pNext);
4575 OnRemoved(bNotify); 4567 OnRemoved(bNotify);
4576 pNode->SetFlag(XFA_NODEFLAG_HasRemoved, true); 4568 pNode->SetFlag(XFA_NodeFlag_HasRemovedChildren, true);
4577 m_pDocument->AddPurgeNode(pNode); 4569 m_pDocument->AddPurgeNode(pNode);
4578 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { 4570 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
4579 if (pNode->IsAttributeInXML()) { 4571 if (pNode->IsAttributeInXML()) {
4580 ASSERT(pNode->m_pXMLNode == m_pXMLNode && 4572 ASSERT(pNode->m_pXMLNode == m_pXMLNode &&
4581 m_pXMLNode->GetType() == FDE_XMLNODE_Element); 4573 m_pXMLNode->GetType() == FDE_XMLNODE_Element);
4582 if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) { 4574 if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) {
4583 CFDE_XMLElement* pXMLElement = 4575 CFDE_XMLElement* pXMLElement =
4584 static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode); 4576 static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode);
4585 CFX_WideStringC wsAttributeName = 4577 CFX_WideStringC wsAttributeName =
4586 pNode->GetCData(XFA_ATTRIBUTE_QualifiedName); 4578 pNode->GetCData(XFA_ATTRIBUTE_QualifiedName);
4587 pXMLElement->RemoveAttribute(wsAttributeName.c_str()); 4579 pXMLElement->RemoveAttribute(wsAttributeName.c_str());
4588 } 4580 }
4589 CFX_WideString wsName; 4581 CFX_WideString wsName;
4590 pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); 4582 pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE);
4591 CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName); 4583 CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName);
4592 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); 4584 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
4593 if (!wsValue.IsEmpty()) { 4585 if (!wsValue.IsEmpty()) {
4594 pNewXMLElement->SetTextData(CFX_WideString(wsValue)); 4586 pNewXMLElement->SetTextData(CFX_WideString(wsValue));
4595 } 4587 }
4596 pNode->m_pXMLNode = pNewXMLElement; 4588 pNode->m_pXMLNode = pNewXMLElement;
4597 pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); 4589 pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown);
4598 } else { 4590 } else {
4599 m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode); 4591 m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode);
4600 } 4592 }
4601 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, false); 4593 pNode->SetFlag(XFA_NodeFlag_OwnXMLNode, false);
4602 } 4594 }
4603 return TRUE; 4595 return TRUE;
4604 } 4596 }
4605 CXFA_Node* CXFA_Node::GetFirstChildByName(const CFX_WideStringC& wsName) const { 4597 CXFA_Node* CXFA_Node::GetFirstChildByName(const CFX_WideStringC& wsName) const {
4606 return GetFirstChildByName(FX_HashCode_GetW(wsName, false)); 4598 return GetFirstChildByName(FX_HashCode_GetW(wsName, false));
4607 } 4599 }
4608 CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const { 4600 CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const {
4609 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; 4601 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
4610 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4602 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4611 if (pNode->GetNameHash() == dwNameHash) { 4603 if (pNode->GetNameHash() == dwNameHash) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
4689 } 4681 }
4690 break; 4682 break;
4691 } 4683 }
4692 } 4684 }
4693 } 4685 }
4694 return pInstanceMgr; 4686 return pInstanceMgr;
4695 } 4687 }
4696 CXFA_Node* CXFA_Node::GetOccurNode() { 4688 CXFA_Node* CXFA_Node::GetOccurNode() {
4697 return GetFirstChildByClass(XFA_ELEMENT_Occur); 4689 return GetFirstChildByClass(XFA_ELEMENT_Occur);
4698 } 4690 }
4699 FX_BOOL CXFA_Node::HasFlag(uint32_t dwFlag) const { 4691 bool CXFA_Node::HasFlag(XFA_NodeFlag dwFlag) const {
4700 if (m_uFlags & dwFlag) { 4692 if (m_uNodeFlags & dwFlag)
4701 return TRUE; 4693 return true;
4702 } 4694 if (dwFlag == XFA_NodeFlag_HasRemovedChildren)
4703 switch (dwFlag) { 4695 return m_pParent && m_pParent->HasFlag(dwFlag);
4704 case XFA_NODEFLAG_HasRemoved: 4696 return false;
4705 return m_pParent && m_pParent->HasFlag(dwFlag);
4706 default:
4707 break;
4708 }
4709 return FALSE;
4710 } 4697 }
4711 4698
4712 void CXFA_Node::SetFlag(uint32_t dwFlag, bool bNotify) { 4699 void CXFA_Node::SetFlag(uint32_t dwFlag, bool bNotify) {
4713 if (dwFlag == XFA_NODEFLAG_Initialized && bNotify && 4700 if (dwFlag == XFA_NodeFlag_Initialized && bNotify && !IsInitialized()) {
4714 !HasFlag(XFA_NODEFLAG_Initialized)) {
4715 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 4701 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
4716 if (pNotify) { 4702 if (pNotify) {
4717 pNotify->OnNodeReady(this); 4703 pNotify->OnNodeReady(this);
4718 } 4704 }
4719 } 4705 }
4720 m_uFlags |= dwFlag; 4706 m_uNodeFlags |= dwFlag;
4721 } 4707 }
4722 4708
4723 void CXFA_Node::ClearFlag(uint32_t dwFlag) { 4709 void CXFA_Node::ClearFlag(uint32_t dwFlag) {
4724 m_uFlags &= ~dwFlag; 4710 m_uNodeFlags &= ~dwFlag;
4725 } 4711 }
4726 4712
4727 FX_BOOL CXFA_Node::IsAttributeInXML() { 4713 FX_BOOL CXFA_Node::IsAttributeInXML() {
4728 return GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData; 4714 return GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData;
4729 } 4715 }
4730 4716
4731 void CXFA_Node::OnRemoved(bool bNotify) { 4717 void CXFA_Node::OnRemoved(bool bNotify) {
4732 if (!bNotify) 4718 if (!bNotify)
4733 return; 4719 return;
4734 4720
4735 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 4721 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
4736 if (pNotify) 4722 if (pNotify)
4737 pNotify->OnChildRemoved(); 4723 pNotify->OnChildRemoved();
4738 } 4724 }
4739 4725
4740 void CXFA_Node::OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify) { 4726 void CXFA_Node::OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify) {
4741 if (bNotify && HasFlag(XFA_NODEFLAG_Initialized)) { 4727 if (bNotify && IsInitialized()) {
4742 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 4728 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
4743 if (pNotify) { 4729 if (pNotify) {
4744 pNotify->OnValueChanging(this, eAttr); 4730 pNotify->OnValueChanging(this, eAttr);
4745 } 4731 }
4746 } 4732 }
4747 } 4733 }
4748 4734
4749 void CXFA_Node::OnChanged(XFA_ATTRIBUTE eAttr, 4735 void CXFA_Node::OnChanged(XFA_ATTRIBUTE eAttr,
4750 bool bNotify, 4736 bool bNotify,
4751 FX_BOOL bScriptModify) { 4737 FX_BOOL bScriptModify) {
4752 if (bNotify && HasFlag(XFA_NODEFLAG_Initialized)) { 4738 if (bNotify && IsInitialized()) {
4753 Script_Attribute_SendAttributeChangeMessage(eAttr, bScriptModify); 4739 Script_Attribute_SendAttributeChangeMessage(eAttr, bScriptModify);
4754 } 4740 }
4755 } 4741 }
4756 4742
4757 int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, 4743 int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName,
4758 XFA_ELEMENT eElementType) { 4744 XFA_ELEMENT eElementType) {
4759 int32_t iRet = XFA_EVENTERROR_NotExist; 4745 int32_t iRet = XFA_EVENTERROR_NotExist;
4760 const XFA_ExecEventParaInfo* eventParaInfo = 4746 const XFA_ExecEventParaInfo* eventParaInfo =
4761 GetEventParaInfoByName(wsEventName); 4747 GetEventParaInfoByName(wsEventName);
4762 if (eventParaInfo) { 4748 if (eventParaInfo) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
4823 m_dwNameHash = FX_HashCode_GetW(wsName, false); 4809 m_dwNameHash = FX_HashCode_GetW(wsName, false);
4824 } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) { 4810 } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) {
4825 wsName = XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName; 4811 wsName = XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName;
4826 m_dwNameHash = FX_HashCode_GetW(wsName, false); 4812 m_dwNameHash = FX_HashCode_GetW(wsName, false);
4827 } 4813 }
4828 } 4814 }
4829 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { 4815 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() {
4830 if (!m_pXMLNode) { 4816 if (!m_pXMLNode) {
4831 CFX_WideString wsTag(GetCData(XFA_ATTRIBUTE_Name)); 4817 CFX_WideString wsTag(GetCData(XFA_ATTRIBUTE_Name));
4832 m_pXMLNode = new CFDE_XMLElement(wsTag); 4818 m_pXMLNode = new CFDE_XMLElement(wsTag);
4833 SetFlag(XFA_NODEFLAG_OwnXMLNode, false); 4819 SetFlag(XFA_NodeFlag_OwnXMLNode, false);
4834 } 4820 }
4835 return m_pXMLNode; 4821 return m_pXMLNode;
4836 } 4822 }
4837 FX_BOOL CXFA_Node::IsNeedSavingXMLNode() { 4823 FX_BOOL CXFA_Node::IsNeedSavingXMLNode() {
4838 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets || 4824 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets ||
4839 GetClassID() == XFA_ELEMENT_Xfa); 4825 GetClassID() == XFA_ELEMENT_Xfa);
4840 } 4826 }
4841 4827
4842 XFA_MAPMODULEDATA* CXFA_Node::CreateMapModuleData() { 4828 XFA_MAPMODULEDATA* CXFA_Node::CreateMapModuleData() {
4843 if (!m_pMapModuleData) 4829 if (!m_pMapModuleData)
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
5055 } 5041 }
5056 if (bNeedMove) { 5042 if (bNeedMove) {
5057 void* pBufferBlockData = pSrcModuleData->m_BufferMap.GetValueAt(pKey); 5043 void* pBufferBlockData = pSrcModuleData->m_BufferMap.GetValueAt(pKey);
5058 if (pBufferBlockData) { 5044 if (pBufferBlockData) {
5059 pSrcModuleData->m_BufferMap.RemoveKey(pKey); 5045 pSrcModuleData->m_BufferMap.RemoveKey(pKey);
5060 pDstModuleData->m_BufferMap.RemoveKey(pKey); 5046 pDstModuleData->m_BufferMap.RemoveKey(pKey);
5061 pDstModuleData->m_BufferMap.SetAt(pKey, 5047 pDstModuleData->m_BufferMap.SetAt(pKey,
5062 (XFA_MAPDATABLOCK*)pBufferBlockData); 5048 (XFA_MAPDATABLOCK*)pBufferBlockData);
5063 } 5049 }
5064 } 5050 }
5065 if (pDstModule->GetObjectType() == XFA_OBJECTTYPE_NodeV) { 5051 if (pDstModule->IsNodeV()) {
5066 CFX_WideString wsValue = pDstModule->GetScriptContent(FALSE); 5052 CFX_WideString wsValue = pDstModule->GetScriptContent(FALSE);
5067 CFX_WideString wsFormatValue(wsValue); 5053 CFX_WideString wsFormatValue(wsValue);
5068 CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData(); 5054 CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData();
5069 if (pWidgetData) { 5055 if (pWidgetData) {
5070 pWidgetData->GetFormatDataValue(wsValue, wsFormatValue); 5056 pWidgetData->GetFormatDataValue(wsValue, wsFormatValue);
5071 } 5057 }
5072 pDstModule->SetScriptContent(wsValue, wsFormatValue, true, TRUE); 5058 pDstModule->SetScriptContent(wsValue, wsFormatValue, true, TRUE);
5073 } 5059 }
5074 } 5060 }
5075 void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule, 5061 void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule,
(...skipping 10 matching lines...) Expand all
5086 pSrcChild = pSrcChild->GetNodeItem(XFA_NODEITEM_NextSibling), 5072 pSrcChild = pSrcChild->GetNodeItem(XFA_NODEITEM_NextSibling),
5087 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { 5073 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
5088 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE); 5074 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE);
5089 } 5075 }
5090 } 5076 }
5091 pSrcModule->MoveBufferMapData(pDstModule, pKey); 5077 pSrcModule->MoveBufferMapData(pDstModule, pKey);
5092 } 5078 }
5093 5079
5094 CXFA_OrdinaryObject::CXFA_OrdinaryObject(CXFA_Document* pDocument, 5080 CXFA_OrdinaryObject::CXFA_OrdinaryObject(CXFA_Document* pDocument,
5095 XFA_ELEMENT eElement) 5081 XFA_ELEMENT eElement)
5096 : CXFA_Object(pDocument, XFA_OBJECTTYPE_OrdinaryObject), m_uScriptHash(0) { 5082 : CXFA_Object(pDocument, XFA_ObjectType::OrdinaryObject), m_uScriptHash(0) {
5097 m_eNodeClass = eElement; 5083 m_eNodeClass = eElement;
5098 } 5084 }
5099 5085
5100 CXFA_OrdinaryObject::~CXFA_OrdinaryObject() {} 5086 CXFA_OrdinaryObject::~CXFA_OrdinaryObject() {}
5101 5087
5102 XFA_ELEMENT CXFA_OrdinaryObject::GetClassID() const { 5088 XFA_ELEMENT CXFA_OrdinaryObject::GetClassID() const {
5103 return m_eNodeClass; 5089 return m_eNodeClass;
5104 } 5090 }
5105 5091
5106 uint32_t CXFA_OrdinaryObject::GetScriptObjHash() const { 5092 uint32_t CXFA_OrdinaryObject::GetScriptObjHash() const {
5107 return m_uScriptHash; 5093 return m_uScriptHash;
5108 } 5094 }
5109 5095
5110 CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) 5096 CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode)
5111 : CXFA_Object(pThisNode->GetDocument(), XFA_OBJECTTYPE_VariablesThis), 5097 : CXFA_Object(pThisNode->GetDocument(), XFA_ObjectType::VariablesThis),
5112 m_pThisNode(NULL), 5098 m_pThisNode(NULL),
5113 m_pScriptNode(NULL) { 5099 m_pScriptNode(NULL) {
5114 m_pThisNode = pThisNode; 5100 m_pThisNode = pThisNode;
5115 m_pScriptNode = pScriptNode; 5101 m_pScriptNode = pScriptNode;
5116 } 5102 }
5117 5103
5118 CXFA_ThisProxy::~CXFA_ThisProxy() {} 5104 CXFA_ThisProxy::~CXFA_ThisProxy() {}
5119 5105
5120 CXFA_Node* CXFA_ThisProxy::GetThisNode() const { 5106 CXFA_Node* CXFA_ThisProxy::GetThisNode() const {
5121 return m_pThisNode; 5107 return m_pThisNode;
5122 } 5108 }
5123 5109
5124 CXFA_Node* CXFA_ThisProxy::GetScriptNode() const { 5110 CXFA_Node* CXFA_ThisProxy::GetScriptNode() const {
5125 return m_pScriptNode; 5111 return m_pScriptNode;
5126 } 5112 }
5127 5113
5128 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) 5114 CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument)
5129 : CXFA_Object(pDocument, XFA_OBJECTTYPE_NodeList) { 5115 : CXFA_Object(pDocument, XFA_ObjectType::NodeList) {
5130 m_pDocument->GetScriptContext()->AddToCacheList( 5116 m_pDocument->GetScriptContext()->AddToCacheList(
5131 std::unique_ptr<CXFA_NodeList>(this)); 5117 std::unique_ptr<CXFA_NodeList>(this));
5132 } 5118 }
5133 CXFA_NodeList::~CXFA_NodeList() {} 5119 CXFA_NodeList::~CXFA_NodeList() {}
5134 XFA_ELEMENT CXFA_NodeList::GetClassID() const { 5120 XFA_ELEMENT CXFA_NodeList::GetClassID() const {
5135 return XFA_ELEMENT_NodeList; 5121 return XFA_ELEMENT_NodeList;
5136 } 5122 }
5137 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { 5123 CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) {
5138 uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); 5124 uint32_t dwHashCode = FX_HashCode_GetW(wsName, false);
5139 int32_t iCount = GetLength(); 5125 int32_t iCount = GetLength();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
5297 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); 5283 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
5298 } 5284 }
5299 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { 5285 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
5300 return m_pAttachNode->RemoveChild(pNode); 5286 return m_pAttachNode->RemoveChild(pNode);
5301 } 5287 }
5302 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { 5288 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
5303 return m_pAttachNode->GetChild( 5289 return m_pAttachNode->GetChild(
5304 iIndex, XFA_ELEMENT_UNKNOWN, 5290 iIndex, XFA_ELEMENT_UNKNOWN,
5305 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5291 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
5306 } 5292 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698