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