| 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_DOCLAYOUT_H_ | |
| 8 #define XFA_SRC_FXFA_PARSER_XFA_DOCLAYOUT_H_ | |
| 9 | |
| 10 #include "xfa/src/fxfa/parser/xfa_document.h" | |
| 11 | |
| 12 class CXFA_ContainerLayoutItem; | |
| 13 class CXFA_ContentLayoutItem; | |
| 14 class IXFA_DocLayout; | |
| 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 | |
| 25 class CXFA_LayoutItem { | |
| 26 public: | |
| 27 virtual ~CXFA_LayoutItem(); | |
| 28 | |
| 29 FX_BOOL IsContainerLayoutItem() const { return !m_bIsContentLayoutItem; } | |
| 30 FX_BOOL IsContentLayoutItem() const { return m_bIsContentLayoutItem; } | |
| 31 inline CXFA_ContainerLayoutItem* AsContainerLayoutItem(); | |
| 32 inline CXFA_ContentLayoutItem* AsContentLayoutItem(); | |
| 33 | |
| 34 IXFA_LayoutPage* GetPage() const; | |
| 35 CXFA_Node* GetFormNode() const; | |
| 36 void GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative = FALSE) const; | |
| 37 int32_t GetIndex() const; | |
| 38 int32_t GetCount() const; | |
| 39 CXFA_LayoutItem* GetParent() const; | |
| 40 const CXFA_LayoutItem* GetFirst() const; | |
| 41 CXFA_LayoutItem* GetFirst(); | |
| 42 const CXFA_LayoutItem* GetLast() const; | |
| 43 CXFA_LayoutItem* GetLast(); | |
| 44 CXFA_LayoutItem* GetPrev() const; | |
| 45 CXFA_LayoutItem* GetNext() const; | |
| 46 | |
| 47 void AddChild(CXFA_LayoutItem* pChildItem); | |
| 48 void AddHeadChild(CXFA_LayoutItem* pChildItem); | |
| 49 void RemoveChild(CXFA_LayoutItem* pChildItem); | |
| 50 void InsertChild(CXFA_LayoutItem* pBeforeItem, CXFA_LayoutItem* pChildItem); | |
| 51 | |
| 52 CXFA_Node* m_pFormNode; | |
| 53 CXFA_LayoutItem* m_pParent; | |
| 54 CXFA_LayoutItem* m_pNextSibling; | |
| 55 CXFA_LayoutItem* m_pFirstChild; | |
| 56 | |
| 57 protected: | |
| 58 CXFA_LayoutItem(CXFA_Node* pNode, FX_BOOL bIsContentLayoutItem); | |
| 59 | |
| 60 FX_BOOL m_bIsContentLayoutItem; | |
| 61 }; | |
| 62 | |
| 63 class CXFA_ContainerLayoutItem : public CXFA_LayoutItem, | |
| 64 public IXFA_LayoutPage { | |
| 65 public: | |
| 66 CXFA_ContainerLayoutItem(CXFA_Node* pNode); | |
| 67 | |
| 68 // IXFA_LayoutPage: | |
| 69 IXFA_DocLayout* GetLayout() const override; | |
| 70 int32_t GetPageIndex() const override; | |
| 71 void GetPageSize(CFX_SizeF& size) override; | |
| 72 CXFA_Node* GetMasterPage() const override; | |
| 73 | |
| 74 CXFA_Node* m_pOldSubform; | |
| 75 }; | |
| 76 | |
| 77 #define XFA_WIDGETSTATUS_Access 0x80000000 | |
| 78 #define XFA_WIDGETSTATUS_Disabled 0x40000000 | |
| 79 #define XFA_WIDGETSTATUS_RectCached 0x20000000 | |
| 80 #define XFA_WIDGETSTATUS_ButtonDown 0x10000000 | |
| 81 #define XFA_WIDGETSTATUS_Highlight 0x08000000 | |
| 82 #define XFA_WIDGETSTATUS_TextEditValueChanged 0x04000000 | |
| 83 | |
| 84 class CXFA_ContentLayoutItem : public CXFA_LayoutItem { | |
| 85 public: | |
| 86 CXFA_ContentLayoutItem(CXFA_Node* pNode); | |
| 87 virtual ~CXFA_ContentLayoutItem(); | |
| 88 | |
| 89 CXFA_ContentLayoutItem* m_pPrev; | |
| 90 CXFA_ContentLayoutItem* m_pNext; | |
| 91 CFX_PointF m_sPos; | |
| 92 CFX_SizeF m_sSize; | |
| 93 FX_DWORD m_dwStatus; | |
| 94 }; | |
| 95 | |
| 96 CXFA_ContainerLayoutItem* CXFA_LayoutItem::AsContainerLayoutItem() { | |
| 97 return IsContainerLayoutItem() ? static_cast<CXFA_ContainerLayoutItem*>(this) | |
| 98 : nullptr; | |
| 99 } | |
| 100 CXFA_ContentLayoutItem* CXFA_LayoutItem::AsContentLayoutItem() { | |
| 101 return IsContentLayoutItem() ? static_cast<CXFA_ContentLayoutItem*>(this) | |
| 102 : nullptr; | |
| 103 } | |
| 104 inline CXFA_ContainerLayoutItem* ToContainerLayoutItem(CXFA_LayoutItem* pItem) { | |
| 105 return pItem ? pItem->AsContainerLayoutItem() : nullptr; | |
| 106 } | |
| 107 inline CXFA_ContentLayoutItem* ToContentLayoutItem(CXFA_LayoutItem* pItem) { | |
| 108 return pItem ? pItem->AsContentLayoutItem() : nullptr; | |
| 109 } | |
| 110 | |
| 111 class CXFA_TraverseStrategy_LayoutItem { | |
| 112 public: | |
| 113 static inline CXFA_LayoutItem* GetFirstChild(CXFA_LayoutItem* pLayoutItem) { | |
| 114 return pLayoutItem->m_pFirstChild; | |
| 115 } | |
| 116 static inline CXFA_LayoutItem* GetNextSibling(CXFA_LayoutItem* pLayoutItem) { | |
| 117 return pLayoutItem->m_pNextSibling; | |
| 118 } | |
| 119 static inline CXFA_LayoutItem* GetParent(CXFA_LayoutItem* pLayoutItem) { | |
| 120 return pLayoutItem->m_pParent; | |
| 121 } | |
| 122 }; | |
| 123 | |
| 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_SRC_FXFA_PARSER_XFA_DOCLAYOUT_H_ | |
| OLD | NEW |