OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef XFA_SRC_FXFA_PARSER_XFA_LAYOUT_APPADAPTER_H_ | |
8 #define XFA_SRC_FXFA_PARSER_XFA_LAYOUT_APPADAPTER_H_ | |
9 | |
10 #include "xfa/src/fxfa/parser/xfa_doclayout.h" | |
11 | |
12 class CXFA_TraverseStrategy_PageAreaContainerLayoutItem { | |
13 public: | |
14 static inline CXFA_ContainerLayoutItem* GetFirstChild( | |
15 CXFA_ContainerLayoutItem* pLayoutItem) { | |
16 if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_PageSet) { | |
17 return (CXFA_ContainerLayoutItem*)pLayoutItem->m_pFirstChild; | |
18 } | |
19 return NULL; | |
20 } | |
21 static inline CXFA_ContainerLayoutItem* GetNextSibling( | |
22 CXFA_ContainerLayoutItem* pLayoutItem) { | |
23 return (CXFA_ContainerLayoutItem*)pLayoutItem->m_pNextSibling; | |
24 } | |
25 static inline CXFA_ContainerLayoutItem* GetParent( | |
26 CXFA_ContainerLayoutItem* pLayoutItem) { | |
27 return (CXFA_ContainerLayoutItem*)pLayoutItem->m_pParent; | |
28 } | |
29 }; | |
30 class CXFA_TraverseStrategy_ContentAreaContainerLayoutItem { | |
31 public: | |
32 static inline CXFA_ContainerLayoutItem* GetFirstChild( | |
33 CXFA_ContainerLayoutItem* pLayoutItem) { | |
34 for (CXFA_LayoutItem* pChildItem = pLayoutItem->m_pFirstChild; pChildItem; | |
35 pChildItem = pChildItem->m_pNextSibling) { | |
36 if (CXFA_ContainerLayoutItem* pContainer = | |
37 pChildItem->AsContainerLayoutItem()) { | |
38 return pContainer; | |
39 } | |
40 } | |
41 return nullptr; | |
42 } | |
43 static inline CXFA_ContainerLayoutItem* GetNextSibling( | |
44 CXFA_ContainerLayoutItem* pLayoutItem) { | |
45 for (CXFA_LayoutItem* pChildItem = pLayoutItem->m_pNextSibling; pChildItem; | |
46 pChildItem = pChildItem->m_pNextSibling) { | |
47 if (CXFA_ContainerLayoutItem* pContainer = | |
48 pChildItem->AsContainerLayoutItem()) { | |
49 return pContainer; | |
50 } | |
51 } | |
52 return nullptr; | |
53 } | |
54 static inline CXFA_ContainerLayoutItem* GetParent( | |
55 CXFA_ContainerLayoutItem* pLayoutItem) { | |
56 return (CXFA_ContainerLayoutItem*)pLayoutItem->m_pParent; | |
57 } | |
58 }; | |
59 class CXFA_TraverseStrategy_ContentLayoutItem { | |
60 public: | |
61 static inline CXFA_ContentLayoutItem* GetFirstChild( | |
62 CXFA_ContentLayoutItem* pLayoutItem) { | |
63 return (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild; | |
64 } | |
65 static inline CXFA_ContentLayoutItem* GetNextSibling( | |
66 CXFA_ContentLayoutItem* pLayoutItem) { | |
67 return (CXFA_ContentLayoutItem*)pLayoutItem->m_pNextSibling; | |
68 } | |
69 static inline CXFA_ContentLayoutItem* GetParent( | |
70 CXFA_ContentLayoutItem* pLayoutItem) { | |
71 return (CXFA_ContentLayoutItem*)pLayoutItem->m_pParent; | |
72 } | |
73 }; | |
74 FX_DWORD XFA_GetRelevant(CXFA_Node* pFormItem, FX_DWORD dwParentRelvant); | |
75 void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem); | |
76 | |
77 #endif // XFA_SRC_FXFA_PARSER_XFA_LAYOUT_APPADAPTER_H_ | |
OLD | NEW |