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