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 "fpdfsdk/formfiller/cffl_iformfiller.h" | 7 #include "fpdfsdk/formfiller/cffl_iformfiller.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* pApp) | 30 CFFL_IFormFiller::CFFL_IFormFiller(CPDFSDK_Environment* pEnv) |
31 : m_pApp(pApp), m_bNotifying(FALSE) {} | 31 : m_pEnv(pEnv), m_bNotifying(FALSE) {} |
32 | 32 |
33 CFFL_IFormFiller::~CFFL_IFormFiller() {} | 33 CFFL_IFormFiller::~CFFL_IFormFiller() {} |
34 | 34 |
35 FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView, | 35 FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView, |
36 CPDFSDK_Annot* pAnnot, | 36 CPDFSDK_Annot* pAnnot, |
37 CFX_FloatPoint point) { | 37 CFX_FloatPoint point) { |
38 CFX_FloatRect rc = pAnnot->GetRect(); | 38 CFX_FloatRect rc = pAnnot->GetRect(); |
39 return rc.Contains(point.x, point.y); | 39 return rc.Contains(point.x, point.y); |
40 } | 40 } |
41 | 41 |
(...skipping 17 matching lines...) Expand all Loading... |
59 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 59 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
60 | 60 |
61 if (!IsVisible(pWidget)) | 61 if (!IsVisible(pWidget)) |
62 return; | 62 return; |
63 | 63 |
64 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 64 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
65 if (pFormFiller->IsValid()) { | 65 if (pFormFiller->IsValid()) { |
66 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device); | 66 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device); |
67 pAnnot->GetPDFPage(); | 67 pAnnot->GetPDFPage(); |
68 | 68 |
69 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); | 69 CPDFSDK_Document* pDocument = m_pEnv->GetSDKDocument(); |
70 if (pDocument->GetFocusAnnot() == pAnnot) { | 70 if (pDocument->GetFocusAnnot() == pAnnot) { |
71 CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView); | 71 CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView); |
72 if (!rcFocus.IsEmpty()) { | 72 if (!rcFocus.IsEmpty()) { |
73 CFX_PathData path; | 73 CFX_PathData path; |
74 path.SetPointCount(5); | 74 path.SetPointCount(5); |
75 path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); | 75 path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); |
76 path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); | 76 path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); |
77 path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); | 77 path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); |
78 path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); | 78 path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); |
79 path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); | 79 path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 if (pWidget->GetAAction(CPDF_AAction::CursorEnter).GetDict()) { | 131 if (pWidget->GetAAction(CPDF_AAction::CursorEnter).GetDict()) { |
132 m_bNotifying = TRUE; | 132 m_bNotifying = TRUE; |
133 | 133 |
134 int nValueAge = pWidget->GetValueAge(); | 134 int nValueAge = pWidget->GetValueAge(); |
135 | 135 |
136 pWidget->ClearAppModified(); | 136 pWidget->ClearAppModified(); |
137 | 137 |
138 ASSERT(pPageView); | 138 ASSERT(pPageView); |
139 | 139 |
140 PDFSDK_FieldAction fa; | 140 PDFSDK_FieldAction fa; |
141 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlag); | 141 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
142 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlag); | 142 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
143 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); | 143 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); |
144 m_bNotifying = FALSE; | 144 m_bNotifying = FALSE; |
145 | 145 |
146 if (pWidget->IsAppModified()) { | 146 if (pWidget->IsAppModified()) { |
147 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 147 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
148 pFormFiller->ResetPDFWindow(pPageView, | 148 pFormFiller->ResetPDFWindow(pPageView, |
149 pWidget->GetValueAge() == nValueAge); | 149 pWidget->GetValueAge() == nValueAge); |
150 } | 150 } |
151 } | 151 } |
152 } | 152 } |
(...skipping 13 matching lines...) Expand all Loading... |
166 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 166 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
167 if (pWidget->GetAAction(CPDF_AAction::CursorExit).GetDict()) { | 167 if (pWidget->GetAAction(CPDF_AAction::CursorExit).GetDict()) { |
168 m_bNotifying = TRUE; | 168 m_bNotifying = TRUE; |
169 pWidget->GetAppearanceAge(); | 169 pWidget->GetAppearanceAge(); |
170 int nValueAge = pWidget->GetValueAge(); | 170 int nValueAge = pWidget->GetValueAge(); |
171 pWidget->ClearAppModified(); | 171 pWidget->ClearAppModified(); |
172 | 172 |
173 ASSERT(pPageView); | 173 ASSERT(pPageView); |
174 | 174 |
175 PDFSDK_FieldAction fa; | 175 PDFSDK_FieldAction fa; |
176 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlag); | 176 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
177 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlag); | 177 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
178 | 178 |
179 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); | 179 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); |
180 m_bNotifying = FALSE; | 180 m_bNotifying = FALSE; |
181 | 181 |
182 if (pWidget->IsAppModified()) { | 182 if (pWidget->IsAppModified()) { |
183 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 183 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
184 pFormFiller->ResetPDFWindow(pPageView, | 184 pFormFiller->ResetPDFWindow(pPageView, |
185 nValueAge == pWidget->GetValueAge()); | 185 nValueAge == pWidget->GetValueAge()); |
186 } | 186 } |
187 } | 187 } |
(...skipping 16 matching lines...) Expand all Loading... |
204 if (Annot_HitTest(pPageView, pAnnot, point) && | 204 if (Annot_HitTest(pPageView, pAnnot, point) && |
205 pWidget->GetAAction(CPDF_AAction::ButtonDown).GetDict()) { | 205 pWidget->GetAAction(CPDF_AAction::ButtonDown).GetDict()) { |
206 m_bNotifying = TRUE; | 206 m_bNotifying = TRUE; |
207 pWidget->GetAppearanceAge(); | 207 pWidget->GetAppearanceAge(); |
208 int nValueAge = pWidget->GetValueAge(); | 208 int nValueAge = pWidget->GetValueAge(); |
209 pWidget->ClearAppModified(); | 209 pWidget->ClearAppModified(); |
210 | 210 |
211 ASSERT(pPageView); | 211 ASSERT(pPageView); |
212 | 212 |
213 PDFSDK_FieldAction fa; | 213 PDFSDK_FieldAction fa; |
214 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlags); | 214 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlags); |
215 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlags); | 215 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlags); |
216 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); | 216 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); |
217 m_bNotifying = FALSE; | 217 m_bNotifying = FALSE; |
218 | 218 |
219 if (!IsValidAnnot(pPageView, pAnnot)) | 219 if (!IsValidAnnot(pPageView, pAnnot)) |
220 return TRUE; | 220 return TRUE; |
221 | 221 |
222 if (pWidget->IsAppModified()) { | 222 if (pWidget->IsAppModified()) { |
223 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 223 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
224 pFormFiller->ResetPDFWindow(pPageView, | 224 pFormFiller->ResetPDFWindow(pPageView, |
225 nValueAge == pWidget->GetValueAge()); | 225 nValueAge == pWidget->GetValueAge()); |
226 } | 226 } |
227 } | 227 } |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 231 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
232 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); | 232 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); |
233 } | 233 } |
234 | 234 |
235 return FALSE; | 235 return FALSE; |
236 } | 236 } |
237 | 237 |
238 FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, | 238 FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, |
239 CPDFSDK_Annot* pAnnot, | 239 CPDFSDK_Annot* pAnnot, |
240 uint32_t nFlags, | 240 uint32_t nFlags, |
241 const CFX_FloatPoint& point) { | 241 const CFX_FloatPoint& point) { |
242 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 242 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
243 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 243 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
244 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); | 244 CPDFSDK_Document* pDocument = m_pEnv->GetSDKDocument(); |
245 | 245 |
246 switch (pWidget->GetFieldType()) { | 246 switch (pWidget->GetFieldType()) { |
247 case FIELDTYPE_PUSHBUTTON: | 247 case FIELDTYPE_PUSHBUTTON: |
248 case FIELDTYPE_CHECKBOX: | 248 case FIELDTYPE_CHECKBOX: |
249 case FIELDTYPE_RADIOBUTTON: | 249 case FIELDTYPE_RADIOBUTTON: |
250 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y)) | 250 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y)) |
251 pDocument->SetFocusAnnot(pAnnot); | 251 pDocument->SetFocusAnnot(pAnnot); |
252 break; | 252 break; |
253 default: | 253 default: |
254 pDocument->SetFocusAnnot(pAnnot); | 254 pDocument->SetFocusAnnot(pAnnot); |
(...skipping 30 matching lines...) Expand all Loading... |
285 | 285 |
286 if (!m_bNotifying) { | 286 if (!m_bNotifying) { |
287 if (pWidget->GetAAction(CPDF_AAction::ButtonUp).GetDict()) { | 287 if (pWidget->GetAAction(CPDF_AAction::ButtonUp).GetDict()) { |
288 m_bNotifying = TRUE; | 288 m_bNotifying = TRUE; |
289 int nAge = pWidget->GetAppearanceAge(); | 289 int nAge = pWidget->GetAppearanceAge(); |
290 int nValueAge = pWidget->GetValueAge(); | 290 int nValueAge = pWidget->GetValueAge(); |
291 | 291 |
292 ASSERT(pPageView); | 292 ASSERT(pPageView); |
293 | 293 |
294 PDFSDK_FieldAction fa; | 294 PDFSDK_FieldAction fa; |
295 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlag); | 295 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
296 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlag); | 296 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
297 | 297 |
298 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); | 298 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); |
299 m_bNotifying = FALSE; | 299 m_bNotifying = FALSE; |
300 | 300 |
301 if (!IsValidAnnot(pPageView, pWidget)) { | 301 if (!IsValidAnnot(pPageView, pWidget)) { |
302 bExit = TRUE; | 302 bExit = TRUE; |
303 return; | 303 return; |
304 } | 304 } |
305 | 305 |
306 if (nAge != pWidget->GetAppearanceAge()) { | 306 if (nAge != pWidget->GetAppearanceAge()) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 m_bNotifying = TRUE; | 419 m_bNotifying = TRUE; |
420 pWidget->GetAppearanceAge(); | 420 pWidget->GetAppearanceAge(); |
421 | 421 |
422 int nValueAge = pWidget->GetValueAge(); | 422 int nValueAge = pWidget->GetValueAge(); |
423 pWidget->ClearAppModified(); | 423 pWidget->ClearAppModified(); |
424 | 424 |
425 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 425 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
426 ASSERT(pPageView); | 426 ASSERT(pPageView); |
427 | 427 |
428 PDFSDK_FieldAction fa; | 428 PDFSDK_FieldAction fa; |
429 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlag); | 429 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
430 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlag); | 430 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
431 | 431 |
432 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); | 432 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); |
433 if (!pFormFiller) | 433 if (!pFormFiller) |
434 return FALSE; | 434 return FALSE; |
435 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); | 435 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); |
436 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); | 436 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); |
437 m_bNotifying = FALSE; | 437 m_bNotifying = FALSE; |
438 | 438 |
439 if (pWidget->IsAppModified()) { | 439 if (pWidget->IsAppModified()) { |
440 if (CFFL_FormFiller* pFiller = GetFormFiller(pWidget, FALSE)) { | 440 if (CFFL_FormFiller* pFiller = GetFormFiller(pWidget, FALSE)) { |
(...skipping 21 matching lines...) Expand all Loading... |
462 if (!m_bNotifying) { | 462 if (!m_bNotifying) { |
463 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 463 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
464 if (pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) { | 464 if (pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) { |
465 m_bNotifying = TRUE; | 465 m_bNotifying = TRUE; |
466 pWidget->ClearAppModified(); | 466 pWidget->ClearAppModified(); |
467 | 467 |
468 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | 468 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
469 ASSERT(pPageView); | 469 ASSERT(pPageView); |
470 | 470 |
471 PDFSDK_FieldAction fa; | 471 PDFSDK_FieldAction fa; |
472 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlag); | 472 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
473 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlag); | 473 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
474 | 474 |
475 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); | 475 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); |
476 | 476 |
477 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); | 477 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); |
478 m_bNotifying = FALSE; | 478 m_bNotifying = FALSE; |
479 } | 479 } |
480 } | 480 } |
481 } | 481 } |
482 | 482 |
483 return TRUE; | 483 return TRUE; |
(...skipping 27 matching lines...) Expand all Loading... |
511 return it->second.get(); | 511 return it->second.get(); |
512 | 512 |
513 if (!bRegister) | 513 if (!bRegister) |
514 return nullptr; | 514 return nullptr; |
515 | 515 |
516 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 516 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
517 int nFieldType = pWidget->GetFieldType(); | 517 int nFieldType = pWidget->GetFieldType(); |
518 CFFL_FormFiller* pFormFiller; | 518 CFFL_FormFiller* pFormFiller; |
519 switch (nFieldType) { | 519 switch (nFieldType) { |
520 case FIELDTYPE_PUSHBUTTON: | 520 case FIELDTYPE_PUSHBUTTON: |
521 pFormFiller = new CFFL_PushButton(m_pApp, pWidget); | 521 pFormFiller = new CFFL_PushButton(m_pEnv, pWidget); |
522 break; | 522 break; |
523 case FIELDTYPE_CHECKBOX: | 523 case FIELDTYPE_CHECKBOX: |
524 pFormFiller = new CFFL_CheckBox(m_pApp, pWidget); | 524 pFormFiller = new CFFL_CheckBox(m_pEnv, pWidget); |
525 break; | 525 break; |
526 case FIELDTYPE_RADIOBUTTON: | 526 case FIELDTYPE_RADIOBUTTON: |
527 pFormFiller = new CFFL_RadioButton(m_pApp, pWidget); | 527 pFormFiller = new CFFL_RadioButton(m_pEnv, pWidget); |
528 break; | 528 break; |
529 case FIELDTYPE_TEXTFIELD: | 529 case FIELDTYPE_TEXTFIELD: |
530 pFormFiller = new CFFL_TextField(m_pApp, pWidget); | 530 pFormFiller = new CFFL_TextField(m_pEnv, pWidget); |
531 break; | 531 break; |
532 case FIELDTYPE_LISTBOX: | 532 case FIELDTYPE_LISTBOX: |
533 pFormFiller = new CFFL_ListBox(m_pApp, pWidget); | 533 pFormFiller = new CFFL_ListBox(m_pEnv, pWidget); |
534 break; | 534 break; |
535 case FIELDTYPE_COMBOBOX: | 535 case FIELDTYPE_COMBOBOX: |
536 pFormFiller = new CFFL_ComboBox(m_pApp, pWidget); | 536 pFormFiller = new CFFL_ComboBox(m_pEnv, pWidget); |
537 break; | 537 break; |
538 case FIELDTYPE_UNKNOWN: | 538 case FIELDTYPE_UNKNOWN: |
539 default: | 539 default: |
540 pFormFiller = nullptr; | 540 pFormFiller = nullptr; |
541 break; | 541 break; |
542 } | 542 } |
543 | 543 |
544 if (!pFormFiller) | 544 if (!pFormFiller) |
545 return nullptr; | 545 return nullptr; |
546 | 546 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 FX_BOOL& bExit, | 641 FX_BOOL& bExit, |
642 uint32_t nFlag) { | 642 uint32_t nFlag) { |
643 if (!m_bNotifying) { | 643 if (!m_bNotifying) { |
644 if (pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { | 644 if (pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { |
645 m_bNotifying = TRUE; | 645 m_bNotifying = TRUE; |
646 pWidget->ClearAppModified(); | 646 pWidget->ClearAppModified(); |
647 | 647 |
648 ASSERT(pPageView); | 648 ASSERT(pPageView); |
649 | 649 |
650 PDFSDK_FieldAction fa; | 650 PDFSDK_FieldAction fa; |
651 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlag); | 651 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
652 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlag); | 652 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
653 fa.bWillCommit = TRUE; | 653 fa.bWillCommit = TRUE; |
654 fa.bKeyDown = TRUE; | 654 fa.bKeyDown = TRUE; |
655 fa.bRC = TRUE; | 655 fa.bRC = TRUE; |
656 | 656 |
657 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); | 657 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
658 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); | 658 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); |
659 pFormFiller->SaveState(pPageView); | 659 pFormFiller->SaveState(pPageView); |
660 | 660 |
661 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); | 661 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); |
662 | 662 |
663 bRC = fa.bRC; | 663 bRC = fa.bRC; |
664 m_bNotifying = FALSE; | 664 m_bNotifying = FALSE; |
665 } | 665 } |
666 } | 666 } |
667 } | 667 } |
668 | 668 |
669 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, | 669 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, |
670 CPDFSDK_PageView* pPageView, | 670 CPDFSDK_PageView* pPageView, |
671 FX_BOOL& bRC, | 671 FX_BOOL& bRC, |
672 FX_BOOL& bExit, | 672 FX_BOOL& bExit, |
673 uint32_t nFlag) { | 673 uint32_t nFlag) { |
674 if (!m_bNotifying) { | 674 if (!m_bNotifying) { |
675 if (pWidget->GetAAction(CPDF_AAction::Validate).GetDict()) { | 675 if (pWidget->GetAAction(CPDF_AAction::Validate).GetDict()) { |
676 m_bNotifying = TRUE; | 676 m_bNotifying = TRUE; |
677 pWidget->ClearAppModified(); | 677 pWidget->ClearAppModified(); |
678 | 678 |
679 ASSERT(pPageView); | 679 ASSERT(pPageView); |
680 | 680 |
681 PDFSDK_FieldAction fa; | 681 PDFSDK_FieldAction fa; |
682 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlag); | 682 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
683 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlag); | 683 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
684 fa.bKeyDown = TRUE; | 684 fa.bKeyDown = TRUE; |
685 fa.bRC = TRUE; | 685 fa.bRC = TRUE; |
686 | 686 |
687 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); | 687 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
688 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); | 688 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); |
689 pFormFiller->SaveState(pPageView); | 689 pFormFiller->SaveState(pPageView); |
690 | 690 |
691 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); | 691 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); |
692 | 692 |
693 bRC = fa.bRC; | 693 bRC = fa.bRC; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 FX_BOOL& bReset, | 740 FX_BOOL& bReset, |
741 FX_BOOL& bExit, | 741 FX_BOOL& bExit, |
742 uint32_t nFlag) { | 742 uint32_t nFlag) { |
743 if (!m_bNotifying) { | 743 if (!m_bNotifying) { |
744 if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) { | 744 if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) { |
745 m_bNotifying = TRUE; | 745 m_bNotifying = TRUE; |
746 int nAge = pWidget->GetAppearanceAge(); | 746 int nAge = pWidget->GetAppearanceAge(); |
747 int nValueAge = pWidget->GetValueAge(); | 747 int nValueAge = pWidget->GetValueAge(); |
748 | 748 |
749 PDFSDK_FieldAction fa; | 749 PDFSDK_FieldAction fa; |
750 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlag); | 750 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
751 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlag); | 751 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
752 | 752 |
753 pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); | 753 pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); |
754 m_bNotifying = FALSE; | 754 m_bNotifying = FALSE; |
755 | 755 |
756 if (!IsValidAnnot(pPageView, pWidget)) { | 756 if (!IsValidAnnot(pPageView, pWidget)) { |
757 bExit = TRUE; | 757 bExit = TRUE; |
758 return; | 758 return; |
759 } | 759 } |
760 | 760 |
761 if (nAge != pWidget->GetAppearanceAge()) { | 761 if (nAge != pWidget->GetAppearanceAge()) { |
(...skipping 13 matching lines...) Expand all Loading... |
775 FX_BOOL& bReset, | 775 FX_BOOL& bReset, |
776 FX_BOOL& bExit, | 776 FX_BOOL& bExit, |
777 uint32_t nFlag) { | 777 uint32_t nFlag) { |
778 if (!m_bNotifying) { | 778 if (!m_bNotifying) { |
779 if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) { | 779 if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) { |
780 m_bNotifying = TRUE; | 780 m_bNotifying = TRUE; |
781 int nAge = pWidget->GetAppearanceAge(); | 781 int nAge = pWidget->GetAppearanceAge(); |
782 int nValueAge = pWidget->GetValueAge(); | 782 int nValueAge = pWidget->GetValueAge(); |
783 | 783 |
784 PDFSDK_FieldAction fa; | 784 PDFSDK_FieldAction fa; |
785 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlag); | 785 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
786 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlag); | 786 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
787 | 787 |
788 pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); | 788 pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); |
789 m_bNotifying = FALSE; | 789 m_bNotifying = FALSE; |
790 | 790 |
791 if (!IsValidAnnot(pPageView, pWidget)) { | 791 if (!IsValidAnnot(pPageView, pWidget)) { |
792 bExit = TRUE; | 792 bExit = TRUE; |
793 return; | 793 return; |
794 } | 794 } |
795 | 795 |
796 if (nAge != pWidget->GetAppearanceAge()) { | 796 if (nAge != pWidget->GetAppearanceAge()) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 FX_BOOL& bReset, | 842 FX_BOOL& bReset, |
843 FX_BOOL& bExit, | 843 FX_BOOL& bExit, |
844 uint32_t nFlag) { | 844 uint32_t nFlag) { |
845 if (!m_bNotifying) { | 845 if (!m_bNotifying) { |
846 if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) { | 846 if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) { |
847 m_bNotifying = TRUE; | 847 m_bNotifying = TRUE; |
848 int nAge = pWidget->GetAppearanceAge(); | 848 int nAge = pWidget->GetAppearanceAge(); |
849 int nValueAge = pWidget->GetValueAge(); | 849 int nValueAge = pWidget->GetValueAge(); |
850 | 850 |
851 PDFSDK_FieldAction fa; | 851 PDFSDK_FieldAction fa; |
852 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlag); | 852 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
853 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlag); | 853 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
854 | 854 |
855 pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView); | 855 pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView); |
856 m_bNotifying = FALSE; | 856 m_bNotifying = FALSE; |
857 | 857 |
858 if (!IsValidAnnot(pPageView, pWidget)) { | 858 if (!IsValidAnnot(pPageView, pWidget)) { |
859 bExit = TRUE; | 859 bExit = TRUE; |
860 return; | 860 return; |
861 } | 861 } |
862 | 862 |
863 if (nAge != pWidget->GetAppearanceAge()) { | 863 if (nAge != pWidget->GetAppearanceAge()) { |
(...skipping 13 matching lines...) Expand all Loading... |
877 FX_BOOL& bReset, | 877 FX_BOOL& bReset, |
878 FX_BOOL& bExit, | 878 FX_BOOL& bExit, |
879 uint32_t nFlag) { | 879 uint32_t nFlag) { |
880 if (!m_bNotifying) { | 880 if (!m_bNotifying) { |
881 if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) { | 881 if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) { |
882 m_bNotifying = TRUE; | 882 m_bNotifying = TRUE; |
883 int nAge = pWidget->GetAppearanceAge(); | 883 int nAge = pWidget->GetAppearanceAge(); |
884 int nValueAge = pWidget->GetValueAge(); | 884 int nValueAge = pWidget->GetValueAge(); |
885 | 885 |
886 PDFSDK_FieldAction fa; | 886 PDFSDK_FieldAction fa; |
887 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlag); | 887 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
888 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlag); | 888 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
889 | 889 |
890 pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView); | 890 pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView); |
891 m_bNotifying = FALSE; | 891 m_bNotifying = FALSE; |
892 | 892 |
893 if (!IsValidAnnot(pPageView, pWidget)) { | 893 if (!IsValidAnnot(pPageView, pWidget)) { |
894 bExit = TRUE; | 894 bExit = TRUE; |
895 return; | 895 return; |
896 } | 896 } |
897 | 897 |
898 if (nAge != pWidget->GetAppearanceAge()) { | 898 if (nAge != pWidget->GetAppearanceAge()) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 | 945 |
946 if (!m_bNotifying) { | 946 if (!m_bNotifying) { |
947 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { | 947 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { |
948 m_bNotifying = TRUE; | 948 m_bNotifying = TRUE; |
949 int nAge = pData->pWidget->GetAppearanceAge(); | 949 int nAge = pData->pWidget->GetAppearanceAge(); |
950 int nValueAge = pData->pWidget->GetValueAge(); | 950 int nValueAge = pData->pWidget->GetValueAge(); |
951 | 951 |
952 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); | 952 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); |
953 | 953 |
954 PDFSDK_FieldAction fa; | 954 PDFSDK_FieldAction fa; |
955 fa.bModifier = m_pApp->IsCTRLKeyDown(nFlag); | 955 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
956 fa.bShift = m_pApp->IsSHIFTKeyDown(nFlag); | 956 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
957 fa.sChange = strChange; | 957 fa.sChange = strChange; |
958 fa.sChangeEx = strChangeEx; | 958 fa.sChangeEx = strChangeEx; |
959 fa.bKeyDown = bKeyDown; | 959 fa.bKeyDown = bKeyDown; |
960 fa.bWillCommit = FALSE; | 960 fa.bWillCommit = FALSE; |
961 fa.bRC = TRUE; | 961 fa.bRC = TRUE; |
962 fa.nSelStart = nSelStart; | 962 fa.nSelStart = nSelStart; |
963 fa.nSelEnd = nSelEnd; | 963 fa.nSelEnd = nSelEnd; |
964 | 964 |
965 pFormFiller->GetActionData(pData->pPageView, CPDF_AAction::KeyStroke, fa); | 965 pFormFiller->GetActionData(pData->pPageView, CPDF_AAction::KeyStroke, fa); |
966 pFormFiller->SaveState(pData->pPageView); | 966 pFormFiller->SaveState(pData->pPageView); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 bExit = TRUE; | 998 bExit = TRUE; |
999 m_bNotifying = FALSE; | 999 m_bNotifying = FALSE; |
1000 return; | 1000 return; |
1001 } | 1001 } |
1002 } | 1002 } |
1003 | 1003 |
1004 m_bNotifying = FALSE; | 1004 m_bNotifying = FALSE; |
1005 } | 1005 } |
1006 } | 1006 } |
1007 } | 1007 } |
OLD | NEW |