OLD | NEW |
---|---|
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/parser/xfa_object.h" | 7 #include "xfa/fxfa/parser/xfa_object.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... | |
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 eType) { |
47 return XFA_GetElementByID(eElement)->eObjectType; | 47 return XFA_GetElementByID(eType)->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 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); | 101 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); |
102 va_end(arg_ptr); | 102 va_end(arg_ptr); |
103 FXJSE_ThrowMessage( | 103 FXJSE_ThrowMessage( |
104 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); | 104 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); |
105 } | 105 } |
106 | 106 |
107 XFA_MAPMODULEDATA::XFA_MAPMODULEDATA() {} | 107 XFA_MAPMODULEDATA::XFA_MAPMODULEDATA() {} |
108 | 108 |
109 XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {} | 109 XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {} |
110 | 110 |
111 CXFA_Node::CXFA_Node(CXFA_Document* pDoc, | 111 CXFA_Node::CXFA_Node(CXFA_Document* pDoc, uint16_t ePacket, XFA_Element eType) |
Lei Zhang
2016/06/23 15:01:23
Ditto, more below.
dsinclair
2016/06/23 15:57:28
Done.
| |
112 uint16_t ePacket, | 112 : CXFA_Object(pDoc, XFA_GetElementObjectType(eType), eType), |
113 XFA_Element eElement) | |
114 : CXFA_Object(pDoc, XFA_GetElementObjectType(eElement), eElement), | |
115 m_pNext(nullptr), | 113 m_pNext(nullptr), |
116 m_pChild(nullptr), | 114 m_pChild(nullptr), |
117 m_pLastChild(nullptr), | 115 m_pLastChild(nullptr), |
118 m_pParent(nullptr), | 116 m_pParent(nullptr), |
119 m_pXMLNode(nullptr), | 117 m_pXMLNode(nullptr), |
120 m_ePacket(ePacket), | 118 m_ePacket(ePacket), |
121 m_uNodeFlags(XFA_NodeFlag_None), | 119 m_uNodeFlags(XFA_NodeFlag_None), |
122 m_dwNameHash(0), | 120 m_dwNameHash(0), |
123 m_pAuxNode(nullptr), | 121 m_pAuxNode(nullptr), |
124 m_pMapModuleData(nullptr) { | 122 m_pMapModuleData(nullptr) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 } | 231 } |
234 break; | 232 break; |
235 default: | 233 default: |
236 break; | 234 break; |
237 } | 235 } |
238 return pNode; | 236 return pNode; |
239 } | 237 } |
240 | 238 |
241 int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, | 239 int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, |
242 uint32_t dwTypeFilter, | 240 uint32_t dwTypeFilter, |
243 XFA_Element eElementFilter, | 241 XFA_Element eTypeFilter, |
244 int32_t iLevel) { | 242 int32_t iLevel) { |
245 if (--iLevel < 0) { | 243 if (--iLevel < 0) { |
246 return nodes.GetSize(); | 244 return nodes.GetSize(); |
247 } | 245 } |
248 if (eElementFilter != XFA_Element::Unknown) { | 246 if (eTypeFilter != XFA_Element::Unknown) { |
249 CXFA_Node* pChild = m_pChild; | 247 CXFA_Node* pChild = m_pChild; |
250 while (pChild) { | 248 while (pChild) { |
251 if (pChild->GetElementType() == eElementFilter) { | 249 if (pChild->GetElementType() == eTypeFilter) { |
252 nodes.Add(pChild); | 250 nodes.Add(pChild); |
253 if (iLevel > 0) { | 251 if (iLevel > 0) { |
254 GetNodeList(nodes, dwTypeFilter, eElementFilter, iLevel); | 252 GetNodeList(nodes, dwTypeFilter, eTypeFilter, iLevel); |
255 } | 253 } |
256 } | 254 } |
257 pChild = pChild->m_pNext; | 255 pChild = pChild->m_pNext; |
258 } | 256 } |
259 } else if (dwTypeFilter == | 257 } else if (dwTypeFilter == |
260 (XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties)) { | 258 (XFA_NODEFILTER_Children | XFA_NODEFILTER_Properties)) { |
261 CXFA_Node* pChild = m_pChild; | 259 CXFA_Node* pChild = m_pChild; |
262 while (pChild) { | 260 while (pChild) { |
263 nodes.Add(pChild); | 261 nodes.Add(pChild); |
264 if (iLevel > 0) { | 262 if (iLevel > 0) { |
265 GetNodeList(nodes, dwTypeFilter, eElementFilter, iLevel); | 263 GetNodeList(nodes, dwTypeFilter, eTypeFilter, iLevel); |
266 } | 264 } |
267 pChild = pChild->m_pNext; | 265 pChild = pChild->m_pNext; |
268 } | 266 } |
269 } else if (dwTypeFilter != 0) { | 267 } else if (dwTypeFilter != 0) { |
270 bool bFilterChildren = !!(dwTypeFilter & XFA_NODEFILTER_Children); | 268 bool bFilterChildren = !!(dwTypeFilter & XFA_NODEFILTER_Children); |
271 bool bFilterProperties = !!(dwTypeFilter & XFA_NODEFILTER_Properties); | 269 bool bFilterProperties = !!(dwTypeFilter & XFA_NODEFILTER_Properties); |
272 bool bFilterOneOfProperties = | 270 bool bFilterOneOfProperties = |
273 !!(dwTypeFilter & XFA_NODEFILTER_OneOfProperty); | 271 !!(dwTypeFilter & XFA_NODEFILTER_OneOfProperty); |
274 CXFA_Node* pChild = m_pChild; | 272 CXFA_Node* pChild = m_pChild; |
275 while (pChild) { | 273 while (pChild) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 pNewNode->SetFlag(XFA_NodeFlag_Initialized, true); | 307 pNewNode->SetFlag(XFA_NodeFlag_Initialized, true); |
310 nodes.Add(pNewNode); | 308 nodes.Add(pNewNode); |
311 break; | 309 break; |
312 } | 310 } |
313 } | 311 } |
314 } | 312 } |
315 } | 313 } |
316 return nodes.GetSize(); | 314 return nodes.GetSize(); |
317 } | 315 } |
318 | 316 |
319 CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_Element eElement, | 317 CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_Element eType, |
320 uint32_t dwFlags) { | 318 uint32_t dwFlags) { |
321 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); | 319 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); |
322 CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eElement); | 320 CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eType); |
323 pNode->SetFlag(dwFlags, true); | 321 pNode->SetFlag(dwFlags, true); |
324 return pNode; | 322 return pNode; |
325 } | 323 } |
326 | 324 |
327 CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) { | 325 CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) { |
328 ASSERT(m_ePacket == XFA_XDPPACKET_Template); | 326 ASSERT(m_ePacket == XFA_XDPPACKET_Template); |
329 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); | 327 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); |
330 CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_elementType); | 328 CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_elementType); |
331 if (!pClone) | 329 if (!pClone) |
332 return nullptr; | 330 return nullptr; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 GetObject(XFA_ATTRIBUTE_BindingNode); | 430 GetObject(XFA_ATTRIBUTE_BindingNode); |
433 } | 431 } |
434 | 432 |
435 CXFA_WidgetData* CXFA_Node::GetWidgetData() { | 433 CXFA_WidgetData* CXFA_Node::GetWidgetData() { |
436 return (CXFA_WidgetData*)GetObject(XFA_ATTRIBUTE_WidgetData); | 434 return (CXFA_WidgetData*)GetObject(XFA_ATTRIBUTE_WidgetData); |
437 } | 435 } |
438 | 436 |
439 CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { | 437 CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { |
440 if (GetPacketID() != XFA_XDPPACKET_Form) | 438 if (GetPacketID() != XFA_XDPPACKET_Form) |
441 return nullptr; | 439 return nullptr; |
442 XFA_Element classID = GetElementType(); | 440 XFA_Element eType = GetElementType(); |
443 if (classID == XFA_Element::ExclGroup) | 441 if (eType == XFA_Element::ExclGroup) |
444 return nullptr; | 442 return nullptr; |
445 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); | 443 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); |
446 if (pParentNode && pParentNode->GetElementType() == XFA_Element::ExclGroup) | 444 if (pParentNode && pParentNode->GetElementType() == XFA_Element::ExclGroup) |
447 return nullptr; | 445 return nullptr; |
448 | 446 |
449 if (classID == XFA_Element::Field) { | 447 if (eType == XFA_Element::Field) { |
450 CXFA_WidgetData* pFieldWidgetData = GetWidgetData(); | 448 CXFA_WidgetData* pFieldWidgetData = GetWidgetData(); |
451 if (pFieldWidgetData && | 449 if (pFieldWidgetData && |
452 pFieldWidgetData->GetChoiceListOpen() == | 450 pFieldWidgetData->GetChoiceListOpen() == |
453 XFA_ATTRIBUTEENUM_MultiSelect) { | 451 XFA_ATTRIBUTEENUM_MultiSelect) { |
454 return nullptr; | 452 return nullptr; |
455 } else { | 453 } else { |
456 CFX_WideString wsPicture; | 454 CFX_WideString wsPicture; |
457 if (pFieldWidgetData) { | 455 if (pFieldWidgetData) { |
458 pFieldWidgetData->GetPictureContent(wsPicture, | 456 pFieldWidgetData->GetPictureContent(wsPicture, |
459 XFA_VALUEPICTURE_DataBind); | 457 XFA_VALUEPICTURE_DataBind); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
524 } | 522 } |
525 IFX_Locale* pLocale = GetDocument()->GetLocalMgr()->GetDefLocale(); | 523 IFX_Locale* pLocale = GetDocument()->GetLocalMgr()->GetDefLocale(); |
526 if (pLocale) { | 524 if (pLocale) { |
527 wsLocaleName = pLocale->GetName(); | 525 wsLocaleName = pLocale->GetName(); |
528 return TRUE; | 526 return TRUE; |
529 } | 527 } |
530 return FALSE; | 528 return FALSE; |
531 } | 529 } |
532 | 530 |
533 XFA_ATTRIBUTEENUM CXFA_Node::GetIntact() { | 531 XFA_ATTRIBUTEENUM CXFA_Node::GetIntact() { |
534 XFA_Element eElement = GetElementType(); | |
535 CXFA_Node* pKeep = GetFirstChildByClass(XFA_Element::Keep); | 532 CXFA_Node* pKeep = GetFirstChildByClass(XFA_Element::Keep); |
536 XFA_ATTRIBUTEENUM eLayoutType = GetEnum(XFA_ATTRIBUTE_Layout); | 533 XFA_ATTRIBUTEENUM eLayoutType = GetEnum(XFA_ATTRIBUTE_Layout); |
537 if (pKeep) { | 534 if (pKeep) { |
538 XFA_ATTRIBUTEENUM eIntact; | 535 XFA_ATTRIBUTEENUM eIntact; |
539 if (pKeep->TryEnum(XFA_ATTRIBUTE_Intact, eIntact, FALSE)) { | 536 if (pKeep->TryEnum(XFA_ATTRIBUTE_Intact, eIntact, FALSE)) { |
540 if (eIntact == XFA_ATTRIBUTEENUM_None && | 537 if (eIntact == XFA_ATTRIBUTEENUM_None && |
541 eLayoutType == XFA_ATTRIBUTEENUM_Row && | 538 eLayoutType == XFA_ATTRIBUTEENUM_Row && |
542 m_pDocument->GetCurVersionMode() < XFA_VERSION_208) { | 539 m_pDocument->GetCurVersionMode() < XFA_VERSION_208) { |
543 CXFA_Node* pPreviewRow = GetNodeItem(XFA_NODEITEM_PrevSibling, | 540 CXFA_Node* pPreviewRow = GetNodeItem(XFA_NODEITEM_PrevSibling, |
544 XFA_ObjectType::ContainerNode); | 541 XFA_ObjectType::ContainerNode); |
(...skipping 11 matching lines...) Expand all Loading... | |
556 if (pNode && pNode->TryEnum(XFA_ATTRIBUTE_Next, eValue, FALSE) && | 553 if (pNode && pNode->TryEnum(XFA_ATTRIBUTE_Next, eValue, FALSE) && |
557 (eValue == XFA_ATTRIBUTEENUM_ContentArea || | 554 (eValue == XFA_ATTRIBUTEENUM_ContentArea || |
558 eValue == XFA_ATTRIBUTEENUM_PageArea)) { | 555 eValue == XFA_ATTRIBUTEENUM_PageArea)) { |
559 return XFA_ATTRIBUTEENUM_ContentArea; | 556 return XFA_ATTRIBUTEENUM_ContentArea; |
560 } | 557 } |
561 } | 558 } |
562 } | 559 } |
563 return eIntact; | 560 return eIntact; |
564 } | 561 } |
565 } | 562 } |
566 switch (eElement) { | 563 switch (GetElementType()) { |
567 case XFA_Element::Subform: | 564 case XFA_Element::Subform: |
568 switch (eLayoutType) { | 565 switch (eLayoutType) { |
569 case XFA_ATTRIBUTEENUM_Position: | 566 case XFA_ATTRIBUTEENUM_Position: |
570 case XFA_ATTRIBUTEENUM_Row: | 567 case XFA_ATTRIBUTEENUM_Row: |
571 return XFA_ATTRIBUTEENUM_ContentArea; | 568 return XFA_ATTRIBUTEENUM_ContentArea; |
572 case XFA_ATTRIBUTEENUM_Tb: | 569 case XFA_ATTRIBUTEENUM_Tb: |
573 case XFA_ATTRIBUTEENUM_Table: | 570 case XFA_ATTRIBUTEENUM_Table: |
574 case XFA_ATTRIBUTEENUM_Lr_tb: | 571 case XFA_ATTRIBUTEENUM_Lr_tb: |
575 case XFA_ATTRIBUTEENUM_Rl_tb: | 572 case XFA_ATTRIBUTEENUM_Rl_tb: |
576 return XFA_ATTRIBUTEENUM_None; | 573 return XFA_ATTRIBUTEENUM_None; |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1279 if (!pNotify) | 1276 if (!pNotify) |
1280 return; | 1277 return; |
1281 | 1278 |
1282 uint32_t dwPacket = GetPacketID(); | 1279 uint32_t dwPacket = GetPacketID(); |
1283 if (!(dwPacket & XFA_XDPPACKET_Form)) { | 1280 if (!(dwPacket & XFA_XDPPACKET_Form)) { |
1284 pNotify->OnValueChanged(this, eAttribute, this, this); | 1281 pNotify->OnValueChanged(this, eAttribute, this, this); |
1285 return; | 1282 return; |
1286 } | 1283 } |
1287 | 1284 |
1288 bool bNeedFindContainer = false; | 1285 bool bNeedFindContainer = false; |
1289 XFA_Element eType = GetElementType(); | 1286 switch (GetElementType()) { |
1290 switch (eType) { | |
1291 case XFA_Element::Caption: | 1287 case XFA_Element::Caption: |
1292 bNeedFindContainer = true; | 1288 bNeedFindContainer = true; |
1293 pNotify->OnValueChanged(this, eAttribute, this, | 1289 pNotify->OnValueChanged(this, eAttribute, this, |
1294 GetNodeItem(XFA_NODEITEM_Parent)); | 1290 GetNodeItem(XFA_NODEITEM_Parent)); |
1295 break; | 1291 break; |
1296 case XFA_Element::Font: | 1292 case XFA_Element::Font: |
1297 case XFA_Element::Para: { | 1293 case XFA_Element::Para: { |
1298 bNeedFindContainer = true; | 1294 bNeedFindContainer = true; |
1299 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); | 1295 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); |
1300 if (pParentNode->GetElementType() == XFA_Element::Caption) { | 1296 if (pParentNode->GetElementType() == XFA_Element::Caption) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1376 case XFA_Element::Sharpxml: | 1372 case XFA_Element::Sharpxml: |
1377 case XFA_Element::SharpxHTML: { | 1373 case XFA_Element::SharpxHTML: { |
1378 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent); | 1374 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent); |
1379 if (!pTextNode) { | 1375 if (!pTextNode) { |
1380 return; | 1376 return; |
1381 } | 1377 } |
1382 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent); | 1378 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent); |
1383 if (!pValueNode) { | 1379 if (!pValueNode) { |
1384 return; | 1380 return; |
1385 } | 1381 } |
1386 XFA_Element eNodeType = pValueNode->GetElementType(); | 1382 XFA_Element eType = pValueNode->GetElementType(); |
1387 if (eNodeType == XFA_Element::Value) { | 1383 if (eType == XFA_Element::Value) { |
1388 bNeedFindContainer = true; | 1384 bNeedFindContainer = true; |
1389 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); | 1385 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); |
1390 if (pNode && pNode->IsContainerNode()) { | 1386 if (pNode && pNode->IsContainerNode()) { |
1391 if (bScriptModify) { | 1387 if (bScriptModify) { |
1392 pValueNode = pNode; | 1388 pValueNode = pNode; |
1393 } | 1389 } |
1394 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); | 1390 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); |
1395 } else { | 1391 } else { |
1396 pNotify->OnValueChanged(this, eAttribute, pNode, | 1392 pNotify->OnValueChanged(this, eAttribute, pNode, |
1397 pNode->GetNodeItem(XFA_NODEITEM_Parent)); | 1393 pNode->GetNodeItem(XFA_NODEITEM_Parent)); |
1398 } | 1394 } |
1399 } else { | 1395 } else { |
1400 if (eNodeType == XFA_Element::Items) { | 1396 if (eType == XFA_Element::Items) { |
1401 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); | 1397 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); |
1402 if (pNode && pNode->IsContainerNode()) { | 1398 if (pNode && pNode->IsContainerNode()) { |
1403 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); | 1399 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); |
1404 } | 1400 } |
1405 } | 1401 } |
1406 } | 1402 } |
1407 } break; | 1403 } break; |
1408 default: | 1404 default: |
1409 break; | 1405 break; |
1410 } | 1406 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1591 if (!pWidgetData) { | 1587 if (!pWidgetData) { |
1592 pValue->SetInteger(0); | 1588 pValue->SetInteger(0); |
1593 return; | 1589 return; |
1594 } | 1590 } |
1595 pValue->SetInteger(pWidgetData->CountChoiceListItems(TRUE)); | 1591 pValue->SetInteger(pWidgetData->CountChoiceListItems(TRUE)); |
1596 } | 1592 } |
1597 } | 1593 } |
1598 void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, | 1594 void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, |
1599 FX_BOOL bSetting, | 1595 FX_BOOL bSetting, |
1600 XFA_ATTRIBUTE eAttribute) { | 1596 XFA_ATTRIBUTE eAttribute) { |
1601 XFA_Element classID = GetElementType(); | 1597 XFA_Element eType = GetElementType(); |
1602 if (classID == XFA_Element::Field) { | 1598 if (eType == XFA_Element::Field) { |
1603 Script_Field_DefaultValue(pValue, bSetting, eAttribute); | 1599 Script_Field_DefaultValue(pValue, bSetting, eAttribute); |
1604 return; | 1600 return; |
1605 } else if (classID == XFA_Element::Draw) { | 1601 } |
1602 if (eType == XFA_Element::Draw) { | |
1606 Script_Draw_DefaultValue(pValue, bSetting, eAttribute); | 1603 Script_Draw_DefaultValue(pValue, bSetting, eAttribute); |
1607 return; | 1604 return; |
1608 } else if (classID == XFA_Element::Boolean) { | 1605 } |
1606 if (eType == XFA_Element::Boolean) { | |
1609 Script_Boolean_Value(pValue, bSetting, eAttribute); | 1607 Script_Boolean_Value(pValue, bSetting, eAttribute); |
1610 return; | 1608 return; |
1611 } | 1609 } |
1612 if (bSetting) { | 1610 if (bSetting) { |
1613 CFX_WideString wsNewValue; | 1611 CFX_WideString wsNewValue; |
1614 if (!(pValue && (pValue->IsNull() || pValue->IsUndefined()))) | 1612 if (!(pValue && (pValue->IsNull() || pValue->IsUndefined()))) |
1615 wsNewValue = pValue->ToWideString(); | 1613 wsNewValue = pValue->ToWideString(); |
1616 | 1614 |
1617 CFX_WideString wsFormatValue(wsNewValue); | 1615 CFX_WideString wsFormatValue(wsNewValue); |
1618 CXFA_WidgetData* pContainerWidgetData = nullptr; | 1616 CXFA_WidgetData* pContainerWidgetData = nullptr; |
(...skipping 18 matching lines...) Expand all Loading... | |
1637 } | 1635 } |
1638 } else if (GetPacketID() == XFA_XDPPACKET_Form) { | 1636 } else if (GetPacketID() == XFA_XDPPACKET_Form) { |
1639 pContainerWidgetData = GetContainerWidgetData(); | 1637 pContainerWidgetData = GetContainerWidgetData(); |
1640 } | 1638 } |
1641 if (pContainerWidgetData) { | 1639 if (pContainerWidgetData) { |
1642 pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); | 1640 pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); |
1643 } | 1641 } |
1644 SetScriptContent(wsNewValue, wsFormatValue, true, TRUE); | 1642 SetScriptContent(wsNewValue, wsFormatValue, true, TRUE); |
1645 } else { | 1643 } else { |
1646 CFX_WideString content = GetScriptContent(TRUE); | 1644 CFX_WideString content = GetScriptContent(TRUE); |
1647 if (content.IsEmpty() && classID != XFA_Element::Text && | 1645 if (content.IsEmpty() && eType != XFA_Element::Text && |
1648 classID != XFA_Element::SubmitUrl) { | 1646 eType != XFA_Element::SubmitUrl) { |
1649 pValue->SetNull(); | 1647 pValue->SetNull(); |
1650 } else if (classID == XFA_Element::Integer) { | 1648 } else if (eType == XFA_Element::Integer) { |
1651 pValue->SetInteger(FXSYS_wtoi(content.c_str())); | 1649 pValue->SetInteger(FXSYS_wtoi(content.c_str())); |
1652 } else if (classID == XFA_Element::Float || | 1650 } else if (eType == XFA_Element::Float || eType == XFA_Element::Decimal) { |
1653 classID == XFA_Element::Decimal) { | |
1654 CFX_Decimal decimal(content.AsStringC()); | 1651 CFX_Decimal decimal(content.AsStringC()); |
1655 pValue->SetFloat((FX_FLOAT)(double)decimal); | 1652 pValue->SetFloat((FX_FLOAT)(double)decimal); |
1656 } else { | 1653 } else { |
1657 pValue->SetString( | 1654 pValue->SetString( |
1658 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); | 1655 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); |
1659 } | 1656 } |
1660 } | 1657 } |
1661 } | 1658 } |
1662 void CXFA_Node::Script_Som_DefaultValue_Read(CFXJSE_Value* pValue, | 1659 void CXFA_Node::Script_Som_DefaultValue_Read(CFXJSE_Value* pValue, |
1663 FX_BOOL bSetting, | 1660 FX_BOOL bSetting, |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1940 if (pContainerWidgetData) { | 1937 if (pContainerWidgetData) { |
1941 pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText); | 1938 pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText); |
1942 } | 1939 } |
1943 SetScriptContent(wsNewText, wsFormatText, true, TRUE); | 1940 SetScriptContent(wsNewText, wsFormatText, true, TRUE); |
1944 } else { | 1941 } else { |
1945 CFX_WideString content = GetScriptContent(TRUE); | 1942 CFX_WideString content = GetScriptContent(TRUE); |
1946 if (content.IsEmpty()) { | 1943 if (content.IsEmpty()) { |
1947 pValue->SetNull(); | 1944 pValue->SetNull(); |
1948 } else { | 1945 } else { |
1949 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); | 1946 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); |
1950 XFA_Element eUI = pUIChild->GetElementType(); | |
1951 CXFA_Value defVal = pWidgetData->GetFormValue(); | 1947 CXFA_Value defVal = pWidgetData->GetFormValue(); |
1952 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); | 1948 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); |
1953 if (pNode && pNode->GetElementType() == XFA_Element::Decimal) { | 1949 if (pNode && pNode->GetElementType() == XFA_Element::Decimal) { |
1954 if (eUI == XFA_Element::NumericEdit && | 1950 if (pUIChild->GetElementType() == XFA_Element::NumericEdit && |
1955 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { | 1951 (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { |
1956 pValue->SetString( | 1952 pValue->SetString( |
1957 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); | 1953 FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); |
1958 } else { | 1954 } else { |
1959 CFX_Decimal decimal(content.AsStringC()); | 1955 CFX_Decimal decimal(content.AsStringC()); |
1960 pValue->SetFloat((FX_FLOAT)(double)decimal); | 1956 pValue->SetFloat((FX_FLOAT)(double)decimal); |
1961 } | 1957 } |
1962 } else if (pNode && pNode->GetElementType() == XFA_Element::Integer) { | 1958 } else if (pNode && pNode->GetElementType() == XFA_Element::Integer) { |
1963 pValue->SetInteger(FXSYS_wtoi(content.c_str())); | 1959 pValue->SetInteger(FXSYS_wtoi(content.c_str())); |
1964 } else if (pNode && pNode->GetElementType() == XFA_Element::Boolean) { | 1960 } else if (pNode && pNode->GetElementType() == XFA_Element::Boolean) { |
(...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3594 FX_BOOL bSetting, | 3590 FX_BOOL bSetting, |
3595 XFA_ATTRIBUTE eAttribute) {} | 3591 XFA_ATTRIBUTE eAttribute) {} |
3596 enum XFA_KEYTYPE { | 3592 enum XFA_KEYTYPE { |
3597 XFA_KEYTYPE_Custom, | 3593 XFA_KEYTYPE_Custom, |
3598 XFA_KEYTYPE_Element, | 3594 XFA_KEYTYPE_Element, |
3599 }; | 3595 }; |
3600 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { | 3596 void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { |
3601 uint32_t dwKey = FX_HashCode_GetW(wsKey, false); | 3597 uint32_t dwKey = FX_HashCode_GetW(wsKey, false); |
3602 return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom); | 3598 return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom); |
3603 } | 3599 } |
3604 void* XFA_GetMapKey_Element(XFA_Element eElement, XFA_ATTRIBUTE eAttribute) { | 3600 void* XFA_GetMapKey_Element(XFA_Element eType, XFA_ATTRIBUTE eAttribute) { |
3605 return (void*)(uintptr_t)((static_cast<int32_t>(eElement) << 16) | | 3601 return (void*)(uintptr_t)((static_cast<int32_t>(eType) << 16) | |
3606 (eAttribute << 8) | XFA_KEYTYPE_Element); | 3602 (eAttribute << 8) | XFA_KEYTYPE_Element); |
3607 } | 3603 } |
3608 FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) { | 3604 FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) { |
3609 void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); | 3605 void* pKey = XFA_GetMapKey_Element(GetElementType(), eAttr); |
3610 return HasMapModuleKey(pKey, bCanInherit); | 3606 return HasMapModuleKey(pKey, bCanInherit); |
3611 } | 3607 } |
3612 FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, | 3608 FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, |
3613 const CFX_WideStringC& wsValue, | 3609 const CFX_WideStringC& wsValue, |
3614 bool bNotify) { | 3610 bool bNotify) { |
3615 const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); | 3611 const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4351 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); | 4347 static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI(wsNamespace); |
4352 return TRUE; | 4348 return TRUE; |
4353 } else { | 4349 } else { |
4354 CXFA_Node* pModelNode = GetModelNode(); | 4350 CXFA_Node* pModelNode = GetModelNode(); |
4355 return pModelNode->TryNamespace(wsNamespace); | 4351 return pModelNode->TryNamespace(wsNamespace); |
4356 } | 4352 } |
4357 } | 4353 } |
4358 CXFA_Node* CXFA_Node::GetProperty(int32_t index, | 4354 CXFA_Node* CXFA_Node::GetProperty(int32_t index, |
4359 XFA_Element eProperty, | 4355 XFA_Element eProperty, |
4360 FX_BOOL bCreateProperty) { | 4356 FX_BOOL bCreateProperty) { |
4361 XFA_Element eElement = GetElementType(); | 4357 XFA_Element eType = GetElementType(); |
4362 uint32_t dwPacket = GetPacketID(); | 4358 uint32_t dwPacket = GetPacketID(); |
4363 const XFA_PROPERTY* pProperty = | 4359 const XFA_PROPERTY* pProperty = |
4364 XFA_GetPropertyOfElement(eElement, eProperty, dwPacket); | 4360 XFA_GetPropertyOfElement(eType, eProperty, dwPacket); |
4365 if (!pProperty || index >= pProperty->uOccur) | 4361 if (!pProperty || index >= pProperty->uOccur) |
4366 return nullptr; | 4362 return nullptr; |
4367 | 4363 |
4368 CXFA_Node* pNode = m_pChild; | 4364 CXFA_Node* pNode = m_pChild; |
4369 int32_t iCount = 0; | 4365 int32_t iCount = 0; |
4370 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4366 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
4371 if (pNode->GetElementType() == eProperty) { | 4367 if (pNode->GetElementType() == eProperty) { |
4372 iCount++; | 4368 iCount++; |
4373 if (iCount > index) { | 4369 if (iCount > index) { |
4374 return pNode; | 4370 return pNode; |
4375 } | 4371 } |
4376 } | 4372 } |
4377 } | 4373 } |
4378 if (!bCreateProperty) | 4374 if (!bCreateProperty) |
4379 return nullptr; | 4375 return nullptr; |
4380 | 4376 |
4381 if (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf) { | 4377 if (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf) { |
4382 pNode = m_pChild; | 4378 pNode = m_pChild; |
4383 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4379 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
4384 const XFA_PROPERTY* pExistProperty = | 4380 const XFA_PROPERTY* pExistProperty = |
4385 XFA_GetPropertyOfElement(eElement, pNode->GetElementType(), dwPacket); | 4381 XFA_GetPropertyOfElement(eType, pNode->GetElementType(), dwPacket); |
4386 if (pExistProperty && (pExistProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) | 4382 if (pExistProperty && (pExistProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) |
4387 return nullptr; | 4383 return nullptr; |
4388 } | 4384 } |
4389 } | 4385 } |
4390 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); | 4386 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); |
4391 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket); | 4387 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket); |
4392 CXFA_Node* pNewNode = nullptr; | 4388 CXFA_Node* pNewNode = nullptr; |
4393 for (; iCount <= index; iCount++) { | 4389 for (; iCount <= index; iCount++) { |
4394 pNewNode = pFactory->CreateNode(pPacket, eProperty); | 4390 pNewNode = pFactory->CreateNode(pPacket, eProperty); |
4395 if (!pNewNode) | 4391 if (!pNewNode) |
4396 return nullptr; | 4392 return nullptr; |
4397 InsertChild(pNewNode, nullptr); | 4393 InsertChild(pNewNode, nullptr); |
4398 pNewNode->SetFlag(XFA_NodeFlag_Initialized, true); | 4394 pNewNode->SetFlag(XFA_NodeFlag_Initialized, true); |
4399 } | 4395 } |
4400 return pNewNode; | 4396 return pNewNode; |
4401 } | 4397 } |
4402 int32_t CXFA_Node::CountChildren(XFA_Element eElement, FX_BOOL bOnlyChild) { | 4398 int32_t CXFA_Node::CountChildren(XFA_Element eType, FX_BOOL bOnlyChild) { |
4403 CXFA_Node* pNode = m_pChild; | 4399 CXFA_Node* pNode = m_pChild; |
4404 int32_t iCount = 0; | 4400 int32_t iCount = 0; |
4405 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4401 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
4406 if (pNode->GetElementType() == eElement || | 4402 if (pNode->GetElementType() == eType || eType == XFA_Element::Unknown) { |
4407 eElement == XFA_Element::Unknown) { | |
4408 if (bOnlyChild) { | 4403 if (bOnlyChild) { |
4409 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( | 4404 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( |
4410 GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); | 4405 GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); |
4411 if (pProperty) { | 4406 if (pProperty) { |
4412 continue; | 4407 continue; |
4413 } | 4408 } |
4414 } | 4409 } |
4415 iCount++; | 4410 iCount++; |
4416 } | 4411 } |
4417 } | 4412 } |
4418 return iCount; | 4413 return iCount; |
4419 } | 4414 } |
4420 CXFA_Node* CXFA_Node::GetChild(int32_t index, | 4415 CXFA_Node* CXFA_Node::GetChild(int32_t index, |
4421 XFA_Element eElement, | 4416 XFA_Element eType, |
4422 FX_BOOL bOnlyChild) { | 4417 FX_BOOL bOnlyChild) { |
4423 ASSERT(index > -1); | 4418 ASSERT(index > -1); |
4424 CXFA_Node* pNode = m_pChild; | 4419 CXFA_Node* pNode = m_pChild; |
4425 int32_t iCount = 0; | 4420 int32_t iCount = 0; |
4426 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4421 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
4427 if (pNode->GetElementType() == eElement || | 4422 if (pNode->GetElementType() == eType || eType == XFA_Element::Unknown) { |
4428 eElement == XFA_Element::Unknown) { | |
4429 if (bOnlyChild) { | 4423 if (bOnlyChild) { |
4430 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( | 4424 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( |
4431 GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); | 4425 GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); |
4432 if (pProperty) { | 4426 if (pProperty) { |
4433 continue; | 4427 continue; |
4434 } | 4428 } |
4435 } | 4429 } |
4436 iCount++; | 4430 iCount++; |
4437 if (iCount > index) { | 4431 if (iCount > index) { |
4438 return pNode; | 4432 return pNode; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4603 } | 4597 } |
4604 CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const { | 4598 CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const { |
4605 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; | 4599 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; |
4606 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4600 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
4607 if (pNode->GetNameHash() == dwNameHash) { | 4601 if (pNode->GetNameHash() == dwNameHash) { |
4608 return pNode; | 4602 return pNode; |
4609 } | 4603 } |
4610 } | 4604 } |
4611 return nullptr; | 4605 return nullptr; |
4612 } | 4606 } |
4613 CXFA_Node* CXFA_Node::GetFirstChildByClass(XFA_Element eElement) const { | 4607 CXFA_Node* CXFA_Node::GetFirstChildByClass(XFA_Element eType) const { |
4614 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; | 4608 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; |
4615 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4609 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
4616 if (pNode->GetElementType() == eElement) { | 4610 if (pNode->GetElementType() == eType) { |
4617 return pNode; | 4611 return pNode; |
4618 } | 4612 } |
4619 } | 4613 } |
4620 return nullptr; | 4614 return nullptr; |
4621 } | 4615 } |
4622 CXFA_Node* CXFA_Node::GetNextSameNameSibling(uint32_t dwNameHash) const { | 4616 CXFA_Node* CXFA_Node::GetNextSameNameSibling(uint32_t dwNameHash) const { |
4623 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; | 4617 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; |
4624 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4618 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
4625 if (pNode->GetNameHash() == dwNameHash) { | 4619 if (pNode->GetNameHash() == dwNameHash) { |
4626 return pNode; | 4620 return pNode; |
4627 } | 4621 } |
4628 } | 4622 } |
4629 return nullptr; | 4623 return nullptr; |
4630 } | 4624 } |
4631 CXFA_Node* CXFA_Node::GetNextSameNameSibling( | 4625 CXFA_Node* CXFA_Node::GetNextSameNameSibling( |
4632 const CFX_WideStringC& wsNodeName) const { | 4626 const CFX_WideStringC& wsNodeName) const { |
4633 return GetNextSameNameSibling(FX_HashCode_GetW(wsNodeName, false)); | 4627 return GetNextSameNameSibling(FX_HashCode_GetW(wsNodeName, false)); |
4634 } | 4628 } |
4635 CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_Element eElement) const { | 4629 CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_Element eType) const { |
4636 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; | 4630 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_NextSibling); pNode; |
4637 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 4631 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
4638 if (pNode->GetElementType() == eElement) { | 4632 if (pNode->GetElementType() == eType) { |
4639 return pNode; | 4633 return pNode; |
4640 } | 4634 } |
4641 } | 4635 } |
4642 return nullptr; | 4636 return nullptr; |
4643 } | 4637 } |
4644 int32_t CXFA_Node::GetNodeSameNameIndex() const { | 4638 int32_t CXFA_Node::GetNodeSameNameIndex() const { |
4645 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); | 4639 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); |
4646 if (!pScriptContext) { | 4640 if (!pScriptContext) { |
4647 return -1; | 4641 return -1; |
4648 } | 4642 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4738 | 4732 |
4739 void CXFA_Node::OnChanged(XFA_ATTRIBUTE eAttr, | 4733 void CXFA_Node::OnChanged(XFA_ATTRIBUTE eAttr, |
4740 bool bNotify, | 4734 bool bNotify, |
4741 FX_BOOL bScriptModify) { | 4735 FX_BOOL bScriptModify) { |
4742 if (bNotify && IsInitialized()) { | 4736 if (bNotify && IsInitialized()) { |
4743 Script_Attribute_SendAttributeChangeMessage(eAttr, bScriptModify); | 4737 Script_Attribute_SendAttributeChangeMessage(eAttr, bScriptModify); |
4744 } | 4738 } |
4745 } | 4739 } |
4746 | 4740 |
4747 int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, | 4741 int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, |
4748 XFA_Element eElementType) { | 4742 XFA_Element eType) { |
4749 int32_t iRet = XFA_EVENTERROR_NotExist; | 4743 int32_t iRet = XFA_EVENTERROR_NotExist; |
4750 const XFA_ExecEventParaInfo* eventParaInfo = | 4744 const XFA_ExecEventParaInfo* eventParaInfo = |
4751 GetEventParaInfoByName(wsEventName); | 4745 GetEventParaInfoByName(wsEventName); |
4752 if (eventParaInfo) { | 4746 if (eventParaInfo) { |
4753 uint32_t validFlags = eventParaInfo->m_validFlags; | 4747 uint32_t validFlags = eventParaInfo->m_validFlags; |
4754 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 4748 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
4755 if (!pNotify) { | 4749 if (!pNotify) { |
4756 return iRet; | 4750 return iRet; |
4757 } | 4751 } |
4758 if (validFlags == 1) { | 4752 if (validFlags == 1) { |
4759 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType); | 4753 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType); |
4760 } else if (validFlags == 2) { | 4754 } else if (validFlags == 2) { |
4761 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, | 4755 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, |
4762 FALSE, FALSE); | 4756 FALSE, FALSE); |
4763 } else if (validFlags == 3) { | 4757 } else if (validFlags == 3) { |
4764 if (eElementType == XFA_Element::Subform) { | 4758 if (eType == XFA_Element::Subform) { |
4765 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, | 4759 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, |
4766 FALSE, FALSE); | 4760 FALSE, FALSE); |
4767 } | 4761 } |
4768 } else if (validFlags == 4) { | 4762 } else if (validFlags == 4) { |
4769 if (eElementType == XFA_Element::ExclGroup || | 4763 if (eType == XFA_Element::ExclGroup || eType == XFA_Element::Field) { |
4770 eElementType == XFA_Element::Field) { | |
4771 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); | 4764 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); |
4772 if (pParentNode && | 4765 if (pParentNode && |
4773 pParentNode->GetElementType() == XFA_Element::ExclGroup) { | 4766 pParentNode->GetElementType() == XFA_Element::ExclGroup) { |
4774 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, | 4767 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, |
4775 FALSE, FALSE); | 4768 FALSE, FALSE); |
4776 } | 4769 } |
4777 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, | 4770 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, |
4778 FALSE, FALSE); | 4771 FALSE, FALSE); |
4779 } | 4772 } |
4780 } else if (validFlags == 5) { | 4773 } else if (validFlags == 5) { |
4781 if (eElementType == XFA_Element::Field) { | 4774 if (eType == XFA_Element::Field) { |
4782 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, | 4775 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, |
4783 FALSE, FALSE); | 4776 FALSE, FALSE); |
4784 } | 4777 } |
4785 } else if (validFlags == 6) { | 4778 } else if (validFlags == 6) { |
4786 CXFA_WidgetData* pWidgetData = GetWidgetData(); | 4779 CXFA_WidgetData* pWidgetData = GetWidgetData(); |
4787 if (pWidgetData) { | 4780 if (pWidgetData) { |
4788 CXFA_Node* pUINode = pWidgetData->GetUIChild(); | 4781 CXFA_Node* pUINode = pWidgetData->GetUIChild(); |
4789 if (pUINode->m_elementType == XFA_Element::Signature) { | 4782 if (pUINode->m_elementType == XFA_Element::Signature) { |
4790 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, | 4783 iRet = pNotify->ExecEventByDeepFirst(this, eventParaInfo->m_eventType, |
4791 FALSE, FALSE); | 4784 FALSE, FALSE); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5076 for (; pSrcChild && pDstChild; | 5069 for (; pSrcChild && pDstChild; |
5077 pSrcChild = pSrcChild->GetNodeItem(XFA_NODEITEM_NextSibling), | 5070 pSrcChild = pSrcChild->GetNodeItem(XFA_NODEITEM_NextSibling), |
5078 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 5071 pDstChild = pDstChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
5079 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE); | 5072 MoveBufferMapData(pSrcChild, pDstChild, pKey, TRUE); |
5080 } | 5073 } |
5081 } | 5074 } |
5082 pSrcModule->MoveBufferMapData(pDstModule, pKey); | 5075 pSrcModule->MoveBufferMapData(pDstModule, pKey); |
5083 } | 5076 } |
5084 | 5077 |
5085 CXFA_OrdinaryObject::CXFA_OrdinaryObject(CXFA_Document* pDocument, | 5078 CXFA_OrdinaryObject::CXFA_OrdinaryObject(CXFA_Document* pDocument, |
5086 XFA_Element eElement) | 5079 XFA_Element eType) |
5087 : CXFA_Object(pDocument, XFA_ObjectType::OrdinaryObject, eElement) {} | 5080 : CXFA_Object(pDocument, XFA_ObjectType::OrdinaryObject, eType) {} |
5088 | 5081 |
5089 CXFA_OrdinaryObject::~CXFA_OrdinaryObject() {} | 5082 CXFA_OrdinaryObject::~CXFA_OrdinaryObject() {} |
5090 | 5083 |
5091 CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) | 5084 CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) |
5092 : CXFA_Object(pThisNode->GetDocument(), | 5085 : CXFA_Object(pThisNode->GetDocument(), |
5093 XFA_ObjectType::VariablesThis, | 5086 XFA_ObjectType::VariablesThis, |
5094 XFA_Element::Unknown), | 5087 XFA_Element::Unknown), |
5095 m_pThisNode(NULL), | 5088 m_pThisNode(NULL), |
5096 m_pScriptNode(NULL) { | 5089 m_pScriptNode(NULL) { |
5097 m_pThisNode = pThisNode; | 5090 m_pThisNode = pThisNode; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5280 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5273 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
5281 } | 5274 } |
5282 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5275 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
5283 return m_pAttachNode->RemoveChild(pNode); | 5276 return m_pAttachNode->RemoveChild(pNode); |
5284 } | 5277 } |
5285 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5278 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
5286 return m_pAttachNode->GetChild( | 5279 return m_pAttachNode->GetChild( |
5287 iIndex, XFA_Element::Unknown, | 5280 iIndex, XFA_Element::Unknown, |
5288 m_pAttachNode->GetElementType() == XFA_Element::Subform); | 5281 m_pAttachNode->GetElementType() == XFA_Element::Subform); |
5289 } | 5282 } |
OLD | NEW |