Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: fpdfsdk/formfiller/cffl_interactiveformfiller.cpp

Issue 2357203003: Make the I in IFormFiller explicit (Closed)
Patch Set: Remove locals Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/formfiller/cffl_interactiveformfiller.h ('k') | fpdfsdk/formfiller/cffl_listbox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "fpdfsdk/formfiller/cffl_iformfiller.h" 7 #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h"
8 8
9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
11 #include "core/fxge/include/cfx_graphstatedata.h" 11 #include "core/fxge/include/cfx_graphstatedata.h"
12 #include "core/fxge/include/cfx_pathdata.h" 12 #include "core/fxge/include/cfx_pathdata.h"
13 #include "core/fxge/include/cfx_renderdevice.h" 13 #include "core/fxge/include/cfx_renderdevice.h"
14 #include "fpdfsdk/formfiller/cffl_checkbox.h" 14 #include "fpdfsdk/formfiller/cffl_checkbox.h"
15 #include "fpdfsdk/formfiller/cffl_combobox.h" 15 #include "fpdfsdk/formfiller/cffl_combobox.h"
16 #include "fpdfsdk/formfiller/cffl_formfiller.h" 16 #include "fpdfsdk/formfiller/cffl_formfiller.h"
17 #include "fpdfsdk/formfiller/cffl_listbox.h" 17 #include "fpdfsdk/formfiller/cffl_listbox.h"
18 #include "fpdfsdk/formfiller/cffl_pushbutton.h" 18 #include "fpdfsdk/formfiller/cffl_pushbutton.h"
19 #include "fpdfsdk/formfiller/cffl_radiobutton.h" 19 #include "fpdfsdk/formfiller/cffl_radiobutton.h"
20 #include "fpdfsdk/formfiller/cffl_textfield.h" 20 #include "fpdfsdk/formfiller/cffl_textfield.h"
21 #include "fpdfsdk/include/cpdfsdk_document.h" 21 #include "fpdfsdk/include/cpdfsdk_document.h"
22 #include "fpdfsdk/include/cpdfsdk_environment.h" 22 #include "fpdfsdk/include/cpdfsdk_environment.h"
23 #include "fpdfsdk/include/cpdfsdk_interform.h" 23 #include "fpdfsdk/include/cpdfsdk_interform.h"
24 #include "fpdfsdk/include/cpdfsdk_pageview.h" 24 #include "fpdfsdk/include/cpdfsdk_pageview.h"
25 #include "fpdfsdk/include/cpdfsdk_widget.h" 25 #include "fpdfsdk/include/cpdfsdk_widget.h"
26 #include "fpdfsdk/pdfwindow/PWL_Utils.h" 26 #include "fpdfsdk/pdfwindow/PWL_Utils.h"
27 27
28 #define FFL_MAXLISTBOXHEIGHT 140.0f 28 #define FFL_MAXLISTBOXHEIGHT 140.0f
29 29
30 CFFL_IFormFiller::CFFL_IFormFiller(CPDFSDK_Environment* pEnv) 30 CFFL_InteractiveFormFiller::CFFL_InteractiveFormFiller(
31 CPDFSDK_Environment* pEnv)
31 : m_pEnv(pEnv), m_bNotifying(FALSE) {} 32 : m_pEnv(pEnv), m_bNotifying(FALSE) {}
32 33
33 CFFL_IFormFiller::~CFFL_IFormFiller() {} 34 CFFL_InteractiveFormFiller::~CFFL_InteractiveFormFiller() {}
34 35
35 FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView, 36 FX_BOOL CFFL_InteractiveFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,
36 CPDFSDK_Annot* pAnnot, 37 CPDFSDK_Annot* pAnnot,
37 CFX_FloatPoint point) { 38 CFX_FloatPoint point) {
38 CFX_FloatRect rc = pAnnot->GetRect(); 39 CFX_FloatRect rc = pAnnot->GetRect();
39 return rc.Contains(point.x, point.y); 40 return rc.Contains(point.x, point.y);
40 } 41 }
41 42
42 FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, 43 FX_RECT CFFL_InteractiveFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView,
43 CPDFSDK_Annot* pAnnot) { 44 CPDFSDK_Annot* pAnnot) {
44 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 45 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
45 return pFormFiller->GetViewBBox(pPageView, pAnnot); 46 return pFormFiller->GetViewBBox(pPageView, pAnnot);
46 47
47 ASSERT(pPageView); 48 ASSERT(pPageView);
48 49
49 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 50 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
50 CFX_FloatRect rcWin = CPWL_Utils::InflateRect(pPDFAnnot->GetRect(), 1); 51 CFX_FloatRect rcWin = CPWL_Utils::InflateRect(pPDFAnnot->GetRect(), 1);
51 return rcWin.GetOuterRect(); 52 return rcWin.GetOuterRect();
52 } 53 }
53 54
54 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, 55 void CFFL_InteractiveFormFiller::OnDraw(CPDFSDK_PageView* pPageView,
55 CPDFSDK_Annot* pAnnot, 56 CPDFSDK_Annot* pAnnot,
56 CFX_RenderDevice* pDevice, 57 CFX_RenderDevice* pDevice,
57 CFX_Matrix* pUser2Device) { 58 CFX_Matrix* pUser2Device) {
58 ASSERT(pPageView); 59 ASSERT(pPageView);
59 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 60 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
60 61
61 if (!IsVisible(pWidget)) 62 if (!IsVisible(pWidget))
62 return; 63 return;
63 64
64 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 65 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
65 if (pFormFiller->IsValid()) { 66 if (pFormFiller->IsValid()) {
66 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device); 67 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device);
67 pAnnot->GetPDFPage(); 68 pAnnot->GetPDFPage();
(...skipping 26 matching lines...) Expand all
94 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 95 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
95 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device); 96 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device);
96 } else { 97 } else {
97 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); 98 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
98 } 99 }
99 100
100 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) 101 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget))
101 pWidget->DrawShadow(pDevice, pPageView); 102 pWidget->DrawShadow(pDevice, pPageView);
102 } 103 }
103 104
104 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) { 105 void CFFL_InteractiveFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) {
105 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 106 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
106 pFormFiller->OnCreate(pAnnot); 107 pFormFiller->OnCreate(pAnnot);
107 } 108 }
108 } 109 }
109 110
110 void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot) { 111 void CFFL_InteractiveFormFiller::OnLoad(CPDFSDK_Annot* pAnnot) {
111 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 112 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
112 pFormFiller->OnLoad(pAnnot); 113 pFormFiller->OnLoad(pAnnot);
113 } 114 }
114 } 115 }
115 116
116 void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) { 117 void CFFL_InteractiveFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) {
117 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 118 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
118 pFormFiller->OnDelete(pAnnot); 119 pFormFiller->OnDelete(pAnnot);
119 } 120 }
120 121
121 UnRegisterFormFiller(pAnnot); 122 UnRegisterFormFiller(pAnnot);
122 } 123 }
123 124
124 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, 125 void CFFL_InteractiveFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView,
125 CPDFSDK_Annot* pAnnot, 126 CPDFSDK_Annot* pAnnot,
126 uint32_t nFlag) { 127 uint32_t nFlag) {
127 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 128 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
128 129
129 if (!m_bNotifying) { 130 if (!m_bNotifying) {
130 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 131 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
131 if (pWidget->GetAAction(CPDF_AAction::CursorEnter).GetDict()) { 132 if (pWidget->GetAAction(CPDF_AAction::CursorEnter).GetDict()) {
132 m_bNotifying = TRUE; 133 m_bNotifying = TRUE;
133 134
134 int nValueAge = pWidget->GetValueAge(); 135 int nValueAge = pWidget->GetValueAge();
135 136
136 pWidget->ClearAppModified(); 137 pWidget->ClearAppModified();
(...skipping 13 matching lines...) Expand all
150 } 151 }
151 } 152 }
152 } 153 }
153 } 154 }
154 155
155 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { 156 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) {
156 pFormFiller->OnMouseEnter(pPageView, pAnnot); 157 pFormFiller->OnMouseEnter(pPageView, pAnnot);
157 } 158 }
158 } 159 }
159 160
160 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, 161 void CFFL_InteractiveFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
161 CPDFSDK_Annot* pAnnot, 162 CPDFSDK_Annot* pAnnot,
162 uint32_t nFlag) { 163 uint32_t nFlag) {
163 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 164 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
164 165
165 if (!m_bNotifying) { 166 if (!m_bNotifying) {
166 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 167 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
167 if (pWidget->GetAAction(CPDF_AAction::CursorExit).GetDict()) { 168 if (pWidget->GetAAction(CPDF_AAction::CursorExit).GetDict()) {
168 m_bNotifying = TRUE; 169 m_bNotifying = TRUE;
169 pWidget->GetAppearanceAge(); 170 pWidget->GetAppearanceAge();
170 int nValueAge = pWidget->GetValueAge(); 171 int nValueAge = pWidget->GetValueAge();
171 pWidget->ClearAppModified(); 172 pWidget->ClearAppModified();
172 173
(...skipping 13 matching lines...) Expand all
186 } 187 }
187 } 188 }
188 } 189 }
189 } 190 }
190 191
191 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 192 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
192 pFormFiller->OnMouseExit(pPageView, pAnnot); 193 pFormFiller->OnMouseExit(pPageView, pAnnot);
193 } 194 }
194 } 195 }
195 196
196 FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, 197 FX_BOOL CFFL_InteractiveFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView,
197 CPDFSDK_Annot* pAnnot, 198 CPDFSDK_Annot* pAnnot,
198 uint32_t nFlags, 199 uint32_t nFlags,
199 const CFX_FloatPoint& point) { 200 const CFX_FloatPoint& point) {
200 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 201 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
201 202
202 if (!m_bNotifying) { 203 if (!m_bNotifying) {
203 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 204 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
204 if (Annot_HitTest(pPageView, pAnnot, point) && 205 if (Annot_HitTest(pPageView, pAnnot, point) &&
205 pWidget->GetAAction(CPDF_AAction::ButtonDown).GetDict()) { 206 pWidget->GetAAction(CPDF_AAction::ButtonDown).GetDict()) {
206 m_bNotifying = TRUE; 207 m_bNotifying = TRUE;
207 pWidget->GetAppearanceAge(); 208 pWidget->GetAppearanceAge();
208 int nValueAge = pWidget->GetValueAge(); 209 int nValueAge = pWidget->GetValueAge();
209 pWidget->ClearAppModified(); 210 pWidget->ClearAppModified();
(...skipping 18 matching lines...) Expand all
228 } 229 }
229 } 230 }
230 231
231 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 232 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
232 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); 233 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point);
233 } 234 }
234 235
235 return FALSE; 236 return FALSE;
236 } 237 }
237 238
238 FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, 239 FX_BOOL CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView,
239 CPDFSDK_Annot* pAnnot, 240 CPDFSDK_Annot* pAnnot,
240 uint32_t nFlags, 241 uint32_t nFlags,
241 const CFX_FloatPoint& point) { 242 const CFX_FloatPoint& point) {
242 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 243 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
243 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 244 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
244 CPDFSDK_Document* pDocument = m_pEnv->GetSDKDocument(); 245 CPDFSDK_Document* pDocument = m_pEnv->GetSDKDocument();
245 246
246 switch (pWidget->GetFieldType()) { 247 switch (pWidget->GetFieldType()) {
247 case FIELDTYPE_PUSHBUTTON: 248 case FIELDTYPE_PUSHBUTTON:
248 case FIELDTYPE_CHECKBOX: 249 case FIELDTYPE_CHECKBOX:
249 case FIELDTYPE_RADIOBUTTON: 250 case FIELDTYPE_RADIOBUTTON:
250 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y)) 251 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y))
251 pDocument->SetFocusAnnot(pAnnot); 252 pDocument->SetFocusAnnot(pAnnot);
(...skipping 17 matching lines...) Expand all
269 return TRUE; 270 return TRUE;
270 #ifdef PDF_ENABLE_XFA 271 #ifdef PDF_ENABLE_XFA
271 OnClick(pWidget, pPageView, bReset, bExit, nFlags); 272 OnClick(pWidget, pPageView, bReset, bExit, nFlags);
272 if (bExit) 273 if (bExit)
273 return TRUE; 274 return TRUE;
274 #endif // PDF_ENABLE_XFA 275 #endif // PDF_ENABLE_XFA
275 } 276 }
276 return bRet; 277 return bRet;
277 } 278 }
278 279
279 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, 280 void CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget,
280 CPDFSDK_PageView* pPageView, 281 CPDFSDK_PageView* pPageView,
281 FX_BOOL& bReset, 282 FX_BOOL& bReset,
282 FX_BOOL& bExit, 283 FX_BOOL& bExit,
283 uint32_t nFlag) { 284 uint32_t nFlag) {
284 ASSERT(pWidget); 285 ASSERT(pWidget);
285 286
286 if (!m_bNotifying) { 287 if (!m_bNotifying) {
287 if (pWidget->GetAAction(CPDF_AAction::ButtonUp).GetDict()) { 288 if (pWidget->GetAAction(CPDF_AAction::ButtonUp).GetDict()) {
288 m_bNotifying = TRUE; 289 m_bNotifying = TRUE;
289 int nAge = pWidget->GetAppearanceAge(); 290 int nAge = pWidget->GetAppearanceAge();
290 int nValueAge = pWidget->GetValueAge(); 291 int nValueAge = pWidget->GetValueAge();
291 292
292 ASSERT(pPageView); 293 ASSERT(pPageView);
293 294
(...skipping 14 matching lines...) Expand all
308 pFormFiller->ResetPDFWindow(pPageView, 309 pFormFiller->ResetPDFWindow(pPageView,
309 nValueAge == pWidget->GetValueAge()); 310 nValueAge == pWidget->GetValueAge());
310 } 311 }
311 312
312 bReset = TRUE; 313 bReset = TRUE;
313 } 314 }
314 } 315 }
315 } 316 }
316 } 317 }
317 318
318 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, 319 FX_BOOL CFFL_InteractiveFormFiller::OnLButtonDblClk(
319 CPDFSDK_Annot* pAnnot, 320 CPDFSDK_PageView* pPageView,
320 uint32_t nFlags, 321 CPDFSDK_Annot* pAnnot,
321 const CFX_FloatPoint& point) { 322 uint32_t nFlags,
323 const CFX_FloatPoint& point) {
322 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 324 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
323 325
324 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 326 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
325 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); 327 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
326 } 328 }
327 329
328 return FALSE; 330 return FALSE;
329 } 331 }
330 332
331 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, 333 FX_BOOL CFFL_InteractiveFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView,
332 CPDFSDK_Annot* pAnnot, 334 CPDFSDK_Annot* pAnnot,
333 uint32_t nFlags, 335 uint32_t nFlags,
334 const CFX_FloatPoint& point) { 336 const CFX_FloatPoint& point) {
335 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 337 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
336 338
337 // change cursor 339 // change cursor
338 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { 340 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) {
339 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); 341 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point);
340 } 342 }
341 343
342 return FALSE; 344 return FALSE;
343 } 345 }
344 346
345 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, 347 FX_BOOL CFFL_InteractiveFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView,
346 CPDFSDK_Annot* pAnnot, 348 CPDFSDK_Annot* pAnnot,
347 uint32_t nFlags, 349 uint32_t nFlags,
348 short zDelta, 350 short zDelta,
349 const CFX_FloatPoint& point) { 351 const CFX_FloatPoint& point) {
350 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 352 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
351 353
352 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 354 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
353 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); 355 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point);
354 } 356 }
355 357
356 return FALSE; 358 return FALSE;
357 } 359 }
358 360
359 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, 361 FX_BOOL CFFL_InteractiveFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView,
360 CPDFSDK_Annot* pAnnot, 362 CPDFSDK_Annot* pAnnot,
361 uint32_t nFlags, 363 uint32_t nFlags,
362 const CFX_FloatPoint& point) { 364 const CFX_FloatPoint& point) {
363 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 365 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
364 366
365 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 367 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
366 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); 368 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
367 } 369 }
368 370
369 return FALSE; 371 return FALSE;
370 } 372 }
371 373
372 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, 374 FX_BOOL CFFL_InteractiveFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView,
373 CPDFSDK_Annot* pAnnot, 375 CPDFSDK_Annot* pAnnot,
374 uint32_t nFlags, 376 uint32_t nFlags,
375 const CFX_FloatPoint& point) { 377 const CFX_FloatPoint& point) {
376 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 378 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
377 379
378 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 380 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
379 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); 381 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
380 } 382 }
381 383
382 return FALSE; 384 return FALSE;
383 } 385 }
384 386
385 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, 387 FX_BOOL CFFL_InteractiveFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot,
386 uint32_t nKeyCode, 388 uint32_t nKeyCode,
387 uint32_t nFlags) { 389 uint32_t nFlags) {
388 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 390 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
389 391
390 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 392 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
391 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); 393 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags);
392 } 394 }
393 395
394 return FALSE; 396 return FALSE;
395 } 397 }
396 398
397 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, 399 FX_BOOL CFFL_InteractiveFormFiller::OnChar(CPDFSDK_Annot* pAnnot,
398 uint32_t nChar, 400 uint32_t nChar,
399 uint32_t nFlags) { 401 uint32_t nFlags) {
400 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 402 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
401 if (nChar == FWL_VKEY_Tab) 403 if (nChar == FWL_VKEY_Tab)
402 return TRUE; 404 return TRUE;
403 405
404 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 406 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE))
405 return pFormFiller->OnChar(pAnnot, nChar, nFlags); 407 return pFormFiller->OnChar(pAnnot, nChar, nFlags);
406 408
407 return FALSE; 409 return FALSE;
408 } 410 }
409 411
410 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) { 412 FX_BOOL CFFL_InteractiveFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,
413 uint32_t nFlag) {
411 if (!pAnnot) 414 if (!pAnnot)
412 return FALSE; 415 return FALSE;
413 416
414 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 417 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
415 418
416 if (!m_bNotifying) { 419 if (!m_bNotifying) {
417 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 420 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
418 if (pWidget->GetAAction(CPDF_AAction::GetFocus).GetDict()) { 421 if (pWidget->GetAAction(CPDF_AAction::GetFocus).GetDict()) {
419 m_bNotifying = TRUE; 422 m_bNotifying = TRUE;
420 pWidget->GetAppearanceAge(); 423 pWidget->GetAppearanceAge();
(...skipping 23 matching lines...) Expand all
444 } 447 }
445 } 448 }
446 } 449 }
447 450
448 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) 451 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE))
449 pFormFiller->SetFocusForAnnot(pAnnot, nFlag); 452 pFormFiller->SetFocusForAnnot(pAnnot, nFlag);
450 453
451 return TRUE; 454 return TRUE;
452 } 455 }
453 456
454 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) { 457 FX_BOOL CFFL_InteractiveFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,
458 uint32_t nFlag) {
455 if (!pAnnot) 459 if (!pAnnot)
456 return FALSE; 460 return FALSE;
457 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); 461 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
458 462
459 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { 463 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
460 pFormFiller->KillFocusForAnnot(pAnnot, nFlag); 464 pFormFiller->KillFocusForAnnot(pAnnot, nFlag);
461 465
462 if (!m_bNotifying) { 466 if (!m_bNotifying) {
463 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 467 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
464 if (pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) { 468 if (pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) {
(...skipping 11 matching lines...) Expand all
476 480
477 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); 481 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView);
478 m_bNotifying = FALSE; 482 m_bNotifying = FALSE;
479 } 483 }
480 } 484 }
481 } 485 }
482 486
483 return TRUE; 487 return TRUE;
484 } 488 }
485 489
486 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { 490 FX_BOOL CFFL_InteractiveFormFiller::IsVisible(CPDFSDK_Widget* pWidget) {
487 return pWidget->IsVisible(); 491 return pWidget->IsVisible();
488 } 492 }
489 493
490 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { 494 FX_BOOL CFFL_InteractiveFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) {
491 int nFieldFlags = pWidget->GetFieldFlags(); 495 int nFieldFlags = pWidget->GetFieldFlags();
492 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; 496 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY;
493 } 497 }
494 498
495 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { 499 FX_BOOL CFFL_InteractiveFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) {
496 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) 500 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
497 return TRUE; 501 return TRUE;
498 502
499 CPDF_Page* pPage = pWidget->GetPDFPage(); 503 CPDF_Page* pPage = pWidget->GetPDFPage();
500 CPDF_Document* pDocument = pPage->m_pDocument; 504 CPDF_Document* pDocument = pPage->m_pDocument;
501 uint32_t dwPermissions = pDocument->GetUserPermissions(); 505 uint32_t dwPermissions = pDocument->GetUserPermissions();
502 return (dwPermissions & FPDFPERM_FILL_FORM) || 506 return (dwPermissions & FPDFPERM_FILL_FORM) ||
503 (dwPermissions & FPDFPERM_ANNOT_FORM) || 507 (dwPermissions & FPDFPERM_ANNOT_FORM) ||
504 (dwPermissions & FPDFPERM_MODIFY); 508 (dwPermissions & FPDFPERM_MODIFY);
505 } 509 }
506 510
507 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, 511 CFFL_FormFiller* CFFL_InteractiveFormFiller::GetFormFiller(
508 FX_BOOL bRegister) { 512 CPDFSDK_Annot* pAnnot,
513 FX_BOOL bRegister) {
509 auto it = m_Maps.find(pAnnot); 514 auto it = m_Maps.find(pAnnot);
510 if (it != m_Maps.end()) 515 if (it != m_Maps.end())
511 return it->second.get(); 516 return it->second.get();
512 517
513 if (!bRegister) 518 if (!bRegister)
514 return nullptr; 519 return nullptr;
515 520
516 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 521 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
517 int nFieldType = pWidget->GetFieldType(); 522 int nFieldType = pWidget->GetFieldType();
518 CFFL_FormFiller* pFormFiller; 523 CFFL_FormFiller* pFormFiller;
(...skipping 22 matching lines...) Expand all
541 break; 546 break;
542 } 547 }
543 548
544 if (!pFormFiller) 549 if (!pFormFiller)
545 return nullptr; 550 return nullptr;
546 551
547 m_Maps[pAnnot].reset(pFormFiller); 552 m_Maps[pAnnot].reset(pFormFiller);
548 return pFormFiller; 553 return pFormFiller;
549 } 554 }
550 555
551 void CFFL_IFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) { 556 void CFFL_InteractiveFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) {
552 if (pAnnot) { 557 if (pAnnot) {
553 UnRegisterFormFiller(pAnnot); 558 UnRegisterFormFiller(pAnnot);
554 } 559 }
555 } 560 }
556 561
557 void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) { 562 void CFFL_InteractiveFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) {
558 auto it = m_Maps.find(pAnnot); 563 auto it = m_Maps.find(pAnnot);
559 if (it == m_Maps.end()) 564 if (it == m_Maps.end())
560 return; 565 return;
561 566
562 m_Maps.erase(it); 567 m_Maps.erase(it);
563 } 568 }
564 569
565 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, 570 void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData,
566 FX_FLOAT fPopupMin, 571 FX_FLOAT fPopupMin,
567 FX_FLOAT fPopupMax, 572 FX_FLOAT fPopupMax,
568 int32_t& nRet, 573 int32_t& nRet,
569 FX_FLOAT& fPopupRet) { 574 FX_FLOAT& fPopupRet) {
570 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; 575 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
571 576
572 CFX_FloatRect rcPageView(0, 0, 0, 0); 577 CFX_FloatRect rcPageView(0, 0, 0, 0);
573 rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth(); 578 rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth();
574 rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); 579 rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight();
575 rcPageView.Normalize(); 580 rcPageView.Normalize();
576 581
577 CFX_FloatRect rcAnnot = pData->pWidget->GetRect(); 582 CFX_FloatRect rcAnnot = pData->pWidget->GetRect();
578 583
579 FX_FLOAT fTop = 0.0f; 584 FX_FLOAT fTop = 0.0f;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 fFactHeight = fBottom; 633 fFactHeight = fBottom;
629 bBottom = TRUE; 634 bBottom = TRUE;
630 } 635 }
631 } 636 }
632 } 637 }
633 638
634 nRet = bBottom ? 0 : 1; 639 nRet = bBottom ? 0 : 1;
635 fPopupRet = fFactHeight; 640 fPopupRet = fFactHeight;
636 } 641 }
637 642
638 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, 643 void CFFL_InteractiveFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget,
639 CPDFSDK_PageView* pPageView, 644 CPDFSDK_PageView* pPageView,
640 FX_BOOL& bRC, 645 FX_BOOL& bRC,
641 FX_BOOL& bExit, 646 FX_BOOL& bExit,
642 uint32_t nFlag) { 647 uint32_t nFlag) {
643 if (!m_bNotifying) { 648 if (!m_bNotifying) {
644 if (pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { 649 if (pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) {
645 m_bNotifying = TRUE; 650 m_bNotifying = TRUE;
646 pWidget->ClearAppModified(); 651 pWidget->ClearAppModified();
647 652
648 ASSERT(pPageView); 653 ASSERT(pPageView);
649 654
650 PDFSDK_FieldAction fa; 655 PDFSDK_FieldAction fa;
651 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); 656 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
652 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); 657 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
653 fa.bWillCommit = TRUE; 658 fa.bWillCommit = TRUE;
654 fa.bKeyDown = TRUE; 659 fa.bKeyDown = TRUE;
655 fa.bRC = TRUE; 660 fa.bRC = TRUE;
656 661
657 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); 662 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE);
658 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); 663 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa);
659 pFormFiller->SaveState(pPageView); 664 pFormFiller->SaveState(pPageView);
660 665
661 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); 666 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView);
662 667
663 bRC = fa.bRC; 668 bRC = fa.bRC;
664 m_bNotifying = FALSE; 669 m_bNotifying = FALSE;
665 } 670 }
666 } 671 }
667 } 672 }
668 673
669 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, 674 void CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Widget* pWidget,
670 CPDFSDK_PageView* pPageView, 675 CPDFSDK_PageView* pPageView,
671 FX_BOOL& bRC, 676 FX_BOOL& bRC,
672 FX_BOOL& bExit, 677 FX_BOOL& bExit,
673 uint32_t nFlag) { 678 uint32_t nFlag) {
674 if (!m_bNotifying) { 679 if (!m_bNotifying) {
675 if (pWidget->GetAAction(CPDF_AAction::Validate).GetDict()) { 680 if (pWidget->GetAAction(CPDF_AAction::Validate).GetDict()) {
676 m_bNotifying = TRUE; 681 m_bNotifying = TRUE;
677 pWidget->ClearAppModified(); 682 pWidget->ClearAppModified();
678 683
679 ASSERT(pPageView); 684 ASSERT(pPageView);
680 685
681 PDFSDK_FieldAction fa; 686 PDFSDK_FieldAction fa;
682 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); 687 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
683 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); 688 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
684 fa.bKeyDown = TRUE; 689 fa.bKeyDown = TRUE;
685 fa.bRC = TRUE; 690 fa.bRC = TRUE;
686 691
687 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); 692 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE);
688 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); 693 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa);
689 pFormFiller->SaveState(pPageView); 694 pFormFiller->SaveState(pPageView);
690 695
691 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); 696 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView);
692 697
693 bRC = fa.bRC; 698 bRC = fa.bRC;
694 m_bNotifying = FALSE; 699 m_bNotifying = FALSE;
695 } 700 }
696 } 701 }
697 } 702 }
698 703
699 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, 704 void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Widget* pWidget,
700 CPDFSDK_PageView* pPageView, 705 CPDFSDK_PageView* pPageView,
701 FX_BOOL& bExit, 706 FX_BOOL& bExit,
702 uint32_t nFlag) { 707 uint32_t nFlag) {
703 if (!m_bNotifying) { 708 if (!m_bNotifying) {
704 ASSERT(pWidget); 709 ASSERT(pWidget);
705 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 710 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
706 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); 711 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm();
707 pInterForm->OnCalculate(pWidget->GetFormField()); 712 pInterForm->OnCalculate(pWidget->GetFormField());
708 m_bNotifying = FALSE; 713 m_bNotifying = FALSE;
709 } 714 }
710 } 715 }
711 716
712 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, 717 void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Widget* pWidget,
713 CPDFSDK_PageView* pPageView, 718 CPDFSDK_PageView* pPageView,
714 FX_BOOL& bExit, 719 FX_BOOL& bExit,
715 uint32_t nFlag) { 720 uint32_t nFlag) {
716 if (!m_bNotifying) { 721 if (!m_bNotifying) {
717 ASSERT(pWidget); 722 ASSERT(pWidget);
718 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 723 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
719 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); 724 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm();
720 725
721 FX_BOOL bFormatted = FALSE; 726 FX_BOOL bFormatted = FALSE;
722 CFX_WideString sValue = 727 CFX_WideString sValue =
723 pInterForm->OnFormat(pWidget->GetFormField(), bFormatted); 728 pInterForm->OnFormat(pWidget->GetFormField(), bFormatted);
724 729
725 if (bExit) 730 if (bExit)
726 return; 731 return;
727 732
728 if (bFormatted) { 733 if (bFormatted) {
729 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), &sValue, TRUE); 734 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), &sValue, TRUE);
730 pInterForm->UpdateField(pWidget->GetFormField()); 735 pInterForm->UpdateField(pWidget->GetFormField());
731 } 736 }
732 737
733 m_bNotifying = FALSE; 738 m_bNotifying = FALSE;
734 } 739 }
735 } 740 }
736 741
737 #ifdef PDF_ENABLE_XFA 742 #ifdef PDF_ENABLE_XFA
738 void CFFL_IFormFiller::OnClick(CPDFSDK_Widget* pWidget, 743 void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Widget* pWidget,
739 CPDFSDK_PageView* pPageView, 744 CPDFSDK_PageView* pPageView,
740 FX_BOOL& bReset, 745 FX_BOOL& bReset,
741 FX_BOOL& bExit, 746 FX_BOOL& bExit,
742 uint32_t nFlag) { 747 uint32_t nFlag) {
743 if (!m_bNotifying) { 748 if (!m_bNotifying) {
744 if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) { 749 if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) {
745 m_bNotifying = TRUE; 750 m_bNotifying = TRUE;
746 int nAge = pWidget->GetAppearanceAge(); 751 int nAge = pWidget->GetAppearanceAge();
747 int nValueAge = pWidget->GetValueAge(); 752 int nValueAge = pWidget->GetValueAge();
748 753
749 PDFSDK_FieldAction fa; 754 PDFSDK_FieldAction fa;
750 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); 755 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
751 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); 756 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
752 757
(...skipping 10 matching lines...) Expand all
763 pFormFiller->ResetPDFWindow(pPageView, 768 pFormFiller->ResetPDFWindow(pPageView,
764 nValueAge == pWidget->GetValueAge()); 769 nValueAge == pWidget->GetValueAge());
765 } 770 }
766 771
767 bReset = TRUE; 772 bReset = TRUE;
768 } 773 }
769 } 774 }
770 } 775 }
771 } 776 }
772 777
773 void CFFL_IFormFiller::OnFull(CPDFSDK_Widget* pWidget, 778 void CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Widget* pWidget,
774 CPDFSDK_PageView* pPageView, 779 CPDFSDK_PageView* pPageView,
775 FX_BOOL& bReset, 780 FX_BOOL& bReset,
776 FX_BOOL& bExit, 781 FX_BOOL& bExit,
777 uint32_t nFlag) { 782 uint32_t nFlag) {
778 if (!m_bNotifying) { 783 if (!m_bNotifying) {
779 if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) { 784 if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) {
780 m_bNotifying = TRUE; 785 m_bNotifying = TRUE;
781 int nAge = pWidget->GetAppearanceAge(); 786 int nAge = pWidget->GetAppearanceAge();
782 int nValueAge = pWidget->GetValueAge(); 787 int nValueAge = pWidget->GetValueAge();
783 788
784 PDFSDK_FieldAction fa; 789 PDFSDK_FieldAction fa;
785 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); 790 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
786 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); 791 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
787 792
(...skipping 10 matching lines...) Expand all
798 pFormFiller->ResetPDFWindow(pPageView, 803 pFormFiller->ResetPDFWindow(pPageView,
799 nValueAge == pWidget->GetValueAge()); 804 nValueAge == pWidget->GetValueAge());
800 } 805 }
801 806
802 bReset = TRUE; 807 bReset = TRUE;
803 } 808 }
804 } 809 }
805 } 810 }
806 } 811 }
807 812
808 void CFFL_IFormFiller::OnPopupPreOpen(void* pPrivateData, 813 void CFFL_InteractiveFormFiller::OnPopupPreOpen(void* pPrivateData,
809 FX_BOOL& bExit, 814 FX_BOOL& bExit,
810 uint32_t nFlag) { 815 uint32_t nFlag) {
811 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; 816 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
812 ASSERT(pData); 817 ASSERT(pData);
813 ASSERT(pData->pWidget); 818 ASSERT(pData->pWidget);
814 819
815 FX_BOOL bTempReset = FALSE; 820 FX_BOOL bTempReset = FALSE;
816 FX_BOOL bTempExit = FALSE; 821 FX_BOOL bTempExit = FALSE;
817 OnPreOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag); 822 OnPreOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag);
818 823
819 if (bTempReset || bTempExit) { 824 if (bTempReset || bTempExit) {
820 bExit = TRUE; 825 bExit = TRUE;
821 } 826 }
822 } 827 }
823 828
824 void CFFL_IFormFiller::OnPopupPostOpen(void* pPrivateData, 829 void CFFL_InteractiveFormFiller::OnPopupPostOpen(void* pPrivateData,
825 FX_BOOL& bExit, 830 FX_BOOL& bExit,
826 uint32_t nFlag) { 831 uint32_t nFlag) {
827 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; 832 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
828 ASSERT(pData); 833 ASSERT(pData);
829 ASSERT(pData->pWidget); 834 ASSERT(pData->pWidget);
830 835
831 FX_BOOL bTempReset = FALSE; 836 FX_BOOL bTempReset = FALSE;
832 FX_BOOL bTempExit = FALSE; 837 FX_BOOL bTempExit = FALSE;
833 OnPostOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag); 838 OnPostOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag);
834 839
835 if (bTempReset || bTempExit) { 840 if (bTempReset || bTempExit) {
836 bExit = TRUE; 841 bExit = TRUE;
837 } 842 }
838 } 843 }
839 844
840 void CFFL_IFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget, 845 void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget,
841 CPDFSDK_PageView* pPageView, 846 CPDFSDK_PageView* pPageView,
842 FX_BOOL& bReset, 847 FX_BOOL& bReset,
843 FX_BOOL& bExit, 848 FX_BOOL& bExit,
844 uint32_t nFlag) { 849 uint32_t nFlag) {
845 if (!m_bNotifying) { 850 if (!m_bNotifying) {
846 if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) { 851 if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) {
847 m_bNotifying = TRUE; 852 m_bNotifying = TRUE;
848 int nAge = pWidget->GetAppearanceAge(); 853 int nAge = pWidget->GetAppearanceAge();
849 int nValueAge = pWidget->GetValueAge(); 854 int nValueAge = pWidget->GetValueAge();
850 855
851 PDFSDK_FieldAction fa; 856 PDFSDK_FieldAction fa;
852 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); 857 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
853 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); 858 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
854 859
(...skipping 10 matching lines...) Expand all
865 pFormFiller->ResetPDFWindow(pPageView, 870 pFormFiller->ResetPDFWindow(pPageView,
866 nValueAge == pWidget->GetValueAge()); 871 nValueAge == pWidget->GetValueAge());
867 } 872 }
868 873
869 bReset = TRUE; 874 bReset = TRUE;
870 } 875 }
871 } 876 }
872 } 877 }
873 } 878 }
874 879
875 void CFFL_IFormFiller::OnPostOpen(CPDFSDK_Widget* pWidget, 880 void CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Widget* pWidget,
876 CPDFSDK_PageView* pPageView, 881 CPDFSDK_PageView* pPageView,
877 FX_BOOL& bReset, 882 FX_BOOL& bReset,
878 FX_BOOL& bExit, 883 FX_BOOL& bExit,
879 uint32_t nFlag) { 884 uint32_t nFlag) {
880 if (!m_bNotifying) { 885 if (!m_bNotifying) {
881 if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) { 886 if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) {
882 m_bNotifying = TRUE; 887 m_bNotifying = TRUE;
883 int nAge = pWidget->GetAppearanceAge(); 888 int nAge = pWidget->GetAppearanceAge();
884 int nValueAge = pWidget->GetValueAge(); 889 int nValueAge = pWidget->GetValueAge();
885 890
886 PDFSDK_FieldAction fa; 891 PDFSDK_FieldAction fa;
887 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); 892 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag);
888 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); 893 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag);
889 894
(...skipping 11 matching lines...) Expand all
901 nValueAge == pWidget->GetValueAge()); 906 nValueAge == pWidget->GetValueAge());
902 } 907 }
903 908
904 bReset = TRUE; 909 bReset = TRUE;
905 } 910 }
906 } 911 }
907 } 912 }
908 } 913 }
909 #endif // PDF_ENABLE_XFA 914 #endif // PDF_ENABLE_XFA
910 915
911 FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, 916 FX_BOOL CFFL_InteractiveFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView,
912 CPDFSDK_Annot* pAnnot) { 917 CPDFSDK_Annot* pAnnot) {
913 if (pPageView) 918 if (pPageView)
914 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); 919 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot());
915 920
916 return FALSE; 921 return FALSE;
917 } 922 }
918 923
919 void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData, 924 void CFFL_InteractiveFormFiller::OnBeforeKeyStroke(
920 CFX_WideString& strChange, 925 void* pPrivateData,
921 const CFX_WideString& strChangeEx, 926 CFX_WideString& strChange,
922 int nSelStart, 927 const CFX_WideString& strChangeEx,
923 int nSelEnd, 928 int nSelStart,
924 FX_BOOL bKeyDown, 929 int nSelEnd,
925 FX_BOOL& bRC, 930 FX_BOOL bKeyDown,
926 FX_BOOL& bExit, 931 FX_BOOL& bRC,
927 uint32_t nFlag) { 932 FX_BOOL& bExit,
933 uint32_t nFlag) {
928 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; 934 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
929 ASSERT(pData->pWidget); 935 ASSERT(pData->pWidget);
930 936
931 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); 937 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE);
932 938
933 #ifdef PDF_ENABLE_XFA 939 #ifdef PDF_ENABLE_XFA
934 if (pFormFiller->IsFieldFull(pData->pPageView)) { 940 if (pFormFiller->IsFieldFull(pData->pPageView)) {
935 FX_BOOL bFullExit = FALSE; 941 FX_BOOL bFullExit = FALSE;
936 FX_BOOL bFullReset = FALSE; 942 FX_BOOL bFullReset = FALSE;
937 OnFull(pData->pWidget, pData->pPageView, bFullReset, bFullExit, nFlag); 943 OnFull(pData->pWidget, pData->pPageView, bFullReset, bFullExit, nFlag);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 bExit = TRUE; 1004 bExit = TRUE;
999 m_bNotifying = FALSE; 1005 m_bNotifying = FALSE;
1000 return; 1006 return;
1001 } 1007 }
1002 } 1008 }
1003 1009
1004 m_bNotifying = FALSE; 1010 m_bNotifying = FALSE;
1005 } 1011 }
1006 } 1012 }
1007 } 1013 }
OLDNEW
« no previous file with comments | « fpdfsdk/formfiller/cffl_interactiveformfiller.h ('k') | fpdfsdk/formfiller/cffl_listbox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698