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 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 CXFA_Node* pPageSet = GetRootLayoutItem()->m_pFormNode; | 1775 CXFA_Node* pPageSet = GetRootLayoutItem()->m_pFormNode; |
1776 while (pPageSet) { | 1776 while (pPageSet) { |
1777 CXFA_Node* pNextPageSet = | 1777 CXFA_Node* pNextPageSet = |
1778 pPageSet->GetNextSameClassSibling(XFA_Element::PageSet); | 1778 pPageSet->GetNextSameClassSibling(XFA_Element::PageSet); |
1779 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> | 1779 CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> |
1780 sIterator(pPageSet); | 1780 sIterator(pPageSet); |
1781 CXFA_Node* pNode = sIterator.GetCurrent(); | 1781 CXFA_Node* pNode = sIterator.GetCurrent(); |
1782 while (pNode) { | 1782 while (pNode) { |
1783 if (pNode->IsUnusedNode()) { | 1783 if (pNode->IsUnusedNode()) { |
1784 if (pNode->IsContainerNode()) { | 1784 if (pNode->IsContainerNode()) { |
1785 XFA_Element eCurId = pNode->GetElementType(); | 1785 XFA_Element eType = pNode->GetElementType(); |
1786 if (eCurId == XFA_Element::PageArea || | 1786 if (eType == XFA_Element::PageArea || eType == XFA_Element::PageSet) { |
1787 eCurId == XFA_Element::PageSet) { | |
1788 CXFA_ContainerIterator iteChild(pNode); | 1787 CXFA_ContainerIterator iteChild(pNode); |
1789 CXFA_Node* pChildNode = iteChild.MoveToNext(); | 1788 CXFA_Node* pChildNode = iteChild.MoveToNext(); |
1790 for (; pChildNode; pChildNode = iteChild.MoveToNext()) { | 1789 for (; pChildNode; pChildNode = iteChild.MoveToNext()) { |
1791 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( | 1790 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( |
1792 pChildNode->GetUserData(XFA_LAYOUTITEMKEY)); | 1791 pChildNode->GetUserData(XFA_LAYOUTITEMKEY)); |
1793 if (pLayoutItem) { | 1792 if (pLayoutItem) { |
1794 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); | 1793 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); |
1795 delete pLayoutItem; | 1794 delete pLayoutItem; |
1796 } | 1795 } |
1797 } | 1796 } |
1798 } else if (eCurId != XFA_Element::ContentArea) { | 1797 } else if (eType != XFA_Element::ContentArea) { |
1799 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( | 1798 CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>( |
1800 pNode->GetUserData(XFA_LAYOUTITEMKEY)); | 1799 pNode->GetUserData(XFA_LAYOUTITEMKEY)); |
1801 if (pLayoutItem) { | 1800 if (pLayoutItem) { |
1802 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); | 1801 pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); |
1803 delete pLayoutItem; | 1802 delete pLayoutItem; |
1804 } | 1803 } |
1805 } | 1804 } |
1806 CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext(); | 1805 CXFA_Node* pNext = sIterator.SkipChildrenAndMoveToNext(); |
1807 pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode); | 1806 pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode); |
1808 pNode = pNext; | 1807 pNode = pNext; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 } | 1943 } |
1945 pRootLayoutItem = m_pPageSetLayoutItemRoot; | 1944 pRootLayoutItem = m_pPageSetLayoutItemRoot; |
1946 CXFA_ContainerLayoutItem* pNextLayout = NULL; | 1945 CXFA_ContainerLayoutItem* pNextLayout = NULL; |
1947 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { | 1946 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { |
1948 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; | 1947 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; |
1949 SaveLayoutItem(pRootLayoutItem); | 1948 SaveLayoutItem(pRootLayoutItem); |
1950 delete pRootLayoutItem; | 1949 delete pRootLayoutItem; |
1951 } | 1950 } |
1952 m_pPageSetLayoutItemRoot = NULL; | 1951 m_pPageSetLayoutItemRoot = NULL; |
1953 } | 1952 } |
OLD | NEW |