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/fm2js/xfa_fm2jsapi.h" | 9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
10 #include "xfa/fxfa/parser/xfa_docdata.h" | 10 #include "xfa/fxfa/parser/xfa_docdata.h" |
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 delete pCurLayoutItem; | 1509 delete pCurLayoutItem; |
1510 pCurLayoutItem = pNextLayoutItem; | 1510 pCurLayoutItem = pNextLayoutItem; |
1511 } | 1511 } |
1512 } | 1512 } |
1513 void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { | 1513 void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) { |
1514 CXFA_LayoutItem* pNextLayoutItem; | 1514 CXFA_LayoutItem* pNextLayoutItem; |
1515 CXFA_LayoutItem* pCurLayoutItem = pParentLayoutItem->m_pFirstChild; | 1515 CXFA_LayoutItem* pCurLayoutItem = pParentLayoutItem->m_pFirstChild; |
1516 while (pCurLayoutItem) { | 1516 while (pCurLayoutItem) { |
1517 pNextLayoutItem = pCurLayoutItem->m_pNextSibling; | 1517 pNextLayoutItem = pCurLayoutItem->m_pNextSibling; |
1518 if (pCurLayoutItem->IsContentLayoutItem()) { | 1518 if (pCurLayoutItem->IsContentLayoutItem()) { |
1519 FX_DWORD dwFlag = pCurLayoutItem->m_pFormNode->GetFlag(); | 1519 uint32_t dwFlag = pCurLayoutItem->m_pFormNode->GetFlag(); |
1520 if (dwFlag & (XFA_NODEFLAG_HasRemoved)) { | 1520 if (dwFlag & (XFA_NODEFLAG_HasRemoved)) { |
1521 IXFA_Notify* pNotify = | 1521 IXFA_Notify* pNotify = |
1522 m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); | 1522 m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify(); |
1523 IXFA_DocLayout* pDocLayout = | 1523 IXFA_DocLayout* pDocLayout = |
1524 m_pTemplatePageSetRoot->GetDocument()->GetDocLayout(); | 1524 m_pTemplatePageSetRoot->GetDocument()->GetDocLayout(); |
1525 if (pCurLayoutItem->m_pFirstChild) { | 1525 if (pCurLayoutItem->m_pFirstChild) { |
1526 XFA_SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout); | 1526 XFA_SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout); |
1527 } | 1527 } |
1528 pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem, | 1528 pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem, |
1529 XFA_LAYOUTEVENT_ItemRemoving); | 1529 XFA_LAYOUTEVENT_ItemRemoving); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 break; | 1786 break; |
1787 default: | 1787 default: |
1788 break; | 1788 break; |
1789 } | 1789 } |
1790 } | 1790 } |
1791 } | 1791 } |
1792 } | 1792 } |
1793 void XFA_SyncContainer(IXFA_Notify* pNotify, | 1793 void XFA_SyncContainer(IXFA_Notify* pNotify, |
1794 IXFA_DocLayout* pDocLayout, | 1794 IXFA_DocLayout* pDocLayout, |
1795 CXFA_LayoutItem* pContainerItem, | 1795 CXFA_LayoutItem* pContainerItem, |
1796 FX_DWORD dwRelevant, | 1796 uint32_t dwRelevant, |
1797 FX_BOOL bVisible, | 1797 FX_BOOL bVisible, |
1798 int32_t nPageIndex) { | 1798 int32_t nPageIndex) { |
1799 FX_BOOL bVisibleItem = FALSE; | 1799 FX_BOOL bVisibleItem = FALSE; |
1800 FX_DWORD dwStatus = 0; | 1800 uint32_t dwStatus = 0; |
1801 FX_DWORD dwRelevantContainer = 0; | 1801 uint32_t dwRelevantContainer = 0; |
1802 if (bVisible) { | 1802 if (bVisible) { |
1803 XFA_ATTRIBUTEENUM eAttributeValue = | 1803 XFA_ATTRIBUTEENUM eAttributeValue = |
1804 pContainerItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Presence); | 1804 pContainerItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Presence); |
1805 if (eAttributeValue == XFA_ATTRIBUTEENUM_Visible || | 1805 if (eAttributeValue == XFA_ATTRIBUTEENUM_Visible || |
1806 eAttributeValue == XFA_ATTRIBUTEENUM_Unknown) { | 1806 eAttributeValue == XFA_ATTRIBUTEENUM_Unknown) { |
1807 bVisibleItem = TRUE; | 1807 bVisibleItem = TRUE; |
1808 } | 1808 } |
1809 dwRelevantContainer = | 1809 dwRelevantContainer = |
1810 XFA_GetRelevant(pContainerItem->m_pFormNode, dwRelevant); | 1810 XFA_GetRelevant(pContainerItem->m_pFormNode, dwRelevant); |
1811 dwStatus = | 1811 dwStatus = |
(...skipping 22 matching lines...) Expand all Loading... |
1834 (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling) { | 1834 (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling) { |
1835 CXFA_NodeIteratorTemplate< | 1835 CXFA_NodeIteratorTemplate< |
1836 CXFA_ContainerLayoutItem, | 1836 CXFA_ContainerLayoutItem, |
1837 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> | 1837 CXFA_TraverseStrategy_ContentAreaContainerLayoutItem> |
1838 iteratorParent(pRootLayoutItem); | 1838 iteratorParent(pRootLayoutItem); |
1839 for (CXFA_ContainerLayoutItem* pContainerItem = iteratorParent.GetCurrent(); | 1839 for (CXFA_ContainerLayoutItem* pContainerItem = iteratorParent.GetCurrent(); |
1840 pContainerItem; pContainerItem = iteratorParent.MoveToNext()) { | 1840 pContainerItem; pContainerItem = iteratorParent.MoveToNext()) { |
1841 switch (pContainerItem->m_pFormNode->GetClassID()) { | 1841 switch (pContainerItem->m_pFormNode->GetClassID()) { |
1842 case XFA_ELEMENT_PageArea: { | 1842 case XFA_ELEMENT_PageArea: { |
1843 nPageIdx++; | 1843 nPageIdx++; |
1844 FX_DWORD dwRelevant = | 1844 uint32_t dwRelevant = |
1845 XFA_LAYOUTSTATUS_Viewable | XFA_LAYOUTSTATUS_Printable; | 1845 XFA_LAYOUTSTATUS_Viewable | XFA_LAYOUTSTATUS_Printable; |
1846 CXFA_NodeIteratorTemplate<CXFA_LayoutItem, | 1846 CXFA_NodeIteratorTemplate<CXFA_LayoutItem, |
1847 CXFA_TraverseStrategy_LayoutItem> | 1847 CXFA_TraverseStrategy_LayoutItem> |
1848 iterator(pContainerItem); | 1848 iterator(pContainerItem); |
1849 CXFA_LayoutItem* pChildLayoutItem = iterator.GetCurrent(); | 1849 CXFA_LayoutItem* pChildLayoutItem = iterator.GetCurrent(); |
1850 while (pChildLayoutItem) { | 1850 while (pChildLayoutItem) { |
1851 CXFA_ContentLayoutItem* pContentItem = | 1851 CXFA_ContentLayoutItem* pContentItem = |
1852 pChildLayoutItem->AsContentLayoutItem(); | 1852 pChildLayoutItem->AsContentLayoutItem(); |
1853 if (!pContentItem) { | 1853 if (!pContentItem) { |
1854 pChildLayoutItem = iterator.MoveToNext(); | 1854 pChildLayoutItem = iterator.MoveToNext(); |
1855 continue; | 1855 continue; |
1856 } | 1856 } |
1857 FX_BOOL bVisible = | 1857 FX_BOOL bVisible = |
1858 (pContentItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Presence) == | 1858 (pContentItem->m_pFormNode->GetEnum(XFA_ATTRIBUTE_Presence) == |
1859 XFA_ATTRIBUTEENUM_Visible); | 1859 XFA_ATTRIBUTEENUM_Visible); |
1860 FX_DWORD dwRelevantChild = | 1860 uint32_t dwRelevantChild = |
1861 XFA_GetRelevant(pContentItem->m_pFormNode, dwRelevant); | 1861 XFA_GetRelevant(pContentItem->m_pFormNode, dwRelevant); |
1862 XFA_SyncContainer(pNotify, m_pLayoutProcessor, pContentItem, | 1862 XFA_SyncContainer(pNotify, m_pLayoutProcessor, pContentItem, |
1863 dwRelevantChild, bVisible, nPageIdx); | 1863 dwRelevantChild, bVisible, nPageIdx); |
1864 pChildLayoutItem = iterator.SkipChildrenAndMoveToNext(); | 1864 pChildLayoutItem = iterator.SkipChildrenAndMoveToNext(); |
1865 } | 1865 } |
1866 } break; | 1866 } break; |
1867 default: | 1867 default: |
1868 break; | 1868 break; |
1869 } | 1869 } |
1870 } | 1870 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1922 } | 1922 } |
1923 pRootLayoutItem = m_pPageSetLayoutItemRoot; | 1923 pRootLayoutItem = m_pPageSetLayoutItemRoot; |
1924 CXFA_ContainerLayoutItem* pNextLayout = NULL; | 1924 CXFA_ContainerLayoutItem* pNextLayout = NULL; |
1925 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { | 1925 for (; pRootLayoutItem; pRootLayoutItem = pNextLayout) { |
1926 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; | 1926 pNextLayout = (CXFA_ContainerLayoutItem*)pRootLayoutItem->m_pNextSibling; |
1927 SaveLayoutItem(pRootLayoutItem); | 1927 SaveLayoutItem(pRootLayoutItem); |
1928 delete pRootLayoutItem; | 1928 delete pRootLayoutItem; |
1929 } | 1929 } |
1930 m_pPageSetLayoutItemRoot = NULL; | 1930 m_pPageSetLayoutItemRoot = NULL; |
1931 } | 1931 } |
OLD | NEW |