OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/app/xfa_ffwidgethandler.h" | 7 #include "xfa/include/fxfa/xfa_ffwidgethandler.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "xfa/fxfa/app/xfa_ffchoicelist.h" | 11 #include "xfa/fxfa/app/xfa_ffchoicelist.h" |
12 #include "xfa/fxfa/app/xfa_ffdoc.h" | |
13 #include "xfa/fxfa/app/xfa_ffdocview.h" | |
14 #include "xfa/fxfa/app/xfa_fffield.h" | 12 #include "xfa/fxfa/app/xfa_fffield.h" |
15 #include "xfa/fxfa/app/xfa_ffwidget.h" | 13 #include "xfa/fxfa/app/xfa_ffwidget.h" |
16 #include "xfa/fxfa/app/xfa_fwladapter.h" | 14 #include "xfa/fxfa/app/xfa_fwladapter.h" |
| 15 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" |
17 #include "xfa/fxfa/parser/xfa_parser.h" | 16 #include "xfa/fxfa/parser/xfa_parser.h" |
| 17 #include "xfa/fxfa/parser/xfa_parser_imp.h" |
| 18 #include "xfa/include/fxfa/xfa_ffdoc.h" |
| 19 #include "xfa/include/fxfa/xfa_ffdocview.h" |
18 | 20 |
19 CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView) | 21 CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView) |
20 : m_pDocView(pDocView) {} | 22 : m_pDocView(pDocView) {} |
| 23 |
21 CXFA_FFWidgetHandler::~CXFA_FFWidgetHandler() {} | 24 CXFA_FFWidgetHandler::~CXFA_FFWidgetHandler() {} |
22 IXFA_PageView* CXFA_FFWidgetHandler::GetPageView(IXFA_Widget* hWidget) { | 25 |
23 return static_cast<CXFA_FFWidget*>(hWidget)->GetPageView(); | 26 CXFA_FFPageView* CXFA_FFWidgetHandler::GetPageView(CXFA_FFWidget* hWidget) { |
24 } | 27 return hWidget->GetPageView(); |
25 void CXFA_FFWidgetHandler::GetRect(IXFA_Widget* hWidget, CFX_RectF& rt) { | 28 } |
26 static_cast<CXFA_FFWidget*>(hWidget)->GetWidgetRect(rt); | 29 void CXFA_FFWidgetHandler::GetRect(CXFA_FFWidget* hWidget, CFX_RectF& rt) { |
27 } | 30 hWidget->GetWidgetRect(rt); |
28 uint32_t CXFA_FFWidgetHandler::GetStatus(IXFA_Widget* hWidget) { | 31 } |
29 return static_cast<CXFA_FFWidget*>(hWidget)->GetStatus(); | 32 uint32_t CXFA_FFWidgetHandler::GetStatus(CXFA_FFWidget* hWidget) { |
30 } | 33 return hWidget->GetStatus(); |
31 FX_BOOL CXFA_FFWidgetHandler::GetBBox(IXFA_Widget* hWidget, | 34 } |
| 35 FX_BOOL CXFA_FFWidgetHandler::GetBBox(CXFA_FFWidget* hWidget, |
32 CFX_RectF& rtBox, | 36 CFX_RectF& rtBox, |
33 uint32_t dwStatus, | 37 uint32_t dwStatus, |
34 FX_BOOL bDrawFocus) { | 38 FX_BOOL bDrawFocus) { |
35 return static_cast<CXFA_FFWidget*>(hWidget) | 39 return hWidget->GetBBox(rtBox, dwStatus, bDrawFocus); |
36 ->GetBBox(rtBox, dwStatus, bDrawFocus); | 40 } |
37 } | 41 CXFA_WidgetAcc* CXFA_FFWidgetHandler::GetDataAcc(CXFA_FFWidget* hWidget) { |
38 CXFA_WidgetAcc* CXFA_FFWidgetHandler::GetDataAcc(IXFA_Widget* hWidget) { | 42 return hWidget->GetDataAcc(); |
39 return static_cast<CXFA_FFWidget*>(hWidget)->GetDataAcc(); | 43 } |
40 } | 44 void CXFA_FFWidgetHandler::GetName(CXFA_FFWidget* hWidget, |
41 void CXFA_FFWidgetHandler::GetName(IXFA_Widget* hWidget, | |
42 CFX_WideString& wsName, | 45 CFX_WideString& wsName, |
43 int32_t iNameType) { | 46 int32_t iNameType) { |
44 static_cast<CXFA_FFWidget*>(hWidget)->GetDataAcc()->GetName(wsName, | 47 hWidget->GetDataAcc()->GetName(wsName, iNameType); |
45 iNameType); | 48 } |
46 } | 49 FX_BOOL CXFA_FFWidgetHandler::GetToolTip(CXFA_FFWidget* hWidget, |
47 FX_BOOL CXFA_FFWidgetHandler::GetToolTip(IXFA_Widget* hWidget, | |
48 CFX_WideString& wsToolTip) { | 50 CFX_WideString& wsToolTip) { |
49 return static_cast<CXFA_FFWidget*>(hWidget)->GetToolTip(wsToolTip); | 51 return hWidget->GetToolTip(wsToolTip); |
50 } | 52 } |
51 void CXFA_FFWidgetHandler::SetPrivateData(IXFA_Widget* hWidget, | 53 void CXFA_FFWidgetHandler::SetPrivateData(CXFA_FFWidget* hWidget, |
52 void* module_id, | 54 void* module_id, |
53 void* pData, | 55 void* pData, |
54 PD_CALLBACK_FREEDATA callback) { | 56 PD_CALLBACK_FREEDATA callback) { |
55 static_cast<CXFA_FFWidget*>(hWidget) | 57 hWidget->SetPrivateData(module_id, pData, callback); |
56 ->SetPrivateData(module_id, pData, callback); | 58 } |
57 } | 59 void* CXFA_FFWidgetHandler::GetPrivateData(CXFA_FFWidget* hWidget, |
58 void* CXFA_FFWidgetHandler::GetPrivateData(IXFA_Widget* hWidget, | |
59 void* module_id) { | 60 void* module_id) { |
60 return static_cast<CXFA_FFWidget*>(hWidget)->GetPrivateData(module_id); | 61 return hWidget->GetPrivateData(module_id); |
61 } | 62 } |
62 FX_BOOL CXFA_FFWidgetHandler::OnMouseEnter(IXFA_Widget* hWidget) { | 63 FX_BOOL CXFA_FFWidgetHandler::OnMouseEnter(CXFA_FFWidget* hWidget) { |
63 m_pDocView->LockUpdate(); | 64 m_pDocView->LockUpdate(); |
64 FX_BOOL bRet = static_cast<CXFA_FFWidget*>(hWidget)->OnMouseEnter(); | 65 FX_BOOL bRet = hWidget->OnMouseEnter(); |
65 m_pDocView->UnlockUpdate(); | 66 m_pDocView->UnlockUpdate(); |
66 m_pDocView->UpdateDocView(); | 67 m_pDocView->UpdateDocView(); |
67 return bRet; | 68 return bRet; |
68 } | 69 } |
69 FX_BOOL CXFA_FFWidgetHandler::OnMouseExit(IXFA_Widget* hWidget) { | 70 FX_BOOL CXFA_FFWidgetHandler::OnMouseExit(CXFA_FFWidget* hWidget) { |
70 m_pDocView->LockUpdate(); | 71 m_pDocView->LockUpdate(); |
71 FX_BOOL bRet = static_cast<CXFA_FFWidget*>(hWidget)->OnMouseExit(); | 72 FX_BOOL bRet = hWidget->OnMouseExit(); |
72 m_pDocView->UnlockUpdate(); | 73 m_pDocView->UnlockUpdate(); |
73 m_pDocView->UpdateDocView(); | 74 m_pDocView->UpdateDocView(); |
74 return bRet; | 75 return bRet; |
75 } | 76 } |
76 FX_BOOL CXFA_FFWidgetHandler::OnLButtonDown(IXFA_Widget* hWidget, | 77 FX_BOOL CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget, |
77 uint32_t dwFlags, | 78 uint32_t dwFlags, |
78 FX_FLOAT fx, | 79 FX_FLOAT fx, |
79 FX_FLOAT fy) { | 80 FX_FLOAT fy) { |
80 m_pDocView->LockUpdate(); | 81 m_pDocView->LockUpdate(); |
81 static_cast<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy); | 82 hWidget->Rotate2Normal(fx, fy); |
82 FX_BOOL bRet = | 83 FX_BOOL bRet = hWidget->OnLButtonDown(dwFlags, fx, fy); |
83 static_cast<CXFA_FFWidget*>(hWidget)->OnLButtonDown(dwFlags, fx, fy); | |
84 if (bRet && m_pDocView->SetFocus(hWidget)) { | 84 if (bRet && m_pDocView->SetFocus(hWidget)) { |
85 ((CXFA_FFDoc*)m_pDocView->GetDoc()) | 85 ((CXFA_FFDoc*)m_pDocView->GetDoc()) |
86 ->GetDocProvider() | 86 ->GetDocProvider() |
87 ->SetFocusWidget(m_pDocView->GetDoc(), (IXFA_Widget*)hWidget); | 87 ->SetFocusWidget(m_pDocView->GetDoc(), (CXFA_FFWidget*)hWidget); |
88 } | 88 } |
89 m_pDocView->UnlockUpdate(); | 89 m_pDocView->UnlockUpdate(); |
90 m_pDocView->UpdateDocView(); | 90 m_pDocView->UpdateDocView(); |
91 return bRet; | 91 return bRet; |
92 } | 92 } |
93 FX_BOOL CXFA_FFWidgetHandler::OnLButtonUp(IXFA_Widget* hWidget, | 93 FX_BOOL CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget, |
94 uint32_t dwFlags, | 94 uint32_t dwFlags, |
95 FX_FLOAT fx, | 95 FX_FLOAT fx, |
96 FX_FLOAT fy) { | 96 FX_FLOAT fy) { |
97 m_pDocView->LockUpdate(); | 97 m_pDocView->LockUpdate(); |
98 static_cast<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy); | 98 hWidget->Rotate2Normal(fx, fy); |
99 m_pDocView->m_bLayoutEvent = TRUE; | 99 m_pDocView->m_bLayoutEvent = TRUE; |
100 FX_BOOL bRet = | 100 FX_BOOL bRet = hWidget->OnLButtonUp(dwFlags, fx, fy); |
101 static_cast<CXFA_FFWidget*>(hWidget)->OnLButtonUp(dwFlags, fx, fy); | 101 m_pDocView->UnlockUpdate(); |
102 m_pDocView->UnlockUpdate(); | 102 m_pDocView->UpdateDocView(); |
103 m_pDocView->UpdateDocView(); | 103 return bRet; |
104 return bRet; | 104 } |
105 } | 105 FX_BOOL CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget, |
106 FX_BOOL CXFA_FFWidgetHandler::OnLButtonDblClk(IXFA_Widget* hWidget, | |
107 uint32_t dwFlags, | 106 uint32_t dwFlags, |
108 FX_FLOAT fx, | 107 FX_FLOAT fx, |
109 FX_FLOAT fy) { | 108 FX_FLOAT fy) { |
110 static_cast<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy); | 109 hWidget->Rotate2Normal(fx, fy); |
111 FX_BOOL bRet = | 110 FX_BOOL bRet = hWidget->OnLButtonDblClk(dwFlags, fx, fy); |
112 static_cast<CXFA_FFWidget*>(hWidget)->OnLButtonDblClk(dwFlags, fx, fy); | 111 m_pDocView->RunInvalidate(); |
113 m_pDocView->RunInvalidate(); | 112 return bRet; |
114 return bRet; | 113 } |
115 } | 114 FX_BOOL CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget, |
116 FX_BOOL CXFA_FFWidgetHandler::OnMouseMove(IXFA_Widget* hWidget, | |
117 uint32_t dwFlags, | 115 uint32_t dwFlags, |
118 FX_FLOAT fx, | 116 FX_FLOAT fx, |
119 FX_FLOAT fy) { | 117 FX_FLOAT fy) { |
120 static_cast<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy); | 118 hWidget->Rotate2Normal(fx, fy); |
121 FX_BOOL bRet = | 119 FX_BOOL bRet = hWidget->OnMouseMove(dwFlags, fx, fy); |
122 static_cast<CXFA_FFWidget*>(hWidget)->OnMouseMove(dwFlags, fx, fy); | 120 m_pDocView->RunInvalidate(); |
123 m_pDocView->RunInvalidate(); | 121 return bRet; |
124 return bRet; | 122 } |
125 } | 123 FX_BOOL CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget, |
126 FX_BOOL CXFA_FFWidgetHandler::OnMouseWheel(IXFA_Widget* hWidget, | |
127 uint32_t dwFlags, | 124 uint32_t dwFlags, |
128 int16_t zDelta, | 125 int16_t zDelta, |
129 FX_FLOAT fx, | 126 FX_FLOAT fx, |
130 FX_FLOAT fy) { | 127 FX_FLOAT fy) { |
131 static_cast<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy); | 128 hWidget->Rotate2Normal(fx, fy); |
132 FX_BOOL bRet = static_cast<CXFA_FFWidget*>(hWidget) | 129 FX_BOOL bRet = hWidget->OnMouseWheel(dwFlags, zDelta, fx, fy); |
133 ->OnMouseWheel(dwFlags, zDelta, fx, fy); | 130 m_pDocView->RunInvalidate(); |
134 m_pDocView->RunInvalidate(); | 131 return bRet; |
135 return bRet; | 132 } |
136 } | 133 FX_BOOL CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget, |
137 FX_BOOL CXFA_FFWidgetHandler::OnRButtonDown(IXFA_Widget* hWidget, | |
138 uint32_t dwFlags, | 134 uint32_t dwFlags, |
139 FX_FLOAT fx, | 135 FX_FLOAT fx, |
140 FX_FLOAT fy) { | 136 FX_FLOAT fy) { |
141 static_cast<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy); | 137 hWidget->Rotate2Normal(fx, fy); |
142 FX_BOOL bRet = | 138 FX_BOOL bRet = hWidget->OnRButtonDown(dwFlags, fx, fy); |
143 static_cast<CXFA_FFWidget*>(hWidget)->OnRButtonDown(dwFlags, fx, fy); | |
144 if (bRet && m_pDocView->SetFocus(hWidget)) { | 139 if (bRet && m_pDocView->SetFocus(hWidget)) { |
145 ((CXFA_FFDoc*)m_pDocView->GetDoc()) | 140 ((CXFA_FFDoc*)m_pDocView->GetDoc()) |
146 ->GetDocProvider() | 141 ->GetDocProvider() |
147 ->SetFocusWidget(m_pDocView->GetDoc(), (IXFA_Widget*)hWidget); | 142 ->SetFocusWidget(m_pDocView->GetDoc(), (CXFA_FFWidget*)hWidget); |
148 } | 143 } |
149 m_pDocView->RunInvalidate(); | 144 m_pDocView->RunInvalidate(); |
150 return bRet; | 145 return bRet; |
151 } | 146 } |
152 FX_BOOL CXFA_FFWidgetHandler::OnRButtonUp(IXFA_Widget* hWidget, | 147 FX_BOOL CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget, |
153 uint32_t dwFlags, | 148 uint32_t dwFlags, |
154 FX_FLOAT fx, | 149 FX_FLOAT fx, |
155 FX_FLOAT fy) { | 150 FX_FLOAT fy) { |
156 static_cast<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy); | 151 hWidget->Rotate2Normal(fx, fy); |
157 FX_BOOL bRet = | 152 FX_BOOL bRet = hWidget->OnRButtonUp(dwFlags, fx, fy); |
158 static_cast<CXFA_FFWidget*>(hWidget)->OnRButtonUp(dwFlags, fx, fy); | 153 m_pDocView->RunInvalidate(); |
159 m_pDocView->RunInvalidate(); | 154 return bRet; |
160 return bRet; | 155 } |
161 } | 156 FX_BOOL CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget, |
162 FX_BOOL CXFA_FFWidgetHandler::OnRButtonDblClk(IXFA_Widget* hWidget, | |
163 uint32_t dwFlags, | 157 uint32_t dwFlags, |
164 FX_FLOAT fx, | 158 FX_FLOAT fx, |
165 FX_FLOAT fy) { | 159 FX_FLOAT fy) { |
166 static_cast<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy); | 160 hWidget->Rotate2Normal(fx, fy); |
167 FX_BOOL bRet = | 161 FX_BOOL bRet = hWidget->OnRButtonDblClk(dwFlags, fx, fy); |
168 static_cast<CXFA_FFWidget*>(hWidget)->OnRButtonDblClk(dwFlags, fx, fy); | 162 m_pDocView->RunInvalidate(); |
169 m_pDocView->RunInvalidate(); | 163 return bRet; |
170 return bRet; | 164 } |
171 } | 165 FX_BOOL CXFA_FFWidgetHandler::OnKeyDown(CXFA_FFWidget* hWidget, |
172 FX_BOOL CXFA_FFWidgetHandler::OnKeyDown(IXFA_Widget* hWidget, | |
173 uint32_t dwKeyCode, | 166 uint32_t dwKeyCode, |
174 uint32_t dwFlags) { | 167 uint32_t dwFlags) { |
175 FX_BOOL bRet = | 168 FX_BOOL bRet = hWidget->OnKeyDown(dwKeyCode, dwFlags); |
176 static_cast<CXFA_FFWidget*>(hWidget)->OnKeyDown(dwKeyCode, dwFlags); | 169 m_pDocView->RunInvalidate(); |
177 m_pDocView->RunInvalidate(); | 170 m_pDocView->UpdateDocView(); |
178 m_pDocView->UpdateDocView(); | 171 return bRet; |
179 return bRet; | 172 } |
180 } | 173 FX_BOOL CXFA_FFWidgetHandler::OnKeyUp(CXFA_FFWidget* hWidget, |
181 FX_BOOL CXFA_FFWidgetHandler::OnKeyUp(IXFA_Widget* hWidget, | |
182 uint32_t dwKeyCode, | 174 uint32_t dwKeyCode, |
183 uint32_t dwFlags) { | 175 uint32_t dwFlags) { |
184 FX_BOOL bRet = | 176 FX_BOOL bRet = hWidget->OnKeyUp(dwKeyCode, dwFlags); |
185 static_cast<CXFA_FFWidget*>(hWidget)->OnKeyUp(dwKeyCode, dwFlags); | 177 m_pDocView->RunInvalidate(); |
186 m_pDocView->RunInvalidate(); | 178 return bRet; |
187 return bRet; | 179 } |
188 } | 180 FX_BOOL CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget, |
189 FX_BOOL CXFA_FFWidgetHandler::OnChar(IXFA_Widget* hWidget, | |
190 uint32_t dwChar, | 181 uint32_t dwChar, |
191 uint32_t dwFlags) { | 182 uint32_t dwFlags) { |
192 FX_BOOL bRet = static_cast<CXFA_FFWidget*>(hWidget)->OnChar(dwChar, dwFlags); | 183 FX_BOOL bRet = hWidget->OnChar(dwChar, dwFlags); |
193 m_pDocView->RunInvalidate(); | 184 m_pDocView->RunInvalidate(); |
194 return bRet; | 185 return bRet; |
195 } | 186 } |
196 uint32_t CXFA_FFWidgetHandler::OnHitTest(IXFA_Widget* hWidget, | 187 uint32_t CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget, |
197 FX_FLOAT fx, | 188 FX_FLOAT fx, |
198 FX_FLOAT fy) { | 189 FX_FLOAT fy) { |
199 if (!(static_cast<CXFA_FFWidget*>(hWidget)->GetStatus() & | 190 if (!(hWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) |
200 XFA_WIDGETSTATUS_Visible)) { | |
201 return FWL_WGTHITTEST_Unknown; | 191 return FWL_WGTHITTEST_Unknown; |
202 } | 192 |
203 static_cast<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy); | 193 hWidget->Rotate2Normal(fx, fy); |
204 return static_cast<CXFA_FFWidget*>(hWidget)->OnHitTest(fx, fy); | 194 return hWidget->OnHitTest(fx, fy); |
205 } | 195 } |
206 FX_BOOL CXFA_FFWidgetHandler::OnSetCursor(IXFA_Widget* hWidget, | 196 FX_BOOL CXFA_FFWidgetHandler::OnSetCursor(CXFA_FFWidget* hWidget, |
207 FX_FLOAT fx, | 197 FX_FLOAT fx, |
208 FX_FLOAT fy) { | 198 FX_FLOAT fy) { |
209 static_cast<CXFA_FFWidget*>(hWidget)->Rotate2Normal(fx, fy); | 199 hWidget->Rotate2Normal(fx, fy); |
210 return static_cast<CXFA_FFWidget*>(hWidget)->OnSetCursor(fx, fy); | 200 return hWidget->OnSetCursor(fx, fy); |
211 } | 201 } |
212 void CXFA_FFWidgetHandler::RenderWidget(IXFA_Widget* hWidget, | 202 void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget, |
213 CFX_Graphics* pGS, | 203 CFX_Graphics* pGS, |
214 CFX_Matrix* pMatrix, | 204 CFX_Matrix* pMatrix, |
215 FX_BOOL bHighlight) { | 205 FX_BOOL bHighlight) { |
216 static_cast<CXFA_FFWidget*>(hWidget)->RenderWidget( | 206 hWidget->RenderWidget(pGS, pMatrix, |
217 pGS, pMatrix, bHighlight ? XFA_WIDGETSTATUS_Highlight : 0, 0); | 207 bHighlight ? XFA_WIDGETSTATUS_Highlight : 0, 0); |
218 } | 208 } |
219 FX_BOOL CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc, | 209 FX_BOOL CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc, |
220 XFA_EVENTTYPE eEventType) { | 210 XFA_EVENTTYPE eEventType) { |
221 if (!pWidgetAcc || eEventType == XFA_EVENT_Unknown) { | 211 if (!pWidgetAcc || eEventType == XFA_EVENT_Unknown) { |
222 return FALSE; | 212 return FALSE; |
223 } | 213 } |
224 if (pWidgetAcc->GetClassID() == XFA_ELEMENT_Draw) { | 214 if (pWidgetAcc->GetClassID() == XFA_ELEMENT_Draw) { |
225 return FALSE; | 215 return FALSE; |
226 } | 216 } |
227 switch (eEventType) { | 217 switch (eEventType) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 CXFA_Script script = calc.GetScript(); | 271 CXFA_Script script = calc.GetScript(); |
282 return pWidgetAcc->ExecuteScript(script, pParam); | 272 return pWidgetAcc->ExecuteScript(script, pParam); |
283 } | 273 } |
284 default: | 274 default: |
285 break; | 275 break; |
286 } | 276 } |
287 int32_t iRet = | 277 int32_t iRet = |
288 pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam); | 278 pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam); |
289 return iRet; | 279 return iRet; |
290 } | 280 } |
291 IXFA_Widget* CXFA_FFWidgetHandler::CreateWidget(IXFA_Widget* hParent, | 281 CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent, |
292 XFA_WIDGETTYPE eType, | 282 XFA_WIDGETTYPE eType, |
293 IXFA_Widget* hBefore) { | 283 CXFA_FFWidget* hBefore) { |
294 CXFA_Node* pParentFormItem = | 284 CXFA_Node* pParentFormItem = |
295 hParent ? static_cast<CXFA_FFWidget*>(hParent)->GetDataAcc()->GetNode() | 285 hParent ? hParent->GetDataAcc()->GetNode() : nullptr; |
296 : NULL; | |
297 CXFA_Node* pBeforeFormItem = | 286 CXFA_Node* pBeforeFormItem = |
298 hBefore ? static_cast<CXFA_FFWidget*>(hBefore)->GetDataAcc()->GetNode() | 287 hBefore ? hBefore->GetDataAcc()->GetNode() : nullptr; |
299 : NULL; | |
300 CXFA_Node* pNewFormItem = | 288 CXFA_Node* pNewFormItem = |
301 CreateWidgetFormItem(eType, pParentFormItem, pBeforeFormItem); | 289 CreateWidgetFormItem(eType, pParentFormItem, pBeforeFormItem); |
302 if (pNewFormItem == NULL) { | 290 if (pNewFormItem == NULL) { |
303 return NULL; | 291 return NULL; |
304 } | 292 } |
305 pNewFormItem->GetTemplateNode()->SetFlag(XFA_NODEFLAG_Initialized); | 293 pNewFormItem->GetTemplateNode()->SetFlag(XFA_NODEFLAG_Initialized); |
306 pNewFormItem->SetFlag(XFA_NODEFLAG_Initialized); | 294 pNewFormItem->SetFlag(XFA_NODEFLAG_Initialized); |
307 m_pDocView->RunLayout(); | 295 m_pDocView->RunLayout(); |
308 CXFA_LayoutItem* pLayout = | 296 CXFA_LayoutItem* pLayout = |
309 m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem); | 297 m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem); |
310 return (IXFA_Widget*)pLayout; | 298 return (CXFA_FFWidget*)pLayout; |
311 } | 299 } |
312 CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem( | 300 CXFA_Node* CXFA_FFWidgetHandler::CreateWidgetFormItem( |
313 XFA_WIDGETTYPE eType, | 301 XFA_WIDGETTYPE eType, |
314 CXFA_Node* pParent, | 302 CXFA_Node* pParent, |
315 CXFA_Node* pBefore) const { | 303 CXFA_Node* pBefore) const { |
316 switch (eType) { | 304 switch (eType) { |
317 case XFA_WIDGETTYPE_Barcode: | 305 case XFA_WIDGETTYPE_Barcode: |
318 return NULL; | 306 return NULL; |
319 case XFA_WIDGETTYPE_PushButton: | 307 case XFA_WIDGETTYPE_PushButton: |
320 return CreatePushButton(pParent, pBefore); | 308 return CreatePushButton(pParent, pBefore); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 CXFA_Measurement(fInsets[3], XFA_UNIT_Pt), FALSE); | 542 CXFA_Measurement(fInsets[3], XFA_UNIT_Pt), FALSE); |
555 } | 543 } |
556 return pMargin; | 544 return pMargin; |
557 } | 545 } |
558 CXFA_Node* CXFA_FFWidgetHandler::CreateValueNode(XFA_ELEMENT eValue, | 546 CXFA_Node* CXFA_FFWidgetHandler::CreateValueNode(XFA_ELEMENT eValue, |
559 CXFA_Node* pParent) const { | 547 CXFA_Node* pParent) const { |
560 CXFA_Node* pValue = CreateCopyNode(XFA_ELEMENT_Value, pParent); | 548 CXFA_Node* pValue = CreateCopyNode(XFA_ELEMENT_Value, pParent); |
561 CreateCopyNode(eValue, pValue); | 549 CreateCopyNode(eValue, pValue); |
562 return pValue; | 550 return pValue; |
563 } | 551 } |
564 IXFA_ObjFactory* CXFA_FFWidgetHandler::GetObjFactory() const { | 552 CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const { |
565 return GetXFADoc()->GetParser()->GetFactory(); | 553 return GetXFADoc()->GetParser()->GetFactory(); |
566 } | 554 } |
567 CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const { | 555 CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const { |
568 return ((CXFA_FFDoc*)(m_pDocView->GetDoc()))->GetXFADoc(); | 556 return ((CXFA_FFDoc*)(m_pDocView->GetDoc()))->GetXFADoc(); |
569 } | 557 } |
| 558 |
570 CXFA_FFMenuHandler::CXFA_FFMenuHandler() {} | 559 CXFA_FFMenuHandler::CXFA_FFMenuHandler() {} |
| 560 |
571 CXFA_FFMenuHandler::~CXFA_FFMenuHandler() {} | 561 CXFA_FFMenuHandler::~CXFA_FFMenuHandler() {} |
572 FX_BOOL CXFA_FFMenuHandler::CanCopy(IXFA_Widget* hWidget) { | 562 |
573 return static_cast<CXFA_FFWidget*>(hWidget)->CanCopy(); | 563 FX_BOOL CXFA_FFMenuHandler::CanCopy(CXFA_FFWidget* hWidget) { |
| 564 return hWidget->CanCopy(); |
574 } | 565 } |
575 FX_BOOL CXFA_FFMenuHandler::CanCut(IXFA_Widget* hWidget) { | 566 FX_BOOL CXFA_FFMenuHandler::CanCut(CXFA_FFWidget* hWidget) { |
576 return static_cast<CXFA_FFWidget*>(hWidget)->CanCut(); | 567 return hWidget->CanCut(); |
577 } | 568 } |
578 FX_BOOL CXFA_FFMenuHandler::CanPaste(IXFA_Widget* hWidget) { | 569 FX_BOOL CXFA_FFMenuHandler::CanPaste(CXFA_FFWidget* hWidget) { |
579 return static_cast<CXFA_FFWidget*>(hWidget)->CanPaste(); | 570 return hWidget->CanPaste(); |
580 } | 571 } |
581 FX_BOOL CXFA_FFMenuHandler::CanSelectAll(IXFA_Widget* hWidget) { | 572 FX_BOOL CXFA_FFMenuHandler::CanSelectAll(CXFA_FFWidget* hWidget) { |
582 return static_cast<CXFA_FFWidget*>(hWidget)->CanSelectAll(); | 573 return hWidget->CanSelectAll(); |
583 } | 574 } |
584 FX_BOOL CXFA_FFMenuHandler::CanDelete(IXFA_Widget* hWidget) { | 575 FX_BOOL CXFA_FFMenuHandler::CanDelete(CXFA_FFWidget* hWidget) { |
585 return static_cast<CXFA_FFWidget*>(hWidget)->CanDelete(); | 576 return hWidget->CanDelete(); |
586 } | 577 } |
587 FX_BOOL CXFA_FFMenuHandler::CanDeSelect(IXFA_Widget* hWidget) { | 578 FX_BOOL CXFA_FFMenuHandler::CanDeSelect(CXFA_FFWidget* hWidget) { |
588 return static_cast<CXFA_FFWidget*>(hWidget)->CanDeSelect(); | 579 return hWidget->CanDeSelect(); |
589 } | 580 } |
590 FX_BOOL CXFA_FFMenuHandler::Copy(IXFA_Widget* hWidget, CFX_WideString& wsText) { | 581 FX_BOOL CXFA_FFMenuHandler::Copy(CXFA_FFWidget* hWidget, |
591 return static_cast<CXFA_FFWidget*>(hWidget)->Copy(wsText); | 582 CFX_WideString& wsText) { |
| 583 return hWidget->Copy(wsText); |
592 } | 584 } |
593 FX_BOOL CXFA_FFMenuHandler::Cut(IXFA_Widget* hWidget, CFX_WideString& wsText) { | 585 FX_BOOL CXFA_FFMenuHandler::Cut(CXFA_FFWidget* hWidget, |
594 return static_cast<CXFA_FFWidget*>(hWidget)->Cut(wsText); | 586 CFX_WideString& wsText) { |
| 587 return hWidget->Cut(wsText); |
595 } | 588 } |
596 FX_BOOL CXFA_FFMenuHandler::Paste(IXFA_Widget* hWidget, | 589 FX_BOOL CXFA_FFMenuHandler::Paste(CXFA_FFWidget* hWidget, |
597 const CFX_WideString& wsText) { | 590 const CFX_WideString& wsText) { |
598 return static_cast<CXFA_FFWidget*>(hWidget)->Paste(wsText); | 591 return hWidget->Paste(wsText); |
599 } | 592 } |
600 FX_BOOL CXFA_FFMenuHandler::SelectAll(IXFA_Widget* hWidget) { | 593 FX_BOOL CXFA_FFMenuHandler::SelectAll(CXFA_FFWidget* hWidget) { |
601 return static_cast<CXFA_FFWidget*>(hWidget)->SelectAll(); | 594 return hWidget->SelectAll(); |
602 } | 595 } |
603 FX_BOOL CXFA_FFMenuHandler::Delete(IXFA_Widget* hWidget) { | 596 FX_BOOL CXFA_FFMenuHandler::Delete(CXFA_FFWidget* hWidget) { |
604 return static_cast<CXFA_FFWidget*>(hWidget)->Delete(); | 597 return hWidget->Delete(); |
605 } | 598 } |
606 FX_BOOL CXFA_FFMenuHandler::DeSelect(IXFA_Widget* hWidget) { | 599 FX_BOOL CXFA_FFMenuHandler::DeSelect(CXFA_FFWidget* hWidget) { |
607 return static_cast<CXFA_FFWidget*>(hWidget)->DeSelect(); | 600 return hWidget->DeSelect(); |
608 } | 601 } |
609 FX_BOOL CXFA_FFMenuHandler::CanUndo(IXFA_Widget* hWidget) { | 602 FX_BOOL CXFA_FFMenuHandler::CanUndo(CXFA_FFWidget* hWidget) { |
610 return static_cast<CXFA_FFWidget*>(hWidget)->CanUndo(); | 603 return hWidget->CanUndo(); |
611 } | 604 } |
612 FX_BOOL CXFA_FFMenuHandler::CanRedo(IXFA_Widget* hWidget) { | 605 FX_BOOL CXFA_FFMenuHandler::CanRedo(CXFA_FFWidget* hWidget) { |
613 return static_cast<CXFA_FFWidget*>(hWidget)->CanRedo(); | 606 return hWidget->CanRedo(); |
614 } | 607 } |
615 FX_BOOL CXFA_FFMenuHandler::Undo(IXFA_Widget* hWidget) { | 608 FX_BOOL CXFA_FFMenuHandler::Undo(CXFA_FFWidget* hWidget) { |
616 return static_cast<CXFA_FFWidget*>(hWidget)->Undo(); | 609 return hWidget->Undo(); |
617 } | 610 } |
618 FX_BOOL CXFA_FFMenuHandler::Redo(IXFA_Widget* hWidget) { | 611 FX_BOOL CXFA_FFMenuHandler::Redo(CXFA_FFWidget* hWidget) { |
619 return static_cast<CXFA_FFWidget*>(hWidget)->Redo(); | 612 return hWidget->Redo(); |
620 } | 613 } |
621 FX_BOOL CXFA_FFMenuHandler::GetSuggestWords( | 614 FX_BOOL CXFA_FFMenuHandler::GetSuggestWords( |
622 IXFA_Widget* hWidget, | 615 CXFA_FFWidget* hWidget, |
623 CFX_PointF pointf, | 616 CFX_PointF pointf, |
624 std::vector<CFX_ByteString>& sSuggest) { | 617 std::vector<CFX_ByteString>& sSuggest) { |
625 return static_cast<CXFA_FFWidget*>(hWidget) | 618 return hWidget->GetSuggestWords(pointf, sSuggest); |
626 ->GetSuggestWords(pointf, sSuggest); | |
627 } | 619 } |
628 FX_BOOL CXFA_FFMenuHandler::ReplaceSpellCheckWord( | 620 FX_BOOL CXFA_FFMenuHandler::ReplaceSpellCheckWord( |
629 IXFA_Widget* hWidget, | 621 CXFA_FFWidget* hWidget, |
630 CFX_PointF pointf, | 622 CFX_PointF pointf, |
631 const CFX_ByteStringC& bsReplace) { | 623 const CFX_ByteStringC& bsReplace) { |
632 return static_cast<CXFA_FFWidget*>(hWidget) | 624 return hWidget->ReplaceSpellCheckWord(pointf, bsReplace); |
633 ->ReplaceSpellCheckWord(pointf, bsReplace); | |
634 } | 625 } |
OLD | NEW |