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_FXFA_APP_XFA_FFDOCVIEW_H_ | |
8 #define XFA_FXFA_APP_XFA_FFDOCVIEW_H_ | |
9 | |
10 #include "xfa/fxfa/app/xfa_ffdoc.h" | |
11 | |
12 class CXFA_FFWidgetHandler; | |
13 class CXFA_FFDoc; | |
14 class CXFA_FFWidget; | |
15 extern const XFA_ATTRIBUTEENUM gs_EventActivity[]; | |
16 enum XFA_DOCVIEW_LAYOUTSTATUS { | |
17 XFA_DOCVIEW_LAYOUTSTATUS_None, | |
18 XFA_DOCVIEW_LAYOUTSTATUS_Start, | |
19 XFA_DOCVIEW_LAYOUTSTATUS_FormInitialize, | |
20 XFA_DOCVIEW_LAYOUTSTATUS_FormInitCalculate, | |
21 XFA_DOCVIEW_LAYOUTSTATUS_FormInitValidate, | |
22 XFA_DOCVIEW_LAYOUTSTATUS_FormFormReady, | |
23 XFA_DOCVIEW_LAYOUTSTATUS_Doing, | |
24 XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitialize, | |
25 XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitCalculate, | |
26 XFA_DOCVIEW_LAYOUTSTATUS_PagesetInitValidate, | |
27 XFA_DOCVIEW_LAYOUTSTATUS_PagesetFormReady, | |
28 XFA_DOCVIEW_LAYOUTSTATUS_LayoutReady, | |
29 XFA_DOCVIEW_LAYOUTSTATUS_DocReady, | |
30 XFA_DOCVIEW_LAYOUTSTATUS_End | |
31 }; | |
32 class CXFA_FFDocView : public IXFA_DocView { | |
33 public: | |
34 CXFA_FFDocView(CXFA_FFDoc* pDoc); | |
35 ~CXFA_FFDocView(); | |
36 | |
37 virtual IXFA_Doc* GetDoc() { return m_pDoc; } | |
38 virtual int32_t StartLayout(int32_t iStartPage = 0); | |
39 virtual int32_t DoLayout(IFX_Pause* pPause = NULL); | |
40 virtual void StopLayout(); | |
41 virtual int32_t GetLayoutStatus(); | |
42 virtual void UpdateDocView(); | |
43 virtual int32_t CountPageViews(); | |
44 virtual IXFA_PageView* GetPageView(int32_t nIndex); | |
45 virtual IXFA_Widget* GetWidgetByName(const CFX_WideStringC& wsName); | |
46 virtual CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideStringC& wsName); | |
47 virtual void ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc = NULL); | |
48 virtual int32_t ProcessWidgetEvent(CXFA_EventParam* pParam, | |
49 CXFA_WidgetAcc* pWidgetAcc = NULL); | |
50 virtual IXFA_WidgetHandler* GetWidgetHandler(); | |
51 virtual IXFA_WidgetIterator* CreateWidgetIterator(); | |
52 virtual IXFA_WidgetAccIterator* CreateWidgetAccIterator( | |
53 XFA_WIDGETORDER eOrder = XFA_WIDGETORDER_PreOrder); | |
54 virtual IXFA_Widget* GetFocusWidget(); | |
55 virtual void KillFocus(); | |
56 virtual FX_BOOL SetFocus(IXFA_Widget* hWidget); | |
57 CXFA_FFWidget* GetWidgetByName(const CFX_WideStringC& wsName, | |
58 CXFA_FFWidget* pRefWidget = NULL); | |
59 CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideStringC& wsName, | |
60 CXFA_WidgetAcc* pRefWidgetAcc = NULL); | |
61 IXFA_DocLayout* GetXFALayout() const; | |
62 void OnPageEvent(IXFA_LayoutPage* pSender, | |
63 XFA_PAGEEVENT eEvent, | |
64 int32_t iPageIndex); | |
65 void LockUpdate(); | |
66 void UnlockUpdate(); | |
67 FX_BOOL IsUpdateLocked(); | |
68 void ClearInvalidateList(); | |
69 void AddInvalidateRect(CXFA_FFWidget* pWidget, const CFX_RectF& rtInvalidate); | |
70 void AddInvalidateRect(IXFA_PageView* pPageView, | |
71 const CFX_RectF& rtInvalidate); | |
72 void RunInvalidate(); | |
73 void RunDocClose(); | |
74 void DestroyDocView(); | |
75 | |
76 FX_BOOL InitValidate(CXFA_Node* pNode); | |
77 FX_BOOL RunValidate(); | |
78 | |
79 void SetChangeMark(); | |
80 | |
81 void AddValidateWidget(CXFA_WidgetAcc* pWidget); | |
82 void AddCalculateNodeNotify(CXFA_Node* pNodeChange); | |
83 void AddCalculateWidgetAcc(CXFA_WidgetAcc* pWidgetAcc); | |
84 int32_t RunCalculateWidgets(); | |
85 FX_BOOL IsStaticNotify(); | |
86 FX_BOOL RunLayout(); | |
87 void RunSubformIndexChange(); | |
88 void AddNewFormNode(CXFA_Node* pNode); | |
89 void AddIndexChangedSubform(CXFA_Node* pNode); | |
90 CXFA_WidgetAcc* GetFocusWidgetAcc(); | |
91 void SetFocusWidgetAcc(CXFA_WidgetAcc* pWidgetAcc); | |
92 void DeleteLayoutItem(CXFA_FFWidget* pWidget); | |
93 int32_t ExecEventActivityByDeepFirst(CXFA_Node* pFormNode, | |
94 XFA_EVENTTYPE eEventType, | |
95 FX_BOOL bIsFormReady = FALSE, | |
96 FX_BOOL bRecursive = TRUE, | |
97 CXFA_Node* pExclude = NULL); | |
98 FX_BOOL m_bLayoutEvent; | |
99 CFX_WideStringArray m_arrNullTestMsg; | |
100 CXFA_FFWidget* m_pListFocusWidget; | |
101 FX_BOOL m_bInLayoutStatus; | |
102 | |
103 protected: | |
104 FX_BOOL RunEventLayoutReady(); | |
105 void RunBindItems(); | |
106 FX_BOOL InitCalculate(CXFA_Node* pNode); | |
107 void InitLayout(CXFA_Node* pNode); | |
108 void RunCalculateRecursive(int32_t& iIndex); | |
109 void ShowNullTestMsg(); | |
110 FX_BOOL ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc); | |
111 CXFA_Node* GetRootSubform(); | |
112 | |
113 CXFA_FFDoc* m_pDoc; | |
114 CXFA_FFWidgetHandler* m_pWidgetHandler; | |
115 IXFA_DocLayout* m_pXFADocLayout; | |
116 CXFA_WidgetAcc* m_pFocusAcc; | |
117 CXFA_FFWidget* m_pFocusWidget; | |
118 CXFA_FFWidget* m_pOldFocusWidget; | |
119 CFX_MapPtrToPtr m_mapPageInvalidate; | |
120 CFX_PtrArray m_ValidateAccs; | |
121 CFX_PtrArray m_bindItems; | |
122 CFX_PtrArray m_CalculateAccs; | |
123 | |
124 CFX_PtrArray m_NewAddedNodes; | |
125 CFX_PtrArray m_IndexChangedSubforms; | |
126 XFA_DOCVIEW_LAYOUTSTATUS m_iStatus; | |
127 int32_t m_iLock; | |
128 friend class CXFA_FFNotify; | |
129 }; | |
130 class CXFA_FFDocWidgetIterator : public IXFA_WidgetIterator { | |
131 public: | |
132 CXFA_FFDocWidgetIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot); | |
133 virtual ~CXFA_FFDocWidgetIterator(); | |
134 | |
135 virtual void Release() { delete this; } | |
136 | |
137 virtual void Reset(); | |
138 virtual IXFA_Widget* MoveToFirst(); | |
139 virtual IXFA_Widget* MoveToLast(); | |
140 virtual IXFA_Widget* MoveToNext(); | |
141 virtual IXFA_Widget* MoveToPrevious(); | |
142 virtual IXFA_Widget* GetCurrentWidget(); | |
143 virtual FX_BOOL SetCurrentWidget(IXFA_Widget* hWidget); | |
144 | |
145 protected: | |
146 CXFA_ContainerIterator m_ContentIterator; | |
147 CXFA_FFDocView* m_pDocView; | |
148 CXFA_FFWidget* m_pCurWidget; | |
149 }; | |
150 class CXFA_WidgetAccIterator : public IXFA_WidgetAccIterator { | |
151 public: | |
152 CXFA_WidgetAccIterator(CXFA_FFDocView* pDocView, CXFA_Node* pTravelRoot); | |
153 virtual ~CXFA_WidgetAccIterator(); | |
154 virtual void Release() { delete this; } | |
155 virtual void Reset(); | |
156 virtual CXFA_WidgetAcc* MoveToFirst(); | |
157 virtual CXFA_WidgetAcc* MoveToLast(); | |
158 virtual CXFA_WidgetAcc* MoveToNext(); | |
159 virtual CXFA_WidgetAcc* MoveToPrevious(); | |
160 virtual CXFA_WidgetAcc* GetCurrentWidgetAcc(); | |
161 virtual FX_BOOL SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget); | |
162 virtual void SkipTree(); | |
163 | |
164 protected: | |
165 CXFA_ContainerIterator m_ContentIterator; | |
166 CXFA_FFDocView* m_pDocView; | |
167 CXFA_WidgetAcc* m_pCurWidgetAcc; | |
168 }; | |
169 | |
170 #endif // XFA_FXFA_APP_XFA_FFDOCVIEW_H_ | |
OLD | NEW |