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_FXFA_PARSER_XFA_DOCLAYOUT_H_ | 7 #ifndef XFA_FXFA_PARSER_XFA_DOCLAYOUT_H_ |
8 #define XFA_FXFA_PARSER_XFA_DOCLAYOUT_H_ | 8 #define XFA_FXFA_PARSER_XFA_DOCLAYOUT_H_ |
9 | 9 |
10 #include "xfa/fxfa/parser/xfa_document.h" | 10 #include "xfa/fxfa/parser/xfa_document.h" |
11 | 11 |
12 class CXFA_ContainerLayoutItem; | 12 class CXFA_ContainerLayoutItem; |
13 class CXFA_ContentLayoutItem; | 13 class CXFA_ContentLayoutItem; |
14 class IXFA_DocLayout; | 14 class CXFA_LayoutProcessor; |
15 | |
16 class IXFA_LayoutPage { | |
17 public: | |
18 virtual ~IXFA_LayoutPage() {} | |
19 virtual IXFA_DocLayout* GetLayout() const = 0; | |
20 virtual int32_t GetPageIndex() const = 0; | |
21 virtual void GetPageSize(CFX_SizeF& size) = 0; | |
22 virtual CXFA_Node* GetMasterPage() const = 0; | |
23 }; | |
24 | 15 |
25 class CXFA_LayoutItem { | 16 class CXFA_LayoutItem { |
26 public: | 17 public: |
27 virtual ~CXFA_LayoutItem(); | 18 virtual ~CXFA_LayoutItem(); |
28 | 19 |
29 FX_BOOL IsContainerLayoutItem() const { return !m_bIsContentLayoutItem; } | 20 FX_BOOL IsContainerLayoutItem() const { return !m_bIsContentLayoutItem; } |
30 FX_BOOL IsContentLayoutItem() const { return m_bIsContentLayoutItem; } | 21 FX_BOOL IsContentLayoutItem() const { return m_bIsContentLayoutItem; } |
31 inline CXFA_ContainerLayoutItem* AsContainerLayoutItem(); | 22 inline CXFA_ContainerLayoutItem* AsContainerLayoutItem(); |
32 inline CXFA_ContentLayoutItem* AsContentLayoutItem(); | 23 inline CXFA_ContentLayoutItem* AsContentLayoutItem(); |
33 | 24 |
34 IXFA_LayoutPage* GetPage() const; | 25 CXFA_ContainerLayoutItem* GetPage() const; |
35 CXFA_Node* GetFormNode() const; | 26 CXFA_Node* GetFormNode() const; |
36 void GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative = FALSE) const; | 27 void GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative = FALSE) const; |
37 int32_t GetIndex() const; | 28 int32_t GetIndex() const; |
38 int32_t GetCount() const; | 29 int32_t GetCount() const; |
39 CXFA_LayoutItem* GetParent() const; | 30 CXFA_LayoutItem* GetParent() const; |
40 const CXFA_LayoutItem* GetFirst() const; | 31 const CXFA_LayoutItem* GetFirst() const; |
41 CXFA_LayoutItem* GetFirst(); | 32 CXFA_LayoutItem* GetFirst(); |
42 const CXFA_LayoutItem* GetLast() const; | 33 const CXFA_LayoutItem* GetLast() const; |
43 CXFA_LayoutItem* GetLast(); | 34 CXFA_LayoutItem* GetLast(); |
44 CXFA_LayoutItem* GetPrev() const; | 35 CXFA_LayoutItem* GetPrev() const; |
45 CXFA_LayoutItem* GetNext() const; | 36 CXFA_LayoutItem* GetNext() const; |
46 | 37 |
47 void AddChild(CXFA_LayoutItem* pChildItem); | 38 void AddChild(CXFA_LayoutItem* pChildItem); |
48 void AddHeadChild(CXFA_LayoutItem* pChildItem); | 39 void AddHeadChild(CXFA_LayoutItem* pChildItem); |
49 void RemoveChild(CXFA_LayoutItem* pChildItem); | 40 void RemoveChild(CXFA_LayoutItem* pChildItem); |
50 void InsertChild(CXFA_LayoutItem* pBeforeItem, CXFA_LayoutItem* pChildItem); | 41 void InsertChild(CXFA_LayoutItem* pBeforeItem, CXFA_LayoutItem* pChildItem); |
51 | 42 |
52 CXFA_Node* m_pFormNode; | 43 CXFA_Node* m_pFormNode; |
53 CXFA_LayoutItem* m_pParent; | 44 CXFA_LayoutItem* m_pParent; |
54 CXFA_LayoutItem* m_pNextSibling; | 45 CXFA_LayoutItem* m_pNextSibling; |
55 CXFA_LayoutItem* m_pFirstChild; | 46 CXFA_LayoutItem* m_pFirstChild; |
56 | 47 |
57 protected: | 48 protected: |
58 CXFA_LayoutItem(CXFA_Node* pNode, FX_BOOL bIsContentLayoutItem); | 49 CXFA_LayoutItem(CXFA_Node* pNode, FX_BOOL bIsContentLayoutItem); |
59 | 50 |
60 FX_BOOL m_bIsContentLayoutItem; | 51 FX_BOOL m_bIsContentLayoutItem; |
61 }; | 52 }; |
62 | 53 |
63 class CXFA_ContainerLayoutItem : public CXFA_LayoutItem, | 54 class CXFA_ContainerLayoutItem : public CXFA_LayoutItem { |
64 public IXFA_LayoutPage { | |
65 public: | 55 public: |
66 CXFA_ContainerLayoutItem(CXFA_Node* pNode); | 56 CXFA_ContainerLayoutItem(CXFA_Node* pNode); |
67 | 57 |
68 // IXFA_LayoutPage: | 58 CXFA_LayoutProcessor* GetLayout() const; |
69 IXFA_DocLayout* GetLayout() const override; | 59 int32_t GetPageIndex() const; |
70 int32_t GetPageIndex() const override; | 60 void GetPageSize(CFX_SizeF& size); |
71 void GetPageSize(CFX_SizeF& size) override; | 61 CXFA_Node* GetMasterPage() const; |
72 CXFA_Node* GetMasterPage() const override; | |
73 | 62 |
74 CXFA_Node* m_pOldSubform; | 63 CXFA_Node* m_pOldSubform; |
75 }; | 64 }; |
76 | 65 |
77 #define XFA_WIDGETSTATUS_Access 0x80000000 | 66 #define XFA_WIDGETSTATUS_Access 0x80000000 |
78 #define XFA_WIDGETSTATUS_Disabled 0x40000000 | 67 #define XFA_WIDGETSTATUS_Disabled 0x40000000 |
79 #define XFA_WIDGETSTATUS_RectCached 0x20000000 | 68 #define XFA_WIDGETSTATUS_RectCached 0x20000000 |
80 #define XFA_WIDGETSTATUS_ButtonDown 0x10000000 | 69 #define XFA_WIDGETSTATUS_ButtonDown 0x10000000 |
81 #define XFA_WIDGETSTATUS_Highlight 0x08000000 | 70 #define XFA_WIDGETSTATUS_Highlight 0x08000000 |
82 #define XFA_WIDGETSTATUS_TextEditValueChanged 0x04000000 | 71 #define XFA_WIDGETSTATUS_TextEditValueChanged 0x04000000 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return pLayoutItem->m_pFirstChild; | 103 return pLayoutItem->m_pFirstChild; |
115 } | 104 } |
116 static inline CXFA_LayoutItem* GetNextSibling(CXFA_LayoutItem* pLayoutItem) { | 105 static inline CXFA_LayoutItem* GetNextSibling(CXFA_LayoutItem* pLayoutItem) { |
117 return pLayoutItem->m_pNextSibling; | 106 return pLayoutItem->m_pNextSibling; |
118 } | 107 } |
119 static inline CXFA_LayoutItem* GetParent(CXFA_LayoutItem* pLayoutItem) { | 108 static inline CXFA_LayoutItem* GetParent(CXFA_LayoutItem* pLayoutItem) { |
120 return pLayoutItem->m_pParent; | 109 return pLayoutItem->m_pParent; |
121 } | 110 } |
122 }; | 111 }; |
123 | 112 |
124 class IXFA_DocLayout { | |
125 public: | |
126 virtual ~IXFA_DocLayout() {} | |
127 virtual CXFA_Document* GetDocument() const = 0; | |
128 virtual int32_t StartLayout(FX_BOOL bForceRestart = FALSE) = 0; | |
129 virtual int32_t DoLayout(IFX_Pause* pPause = NULL) = 0; | |
130 virtual FX_BOOL IncrementLayout() = 0; | |
131 virtual int32_t CountPages() const = 0; | |
132 virtual IXFA_LayoutPage* GetPage(int32_t index) const = 0; | |
133 virtual CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem) = 0; | |
134 }; | |
135 | |
136 #endif // XFA_FXFA_PARSER_XFA_DOCLAYOUT_H_ | 113 #endif // XFA_FXFA_PARSER_XFA_DOCLAYOUT_H_ |
OLD | NEW |