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_FFWIDGETHANDLER_H_ | |
8 #define XFA_FXFA_APP_XFA_FFWIDGETHANDLER_H_ | |
9 | |
10 #include <vector> | |
11 | |
12 #include "xfa/fxfa/parser/xfa_document.h" | |
13 #include "xfa/include/fxfa/fxfa.h" | |
14 | |
15 class CXFA_FFDocView; | |
16 | |
17 class CXFA_FFWidgetHandler : public IXFA_WidgetHandler { | |
18 public: | |
19 CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView); | |
20 ~CXFA_FFWidgetHandler(); | |
21 virtual IXFA_Widget* CreateWidget(IXFA_Widget* hParent, | |
22 XFA_WIDGETTYPE eType, | |
23 IXFA_Widget* hBefore = NULL); | |
24 virtual IXFA_PageView* GetPageView(IXFA_Widget* hWidget); | |
25 virtual void GetRect(IXFA_Widget* hWidget, CFX_RectF& rt); | |
26 virtual uint32_t GetStatus(IXFA_Widget* hWidget); | |
27 virtual FX_BOOL GetBBox(IXFA_Widget* hWidget, | |
28 CFX_RectF& rtBox, | |
29 uint32_t dwStatus, | |
30 FX_BOOL bDrawFocus = FALSE); | |
31 virtual CXFA_WidgetAcc* GetDataAcc(IXFA_Widget* hWidget); | |
32 virtual void GetName(IXFA_Widget* hWidget, | |
33 CFX_WideString& wsName, | |
34 int32_t iNameType = 0); | |
35 virtual FX_BOOL GetToolTip(IXFA_Widget* hWidget, CFX_WideString& wsToolTip); | |
36 virtual void SetPrivateData(IXFA_Widget* hWidget, | |
37 void* module_id, | |
38 void* pData, | |
39 PD_CALLBACK_FREEDATA callback); | |
40 virtual void* GetPrivateData(IXFA_Widget* hWidget, void* module_id); | |
41 virtual FX_BOOL OnMouseEnter(IXFA_Widget* hWidget); | |
42 virtual FX_BOOL OnMouseExit(IXFA_Widget* hWidget); | |
43 virtual FX_BOOL OnLButtonDown(IXFA_Widget* hWidget, | |
44 uint32_t dwFlags, | |
45 FX_FLOAT fx, | |
46 FX_FLOAT fy); | |
47 virtual FX_BOOL OnLButtonUp(IXFA_Widget* hWidget, | |
48 uint32_t dwFlags, | |
49 FX_FLOAT fx, | |
50 FX_FLOAT fy); | |
51 virtual FX_BOOL OnLButtonDblClk(IXFA_Widget* hWidget, | |
52 uint32_t dwFlags, | |
53 FX_FLOAT fx, | |
54 FX_FLOAT fy); | |
55 virtual FX_BOOL OnMouseMove(IXFA_Widget* hWidget, | |
56 uint32_t dwFlags, | |
57 FX_FLOAT fx, | |
58 FX_FLOAT fy); | |
59 virtual FX_BOOL OnMouseWheel(IXFA_Widget* hWidget, | |
60 uint32_t dwFlags, | |
61 int16_t zDelta, | |
62 FX_FLOAT fx, | |
63 FX_FLOAT fy); | |
64 virtual FX_BOOL OnRButtonDown(IXFA_Widget* hWidget, | |
65 uint32_t dwFlags, | |
66 FX_FLOAT fx, | |
67 FX_FLOAT fy); | |
68 virtual FX_BOOL OnRButtonUp(IXFA_Widget* hWidget, | |
69 uint32_t dwFlags, | |
70 FX_FLOAT fx, | |
71 FX_FLOAT fy); | |
72 virtual FX_BOOL OnRButtonDblClk(IXFA_Widget* hWidget, | |
73 uint32_t dwFlags, | |
74 FX_FLOAT fx, | |
75 FX_FLOAT fy); | |
76 | |
77 virtual FX_BOOL OnKeyDown(IXFA_Widget* hWidget, | |
78 uint32_t dwKeyCode, | |
79 uint32_t dwFlags); | |
80 virtual FX_BOOL OnKeyUp(IXFA_Widget* hWidget, | |
81 uint32_t dwKeyCode, | |
82 uint32_t dwFlags); | |
83 virtual FX_BOOL OnChar(IXFA_Widget* hWidget, | |
84 uint32_t dwChar, | |
85 uint32_t dwFlags); | |
86 virtual uint32_t OnHitTest(IXFA_Widget* hWidget, FX_FLOAT fx, FX_FLOAT fy); | |
87 virtual FX_BOOL OnSetCursor(IXFA_Widget* hWidget, FX_FLOAT fx, FX_FLOAT fy); | |
88 virtual void RenderWidget(IXFA_Widget* hWidget, | |
89 CFX_Graphics* pGS, | |
90 CFX_Matrix* pMatrix = NULL, | |
91 FX_BOOL bHighlight = FALSE); | |
92 virtual FX_BOOL HasEvent(CXFA_WidgetAcc* pWidgetAcc, | |
93 XFA_EVENTTYPE eEventType); | |
94 virtual int32_t ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, | |
95 CXFA_EventParam* pParam); | |
96 | |
97 protected: | |
98 CXFA_Node* CreateWidgetFormItem(XFA_WIDGETTYPE eType, | |
99 CXFA_Node* pParent, | |
100 CXFA_Node* pBefore) const; | |
101 | |
102 CXFA_Node* CreatePushButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
103 CXFA_Node* CreateCheckButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
104 CXFA_Node* CreateExclGroup(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
105 CXFA_Node* CreateRadioButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
106 CXFA_Node* CreateDatetimeEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
107 CXFA_Node* CreateDecimalField(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
108 CXFA_Node* CreateNumericField(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
109 CXFA_Node* CreateSignature(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
110 CXFA_Node* CreateTextEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
111 CXFA_Node* CreateDropdownList(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
112 CXFA_Node* CreateListBox(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
113 CXFA_Node* CreateImageField(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
114 CXFA_Node* CreatePasswordEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
115 CXFA_Node* CreateField(XFA_ELEMENT eElement, | |
116 CXFA_Node* pParent, | |
117 CXFA_Node* pBefore) const; | |
118 CXFA_Node* CreateArc(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
119 CXFA_Node* CreateRectangle(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
120 CXFA_Node* CreateImage(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
121 CXFA_Node* CreateLine(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
122 CXFA_Node* CreateText(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
123 CXFA_Node* CreateDraw(XFA_ELEMENT eElement, | |
124 CXFA_Node* pParent, | |
125 CXFA_Node* pBefore) const; | |
126 | |
127 CXFA_Node* CreateSubform(CXFA_Node* pParent, CXFA_Node* pBefore) const; | |
128 CXFA_Node* CreateFormItem(XFA_ELEMENT eElement, | |
129 CXFA_Node* pParent, | |
130 CXFA_Node* pBefore) const; | |
131 CXFA_Node* CreateCopyNode(XFA_ELEMENT eElement, | |
132 CXFA_Node* pParent, | |
133 CXFA_Node* pBefore = NULL) const; | |
134 CXFA_Node* CreateTemplateNode(XFA_ELEMENT eElement, | |
135 CXFA_Node* pParent, | |
136 CXFA_Node* pBefore) const; | |
137 CXFA_Node* CreateFontNode(CXFA_Node* pParent) const; | |
138 CXFA_Node* CreateMarginNode(CXFA_Node* pParent, | |
139 uint32_t dwFlags, | |
140 FX_FLOAT fInsets[4]) const; | |
141 CXFA_Node* CreateValueNode(XFA_ELEMENT eValue, CXFA_Node* pParent) const; | |
142 IXFA_ObjFactory* GetObjFactory() const; | |
143 CXFA_Document* GetXFADoc() const; | |
144 | |
145 CXFA_FFDocView* m_pDocView; | |
146 }; | |
147 | |
148 class CXFA_FFMenuHandler : public IXFA_MenuHandler { | |
149 public: | |
150 CXFA_FFMenuHandler(); | |
151 ~CXFA_FFMenuHandler(); | |
152 virtual FX_BOOL CanCopy(IXFA_Widget* hWidget); | |
153 virtual FX_BOOL CanCut(IXFA_Widget* hWidget); | |
154 virtual FX_BOOL CanPaste(IXFA_Widget* hWidget); | |
155 virtual FX_BOOL CanSelectAll(IXFA_Widget* hWidget); | |
156 virtual FX_BOOL CanDelete(IXFA_Widget* hWidget); | |
157 virtual FX_BOOL CanDeSelect(IXFA_Widget* hWidget); | |
158 virtual FX_BOOL Copy(IXFA_Widget* hWidget, CFX_WideString& wsText); | |
159 virtual FX_BOOL Cut(IXFA_Widget* hWidget, CFX_WideString& wsText); | |
160 virtual FX_BOOL Paste(IXFA_Widget* hWidget, const CFX_WideString& wsText); | |
161 virtual FX_BOOL SelectAll(IXFA_Widget* hWidget); | |
162 virtual FX_BOOL Delete(IXFA_Widget* hWidget); | |
163 virtual FX_BOOL DeSelect(IXFA_Widget* hWidget); | |
164 virtual FX_BOOL CanUndo(IXFA_Widget* hWidget); | |
165 virtual FX_BOOL CanRedo(IXFA_Widget* hWidget); | |
166 virtual FX_BOOL Undo(IXFA_Widget* hWidget); | |
167 virtual FX_BOOL Redo(IXFA_Widget* hWidget); | |
168 virtual FX_BOOL GetSuggestWords(IXFA_Widget* hWidget, | |
169 CFX_PointF pointf, | |
170 std::vector<CFX_ByteString>& sSuggest); | |
171 virtual FX_BOOL ReplaceSpellCheckWord(IXFA_Widget* hWidget, | |
172 CFX_PointF pointf, | |
173 const CFX_ByteStringC& bsReplace); | |
174 }; | |
175 | |
176 #endif // XFA_FXFA_APP_XFA_FFWIDGETHANDLER_H_ | |
OLD | NEW |