Chromium Code Reviews| 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_document_datamerger_imp.h" | 7 #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "xfa/fde/xml/fde_xml_imp.h" | 10 #include "xfa/fde/xml/fde_xml_imp.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 XFA_DataMerge_FormValueNode_CreateChild(pValueNode, iType); | 66 XFA_DataMerge_FormValueNode_CreateChild(pValueNode, iType); |
| 67 if (!pChildNode) | 67 if (!pChildNode) |
| 68 return FALSE; | 68 return FALSE; |
| 69 | 69 |
| 70 switch (pChildNode->GetObjectType()) { | 70 switch (pChildNode->GetObjectType()) { |
| 71 case XFA_ObjectType::ContentNode: { | 71 case XFA_ObjectType::ContentNode: { |
| 72 CXFA_Node* pContentRawDataNode = | 72 CXFA_Node* pContentRawDataNode = |
| 73 pChildNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 73 pChildNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 74 if (!pContentRawDataNode) { | 74 if (!pContentRawDataNode) { |
| 75 XFA_Element element = XFA_Element::Sharptext; | 75 XFA_Element element = XFA_Element::Sharptext; |
| 76 if (pChildNode->GetClassID() == XFA_Element::ExData) { | 76 if (pChildNode->GetElementType() == XFA_Element::ExData) { |
| 77 CFX_WideString wsContentType; | 77 CFX_WideString wsContentType; |
| 78 pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, | 78 pChildNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, |
| 79 FALSE); | 79 FALSE); |
| 80 if (wsContentType == FX_WSTRC(L"text/html")) { | 80 if (wsContentType == FX_WSTRC(L"text/html")) { |
| 81 element = XFA_Element::SharpxHTML; | 81 element = XFA_Element::SharpxHTML; |
| 82 } else if (wsContentType == FX_WSTRC(L"text/xml")) { | 82 } else if (wsContentType == FX_WSTRC(L"text/xml")) { |
| 83 element = XFA_Element::Sharpxml; | 83 element = XFA_Element::Sharpxml; |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 pContentRawDataNode = pChildNode->CreateSamePacketNode(element); | 86 pContentRawDataNode = pChildNode->CreateSamePacketNode(element); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 97 ASSERT(FALSE); | 97 ASSERT(FALSE); |
| 98 break; | 98 break; |
| 99 } | 99 } |
| 100 return TRUE; | 100 return TRUE; |
| 101 } | 101 } |
| 102 static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, | 102 static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, |
| 103 CXFA_Node* pDataNode, | 103 CXFA_Node* pDataNode, |
| 104 FX_BOOL bDataToForm = TRUE) { | 104 FX_BOOL bDataToForm = TRUE) { |
| 105 pFormNode->SetObject(XFA_ATTRIBUTE_BindingNode, pDataNode); | 105 pFormNode->SetObject(XFA_ATTRIBUTE_BindingNode, pDataNode); |
| 106 pDataNode->AddBindItem(pFormNode); | 106 pDataNode->AddBindItem(pFormNode); |
| 107 XFA_Element eClass = pFormNode->GetClassID(); | 107 XFA_Element eClass = pFormNode->GetElementType(); |
| 108 if (eClass != XFA_Element::Field && eClass != XFA_Element::ExclGroup) { | 108 if (eClass != XFA_Element::Field && eClass != XFA_Element::ExclGroup) { |
| 109 return; | 109 return; |
| 110 } | 110 } |
| 111 CXFA_WidgetData* pWidgetData = pFormNode->GetWidgetData(); | 111 CXFA_WidgetData* pWidgetData = pFormNode->GetWidgetData(); |
| 112 ASSERT(pWidgetData); | 112 ASSERT(pWidgetData); |
| 113 XFA_Element eUIType = pWidgetData->GetUIType(); | 113 XFA_Element eUIType = pWidgetData->GetUIType(); |
| 114 CXFA_Value defValue(pFormNode->GetProperty(0, XFA_Element::Value)); | 114 CXFA_Value defValue(pFormNode->GetProperty(0, XFA_Element::Value)); |
| 115 if (!bDataToForm) { | 115 if (!bDataToForm) { |
| 116 CFX_WideString wsValue; | 116 CFX_WideString wsValue; |
| 117 CFX_WideString wsFormatedValue; | 117 CFX_WideString wsFormatedValue; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 if (wsValue.IsEmpty()) { | 166 if (wsValue.IsEmpty()) { |
| 167 break; | 167 break; |
| 168 } | 168 } |
| 169 pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); | 169 pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); |
| 170 pDataNode->SetAttributeValue(wsValue, wsFormatedValue); | 170 pDataNode->SetAttributeValue(wsValue, wsFormatedValue); |
| 171 break; | 171 break; |
| 172 case XFA_Element::ExclGroup: { | 172 case XFA_Element::ExclGroup: { |
| 173 CXFA_Node* pChecked = NULL; | 173 CXFA_Node* pChecked = NULL; |
| 174 CXFA_Node* pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 174 CXFA_Node* pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 175 for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 175 for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 176 if (pChild->GetClassID() != XFA_Element::Field) { | 176 if (pChild->GetElementType() != XFA_Element::Field) { |
| 177 continue; | 177 continue; |
| 178 } | 178 } |
| 179 CXFA_Node* pValue = pChild->GetChild(0, XFA_Element::Value); | 179 CXFA_Node* pValue = pChild->GetChild(0, XFA_Element::Value); |
| 180 if (!pValue) { | 180 if (!pValue) { |
| 181 continue; | 181 continue; |
| 182 } | 182 } |
| 183 CXFA_Value valueChild(pValue); | 183 CXFA_Value valueChild(pValue); |
| 184 valueChild.GetChildValueContent(wsValue); | 184 valueChild.GetChildValueContent(wsValue); |
| 185 if (wsValue.IsEmpty()) { | 185 if (wsValue.IsEmpty()) { |
| 186 continue; | 186 continue; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 if (!pChecked) { | 205 if (!pChecked) { |
| 206 break; | 206 break; |
| 207 } | 207 } |
| 208 pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 208 pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 209 for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 209 for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 210 if (pChild == pChecked) { | 210 if (pChild == pChecked) { |
| 211 continue; | 211 continue; |
| 212 } | 212 } |
| 213 if (pChild->GetClassID() != XFA_Element::Field) { | 213 if (pChild->GetElementType() != XFA_Element::Field) { |
| 214 continue; | 214 continue; |
| 215 } | 215 } |
| 216 CXFA_Node* pValue = pChild->GetProperty(0, XFA_Element::Value); | 216 CXFA_Node* pValue = pChild->GetProperty(0, XFA_Element::Value); |
| 217 CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items); | 217 CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items); |
| 218 CXFA_Node* pText = | 218 CXFA_Node* pText = |
| 219 pItems ? pItems->GetNodeItem(XFA_NODEITEM_FirstChild) : NULL; | 219 pItems ? pItems->GetNodeItem(XFA_NODEITEM_FirstChild) : NULL; |
| 220 if (pText) { | 220 if (pText) { |
| 221 pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); | 221 pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 222 } | 222 } |
| 223 CFX_WideString wsContent; | 223 CFX_WideString wsContent; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 for (CXFA_Node *pCurDataScope = pDataScope, *pLastDataScope = NULL; | 360 for (CXFA_Node *pCurDataScope = pDataScope, *pLastDataScope = NULL; |
| 361 pCurDataScope && pCurDataScope->GetPacketID() == XFA_XDPPACKET_Datasets; | 361 pCurDataScope && pCurDataScope->GetPacketID() == XFA_XDPPACKET_Datasets; |
| 362 pLastDataScope = pCurDataScope, | 362 pLastDataScope = pCurDataScope, |
| 363 pCurDataScope = | 363 pCurDataScope = |
| 364 pCurDataScope->GetNodeItem(XFA_NODEITEM_Parent)) { | 364 pCurDataScope->GetNodeItem(XFA_NODEITEM_Parent)) { |
| 365 for (CXFA_Node* pDataChild = pCurDataScope->GetFirstChildByName(dwNameHash); | 365 for (CXFA_Node* pDataChild = pCurDataScope->GetFirstChildByName(dwNameHash); |
| 366 pDataChild; | 366 pDataChild; |
| 367 pDataChild = pDataChild->GetNextSameNameSibling(dwNameHash)) { | 367 pDataChild = pDataChild->GetNextSameNameSibling(dwNameHash)) { |
| 368 if (pDataChild == pLastDataScope || | 368 if (pDataChild == pLastDataScope || |
| 369 (eMatchDataNodeType != XFA_Element::DataModel && | 369 (eMatchDataNodeType != XFA_Element::DataModel && |
| 370 pDataChild->GetClassID() != eMatchDataNodeType) || | 370 pDataChild->GetElementType() != eMatchDataNodeType) || |
| 371 pDataChild->HasBindItem()) { | 371 pDataChild->HasBindItem()) { |
| 372 continue; | 372 continue; |
| 373 } | 373 } |
| 374 return pDataChild; | 374 return pDataChild; |
| 375 } | 375 } |
| 376 for (CXFA_Node* pDataChild = | 376 for (CXFA_Node* pDataChild = |
| 377 pCurDataScope->GetFirstChildByClass(XFA_Element::DataGroup); | 377 pCurDataScope->GetFirstChildByClass(XFA_Element::DataGroup); |
| 378 pDataChild; pDataChild = pDataChild->GetNextSameClassSibling( | 378 pDataChild; pDataChild = pDataChild->GetNextSameClassSibling( |
| 379 XFA_Element::DataGroup)) { | 379 XFA_Element::DataGroup)) { |
| 380 CXFA_Node* pDataNode = XFA_DataMerge_ScopeMatchGlobalBinding( | 380 CXFA_Node* pDataNode = XFA_DataMerge_ScopeMatchGlobalBinding( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 uint32_t dwNameHash = FX_HashCode_GetW(wsName, false); | 418 uint32_t dwNameHash = FX_HashCode_GetW(wsName, false); |
| 419 CXFA_Node* pLastDataScope = nullptr; | 419 CXFA_Node* pLastDataScope = nullptr; |
| 420 for (CXFA_Node* pCurDataScope = pDataScope; | 420 for (CXFA_Node* pCurDataScope = pDataScope; |
| 421 pCurDataScope && pCurDataScope->GetPacketID() == XFA_XDPPACKET_Datasets; | 421 pCurDataScope && pCurDataScope->GetPacketID() == XFA_XDPPACKET_Datasets; |
| 422 pCurDataScope = pCurDataScope->GetNodeItem(XFA_NODEITEM_Parent)) { | 422 pCurDataScope = pCurDataScope->GetNodeItem(XFA_NODEITEM_Parent)) { |
| 423 for (CXFA_Node* pDataChild = pCurDataScope->GetFirstChildByName(dwNameHash); | 423 for (CXFA_Node* pDataChild = pCurDataScope->GetFirstChildByName(dwNameHash); |
| 424 pDataChild; | 424 pDataChild; |
| 425 pDataChild = pDataChild->GetNextSameNameSibling(dwNameHash)) { | 425 pDataChild = pDataChild->GetNextSameNameSibling(dwNameHash)) { |
| 426 if (pDataChild == pLastDataScope || pDataChild->HasBindItem() || | 426 if (pDataChild == pLastDataScope || pDataChild->HasBindItem() || |
| 427 (eMatchNodeType != XFA_Element::DataModel && | 427 (eMatchNodeType != XFA_Element::DataModel && |
| 428 pDataChild->GetClassID() != eMatchNodeType)) { | 428 pDataChild->GetElementType() != eMatchNodeType)) { |
| 429 continue; | 429 continue; |
| 430 } | 430 } |
| 431 return pDataChild; | 431 return pDataChild; |
| 432 } | 432 } |
| 433 pLastDataScope = pCurDataScope; | 433 pLastDataScope = pCurDataScope; |
| 434 } | 434 } |
| 435 return nullptr; | 435 return nullptr; |
| 436 } | 436 } |
| 437 | 437 |
| 438 static CXFA_Node* XFA_DataMerge_FindDataRefDataNode(CXFA_Document* pDocument, | 438 static CXFA_Node* XFA_DataMerge_FindDataRefDataNode(CXFA_Document* pDocument, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 464 } | 464 } |
| 465 return NULL; | 465 return NULL; |
| 466 } | 466 } |
| 467 CXFA_Node* XFA_DataMerge_FindFormDOMInstance(CXFA_Document* pDocument, | 467 CXFA_Node* XFA_DataMerge_FindFormDOMInstance(CXFA_Document* pDocument, |
| 468 XFA_Element eClassID, | 468 XFA_Element eClassID, |
| 469 uint32_t dwNameHash, | 469 uint32_t dwNameHash, |
| 470 CXFA_Node* pFormParent) { | 470 CXFA_Node* pFormParent) { |
| 471 CXFA_Node* pFormChild = pFormParent->GetNodeItem(XFA_NODEITEM_FirstChild); | 471 CXFA_Node* pFormChild = pFormParent->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 472 for (; pFormChild; | 472 for (; pFormChild; |
| 473 pFormChild = pFormChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 473 pFormChild = pFormChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 474 if (pFormChild->GetClassID() == eClassID && | 474 if (pFormChild->GetElementType() == eClassID && |
| 475 pFormChild->GetNameHash() == dwNameHash && pFormChild->IsUnusedNode()) { | 475 pFormChild->GetNameHash() == dwNameHash && pFormChild->IsUnusedNode()) { |
| 476 return pFormChild; | 476 return pFormChild; |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 return NULL; | 479 return NULL; |
| 480 } | 480 } |
| 481 static FX_BOOL XFA_NeedGenerateForm(CXFA_Node* pTemplateChild, | 481 static FX_BOOL XFA_NeedGenerateForm(CXFA_Node* pTemplateChild, |
| 482 FX_BOOL bUseInstanceManager = TRUE) { | 482 FX_BOOL bUseInstanceManager = TRUE) { |
| 483 XFA_Element eType = pTemplateChild->GetClassID(); | 483 XFA_Element eType = pTemplateChild->GetElementType(); |
| 484 if (eType == XFA_Element::Variables) { | 484 if (eType == XFA_Element::Variables) { |
| 485 return TRUE; | 485 return TRUE; |
| 486 } | 486 } |
| 487 if (pTemplateChild->IsContainerNode()) { | 487 if (pTemplateChild->IsContainerNode()) { |
| 488 return FALSE; | 488 return FALSE; |
| 489 } | 489 } |
| 490 if (eType == XFA_Element::Proto || | 490 if (eType == XFA_Element::Proto || |
| 491 (bUseInstanceManager && eType == XFA_Element::Occur)) { | 491 (bUseInstanceManager && eType == XFA_Element::Occur)) { |
| 492 return FALSE; | 492 return FALSE; |
| 493 } | 493 } |
| 494 return TRUE; | 494 return TRUE; |
| 495 } | 495 } |
| 496 CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(CXFA_Document* pDocument, | 496 CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(CXFA_Document* pDocument, |
| 497 CXFA_Node* pFormParent, | 497 CXFA_Node* pFormParent, |
| 498 CXFA_Node* pTemplateNode, | 498 CXFA_Node* pTemplateNode, |
| 499 FX_BOOL bRecursive, | 499 FX_BOOL bRecursive, |
| 500 CXFA_NodeArray* pSubformArray) { | 500 CXFA_NodeArray* pSubformArray) { |
| 501 CXFA_Node* pExistingNode = NULL; | 501 CXFA_Node* pExistingNode = NULL; |
| 502 if (pSubformArray == NULL) { | 502 if (pSubformArray == NULL) { |
| 503 pExistingNode = XFA_DataMerge_FindFormDOMInstance( | 503 pExistingNode = XFA_DataMerge_FindFormDOMInstance( |
| 504 pDocument, pTemplateNode->GetClassID(), pTemplateNode->GetNameHash(), | 504 pDocument, pTemplateNode->GetElementType(), |
| 505 pFormParent); | 505 pTemplateNode->GetNameHash(), pFormParent); |
| 506 } else if (pSubformArray->GetSize() > 0) { | 506 } else if (pSubformArray->GetSize() > 0) { |
| 507 pExistingNode = pSubformArray->GetAt(0); | 507 pExistingNode = pSubformArray->GetAt(0); |
| 508 pSubformArray->RemoveAt(0); | 508 pSubformArray->RemoveAt(0); |
| 509 } | 509 } |
| 510 if (pExistingNode) { | 510 if (pExistingNode) { |
| 511 if (pSubformArray) { | 511 if (pSubformArray) { |
| 512 pFormParent->InsertChild(pExistingNode); | 512 pFormParent->InsertChild(pExistingNode); |
| 513 } else if (pExistingNode->IsContainerNode()) { | 513 } else if (pExistingNode->IsContainerNode()) { |
| 514 pFormParent->RemoveChild(pExistingNode); | 514 pFormParent->RemoveChild(pExistingNode); |
| 515 pFormParent->InsertChild(pExistingNode); | 515 pFormParent->InsertChild(pExistingNode); |
| 516 } | 516 } |
| 517 pExistingNode->ClearFlag(XFA_NodeFlag_UnusedNode); | 517 pExistingNode->ClearFlag(XFA_NodeFlag_UnusedNode); |
| 518 pExistingNode->SetTemplateNode(pTemplateNode); | 518 pExistingNode->SetTemplateNode(pTemplateNode); |
| 519 if (bRecursive && pExistingNode->GetClassID() != XFA_Element::Items) { | 519 if (bRecursive && pExistingNode->GetElementType() != XFA_Element::Items) { |
| 520 for (CXFA_Node* pTemplateChild = | 520 for (CXFA_Node* pTemplateChild = |
| 521 pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 521 pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 522 pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem( | 522 pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem( |
| 523 XFA_NODEITEM_NextSibling)) { | 523 XFA_NODEITEM_NextSibling)) { |
| 524 if (XFA_NeedGenerateForm(pTemplateChild)) { | 524 if (XFA_NeedGenerateForm(pTemplateChild)) { |
| 525 XFA_NodeMerge_CloneOrMergeContainer(pDocument, pExistingNode, | 525 XFA_NodeMerge_CloneOrMergeContainer(pDocument, pExistingNode, |
| 526 pTemplateChild, bRecursive); | 526 pTemplateChild, bRecursive); |
| 527 } | 527 } |
| 528 } | 528 } |
| 529 } | 529 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 554 CFX_WideString wsInstMgrNodeName = FX_WSTRC(L"_") + wsSubformName; | 554 CFX_WideString wsInstMgrNodeName = FX_WSTRC(L"_") + wsSubformName; |
| 555 uint32_t dwInstNameHash = | 555 uint32_t dwInstNameHash = |
| 556 FX_HashCode_GetW(wsInstMgrNodeName.AsStringC(), false); | 556 FX_HashCode_GetW(wsInstMgrNodeName.AsStringC(), false); |
| 557 CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( | 557 CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( |
| 558 pDocument, XFA_Element::InstanceManager, dwInstNameHash, pFormParent); | 558 pDocument, XFA_Element::InstanceManager, dwInstNameHash, pFormParent); |
| 559 if (pExistingNode) { | 559 if (pExistingNode) { |
| 560 uint32_t dwNameHash = pTemplateNode->GetNameHash(); | 560 uint32_t dwNameHash = pTemplateNode->GetNameHash(); |
| 561 for (CXFA_Node* pNode = | 561 for (CXFA_Node* pNode = |
| 562 pExistingNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 562 pExistingNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 563 pNode;) { | 563 pNode;) { |
| 564 XFA_Element eCurType = pNode->GetClassID(); | 564 XFA_Element eCurType = pNode->GetElementType(); |
| 565 if (eCurType == XFA_Element::InstanceManager) { | 565 if (eCurType == XFA_Element::InstanceManager) { |
| 566 break; | 566 break; |
| 567 } | 567 } |
| 568 if ((eCurType != XFA_Element::Subform) && | 568 if ((eCurType != XFA_Element::Subform) && |
| 569 (eCurType != XFA_Element::SubformSet)) { | 569 (eCurType != XFA_Element::SubformSet)) { |
| 570 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 570 pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
| 571 continue; | 571 continue; |
| 572 } | 572 } |
| 573 if (dwNameHash != pNode->GetNameHash()) { | 573 if (dwNameHash != pNode->GetNameHash()) { |
| 574 break; | 574 break; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 609 FX_BOOL bOwnIterator = FALSE; | 609 FX_BOOL bOwnIterator = FALSE; |
| 610 if (!pIterator) { | 610 if (!pIterator) { |
| 611 bOwnIterator = TRUE; | 611 bOwnIterator = TRUE; |
| 612 pIterator = new CXFA_NodeIteratorTemplate< | 612 pIterator = new CXFA_NodeIteratorTemplate< |
| 613 CXFA_Node, CXFA_TraverseStrategy_XFAContainerNode>(pTemplateNode); | 613 CXFA_Node, CXFA_TraverseStrategy_XFAContainerNode>(pTemplateNode); |
| 614 } | 614 } |
| 615 CXFA_Node* pResult = NULL; | 615 CXFA_Node* pResult = NULL; |
| 616 for (CXFA_Node* pCurTemplateNode = pIterator->GetCurrent(); | 616 for (CXFA_Node* pCurTemplateNode = pIterator->GetCurrent(); |
| 617 pCurTemplateNode;) { | 617 pCurTemplateNode;) { |
| 618 XFA_Element eMatchNodeType; | 618 XFA_Element eMatchNodeType; |
| 619 switch (pCurTemplateNode->GetClassID()) { | 619 switch (pCurTemplateNode->GetElementType()) { |
| 620 case XFA_Element::Subform: | 620 case XFA_Element::Subform: |
| 621 eMatchNodeType = XFA_Element::DataGroup; | 621 eMatchNodeType = XFA_Element::DataGroup; |
| 622 break; | 622 break; |
| 623 case XFA_Element::Field: { | 623 case XFA_Element::Field: { |
| 624 eMatchNodeType = XFA_FieldIsMultiListBox(pCurTemplateNode) | 624 eMatchNodeType = XFA_FieldIsMultiListBox(pCurTemplateNode) |
| 625 ? XFA_Element::DataGroup | 625 ? XFA_Element::DataGroup |
| 626 : XFA_Element::DataValue; | 626 : XFA_Element::DataValue; |
| 627 } break; | 627 } break; |
| 628 case XFA_Element::ExclGroup: | 628 case XFA_Element::ExclGroup: |
| 629 eMatchNodeType = XFA_Element::DataValue; | 629 eMatchNodeType = XFA_Element::DataValue; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 continue; | 679 continue; |
| 680 } | 680 } |
| 681 pResult = pOnceBindNode; | 681 pResult = pOnceBindNode; |
| 682 } break; | 682 } break; |
| 683 case XFA_ATTRIBUTEENUM_DataRef: { | 683 case XFA_ATTRIBUTEENUM_DataRef: { |
| 684 bAccessedDataDOM = TRUE; | 684 bAccessedDataDOM = TRUE; |
| 685 CXFA_Node* pDataRefBindNode = XFA_DataMerge_FindDataRefDataNode( | 685 CXFA_Node* pDataRefBindNode = XFA_DataMerge_FindDataRefDataNode( |
| 686 pDocument, pTemplateNodeBind->GetCData(XFA_ATTRIBUTE_Ref), | 686 pDocument, pTemplateNodeBind->GetCData(XFA_ATTRIBUTE_Ref), |
| 687 pDataScope, eMatchNodeType, pTemplateNode, bForceBind, bUpLevel); | 687 pDataScope, eMatchNodeType, pTemplateNode, bForceBind, bUpLevel); |
| 688 if (pDataRefBindNode && | 688 if (pDataRefBindNode && |
| 689 pDataRefBindNode->GetClassID() == eMatchNodeType) { | 689 pDataRefBindNode->GetElementType() == eMatchNodeType) { |
| 690 pResult = pDataRefBindNode; | 690 pResult = pDataRefBindNode; |
| 691 } | 691 } |
| 692 if (!pResult) { | 692 if (!pResult) { |
| 693 pCurTemplateNode = pIterator->SkipChildrenAndMoveToNext(); | 693 pCurTemplateNode = pIterator->SkipChildrenAndMoveToNext(); |
| 694 continue; | 694 continue; |
| 695 } | 695 } |
| 696 } break; | 696 } break; |
| 697 default: | 697 default: |
| 698 break; | 698 break; |
| 699 } | 699 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 rgRecords.Copy(rgResultRecord); | 743 rgRecords.Copy(rgResultRecord); |
| 744 } | 744 } |
| 745 } | 745 } |
| 746 static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( | 746 static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( |
| 747 CXFA_Document* pDocument, | 747 CXFA_Document* pDocument, |
| 748 CXFA_Node* pTemplateNode, | 748 CXFA_Node* pTemplateNode, |
| 749 CXFA_Node* pFormParentNode, | 749 CXFA_Node* pFormParentNode, |
| 750 CXFA_Node* pDataScope, | 750 CXFA_Node* pDataScope, |
| 751 FX_BOOL bOneInstance, | 751 FX_BOOL bOneInstance, |
| 752 FX_BOOL bDataMerge) { | 752 FX_BOOL bDataMerge) { |
| 753 XFA_Element eElement = pTemplateNode->GetClassID(); | 753 XFA_Element eElement = pTemplateNode->GetElementType(); |
| 754 CXFA_Node* pOccurNode = NULL; | 754 CXFA_Node* pOccurNode = NULL; |
| 755 CXFA_Node* pFirstInstance = NULL; | 755 CXFA_Node* pFirstInstance = NULL; |
| 756 FX_BOOL bUseInstanceManager = | 756 FX_BOOL bUseInstanceManager = |
| 757 pFormParentNode->GetClassID() != XFA_Element::Area; | 757 pFormParentNode->GetElementType() != XFA_Element::Area; |
| 758 CXFA_Node* pInstMgrNode = NULL; | 758 CXFA_Node* pInstMgrNode = NULL; |
| 759 CXFA_NodeArray subformArray; | 759 CXFA_NodeArray subformArray; |
| 760 CXFA_NodeArray* pSearchArray = NULL; | 760 CXFA_NodeArray* pSearchArray = NULL; |
| 761 if (!bOneInstance && (eElement == XFA_Element::SubformSet || | 761 if (!bOneInstance && (eElement == XFA_Element::SubformSet || |
| 762 eElement == XFA_Element::Subform)) { | 762 eElement == XFA_Element::Subform)) { |
| 763 pInstMgrNode = | 763 pInstMgrNode = |
| 764 bUseInstanceManager | 764 bUseInstanceManager |
| 765 ? XFA_NodeMerge_CloneOrMergeInstanceManager( | 765 ? XFA_NodeMerge_CloneOrMergeInstanceManager( |
| 766 pDocument, pFormParentNode, pTemplateNode, subformArray) | 766 pDocument, pFormParentNode, pTemplateNode, subformArray) |
| 767 : NULL; | 767 : NULL; |
| 768 if (CXFA_Node* pOccurTemplateNode = | 768 if (CXFA_Node* pOccurTemplateNode = |
| 769 pTemplateNode->GetFirstChildByClass(XFA_Element::Occur)) { | 769 pTemplateNode->GetFirstChildByClass(XFA_Element::Occur)) { |
| 770 pOccurNode = pInstMgrNode | 770 pOccurNode = pInstMgrNode |
| 771 ? XFA_NodeMerge_CloneOrMergeContainer( | 771 ? XFA_NodeMerge_CloneOrMergeContainer( |
| 772 pDocument, pInstMgrNode, pOccurTemplateNode, FALSE) | 772 pDocument, pInstMgrNode, pOccurTemplateNode, FALSE) |
| 773 : pOccurTemplateNode; | 773 : pOccurTemplateNode; |
| 774 } else if (pInstMgrNode) { | 774 } else if (pInstMgrNode) { |
| 775 pOccurNode = pInstMgrNode->GetFirstChildByClass(XFA_Element::Occur); | 775 pOccurNode = pInstMgrNode->GetFirstChildByClass(XFA_Element::Occur); |
| 776 if (pOccurNode) { | 776 if (pOccurNode) { |
| 777 pOccurNode->ClearFlag(XFA_NodeFlag_UnusedNode); | 777 pOccurNode->ClearFlag(XFA_NodeFlag_UnusedNode); |
| 778 } | 778 } |
| 779 } | 779 } |
| 780 if (pInstMgrNode) { | 780 if (pInstMgrNode) { |
| 781 pInstMgrNode->SetFlag(XFA_NodeFlag_Initialized, true); | 781 pInstMgrNode->SetFlag(XFA_NodeFlag_Initialized, true); |
| 782 pSearchArray = &subformArray; | 782 pSearchArray = &subformArray; |
| 783 if (pFormParentNode->GetClassID() == XFA_Element::PageArea) { | 783 if (pFormParentNode->GetElementType() == XFA_Element::PageArea) { |
| 784 bOneInstance = TRUE; | 784 bOneInstance = TRUE; |
| 785 if (subformArray.GetSize() < 1) { | 785 if (subformArray.GetSize() < 1) { |
| 786 pSearchArray = NULL; | 786 pSearchArray = NULL; |
| 787 } | 787 } |
| 788 } else if ((pTemplateNode->GetNameHash() == 0) && | 788 } else if ((pTemplateNode->GetNameHash() == 0) && |
| 789 (subformArray.GetSize() < 1)) { | 789 (subformArray.GetSize() < 1)) { |
| 790 pSearchArray = NULL; | 790 pSearchArray = NULL; |
| 791 } | 791 } |
| 792 } | 792 } |
| 793 } | 793 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 956 } | 956 } |
| 957 for (; (iLimit < 0 || iCurRepeatIndex < iLimit); iCurRepeatIndex++) { | 957 for (; (iLimit < 0 || iCurRepeatIndex < iLimit); iCurRepeatIndex++) { |
| 958 if (pInstMgrNode) { | 958 if (pInstMgrNode) { |
| 959 if (pSearchArray && pSearchArray->GetSize() < 1) { | 959 if (pSearchArray && pSearchArray->GetSize() < 1) { |
| 960 if (pTemplateNode->GetNameHash() != 0) { | 960 if (pTemplateNode->GetNameHash() != 0) { |
| 961 break; | 961 break; |
| 962 } | 962 } |
| 963 pSearchArray = NULL; | 963 pSearchArray = NULL; |
| 964 } | 964 } |
| 965 } else if (!XFA_DataMerge_FindFormDOMInstance( | 965 } else if (!XFA_DataMerge_FindFormDOMInstance( |
| 966 pDocument, pTemplateNode->GetClassID(), | 966 pDocument, pTemplateNode->GetElementType(), |
| 967 pTemplateNode->GetNameHash(), pFormParentNode)) { | 967 pTemplateNode->GetNameHash(), pFormParentNode)) { |
| 968 break; | 968 break; |
| 969 } | 969 } |
| 970 CXFA_Node* pSubformNode = XFA_NodeMerge_CloneOrMergeContainer( | 970 CXFA_Node* pSubformNode = XFA_NodeMerge_CloneOrMergeContainer( |
| 971 pDocument, pFormParentNode, pTemplateNode, FALSE, pSearchArray); | 971 pDocument, pFormParentNode, pTemplateNode, FALSE, pSearchArray); |
| 972 ASSERT(pSubformNode); | 972 ASSERT(pSubformNode); |
| 973 if (!pFirstInstance) { | 973 if (!pFirstInstance) { |
| 974 pFirstInstance = pSubformNode; | 974 pFirstInstance = pSubformNode; |
| 975 } | 975 } |
| 976 for (CXFA_Node* pTemplateChild = | 976 for (CXFA_Node* pTemplateChild = |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1025 CXFA_Node* pFieldNode = XFA_NodeMerge_CloneOrMergeContainer( | 1025 CXFA_Node* pFieldNode = XFA_NodeMerge_CloneOrMergeContainer( |
| 1026 pDocument, pFormNode, pTemplateNode, FALSE); | 1026 pDocument, pFormNode, pTemplateNode, FALSE); |
| 1027 ASSERT(pFieldNode); | 1027 ASSERT(pFieldNode); |
| 1028 for (CXFA_Node* pTemplateChildNode = | 1028 for (CXFA_Node* pTemplateChildNode = |
| 1029 pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 1029 pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1030 pTemplateChildNode; pTemplateChildNode = pTemplateChildNode->GetNodeItem( | 1030 pTemplateChildNode; pTemplateChildNode = pTemplateChildNode->GetNodeItem( |
| 1031 XFA_NODEITEM_NextSibling)) { | 1031 XFA_NODEITEM_NextSibling)) { |
| 1032 if (XFA_NeedGenerateForm(pTemplateChildNode)) { | 1032 if (XFA_NeedGenerateForm(pTemplateChildNode)) { |
| 1033 XFA_NodeMerge_CloneOrMergeContainer(pDocument, pFieldNode, | 1033 XFA_NodeMerge_CloneOrMergeContainer(pDocument, pFieldNode, |
| 1034 pTemplateChildNode, TRUE); | 1034 pTemplateChildNode, TRUE); |
| 1035 } else if (pTemplateNode->GetClassID() == XFA_Element::ExclGroup && | 1035 } else if (pTemplateNode->GetElementType() == XFA_Element::ExclGroup && |
| 1036 pTemplateChildNode->IsContainerNode()) { | 1036 pTemplateChildNode->IsContainerNode()) { |
| 1037 if (pTemplateChildNode->GetClassID() == XFA_Element::Field) { | 1037 if (pTemplateChildNode->GetElementType() == XFA_Element::Field) { |
| 1038 XFA_DataMerge_CopyContainer_Field(pDocument, pTemplateChildNode, | 1038 XFA_DataMerge_CopyContainer_Field(pDocument, pTemplateChildNode, |
| 1039 pFieldNode, NULL, FALSE); | 1039 pFieldNode, NULL, FALSE); |
| 1040 } | 1040 } |
| 1041 } | 1041 } |
| 1042 } | 1042 } |
| 1043 if (bDataMerge) { | 1043 if (bDataMerge) { |
| 1044 FX_BOOL bAccessedDataDOM = FALSE; | 1044 FX_BOOL bAccessedDataDOM = FALSE; |
| 1045 FX_BOOL bSelfMatch = FALSE; | 1045 FX_BOOL bSelfMatch = FALSE; |
| 1046 XFA_ATTRIBUTEENUM eBindMatch; | 1046 XFA_ATTRIBUTEENUM eBindMatch; |
| 1047 CXFA_Node* pDataNode = XFA_DataMerge_FindMatchingDataNode( | 1047 CXFA_Node* pDataNode = XFA_DataMerge_FindMatchingDataNode( |
| 1048 pDocument, pTemplateNode, pDataScope, bAccessedDataDOM, TRUE, NULL, | 1048 pDocument, pTemplateNode, pDataScope, bAccessedDataDOM, TRUE, NULL, |
| 1049 bSelfMatch, eBindMatch, bUpLevel); | 1049 bSelfMatch, eBindMatch, bUpLevel); |
| 1050 if (pDataNode) { | 1050 if (pDataNode) { |
| 1051 XFA_DataMerge_CreateDataBinding(pFieldNode, pDataNode); | 1051 XFA_DataMerge_CreateDataBinding(pFieldNode, pDataNode); |
| 1052 } | 1052 } |
| 1053 } else { | 1053 } else { |
| 1054 XFA_DataMerge_FormValueNode_MatchNoneCreateChild(pFieldNode); | 1054 XFA_DataMerge_FormValueNode_MatchNoneCreateChild(pFieldNode); |
| 1055 } | 1055 } |
| 1056 return pFieldNode; | 1056 return pFieldNode; |
| 1057 } | 1057 } |
| 1058 CXFA_Node* CXFA_Document::DataMerge_CopyContainer(CXFA_Node* pTemplateNode, | 1058 CXFA_Node* CXFA_Document::DataMerge_CopyContainer(CXFA_Node* pTemplateNode, |
| 1059 CXFA_Node* pFormNode, | 1059 CXFA_Node* pFormNode, |
| 1060 CXFA_Node* pDataScope, | 1060 CXFA_Node* pDataScope, |
| 1061 FX_BOOL bOneInstance, | 1061 FX_BOOL bOneInstance, |
| 1062 FX_BOOL bDataMerge, | 1062 FX_BOOL bDataMerge, |
| 1063 FX_BOOL bUpLevel) { | 1063 FX_BOOL bUpLevel) { |
| 1064 switch (pTemplateNode->GetClassID()) { | 1064 switch (pTemplateNode->GetElementType()) { |
| 1065 case XFA_Element::SubformSet: | 1065 case XFA_Element::SubformSet: |
| 1066 case XFA_Element::Subform: | 1066 case XFA_Element::Subform: |
| 1067 case XFA_Element::Area: | 1067 case XFA_Element::Area: |
| 1068 case XFA_Element::PageArea: | 1068 case XFA_Element::PageArea: |
| 1069 return XFA_DataMerge_CopyContainer_SubformSet( | 1069 return XFA_DataMerge_CopyContainer_SubformSet( |
| 1070 this, pTemplateNode, pFormNode, pDataScope, bOneInstance, bDataMerge); | 1070 this, pTemplateNode, pFormNode, pDataScope, bOneInstance, bDataMerge); |
| 1071 case XFA_Element::ExclGroup: | 1071 case XFA_Element::ExclGroup: |
| 1072 case XFA_Element::Field: | 1072 case XFA_Element::Field: |
| 1073 case XFA_Element::Draw: | 1073 case XFA_Element::Draw: |
| 1074 case XFA_Element::ContentArea: | 1074 case XFA_Element::ContentArea: |
| 1075 return XFA_DataMerge_CopyContainer_Field( | 1075 return XFA_DataMerge_CopyContainer_Field( |
| 1076 this, pTemplateNode, pFormNode, pDataScope, bDataMerge, bUpLevel); | 1076 this, pTemplateNode, pFormNode, pDataScope, bDataMerge, bUpLevel); |
| 1077 case XFA_Element::PageSet: | 1077 case XFA_Element::PageSet: |
| 1078 break; | 1078 break; |
| 1079 case XFA_Element::Variables: | 1079 case XFA_Element::Variables: |
| 1080 break; | 1080 break; |
| 1081 default: | 1081 default: |
| 1082 ASSERT(FALSE); | 1082 ASSERT(FALSE); |
| 1083 break; | 1083 break; |
| 1084 } | 1084 } |
| 1085 return NULL; | 1085 return NULL; |
| 1086 } | 1086 } |
| 1087 | 1087 |
| 1088 static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument, | 1088 static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument, |
| 1089 CXFA_Node* pFormNode, | 1089 CXFA_Node* pFormNode, |
| 1090 CXFA_Node* pDataScope, | 1090 CXFA_Node* pDataScope, |
| 1091 FX_BOOL bDataRef, | 1091 FX_BOOL bDataRef, |
| 1092 FX_BOOL bParentDataRef) { | 1092 FX_BOOL bParentDataRef) { |
| 1093 FX_BOOL bMatchRef = TRUE; | 1093 FX_BOOL bMatchRef = TRUE; |
| 1094 XFA_Element eClassID = pFormNode->GetClassID(); | 1094 XFA_Element eClassID = pFormNode->GetElementType(); |
|
Lei Zhang
2016/06/23 05:04:19
BTW, there's still some variables referencing clas
| |
| 1095 CXFA_Node* pDataNode = pFormNode->GetBindData(); | 1095 CXFA_Node* pDataNode = pFormNode->GetBindData(); |
| 1096 if (eClassID == XFA_Element::Subform || eClassID == XFA_Element::ExclGroup || | 1096 if (eClassID == XFA_Element::Subform || eClassID == XFA_Element::ExclGroup || |
| 1097 eClassID == XFA_Element::Field) { | 1097 eClassID == XFA_Element::Field) { |
| 1098 CXFA_Node* pTemplateNode = pFormNode->GetTemplateNode(); | 1098 CXFA_Node* pTemplateNode = pFormNode->GetTemplateNode(); |
| 1099 CXFA_Node* pTemplateNodeBind = | 1099 CXFA_Node* pTemplateNodeBind = |
| 1100 pTemplateNode ? pTemplateNode->GetFirstChildByClass(XFA_Element::Bind) | 1100 pTemplateNode ? pTemplateNode->GetFirstChildByClass(XFA_Element::Bind) |
| 1101 : NULL; | 1101 : NULL; |
| 1102 XFA_ATTRIBUTEENUM eMatch = | 1102 XFA_ATTRIBUTEENUM eMatch = |
| 1103 pTemplateNodeBind ? pTemplateNodeBind->GetEnum(XFA_ATTRIBUTE_Match) | 1103 pTemplateNodeBind ? pTemplateNodeBind->GetEnum(XFA_ATTRIBUTE_Match) |
| 1104 : XFA_ATTRIBUTEENUM_Once; | 1104 : XFA_ATTRIBUTEENUM_Once; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1257 m_pRootNode->InsertChild(pDatasetsRoot); | 1257 m_pRootNode->InsertChild(pDatasetsRoot); |
| 1258 pDatasetsRoot->SetXMLMappingNode(pDatasetsXMLNode); | 1258 pDatasetsRoot->SetXMLMappingNode(pDatasetsXMLNode); |
| 1259 } | 1259 } |
| 1260 CXFA_Node *pDataRoot = NULL, *pDDRoot = NULL; | 1260 CXFA_Node *pDataRoot = NULL, *pDDRoot = NULL; |
| 1261 CFX_WideString wsDatasetsURI; | 1261 CFX_WideString wsDatasetsURI; |
| 1262 pDatasetsRoot->TryNamespace(wsDatasetsURI); | 1262 pDatasetsRoot->TryNamespace(wsDatasetsURI); |
| 1263 for (CXFA_Node* pChildNode = | 1263 for (CXFA_Node* pChildNode = |
| 1264 pDatasetsRoot->GetNodeItem(XFA_NODEITEM_FirstChild); | 1264 pDatasetsRoot->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 1265 pChildNode; | 1265 pChildNode; |
| 1266 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1266 pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1267 if (pChildNode->GetClassID() != XFA_Element::DataGroup) { | 1267 if (pChildNode->GetElementType() != XFA_Element::DataGroup) { |
| 1268 continue; | 1268 continue; |
| 1269 } | 1269 } |
| 1270 CFX_WideString wsNamespaceURI; | 1270 CFX_WideString wsNamespaceURI; |
| 1271 if (!pDDRoot && pChildNode->GetNameHash() == XFA_HASHCODE_DataDescription) { | 1271 if (!pDDRoot && pChildNode->GetNameHash() == XFA_HASHCODE_DataDescription) { |
| 1272 if (!pChildNode->TryNamespace(wsNamespaceURI)) { | 1272 if (!pChildNode->TryNamespace(wsNamespaceURI)) { |
| 1273 continue; | 1273 continue; |
| 1274 } | 1274 } |
| 1275 if (wsNamespaceURI == | 1275 if (wsNamespaceURI == |
| 1276 FX_WSTRC(L"http://ns.adobe.com/data-description/")) { | 1276 FX_WSTRC(L"http://ns.adobe.com/data-description/")) { |
| 1277 pDDRoot = pChildNode; | 1277 pDDRoot = pChildNode; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1299 pDataRoot->GetFirstChildByClass(XFA_Element::DataGroup); | 1299 pDataRoot->GetFirstChildByClass(XFA_Element::DataGroup); |
| 1300 uint32_t dwNameHash = pDataTopLevel ? pDataTopLevel->GetNameHash() : 0; | 1300 uint32_t dwNameHash = pDataTopLevel ? pDataTopLevel->GetNameHash() : 0; |
| 1301 CXFA_Node* pTemplateRoot = | 1301 CXFA_Node* pTemplateRoot = |
| 1302 m_pRootNode->GetFirstChildByClass(XFA_Element::Template); | 1302 m_pRootNode->GetFirstChildByClass(XFA_Element::Template); |
| 1303 if (!pTemplateRoot) { | 1303 if (!pTemplateRoot) { |
| 1304 return; | 1304 return; |
| 1305 } | 1305 } |
| 1306 CXFA_Node* pTemplateChosen = | 1306 CXFA_Node* pTemplateChosen = |
| 1307 dwNameHash != 0 ? pTemplateRoot->GetFirstChildByName(dwNameHash) : NULL; | 1307 dwNameHash != 0 ? pTemplateRoot->GetFirstChildByName(dwNameHash) : NULL; |
| 1308 if (!pTemplateChosen || | 1308 if (!pTemplateChosen || |
| 1309 pTemplateChosen->GetClassID() != XFA_Element::Subform) { | 1309 pTemplateChosen->GetElementType() != XFA_Element::Subform) { |
| 1310 pTemplateChosen = pTemplateRoot->GetFirstChildByClass(XFA_Element::Subform); | 1310 pTemplateChosen = pTemplateRoot->GetFirstChildByClass(XFA_Element::Subform); |
| 1311 } | 1311 } |
| 1312 if (!pTemplateChosen) { | 1312 if (!pTemplateChosen) { |
| 1313 return; | 1313 return; |
| 1314 } | 1314 } |
| 1315 CXFA_Node* pFormRoot = m_pRootNode->GetFirstChildByClass(XFA_Element::Form); | 1315 CXFA_Node* pFormRoot = m_pRootNode->GetFirstChildByClass(XFA_Element::Form); |
| 1316 FX_BOOL bEmptyForm = FALSE; | 1316 FX_BOOL bEmptyForm = FALSE; |
| 1317 if (!pFormRoot) { | 1317 if (!pFormRoot) { |
| 1318 bEmptyForm = TRUE; | 1318 bEmptyForm = TRUE; |
| 1319 pFormRoot = CreateNode(XFA_XDPPACKET_Form, XFA_Element::Form); | 1319 pFormRoot = CreateNode(XFA_XDPPACKET_Form, XFA_Element::Form); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1370 pSubformSetNode->RemoveChild(pPageSetNode); | 1370 pSubformSetNode->RemoveChild(pPageSetNode); |
| 1371 pPageSetNode = pNextPageSetNode; | 1371 pPageSetNode = pNextPageSetNode; |
| 1372 } | 1372 } |
| 1373 if (!bEmptyForm) { | 1373 if (!bEmptyForm) { |
| 1374 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> | 1374 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> |
| 1375 sIterator(pFormRoot); | 1375 sIterator(pFormRoot); |
| 1376 CXFA_Node* pNode = sIterator.MoveToNext(); | 1376 CXFA_Node* pNode = sIterator.MoveToNext(); |
| 1377 while (pNode) { | 1377 while (pNode) { |
| 1378 if (pNode->IsUnusedNode()) { | 1378 if (pNode->IsUnusedNode()) { |
| 1379 if (pNode->IsContainerNode() || | 1379 if (pNode->IsContainerNode() || |
| 1380 pNode->GetClassID() == XFA_Element::InstanceManager) { | 1380 pNode->GetElementType() == XFA_Element::InstanceManager) { |
| 1381 CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext(); | 1381 CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext(); |
| 1382 pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode); | 1382 pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode); |
| 1383 pNode = pNext; | 1383 pNode = pNext; |
| 1384 } else { | 1384 } else { |
| 1385 pNode->ClearFlag(XFA_NodeFlag_UnusedNode); | 1385 pNode->ClearFlag(XFA_NodeFlag_UnusedNode); |
| 1386 pNode->SetFlag(XFA_NodeFlag_Initialized, true); | 1386 pNode->SetFlag(XFA_NodeFlag_Initialized, true); |
| 1387 pNode = sIterator.MoveToNext(); | 1387 pNode = sIterator.MoveToNext(); |
| 1388 } | 1388 } |
| 1389 } else { | 1389 } else { |
| 1390 pNode->SetFlag(XFA_NodeFlag_Initialized, true); | 1390 pNode->SetFlag(XFA_NodeFlag_Initialized, true); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1401 } | 1401 } |
| 1402 pFormRoot->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); | 1402 pFormRoot->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); |
| 1403 } | 1403 } |
| 1404 XFA_DataMerge_ClearGlobalBinding(this); | 1404 XFA_DataMerge_ClearGlobalBinding(this); |
| 1405 if (bDoDataMerge) { | 1405 if (bDoDataMerge) { |
| 1406 DoDataMerge(); | 1406 DoDataMerge(); |
| 1407 } | 1407 } |
| 1408 CXFA_LayoutProcessor* pLayoutProcessor = GetLayoutProcessor(); | 1408 CXFA_LayoutProcessor* pLayoutProcessor = GetLayoutProcessor(); |
| 1409 pLayoutProcessor->SetForceReLayout(TRUE); | 1409 pLayoutProcessor->SetForceReLayout(TRUE); |
| 1410 } | 1410 } |
| OLD | NEW |