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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 int32_t iCurRepeatIndex = 0; | 804 int32_t iCurRepeatIndex = 0; |
805 XFA_ATTRIBUTEENUM eParentBindMatch = XFA_ATTRIBUTEENUM_None; | 805 XFA_ATTRIBUTEENUM eParentBindMatch = XFA_ATTRIBUTEENUM_None; |
806 if (bDataMerge) { | 806 if (bDataMerge) { |
807 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFAContainerNode> | 807 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFAContainerNode> |
808 sNodeIterator(pTemplateNode); | 808 sNodeIterator(pTemplateNode); |
809 FX_BOOL bAccessedDataDOM = FALSE; | 809 FX_BOOL bAccessedDataDOM = FALSE; |
810 if (eElement == XFA_ELEMENT_SubformSet || eElement == XFA_ELEMENT_Area) { | 810 if (eElement == XFA_ELEMENT_SubformSet || eElement == XFA_ELEMENT_Area) { |
811 sNodeIterator.MoveToNext(); | 811 sNodeIterator.MoveToNext(); |
812 } else { | 812 } else { |
813 CFX_MapPtrTemplate<CXFA_Node*, CXFA_Node*> subformMapArray; | 813 CFX_MapPtrTemplate<CXFA_Node*, CXFA_Node*> subformMapArray; |
814 CXFA_NodeArray subformArray; | 814 CXFA_NodeArray nodeArray; |
815 for (; iMax < 0 || iCurRepeatIndex < iMax; iCurRepeatIndex++) { | 815 for (; iMax < 0 || iCurRepeatIndex < iMax; iCurRepeatIndex++) { |
816 FX_BOOL bSelfMatch = FALSE; | 816 FX_BOOL bSelfMatch = FALSE; |
817 XFA_ATTRIBUTEENUM eBindMatch = XFA_ATTRIBUTEENUM_None; | 817 XFA_ATTRIBUTEENUM eBindMatch = XFA_ATTRIBUTEENUM_None; |
818 CXFA_Node* pDataNode = XFA_DataMerge_FindMatchingDataNode( | 818 CXFA_Node* pDataNode = XFA_DataMerge_FindMatchingDataNode( |
819 pDocument, pTemplateNode, pDataScope, bAccessedDataDOM, FALSE, | 819 pDocument, pTemplateNode, pDataScope, bAccessedDataDOM, FALSE, |
820 &sNodeIterator, bSelfMatch, eBindMatch); | 820 &sNodeIterator, bSelfMatch, eBindMatch); |
821 if (!pDataNode || sNodeIterator.GetCurrent() != pTemplateNode) { | 821 if (!pDataNode || sNodeIterator.GetCurrent() != pTemplateNode) { |
822 break; | 822 break; |
823 } | 823 } |
824 eParentBindMatch = eBindMatch; | 824 eParentBindMatch = eBindMatch; |
825 CXFA_Node* pSubformNode = XFA_NodeMerge_CloneOrMergeContainer( | 825 CXFA_Node* pSubformNode = XFA_NodeMerge_CloneOrMergeContainer( |
826 pDocument, pFormParentNode, pTemplateNode, FALSE, pSearchArray); | 826 pDocument, pFormParentNode, pTemplateNode, FALSE, pSearchArray); |
827 if (!pFirstInstance) { | 827 if (!pFirstInstance) { |
828 pFirstInstance = pSubformNode; | 828 pFirstInstance = pSubformNode; |
829 } | 829 } |
830 XFA_DataMerge_CreateDataBinding(pSubformNode, pDataNode); | 830 XFA_DataMerge_CreateDataBinding(pSubformNode, pDataNode); |
831 ASSERT(pSubformNode); | 831 ASSERT(pSubformNode); |
832 subformMapArray.SetAt(pSubformNode, pDataNode); | 832 subformMapArray.SetAt(pSubformNode, pDataNode); |
833 subformArray.Add(pSubformNode); | 833 nodeArray.Add(pSubformNode); |
834 } | 834 } |
835 subformMapArray.GetStartPosition(); | 835 subformMapArray.GetStartPosition(); |
836 for (int32_t iIndex = 0; iIndex < subformArray.GetSize(); iIndex++) { | 836 for (int32_t iIndex = 0; iIndex < nodeArray.GetSize(); iIndex++) { |
837 CXFA_Node* pSubform = subformArray[iIndex]; | 837 CXFA_Node* pSubform = nodeArray[iIndex]; |
838 CXFA_Node* pDataNode = | 838 CXFA_Node* pDataNode = |
839 reinterpret_cast<CXFA_Node*>(subformMapArray.GetValueAt(pSubform)); | 839 reinterpret_cast<CXFA_Node*>(subformMapArray.GetValueAt(pSubform)); |
840 for (CXFA_Node* pTemplateChild = | 840 for (CXFA_Node* pTemplateChild = |
841 pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 841 pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
842 pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem( | 842 pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem( |
843 XFA_NODEITEM_NextSibling)) { | 843 XFA_NODEITEM_NextSibling)) { |
844 if (XFA_NeedGenerateForm(pTemplateChild, bUseInstanceManager)) { | 844 if (XFA_NeedGenerateForm(pTemplateChild, bUseInstanceManager)) { |
845 XFA_NodeMerge_CloneOrMergeContainer(pDocument, pSubform, | 845 XFA_NodeMerge_CloneOrMergeContainer(pDocument, pSubform, |
846 pTemplateChild, TRUE); | 846 pTemplateChild, TRUE); |
847 } else if (pTemplateChild->GetObjectType() == | 847 } else if (pTemplateChild->GetObjectType() == |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 } | 1411 } |
1412 pFormRoot->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); | 1412 pFormRoot->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); |
1413 } | 1413 } |
1414 XFA_DataMerge_ClearGlobalBinding(this); | 1414 XFA_DataMerge_ClearGlobalBinding(this); |
1415 if (bDoDataMerge) { | 1415 if (bDoDataMerge) { |
1416 DoDataMerge(); | 1416 DoDataMerge(); |
1417 } | 1417 } |
1418 CXFA_LayoutProcessor* pLayoutProcessor = GetLayoutProcessor(); | 1418 CXFA_LayoutProcessor* pLayoutProcessor = GetLayoutProcessor(); |
1419 pLayoutProcessor->SetForceReLayout(TRUE); | 1419 pLayoutProcessor->SetForceReLayout(TRUE); |
1420 } | 1420 } |
OLD | NEW |