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 #ifndef _XFA_LAYOUT_APPADAPTER_H_ | 7 #ifndef _XFA_LAYOUT_APPADAPTER_H_ |
8 #define _XFA_LAYOUT_APPADAPTER_H_ | 8 #define _XFA_LAYOUT_APPADAPTER_H_ |
9 class CXFA_TraverseStrategy_PageAreaContainerLayoutItem { | 9 class CXFA_TraverseStrategy_PageAreaContainerLayoutItem { |
10 public: | 10 public: |
(...skipping 12 matching lines...) Expand all Loading... |
23 CXFA_ContainerLayoutItem* pLayoutItem) { | 23 CXFA_ContainerLayoutItem* pLayoutItem) { |
24 return (CXFA_ContainerLayoutItem*)pLayoutItem->m_pParent; | 24 return (CXFA_ContainerLayoutItem*)pLayoutItem->m_pParent; |
25 } | 25 } |
26 }; | 26 }; |
27 class CXFA_TraverseStrategy_ContentAreaContainerLayoutItem { | 27 class CXFA_TraverseStrategy_ContentAreaContainerLayoutItem { |
28 public: | 28 public: |
29 static inline CXFA_ContainerLayoutItem* GetFirstChild( | 29 static inline CXFA_ContainerLayoutItem* GetFirstChild( |
30 CXFA_ContainerLayoutItem* pLayoutItem) { | 30 CXFA_ContainerLayoutItem* pLayoutItem) { |
31 for (CXFA_LayoutItem* pChildItem = pLayoutItem->m_pFirstChild; pChildItem; | 31 for (CXFA_LayoutItem* pChildItem = pLayoutItem->m_pFirstChild; pChildItem; |
32 pChildItem = pChildItem->m_pNextSibling) { | 32 pChildItem = pChildItem->m_pNextSibling) { |
33 if (pChildItem->IsContentLayoutItem()) { | 33 if (CXFA_ContainerLayoutItem* pContainer = |
34 continue; | 34 pChildItem->AsContainerLayoutItem()) { |
| 35 return pContainer; |
35 } | 36 } |
36 return (CXFA_ContainerLayoutItem*)pChildItem; | |
37 } | 37 } |
38 return NULL; | 38 return nullptr; |
39 } | 39 } |
40 static inline CXFA_ContainerLayoutItem* GetNextSibling( | 40 static inline CXFA_ContainerLayoutItem* GetNextSibling( |
41 CXFA_ContainerLayoutItem* pLayoutItem) { | 41 CXFA_ContainerLayoutItem* pLayoutItem) { |
42 for (CXFA_LayoutItem* pChildItem = pLayoutItem->m_pNextSibling; pChildItem; | 42 for (CXFA_LayoutItem* pChildItem = pLayoutItem->m_pNextSibling; pChildItem; |
43 pChildItem = pChildItem->m_pNextSibling) { | 43 pChildItem = pChildItem->m_pNextSibling) { |
44 if (pChildItem->IsContentLayoutItem()) { | 44 if (CXFA_ContainerLayoutItem* pContainer = |
45 continue; | 45 pChildItem->AsContainerLayoutItem()) { |
| 46 return pContainer; |
46 } | 47 } |
47 return (CXFA_ContainerLayoutItem*)pChildItem; | |
48 } | 48 } |
49 return NULL; | 49 return nullptr; |
50 } | 50 } |
51 static inline CXFA_ContainerLayoutItem* GetParent( | 51 static inline CXFA_ContainerLayoutItem* GetParent( |
52 CXFA_ContainerLayoutItem* pLayoutItem) { | 52 CXFA_ContainerLayoutItem* pLayoutItem) { |
53 return (CXFA_ContainerLayoutItem*)pLayoutItem->m_pParent; | 53 return (CXFA_ContainerLayoutItem*)pLayoutItem->m_pParent; |
54 } | 54 } |
55 }; | 55 }; |
56 class CXFA_TraverseStrategy_ContentLayoutItem { | 56 class CXFA_TraverseStrategy_ContentLayoutItem { |
57 public: | 57 public: |
58 static inline CXFA_ContentLayoutItem* GetFirstChild( | 58 static inline CXFA_ContentLayoutItem* GetFirstChild( |
59 CXFA_ContentLayoutItem* pLayoutItem) { | 59 CXFA_ContentLayoutItem* pLayoutItem) { |
60 return (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; | 60 return (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; |
61 } | 61 } |
62 static inline CXFA_ContentLayoutItem* GetNextSibling( | 62 static inline CXFA_ContentLayoutItem* GetNextSibling( |
63 CXFA_ContentLayoutItem* pLayoutItem) { | 63 CXFA_ContentLayoutItem* pLayoutItem) { |
64 return (CXFA_ContentLayoutItem*)pLayoutItem->m_pNextSibling; | 64 return (CXFA_ContentLayoutItem*)pLayoutItem->m_pNextSibling; |
65 } | 65 } |
66 static inline CXFA_ContentLayoutItem* GetParent( | 66 static inline CXFA_ContentLayoutItem* GetParent( |
67 CXFA_ContentLayoutItem* pLayoutItem) { | 67 CXFA_ContentLayoutItem* pLayoutItem) { |
68 return (CXFA_ContentLayoutItem*)pLayoutItem->m_pParent; | 68 return (CXFA_ContentLayoutItem*)pLayoutItem->m_pParent; |
69 } | 69 } |
70 }; | 70 }; |
71 FX_DWORD XFA_GetRelevant(CXFA_Node* pFormItem, FX_DWORD dwParentRelvant); | 71 FX_DWORD XFA_GetRelevant(CXFA_Node* pFormItem, FX_DWORD dwParentRelvant); |
72 void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem); | 72 void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem); |
73 #endif | 73 #endif |
OLD | NEW |