| 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_layout_pagemgr_new.h" | 7 #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h" |
| 8 | 8 |
| 9 #include "xfa/fxfa/app/xfa_ffnotify.h" | 9 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| 10 #include "xfa/fxfa/parser/xfa_doclayout.h" | 10 #include "xfa/fxfa/parser/xfa_doclayout.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 XFA_RESOLVENODE_Parent); | 172 XFA_RESOLVENODE_Parent); |
| 173 if (iCount > 0 && rs.nodes[0]->IsNode()) | 173 if (iCount > 0 && rs.nodes[0]->IsNode()) |
| 174 return rs.nodes[0]->AsNode(); | 174 return rs.nodes[0]->AsNode(); |
| 175 } | 175 } |
| 176 iSpliteIndex = iSpliteNextIndex; | 176 iSpliteIndex = iSpliteNextIndex; |
| 177 } | 177 } |
| 178 return nullptr; | 178 return nullptr; |
| 179 } | 179 } |
| 180 | 180 |
| 181 void SetLayoutGeneratedNodeFlag(CXFA_Node* pNode) { | 181 void SetLayoutGeneratedNodeFlag(CXFA_Node* pNode) { |
| 182 pNode->SetFlag(XFA_NODEFLAG_LayoutGeneratedNode, false); | 182 pNode->SetFlag(XFA_NodeFlag_LayoutGeneratedNode, false); |
| 183 pNode->ClearFlag(XFA_NODEFLAG_UnusedNode); | 183 pNode->ClearFlag(XFA_NodeFlag_UnusedNode); |
| 184 } | 184 } |
| 185 | 185 |
| 186 FX_BOOL CheckContentAreaNotUsed( | 186 FX_BOOL CheckContentAreaNotUsed( |
| 187 CXFA_ContainerLayoutItem* pPageAreaLayoutItem, | 187 CXFA_ContainerLayoutItem* pPageAreaLayoutItem, |
| 188 CXFA_Node* pContentArea, | 188 CXFA_Node* pContentArea, |
| 189 CXFA_ContainerLayoutItem*& pContentAreaLayoutItem) { | 189 CXFA_ContainerLayoutItem*& pContentAreaLayoutItem) { |
| 190 for (CXFA_ContainerLayoutItem* pLayoutItem = | 190 for (CXFA_ContainerLayoutItem* pLayoutItem = |
| 191 (CXFA_ContainerLayoutItem*)pPageAreaLayoutItem->m_pFirstChild; | 191 (CXFA_ContainerLayoutItem*)pPageAreaLayoutItem->m_pFirstChild; |
| 192 pLayoutItem; | 192 pLayoutItem; |
| 193 pLayoutItem = (CXFA_ContainerLayoutItem*)pLayoutItem->m_pNextSibling) { | 193 pLayoutItem = (CXFA_ContainerLayoutItem*)pLayoutItem->m_pNextSibling) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 CXFA_Document* pDocument = pTemplateNode->GetDocument(); | 284 CXFA_Document* pDocument = pTemplateNode->GetDocument(); |
| 285 CXFA_Document* pObjFactory = pDocument->GetParser()->GetFactory(); | 285 CXFA_Document* pObjFactory = pDocument->GetParser()->GetFactory(); |
| 286 pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_ELEMENT_PageArea); | 286 pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_ELEMENT_PageArea); |
| 287 if (!pPageArea) { | 287 if (!pPageArea) { |
| 288 pPageArea = pObjFactory->CreateNode(m_pTemplatePageSetRoot->GetPacketID(), | 288 pPageArea = pObjFactory->CreateNode(m_pTemplatePageSetRoot->GetPacketID(), |
| 289 XFA_ELEMENT_PageArea); | 289 XFA_ELEMENT_PageArea); |
| 290 if (!pPageArea) { | 290 if (!pPageArea) { |
| 291 return FALSE; | 291 return FALSE; |
| 292 } | 292 } |
| 293 m_pTemplatePageSetRoot->InsertChild(pPageArea, NULL); | 293 m_pTemplatePageSetRoot->InsertChild(pPageArea, NULL); |
| 294 pPageArea->SetFlag(XFA_NODEFLAG_Initialized, true); | 294 pPageArea->SetFlag(XFA_NodeFlag_Initialized, true); |
| 295 } | 295 } |
| 296 CXFA_Node* pContentArea = pPageArea->GetChild(0, XFA_ELEMENT_ContentArea); | 296 CXFA_Node* pContentArea = pPageArea->GetChild(0, XFA_ELEMENT_ContentArea); |
| 297 if (!pContentArea) { | 297 if (!pContentArea) { |
| 298 pContentArea = pObjFactory->CreateNode(pPageArea->GetPacketID(), | 298 pContentArea = pObjFactory->CreateNode(pPageArea->GetPacketID(), |
| 299 XFA_ELEMENT_ContentArea); | 299 XFA_ELEMENT_ContentArea); |
| 300 if (!pContentArea) { | 300 if (!pContentArea) { |
| 301 return FALSE; | 301 return FALSE; |
| 302 } | 302 } |
| 303 pPageArea->InsertChild(pContentArea, NULL); | 303 pPageArea->InsertChild(pContentArea, NULL); |
| 304 pContentArea->SetFlag(XFA_NODEFLAG_Initialized, true); | 304 pContentArea->SetFlag(XFA_NodeFlag_Initialized, true); |
| 305 pContentArea->SetMeasure(XFA_ATTRIBUTE_X, | 305 pContentArea->SetMeasure(XFA_ATTRIBUTE_X, |
| 306 CXFA_Measurement(0.25f, XFA_UNIT_In)); | 306 CXFA_Measurement(0.25f, XFA_UNIT_In)); |
| 307 pContentArea->SetMeasure(XFA_ATTRIBUTE_Y, | 307 pContentArea->SetMeasure(XFA_ATTRIBUTE_Y, |
| 308 CXFA_Measurement(0.25f, XFA_UNIT_In)); | 308 CXFA_Measurement(0.25f, XFA_UNIT_In)); |
| 309 pContentArea->SetMeasure(XFA_ATTRIBUTE_W, | 309 pContentArea->SetMeasure(XFA_ATTRIBUTE_W, |
| 310 CXFA_Measurement(8.0f, XFA_UNIT_In)); | 310 CXFA_Measurement(8.0f, XFA_UNIT_In)); |
| 311 pContentArea->SetMeasure(XFA_ATTRIBUTE_H, | 311 pContentArea->SetMeasure(XFA_ATTRIBUTE_H, |
| 312 CXFA_Measurement(10.5f, XFA_UNIT_In)); | 312 CXFA_Measurement(10.5f, XFA_UNIT_In)); |
| 313 } | 313 } |
| 314 CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_ELEMENT_Medium); | 314 CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_ELEMENT_Medium); |
| 315 if (!pMedium) { | 315 if (!pMedium) { |
| 316 pMedium = | 316 pMedium = |
| 317 pObjFactory->CreateNode(pPageArea->GetPacketID(), XFA_ELEMENT_Medium); | 317 pObjFactory->CreateNode(pPageArea->GetPacketID(), XFA_ELEMENT_Medium); |
| 318 if (!pContentArea) { | 318 if (!pContentArea) { |
| 319 return FALSE; | 319 return FALSE; |
| 320 } | 320 } |
| 321 pPageArea->InsertChild(pMedium, NULL); | 321 pPageArea->InsertChild(pMedium, NULL); |
| 322 pMedium->SetFlag(XFA_NODEFLAG_Initialized, true); | 322 pMedium->SetFlag(XFA_NodeFlag_Initialized, true); |
| 323 pMedium->SetMeasure(XFA_ATTRIBUTE_Short, | 323 pMedium->SetMeasure(XFA_ATTRIBUTE_Short, |
| 324 CXFA_Measurement(8.5f, XFA_UNIT_In)); | 324 CXFA_Measurement(8.5f, XFA_UNIT_In)); |
| 325 pMedium->SetMeasure(XFA_ATTRIBUTE_Long, | 325 pMedium->SetMeasure(XFA_ATTRIBUTE_Long, |
| 326 CXFA_Measurement(11.0f, XFA_UNIT_In)); | 326 CXFA_Measurement(11.0f, XFA_UNIT_In)); |
| 327 } | 327 } |
| 328 return TRUE; | 328 return TRUE; |
| 329 } | 329 } |
| 330 FX_BOOL CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) { | 330 FX_BOOL CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) { |
| 331 FX_BOOL bProBreakBefore = FALSE; | 331 FX_BOOL bProBreakBefore = FALSE; |
| 332 CXFA_Node* pBreakBeforeNode = NULL; | 332 CXFA_Node* pBreakBeforeNode = NULL; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 } | 449 } |
| 450 | 450 |
| 451 FX_BOOL XFA_LayoutPageMgr_RunBreakTestScript(CXFA_Node* pTestScript) { | 451 FX_BOOL XFA_LayoutPageMgr_RunBreakTestScript(CXFA_Node* pTestScript) { |
| 452 CFX_WideString wsExpression; | 452 CFX_WideString wsExpression; |
| 453 pTestScript->TryContent(wsExpression); | 453 pTestScript->TryContent(wsExpression); |
| 454 if (wsExpression.IsEmpty()) { | 454 if (wsExpression.IsEmpty()) { |
| 455 return TRUE; | 455 return TRUE; |
| 456 } | 456 } |
| 457 return pTestScript->GetDocument()->GetParser()->GetNotify()->RunScript( | 457 return pTestScript->GetDocument()->GetParser()->GetNotify()->RunScript( |
| 458 pTestScript, pTestScript->GetNodeItem(XFA_NODEITEM_Parent, | 458 pTestScript, pTestScript->GetNodeItem(XFA_NODEITEM_Parent, |
| 459 XFA_OBJECTTYPE_ContainerNode)); | 459 XFA_ObjectType::ContainerNode)); |
| 460 } | 460 } |
| 461 CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( | 461 CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( |
| 462 CXFA_Node* pPageNode, | 462 CXFA_Node* pPageNode, |
| 463 FX_BOOL bCreateNew) { | 463 FX_BOOL bCreateNew) { |
| 464 CXFA_ContainerRecord* pNewRecord = new CXFA_ContainerRecord(); | 464 CXFA_ContainerRecord* pNewRecord = new CXFA_ContainerRecord(); |
| 465 if (m_pCurrentContainerRecord) { | 465 if (m_pCurrentContainerRecord) { |
| 466 if (!IsPageSetRootOrderedOccurrence() || pPageNode == NULL) { | 466 if (!IsPageSetRootOrderedOccurrence() || pPageNode == NULL) { |
| 467 *pNewRecord = *GetCurrentContainerRecord(); | 467 *pNewRecord = *GetCurrentContainerRecord(); |
| 468 m_rgProposedContainerRecord.AddTail(pNewRecord); | 468 m_rgProposedContainerRecord.AddTail(pNewRecord); |
| 469 return pNewRecord; | 469 return pNewRecord; |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 CXFA_Node* pCurNode, | 761 CXFA_Node* pCurNode, |
| 762 FX_BOOL bBefore, | 762 FX_BOOL bBefore, |
| 763 CXFA_Node*& pBreakLeaderTemplate, | 763 CXFA_Node*& pBreakLeaderTemplate, |
| 764 CXFA_Node*& pBreakTrailerTemplate) { | 764 CXFA_Node*& pBreakTrailerTemplate) { |
| 765 XFA_ELEMENT eType = pCurNode->GetClassID(); | 765 XFA_ELEMENT eType = pCurNode->GetClassID(); |
| 766 switch (eType) { | 766 switch (eType) { |
| 767 case XFA_ELEMENT_BreakBefore: | 767 case XFA_ELEMENT_BreakBefore: |
| 768 case XFA_ELEMENT_BreakAfter: { | 768 case XFA_ELEMENT_BreakAfter: { |
| 769 CFX_WideStringC wsBreakLeader, wsBreakTrailer; | 769 CFX_WideStringC wsBreakLeader, wsBreakTrailer; |
| 770 CXFA_Node* pFormNode = pCurNode->GetNodeItem( | 770 CXFA_Node* pFormNode = pCurNode->GetNodeItem( |
| 771 XFA_NODEITEM_Parent, XFA_OBJECTTYPE_ContainerNode); | 771 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); |
| 772 CXFA_Node* pContainer = pFormNode->GetTemplateNode(); | 772 CXFA_Node* pContainer = pFormNode->GetTemplateNode(); |
| 773 FX_BOOL bStartNew = pCurNode->GetInteger(XFA_ATTRIBUTE_StartNew) != 0; | 773 FX_BOOL bStartNew = pCurNode->GetInteger(XFA_ATTRIBUTE_StartNew) != 0; |
| 774 CXFA_Node* pScript = pCurNode->GetFirstChildByClass(XFA_ELEMENT_Script); | 774 CXFA_Node* pScript = pCurNode->GetFirstChildByClass(XFA_ELEMENT_Script); |
| 775 if (pScript && !XFA_LayoutPageMgr_RunBreakTestScript(pScript)) { | 775 if (pScript && !XFA_LayoutPageMgr_RunBreakTestScript(pScript)) { |
| 776 return FALSE; | 776 return FALSE; |
| 777 } | 777 } |
| 778 CFX_WideStringC wsTarget = pCurNode->GetCData(XFA_ATTRIBUTE_Target); | 778 CFX_WideStringC wsTarget = pCurNode->GetCData(XFA_ATTRIBUTE_Target); |
| 779 CXFA_Node* pTarget = | 779 CXFA_Node* pTarget = |
| 780 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsTarget); | 780 ResolveBreakTarget(m_pTemplatePageSetRoot, TRUE, wsTarget); |
| 781 wsBreakTrailer = pCurNode->GetCData(XFA_ATTRIBUTE_Trailer); | 781 wsBreakTrailer = pCurNode->GetCData(XFA_ATTRIBUTE_Trailer); |
| 782 wsBreakLeader = pCurNode->GetCData(XFA_ATTRIBUTE_Leader); | 782 wsBreakLeader = pCurNode->GetCData(XFA_ATTRIBUTE_Leader); |
| 783 pBreakLeaderTemplate = | 783 pBreakLeaderTemplate = |
| 784 ResolveBreakTarget(pContainer, TRUE, wsBreakLeader); | 784 ResolveBreakTarget(pContainer, TRUE, wsBreakLeader); |
| 785 pBreakTrailerTemplate = | 785 pBreakTrailerTemplate = |
| 786 ResolveBreakTarget(pContainer, TRUE, wsBreakTrailer); | 786 ResolveBreakTarget(pContainer, TRUE, wsBreakTrailer); |
| 787 if (RunBreak(eType, pCurNode->GetEnum(XFA_ATTRIBUTE_TargetType), pTarget, | 787 if (RunBreak(eType, pCurNode->GetEnum(XFA_ATTRIBUTE_TargetType), pTarget, |
| 788 bStartNew)) { | 788 bStartNew)) { |
| 789 return TRUE; | 789 return TRUE; |
| 790 } else { | 790 } else { |
| 791 if (m_rgProposedContainerRecord.GetCount() > 0 && | 791 if (m_rgProposedContainerRecord.GetCount() > 0 && |
| 792 m_pCurrentContainerRecord == | 792 m_pCurrentContainerRecord == |
| 793 m_rgProposedContainerRecord.GetHeadPosition() && | 793 m_rgProposedContainerRecord.GetHeadPosition() && |
| 794 eType == XFA_ELEMENT_BreakBefore) { | 794 eType == XFA_ELEMENT_BreakBefore) { |
| 795 CXFA_Node* pParentNode = pFormNode->GetNodeItem( | 795 CXFA_Node* pParentNode = pFormNode->GetNodeItem( |
| 796 XFA_NODEITEM_Parent, XFA_OBJECTTYPE_ContainerNode); | 796 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); |
| 797 if (!pParentNode || | 797 if (!pParentNode || |
| 798 pFormNode != | 798 pFormNode != |
| 799 pParentNode->GetNodeItem(XFA_NODEITEM_FirstChild, | 799 pParentNode->GetNodeItem(XFA_NODEITEM_FirstChild, |
| 800 XFA_OBJECTTYPE_ContainerNode)) { | 800 XFA_ObjectType::ContainerNode)) { |
| 801 break; | 801 break; |
| 802 } | 802 } |
| 803 pParentNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); | 803 pParentNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 804 if (!pParentNode || pParentNode->GetClassID() != XFA_ELEMENT_Form) { | 804 if (!pParentNode || pParentNode->GetClassID() != XFA_ELEMENT_Form) { |
| 805 break; | 805 break; |
| 806 } | 806 } |
| 807 return TRUE; | 807 return TRUE; |
| 808 } | 808 } |
| 809 } | 809 } |
| 810 } break; | 810 } break; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 828 } | 828 } |
| 829 | 829 |
| 830 FX_BOOL CXFA_LayoutPageMgr::ProcessBreakBeforeOrAfter( | 830 FX_BOOL CXFA_LayoutPageMgr::ProcessBreakBeforeOrAfter( |
| 831 CXFA_Node* pBreakNode, | 831 CXFA_Node* pBreakNode, |
| 832 FX_BOOL bBefore, | 832 FX_BOOL bBefore, |
| 833 CXFA_Node*& pBreakLeaderNode, | 833 CXFA_Node*& pBreakLeaderNode, |
| 834 CXFA_Node*& pBreakTrailerNode, | 834 CXFA_Node*& pBreakTrailerNode, |
| 835 FX_BOOL& bCreatePage) { | 835 FX_BOOL& bCreatePage) { |
| 836 CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; | 836 CXFA_Node *pLeaderTemplate = NULL, *pTrailerTemplate = NULL; |
| 837 CXFA_Node* pFormNode = pBreakNode->GetNodeItem(XFA_NODEITEM_Parent, | 837 CXFA_Node* pFormNode = pBreakNode->GetNodeItem(XFA_NODEITEM_Parent, |
| 838 XFA_OBJECTTYPE_ContainerNode); | 838 XFA_ObjectType::ContainerNode); |
| 839 if (XFA_ItemLayoutProcessor_IsTakingSpace(pFormNode)) { | 839 if (XFA_ItemLayoutProcessor_IsTakingSpace(pFormNode)) { |
| 840 bCreatePage = ExecuteBreakBeforeOrAfter(pBreakNode, bBefore, | 840 bCreatePage = ExecuteBreakBeforeOrAfter(pBreakNode, bBefore, |
| 841 pLeaderTemplate, pTrailerTemplate); | 841 pLeaderTemplate, pTrailerTemplate); |
| 842 CXFA_Document* pDocument = pBreakNode->GetDocument(); | 842 CXFA_Document* pDocument = pBreakNode->GetDocument(); |
| 843 CXFA_Node* pDataScope = NULL; | 843 CXFA_Node* pDataScope = NULL; |
| 844 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent, | 844 pFormNode = pFormNode->GetNodeItem(XFA_NODEITEM_Parent, |
| 845 XFA_OBJECTTYPE_ContainerNode); | 845 XFA_ObjectType::ContainerNode); |
| 846 if (pLeaderTemplate) { | 846 if (pLeaderTemplate) { |
| 847 if (!pDataScope) { | 847 if (!pDataScope) { |
| 848 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 848 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); |
| 849 } | 849 } |
| 850 pBreakLeaderNode = pDocument->DataMerge_CopyContainer( | 850 pBreakLeaderNode = pDocument->DataMerge_CopyContainer( |
| 851 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 851 pLeaderTemplate, pFormNode, pDataScope, TRUE); |
| 852 pDocument->DataMerge_UpdateBindingRelations(pBreakLeaderNode); | 852 pDocument->DataMerge_UpdateBindingRelations(pBreakLeaderNode); |
| 853 SetLayoutGeneratedNodeFlag(pBreakLeaderNode); | 853 SetLayoutGeneratedNodeFlag(pBreakLeaderNode); |
| 854 } | 854 } |
| 855 if (pTrailerTemplate) { | 855 if (pTrailerTemplate) { |
| 856 if (!pDataScope) { | 856 if (!pDataScope) { |
| 857 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 857 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); |
| 858 } | 858 } |
| 859 pBreakTrailerNode = pDocument->DataMerge_CopyContainer( | 859 pBreakTrailerNode = pDocument->DataMerge_CopyContainer( |
| 860 pTrailerTemplate, pFormNode, pDataScope, TRUE); | 860 pTrailerTemplate, pFormNode, pDataScope, TRUE); |
| 861 pDocument->DataMerge_UpdateBindingRelations(pBreakTrailerNode); | 861 pDocument->DataMerge_UpdateBindingRelations(pBreakTrailerNode); |
| 862 SetLayoutGeneratedNodeFlag(pBreakTrailerNode); | 862 SetLayoutGeneratedNodeFlag(pBreakTrailerNode); |
| 863 } | 863 } |
| 864 return TRUE; | 864 return TRUE; |
| 865 } | 865 } |
| 866 return FALSE; | 866 return FALSE; |
| 867 } | 867 } |
| 868 FX_BOOL CXFA_LayoutPageMgr::ProcessBookendLeaderOrTrailer( | 868 FX_BOOL CXFA_LayoutPageMgr::ProcessBookendLeaderOrTrailer( |
| 869 CXFA_Node* pBookendNode, | 869 CXFA_Node* pBookendNode, |
| 870 FX_BOOL bLeader, | 870 FX_BOOL bLeader, |
| 871 CXFA_Node*& pBookendAppendNode) { | 871 CXFA_Node*& pBookendAppendNode) { |
| 872 CXFA_Node* pLeaderTemplate = NULL; | 872 CXFA_Node* pLeaderTemplate = NULL; |
| 873 CXFA_Node* pFormNode = pBookendNode->GetNodeItem( | 873 CXFA_Node* pFormNode = pBookendNode->GetNodeItem( |
| 874 XFA_NODEITEM_Parent, XFA_OBJECTTYPE_ContainerNode); | 874 XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); |
| 875 if (ResolveBookendLeaderOrTrailer(pBookendNode, bLeader, pLeaderTemplate)) { | 875 if (ResolveBookendLeaderOrTrailer(pBookendNode, bLeader, pLeaderTemplate)) { |
| 876 CXFA_Document* pDocument = pBookendNode->GetDocument(); | 876 CXFA_Document* pDocument = pBookendNode->GetDocument(); |
| 877 CXFA_Node* pDataScope = NULL; | 877 CXFA_Node* pDataScope = NULL; |
| 878 if (pLeaderTemplate) { | 878 if (pLeaderTemplate) { |
| 879 if (!pDataScope) { | 879 if (!pDataScope) { |
| 880 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); | 880 pDataScope = XFA_DataMerge_FindDataScope(pFormNode); |
| 881 } | 881 } |
| 882 pBookendAppendNode = pDocument->DataMerge_CopyContainer( | 882 pBookendAppendNode = pDocument->DataMerge_CopyContainer( |
| 883 pLeaderTemplate, pFormNode, pDataScope, TRUE); | 883 pLeaderTemplate, pFormNode, pDataScope, TRUE); |
| 884 pDocument->DataMerge_UpdateBindingRelations(pBookendAppendNode); | 884 pDocument->DataMerge_UpdateBindingRelations(pBookendAppendNode); |
| 885 SetLayoutGeneratedNodeFlag(pBookendAppendNode); | 885 SetLayoutGeneratedNodeFlag(pBookendAppendNode); |
| 886 return TRUE; | 886 return TRUE; |
| 887 } | 887 } |
| 888 } | 888 } |
| 889 return FALSE; | 889 return FALSE; |
| 890 } | 890 } |
| 891 CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, | 891 CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, |
| 892 CXFA_Node*& pLeaderTemplate, | 892 CXFA_Node*& pLeaderTemplate, |
| 893 CXFA_Node*& pTrailerTemplate, | 893 CXFA_Node*& pTrailerTemplate, |
| 894 FX_BOOL bCreatePage) { | 894 FX_BOOL bCreatePage) { |
| 895 CXFA_Node* pContainer = | 895 CXFA_Node* pContainer = |
| 896 pOverflowNode->GetNodeItem(XFA_NODEITEM_Parent, | 896 pOverflowNode |
| 897 XFA_OBJECTTYPE_ContainerNode) | 897 ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) |
| 898 ->GetTemplateNode(); | 898 ->GetTemplateNode(); |
| 899 if (pOverflowNode->GetClassID() == XFA_ELEMENT_Break) { | 899 if (pOverflowNode->GetClassID() == XFA_ELEMENT_Break) { |
| 900 CFX_WideStringC wsOverflowLeader; | 900 CFX_WideStringC wsOverflowLeader; |
| 901 CFX_WideStringC wsOverflowTarget; | 901 CFX_WideStringC wsOverflowTarget; |
| 902 CFX_WideStringC wsOverflowTrailer; | 902 CFX_WideStringC wsOverflowTrailer; |
| 903 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); | 903 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowLeader, wsOverflowLeader); |
| 904 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); | 904 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTrailer, wsOverflowTrailer); |
| 905 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); | 905 pOverflowNode->TryCData(XFA_ATTRIBUTE_OverflowTarget, wsOverflowTarget); |
| 906 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || | 906 if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || |
| 907 !wsOverflowTarget.IsEmpty()) { | 907 !wsOverflowTarget.IsEmpty()) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 } | 1020 } |
| 1021 } | 1021 } |
| 1022 return FALSE; | 1022 return FALSE; |
| 1023 } | 1023 } |
| 1024 FX_BOOL CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( | 1024 FX_BOOL CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( |
| 1025 CXFA_Node* pBookendNode, | 1025 CXFA_Node* pBookendNode, |
| 1026 FX_BOOL bLeader, | 1026 FX_BOOL bLeader, |
| 1027 CXFA_Node*& pBookendAppendTemplate) { | 1027 CXFA_Node*& pBookendAppendTemplate) { |
| 1028 CFX_WideStringC wsBookendLeader; | 1028 CFX_WideStringC wsBookendLeader; |
| 1029 CXFA_Node* pContainer = | 1029 CXFA_Node* pContainer = |
| 1030 pBookendNode->GetNodeItem(XFA_NODEITEM_Parent, | 1030 pBookendNode |
| 1031 XFA_OBJECTTYPE_ContainerNode) | 1031 ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) |
| 1032 ->GetTemplateNode(); | 1032 ->GetTemplateNode(); |
| 1033 if (pBookendNode->GetClassID() == XFA_ELEMENT_Break) { | 1033 if (pBookendNode->GetClassID() == XFA_ELEMENT_Break) { |
| 1034 pBookendNode->TryCData( | 1034 pBookendNode->TryCData( |
| 1035 bLeader ? XFA_ATTRIBUTE_BookendLeader : XFA_ATTRIBUTE_BookendTrailer, | 1035 bLeader ? XFA_ATTRIBUTE_BookendLeader : XFA_ATTRIBUTE_BookendTrailer, |
| 1036 wsBookendLeader); | 1036 wsBookendLeader); |
| 1037 if (!wsBookendLeader.IsEmpty()) { | 1037 if (!wsBookendLeader.IsEmpty()) { |
| 1038 pBookendAppendTemplate = | 1038 pBookendAppendTemplate = |
| 1039 ResolveBreakTarget(pContainer, FALSE, wsBookendLeader); | 1039 ResolveBreakTarget(pContainer, FALSE, wsBookendLeader); |
| 1040 return TRUE; | 1040 return TRUE; |
| 1041 } | 1041 } |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 return pFormNode->GetDocument()->GetParser()->GetNotify()->OnCreateLayoutItem( | 1559 return pFormNode->GetDocument()->GetParser()->GetNotify()->OnCreateLayoutItem( |
| 1560 pFormNode); | 1560 pFormNode); |
| 1561 } | 1561 } |
| 1562 | 1562 |
| 1563 void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { | 1563 void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { |
| 1564 CXFA_LayoutItem* pNextLayoutItem; | 1564 CXFA_LayoutItem* pNextLayoutItem; |
| 1565 CXFA_LayoutItem* pCurLayoutItem = pParentLayoutItem->m_pFirstChild; | 1565 CXFA_LayoutItem* pCurLayoutItem = pParentLayoutItem->m_pFirstChild; |
| 1566 while (pCurLayoutItem) { | 1566 while (pCurLayoutItem) { |
| 1567 pNextLayoutItem = pCurLayoutItem->m_pNextSibling; | 1567 pNextLayoutItem = pCurLayoutItem->m_pNextSibling; |
| 1568 if (pCurLayoutItem->IsContentLayoutItem()) { | 1568 if (pCurLayoutItem->IsContentLayoutItem()) { |
| 1569 uint32_t dwFlag = pCurLayoutItem->m_pFormNode->GetFlag(); | 1569 if (pCurLayoutItem->m_pFormNode->HasRemovedChildren()) { |
| 1570 if (dwFlag & (XFA_NODEFLAG_HasRemoved)) { | |
| 1571 CXFA_FFNotify* pNotify = | 1570 CXFA_FFNotify* pNotify = |
| 1572 m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); | 1571 m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); |
| 1573 CXFA_LayoutProcessor* pDocLayout = | 1572 CXFA_LayoutProcessor* pDocLayout = |
| 1574 m_pTemplatePageSetRoot->GetDocument()->GetDocLayout(); | 1573 m_pTemplatePageSetRoot->GetDocument()->GetDocLayout(); |
| 1575 if (pCurLayoutItem->m_pFirstChild) { | 1574 if (pCurLayoutItem->m_pFirstChild) { |
| 1576 SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout); | 1575 SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout); |
| 1577 } | 1576 } |
| 1578 pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem); | 1577 pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem); |
| 1579 delete pCurLayoutItem; | 1578 delete pCurLayoutItem; |
| 1580 pCurLayoutItem = pNextLayoutItem; | 1579 pCurLayoutItem = pNextLayoutItem; |
| 1581 continue; | 1580 continue; |
| 1582 } | 1581 } |
| 1583 if (dwFlag & XFA_NODEFLAG_LayoutGeneratedNode) { | 1582 if (pCurLayoutItem->m_pFormNode->IsLayoutGeneratedNode()) { |
| 1584 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> | 1583 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> |
| 1585 sIterator(pCurLayoutItem->m_pFormNode); | 1584 sIterator(pCurLayoutItem->m_pFormNode); |
| 1586 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; | 1585 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; |
| 1587 pNode = sIterator.MoveToNext()) { | 1586 pNode = sIterator.MoveToNext()) { |
| 1588 pNode->SetFlag(XFA_NODEFLAG_UnusedNode, false); | 1587 pNode->SetFlag(XFA_NodeFlag_UnusedNode, false); |
| 1589 } | 1588 } |
| 1590 } | 1589 } |
| 1591 } | 1590 } |
| 1592 if (pCurLayoutItem->m_pFirstChild) { | 1591 if (pCurLayoutItem->m_pFirstChild) { |
| 1593 SaveLayoutItem(pCurLayoutItem); | 1592 SaveLayoutItem(pCurLayoutItem); |
| 1594 } | 1593 } |
| 1595 pCurLayoutItem->m_pParent = NULL; | 1594 pCurLayoutItem->m_pParent = NULL; |
| 1596 pCurLayoutItem->m_pNextSibling = NULL; | 1595 pCurLayoutItem->m_pNextSibling = NULL; |
| 1597 pCurLayoutItem->m_pFirstChild = NULL; | 1596 pCurLayoutItem->m_pFirstChild = NULL; |
| 1598 if (!pCurLayoutItem->IsContentLayoutItem() && | 1597 if (!pCurLayoutItem->IsContentLayoutItem() && |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 sIterator(pDocument->m_pPendingPageSet.GetAt(iIndex)); | 1637 sIterator(pDocument->m_pPendingPageSet.GetAt(iIndex)); |
| 1639 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; | 1638 for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; |
| 1640 pNode = sIterator.MoveToNext()) { | 1639 pNode = sIterator.MoveToNext()) { |
| 1641 if (pNode->IsContainerNode()) { | 1640 if (pNode->IsContainerNode()) { |
| 1642 CXFA_Node* pBindNode = pNode->GetBindData(); | 1641 CXFA_Node* pBindNode = pNode->GetBindData(); |
| 1643 if (pBindNode) { | 1642 if (pBindNode) { |
| 1644 pBindNode->RemoveBindItem(pNode); | 1643 pBindNode->RemoveBindItem(pNode); |
| 1645 pNode->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); | 1644 pNode->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); |
| 1646 } | 1645 } |
| 1647 } | 1646 } |
| 1648 pNode->SetFlag(XFA_NODEFLAG_UnusedNode, true); | 1647 pNode->SetFlag(XFA_NodeFlag_UnusedNode, true); |
| 1649 } | 1648 } |
| 1650 } | 1649 } |
| 1651 } | 1650 } |
| 1652 int32_t iIndex = 0; | 1651 int32_t iIndex = 0; |
| 1653 for (; pRootLayout; | 1652 for (; pRootLayout; |
| 1654 pRootLayout = (CXFA_ContainerLayoutItem*)pRootLayout->m_pNextSibling) { | 1653 pRootLayout = (CXFA_ContainerLayoutItem*)pRootLayout->m_pNextSibling) { |
| 1655 CXFA_Node* pPendingPageSet = nullptr; | 1654 CXFA_Node* pPendingPageSet = nullptr; |
| 1656 CXFA_NodeIteratorTemplate< | 1655 CXFA_NodeIteratorTemplate< |
| 1657 CXFA_ContainerLayoutItem, | 1656 CXFA_ContainerLayoutItem, |
| 1658 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> | 1657 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1672 } else { | 1671 } else { |
| 1673 pPendingPageSet = pRootPageSetContainerItem->m_pFormNode; | 1672 pPendingPageSet = pRootPageSetContainerItem->m_pFormNode; |
| 1674 } | 1673 } |
| 1675 } | 1674 } |
| 1676 if (pRootPageSetContainerItem->m_pFormNode->GetUserData( | 1675 if (pRootPageSetContainerItem->m_pFormNode->GetUserData( |
| 1677 XFA_LAYOUTITEMKEY) == pRootPageSetContainerItem) { | 1676 XFA_LAYOUTITEMKEY) == pRootPageSetContainerItem) { |
| 1678 pRootPageSetContainerItem->m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, | 1677 pRootPageSetContainerItem->m_pFormNode->SetUserData(XFA_LAYOUTITEMKEY, |
| 1679 NULL); | 1678 NULL); |
| 1680 } | 1679 } |
| 1681 pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; | 1680 pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; |
| 1682 pPendingPageSet->ClearFlag(XFA_NODEFLAG_UnusedNode); | 1681 pPendingPageSet->ClearFlag(XFA_NodeFlag_UnusedNode); |
| 1683 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext(); | 1682 for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext(); |
| 1684 pContainerItem; pContainerItem = iterator.MoveToNext()) { | 1683 pContainerItem; pContainerItem = iterator.MoveToNext()) { |
| 1685 CXFA_Node* pNode = pContainerItem->m_pFormNode; | 1684 CXFA_Node* pNode = pContainerItem->m_pFormNode; |
| 1686 if (pNode->GetPacketID() != XFA_XDPPACKET_Template) { | 1685 if (pNode->GetPacketID() != XFA_XDPPACKET_Template) { |
| 1687 continue; | 1686 continue; |
| 1688 } | 1687 } |
| 1689 switch (pNode->GetClassID()) { | 1688 switch (pNode->GetClassID()) { |
| 1690 case XFA_ELEMENT_PageSet: { | 1689 case XFA_ELEMENT_PageSet: { |
| 1691 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; | 1690 CXFA_Node* pParentNode = pContainerItem->m_pParent->m_pFormNode; |
| 1692 pContainerItem->m_pFormNode = XFA_NodeMerge_CloneOrMergeContainer( | 1691 pContainerItem->m_pFormNode = XFA_NodeMerge_CloneOrMergeContainer( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 } | 1757 } |
| 1759 } | 1758 } |
| 1760 if (!pPendingPageSet->GetNodeItem(XFA_NODEITEM_Parent)) { | 1759 if (!pPendingPageSet->GetNodeItem(XFA_NODEITEM_Parent)) { |
| 1761 CXFA_Node* pFormToplevelSubform = | 1760 CXFA_Node* pFormToplevelSubform = |
| 1762 pDocument->GetXFAObject(XFA_HASHCODE_Form) | 1761 pDocument->GetXFAObject(XFA_HASHCODE_Form) |
| 1763 ->AsNode() | 1762 ->AsNode() |
| 1764 ->GetFirstChildByClass(XFA_ELEMENT_Subform); | 1763 ->GetFirstChildByClass(XFA_ELEMENT_Subform); |
| 1765 pFormToplevelSubform->InsertChild(pPendingPageSet); | 1764 pFormToplevelSubform->InsertChild(pPendingPageSet); |
| 1766 } | 1765 } |
| 1767 pDocument->DataMerge_UpdateBindingRelations(pPendingPageSet); | 1766 pDocument->DataMerge_UpdateBindingRelations(pPendingPageSet); |
| 1768 pPendingPageSet->SetFlag(XFA_NODEFLAG_Initialized, true); | 1767 pPendingPageSet->SetFlag(XFA_NodeFlag_Initialized, true); |
| 1769 } | 1768 } |
| 1770 CXFA_Node* pPageSet = GetRootLayoutItem()->m_pFormNode; | 1769 CXFA_Node* pPageSet = GetRootLayoutItem()->m_pFormNode; |
| 1771 while (pPageSet) { | 1770 while (pPageSet) { |
| 1772 CXFA_Node* pNextPageSet = | 1771 CXFA_Node* pNextPageSet = |
| 1773 pPageSet->GetNextSameClassSibling(XFA_ELEMENT_PageSet); | 1772 pPageSet->GetNextSameClassSibling(XFA_ELEMENT_PageSet); |
| 1774 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> | 1773 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> |
| 1775 sIterator(pPageSet); | 1774 sIterator(pPageSet); |
| 1776 CXFA_Node* pNode = sIterator.GetCurrent(); | 1775 CXFA_Node* pNode = sIterator.GetCurrent(); |
| 1777 while (pNode) { | 1776 while (pNode) { |
| 1778 if (pNode->HasFlag(XFA_NODEFLAG_UnusedNode)) { | 1777 if (pNode->IsUnusedNode()) { |
| 1779 if (pNode->GetObjectType() == XFA_OBJECTTYPE_ContainerNode) { | 1778 if (pNode->IsContainerNode()) { |
| 1780 XFA_ELEMENT eCurId = pNode->GetClassID(); | 1779 XFA_ELEMENT eCurId = pNode->GetClassID(); |
| 1781 if (eCurId == XFA_ELEMENT_PageArea || eCurId == XFA_ELEMENT_PageSet) { | 1780 if (eCurId == XFA_ELEMENT_PageArea || eCurId == XFA_ELEMENT_PageSet) { |
| 1782 CXFA_ContainerIterator iteChild(pNode); | 1781 CXFA_ContainerIterator iteChild(pNode); |
| 1783 CXFA_Node* pChildNode = iteChild.MoveToNext(); | 1782 CXFA_Node* pChildNode = iteChild.MoveToNext(); |
| 1784 for (; pChildNode; pChildNode = iteChild.MoveToNext()) { | 1783 for (; pChildNode; pChildNode = iteChild.MoveToNext()) { |
| 1785 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( | 1784 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( |
| 1786 pChildNode->GetUserData(XFA_LAYOUTITEMKEY)); | 1785 pChildNode->GetUserData(XFA_LAYOUTITEMKEY)); |
| 1787 if (pLayoutItem) { | 1786 if (pLayoutItem) { |
| 1788 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); | 1787 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); |
| 1789 delete pLayoutItem; | 1788 delete pLayoutItem; |
| 1790 } | 1789 } |
| 1791 } | 1790 } |
| 1792 } else if (eCurId != XFA_ELEMENT_ContentArea) { | 1791 } else if (eCurId != XFA_ELEMENT_ContentArea) { |
| 1793 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( | 1792 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( |
| 1794 pNode->GetUserData(XFA_LAYOUTITEMKEY)); | 1793 pNode->GetUserData(XFA_LAYOUTITEMKEY)); |
| 1795 if (pLayoutItem) { | 1794 if (pLayoutItem) { |
| 1796 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); | 1795 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); |
| 1797 delete pLayoutItem; | 1796 delete pLayoutItem; |
| 1798 } | 1797 } |
| 1799 } | 1798 } |
| 1800 CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext(); | 1799 CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext(); |
| 1801 pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode); | 1800 pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode); |
| 1802 pNode = pNext; | 1801 pNode = pNext; |
| 1803 } else { | 1802 } else { |
| 1804 pNode->ClearFlag(XFA_NODEFLAG_UnusedNode); | 1803 pNode->ClearFlag(XFA_NodeFlag_UnusedNode); |
| 1805 pNode->SetFlag(XFA_NODEFLAG_Initialized, true); | 1804 pNode->SetFlag(XFA_NodeFlag_Initialized, true); |
| 1806 pNode = sIterator.MoveToNext(); | 1805 pNode = sIterator.MoveToNext(); |
| 1807 } | 1806 } |
| 1808 } else { | 1807 } else { |
| 1809 pNode->SetFlag(XFA_NODEFLAG_Initialized, true); | 1808 pNode->SetFlag(XFA_NodeFlag_Initialized, true); |
| 1810 pNode = sIterator.MoveToNext(); | 1809 pNode = sIterator.MoveToNext(); |
| 1811 } | 1810 } |
| 1812 } | 1811 } |
| 1813 pPageSet = pNextPageSet; | 1812 pPageSet = pNextPageSet; |
| 1814 } | 1813 } |
| 1815 } | 1814 } |
| 1816 | 1815 |
| 1817 void CXFA_LayoutPageMgr::LayoutPageSetContents() { | 1816 void CXFA_LayoutPageMgr::LayoutPageSetContents() { |
| 1818 CXFA_ContainerLayoutItem* pRootLayoutItem = GetRootLayoutItem(); | 1817 CXFA_ContainerLayoutItem* pRootLayoutItem = GetRootLayoutItem(); |
| 1819 for (; pRootLayoutItem; | 1818 for (; pRootLayoutItem; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 m_nAvailPages = 0; | 1911 m_nAvailPages = 0; |
| 1913 ClearRecordList(); | 1912 ClearRecordList(); |
| 1914 if (!m_pPageSetLayoutItemRoot) { | 1913 if (!m_pPageSetLayoutItemRoot) { |
| 1915 return; | 1914 return; |
| 1916 } | 1915 } |
| 1917 CXFA_ContainerLayoutItem* pRootLayoutItem = m_pPageSetLayoutItemRoot; | 1916 CXFA_ContainerLayoutItem* pRootLayoutItem = m_pPageSetLayoutItemRoot; |
| 1918 if (pRootLayoutItem && | 1917 if (pRootLayoutItem && |
| 1919 pRootLayoutItem->m_pFormNode->GetPacketID() == XFA_XDPPACKET_Form) { | 1918 pRootLayoutItem->m_pFormNode->GetPacketID() == XFA_XDPPACKET_Form) { |
| 1920 CXFA_Node* pPageSetFormNode = pRootLayoutItem->m_pFormNode; | 1919 CXFA_Node* pPageSetFormNode = pRootLayoutItem->m_pFormNode; |
| 1921 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.RemoveAll(); | 1920 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.RemoveAll(); |
| 1922 if (pPageSetFormNode->HasFlag(XFA_NODEFLAG_HasRemoved)) { | 1921 if (pPageSetFormNode->HasRemovedChildren()) { |
| 1923 XFA_ReleaseLayoutItem(pRootLayoutItem); | 1922 XFA_ReleaseLayoutItem(pRootLayoutItem); |
| 1924 m_pPageSetLayoutItemRoot = NULL; | 1923 m_pPageSetLayoutItemRoot = NULL; |
| 1925 pRootLayoutItem = NULL; | 1924 pRootLayoutItem = NULL; |
| 1926 pPageSetFormNode = NULL; | 1925 pPageSetFormNode = NULL; |
| 1927 m_PageArray.RemoveAll(); | 1926 m_PageArray.RemoveAll(); |
| 1928 } | 1927 } |
| 1929 while (pPageSetFormNode) { | 1928 while (pPageSetFormNode) { |
| 1930 CXFA_Node* pNextPageSet = | 1929 CXFA_Node* pNextPageSet = |
| 1931 pPageSetFormNode->GetNextSameClassSibling(XFA_ELEMENT_PageSet); | 1930 pPageSetFormNode->GetNextSameClassSibling(XFA_ELEMENT_PageSet); |
| 1932 pPageSetFormNode->GetNodeItem(XFA_NODEITEM_Parent) | 1931 pPageSetFormNode->GetNodeItem(XFA_NODEITEM_Parent) |
| 1933 ->RemoveChild(pPageSetFormNode, FALSE); | 1932 ->RemoveChild(pPageSetFormNode, FALSE); |
| 1934 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.Add( | 1933 pRootLayoutItem->m_pFormNode->GetDocument()->m_pPendingPageSet.Add( |
| 1935 pPageSetFormNode); | 1934 pPageSetFormNode); |
| 1936 pPageSetFormNode = pNextPageSet; | 1935 pPageSetFormNode = pNextPageSet; |
| 1937 } | 1936 } |
| 1938 } | 1937 } |
| 1939 pRootLayoutItem = m_pPageSetLayoutItemRoot; | 1938 pRootLayoutItem = m_pPageSetLayoutItemRoot; |
| 1940 CXFA_ContainerLayoutItem* pNextLayout = NULL; | 1939 CXFA_ContainerLayoutItem* pNextLayout = NULL; |
| 1941 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { | 1940 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { |
| 1942 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; | 1941 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; |
| 1943 SaveLayoutItem(pRootLayoutItem); | 1942 SaveLayoutItem(pRootLayoutItem); |
| 1944 delete pRootLayoutItem; | 1943 delete pRootLayoutItem; |
| 1945 } | 1944 } |
| 1946 m_pPageSetLayoutItemRoot = NULL; | 1945 m_pPageSetLayoutItemRoot = NULL; |
| 1947 } | 1946 } |
| OLD | NEW |