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_interactiveformfiller.h" | 7 #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" |
8 | 8 |
9 #include "core/fpdfapi/page/cpdf_page.h" | 9 #include "core/fpdfapi/page/cpdf_page.h" |
10 #include "core/fpdfapi/parser/cpdf_document.h" | 10 #include "core/fpdfapi/parser/cpdf_document.h" |
11 #include "core/fxge/cfx_graphstatedata.h" | 11 #include "core/fxge/cfx_graphstatedata.h" |
12 #include "core/fxge/cfx_pathdata.h" | 12 #include "core/fxge/cfx_pathdata.h" |
13 #include "core/fxge/cfx_renderdevice.h" | 13 #include "core/fxge/cfx_renderdevice.h" |
14 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" | 14 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
15 #include "fpdfsdk/cpdfsdk_interform.h" | 15 #include "fpdfsdk/cpdfsdk_interform.h" |
16 #include "fpdfsdk/cpdfsdk_pageview.h" | 16 #include "fpdfsdk/cpdfsdk_pageview.h" |
17 #include "fpdfsdk/cpdfsdk_widget.h" | 17 #include "fpdfsdk/cpdfsdk_widget.h" |
18 #include "fpdfsdk/formfiller/cffl_checkbox.h" | 18 #include "fpdfsdk/formfiller/cffl_checkbox.h" |
19 #include "fpdfsdk/formfiller/cffl_combobox.h" | 19 #include "fpdfsdk/formfiller/cffl_combobox.h" |
20 #include "fpdfsdk/formfiller/cffl_formfiller.h" | 20 #include "fpdfsdk/formfiller/cffl_formfiller.h" |
21 #include "fpdfsdk/formfiller/cffl_listbox.h" | 21 #include "fpdfsdk/formfiller/cffl_listbox.h" |
22 #include "fpdfsdk/formfiller/cffl_pushbutton.h" | 22 #include "fpdfsdk/formfiller/cffl_pushbutton.h" |
23 #include "fpdfsdk/formfiller/cffl_radiobutton.h" | 23 #include "fpdfsdk/formfiller/cffl_radiobutton.h" |
24 #include "fpdfsdk/formfiller/cffl_textfield.h" | 24 #include "fpdfsdk/formfiller/cffl_textfield.h" |
25 #include "fpdfsdk/pdfwindow/PWL_Utils.h" | 25 #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
26 | 26 |
27 #define FFL_MAXLISTBOXHEIGHT 140.0f | 27 #define FFL_MAXLISTBOXHEIGHT 140.0f |
28 | 28 |
29 CFFL_InteractiveFormFiller::CFFL_InteractiveFormFiller( | 29 CFFL_InteractiveFormFiller::CFFL_InteractiveFormFiller( |
30 CPDFSDK_FormFillEnvironment* pEnv) | 30 CPDFSDK_FormFillEnvironment* pFormFillEnv) |
31 : m_pEnv(pEnv), m_bNotifying(FALSE) {} | 31 : m_pFormFillEnv(pFormFillEnv), m_bNotifying(FALSE) {} |
32 | 32 |
33 CFFL_InteractiveFormFiller::~CFFL_InteractiveFormFiller() {} | 33 CFFL_InteractiveFormFiller::~CFFL_InteractiveFormFiller() {} |
34 | 34 |
35 FX_BOOL CFFL_InteractiveFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView, | 35 FX_BOOL CFFL_InteractiveFormFiller::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 if (m_pEnv->GetFocusAnnot() == pAnnot) { | 69 if (m_pFormFillEnv->GetFocusAnnot() == pAnnot) { |
70 CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView); | 70 CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView); |
71 if (!rcFocus.IsEmpty()) { | 71 if (!rcFocus.IsEmpty()) { |
72 CFX_PathData path; | 72 CFX_PathData path; |
73 path.SetPointCount(5); | 73 path.SetPointCount(5); |
74 path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); | 74 path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); |
75 path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); | 75 path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); |
76 path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); | 76 path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); |
77 path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); | 77 path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); |
78 path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); | 78 path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); |
79 | 79 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (!m_bNotifying) { | 128 if (!m_bNotifying) { |
129 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); | 129 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
130 if (pWidget->GetAAction(CPDF_AAction::CursorEnter).GetDict()) { | 130 if (pWidget->GetAAction(CPDF_AAction::CursorEnter).GetDict()) { |
131 m_bNotifying = TRUE; | 131 m_bNotifying = TRUE; |
132 | 132 |
133 int nValueAge = pWidget->GetValueAge(); | 133 int nValueAge = pWidget->GetValueAge(); |
134 pWidget->ClearAppModified(); | 134 pWidget->ClearAppModified(); |
135 ASSERT(pPageView); | 135 ASSERT(pPageView); |
136 | 136 |
137 PDFSDK_FieldAction fa; | 137 PDFSDK_FieldAction fa; |
138 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 138 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); |
139 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 139 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); |
140 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); | 140 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); |
141 m_bNotifying = FALSE; | 141 m_bNotifying = FALSE; |
142 if (!(*pAnnot)) | 142 if (!(*pAnnot)) |
143 return; | 143 return; |
144 | 144 |
145 if (pWidget->IsAppModified()) { | 145 if (pWidget->IsAppModified()) { |
146 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 146 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
147 pFormFiller->ResetPDFWindow(pPageView, | 147 pFormFiller->ResetPDFWindow(pPageView, |
148 pWidget->GetValueAge() == nValueAge); | 148 pWidget->GetValueAge() == nValueAge); |
149 } | 149 } |
(...skipping 12 matching lines...) Expand all Loading... |
162 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); | 162 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
163 if (pWidget->GetAAction(CPDF_AAction::CursorExit).GetDict()) { | 163 if (pWidget->GetAAction(CPDF_AAction::CursorExit).GetDict()) { |
164 m_bNotifying = TRUE; | 164 m_bNotifying = TRUE; |
165 pWidget->GetAppearanceAge(); | 165 pWidget->GetAppearanceAge(); |
166 | 166 |
167 int nValueAge = pWidget->GetValueAge(); | 167 int nValueAge = pWidget->GetValueAge(); |
168 pWidget->ClearAppModified(); | 168 pWidget->ClearAppModified(); |
169 ASSERT(pPageView); | 169 ASSERT(pPageView); |
170 | 170 |
171 PDFSDK_FieldAction fa; | 171 PDFSDK_FieldAction fa; |
172 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 172 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); |
173 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 173 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); |
174 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); | 174 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); |
175 m_bNotifying = FALSE; | 175 m_bNotifying = FALSE; |
176 if (!(*pAnnot)) | 176 if (!(*pAnnot)) |
177 return; | 177 return; |
178 | 178 |
179 if (pWidget->IsAppModified()) { | 179 if (pWidget->IsAppModified()) { |
180 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 180 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
181 pFormFiller->ResetPDFWindow(pPageView, | 181 pFormFiller->ResetPDFWindow(pPageView, |
182 nValueAge == pWidget->GetValueAge()); | 182 nValueAge == pWidget->GetValueAge()); |
183 } | 183 } |
(...skipping 15 matching lines...) Expand all Loading... |
199 if (Annot_HitTest(pPageView, pAnnot->Get(), point) && | 199 if (Annot_HitTest(pPageView, pAnnot->Get(), point) && |
200 pWidget->GetAAction(CPDF_AAction::ButtonDown).GetDict()) { | 200 pWidget->GetAAction(CPDF_AAction::ButtonDown).GetDict()) { |
201 m_bNotifying = TRUE; | 201 m_bNotifying = TRUE; |
202 pWidget->GetAppearanceAge(); | 202 pWidget->GetAppearanceAge(); |
203 | 203 |
204 int nValueAge = pWidget->GetValueAge(); | 204 int nValueAge = pWidget->GetValueAge(); |
205 pWidget->ClearAppModified(); | 205 pWidget->ClearAppModified(); |
206 ASSERT(pPageView); | 206 ASSERT(pPageView); |
207 | 207 |
208 PDFSDK_FieldAction fa; | 208 PDFSDK_FieldAction fa; |
209 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlags); | 209 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlags); |
210 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlags); | 210 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlags); |
211 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); | 211 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); |
212 m_bNotifying = FALSE; | 212 m_bNotifying = FALSE; |
213 if (!(*pAnnot)) | 213 if (!(*pAnnot)) |
214 return TRUE; | 214 return TRUE; |
215 | 215 |
216 if (!IsValidAnnot(pPageView, pAnnot->Get())) | 216 if (!IsValidAnnot(pPageView, pAnnot->Get())) |
217 return TRUE; | 217 return TRUE; |
218 | 218 |
219 if (pWidget->IsAppModified()) { | 219 if (pWidget->IsAppModified()) { |
220 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 220 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
(...skipping 16 matching lines...) Expand all Loading... |
237 const CFX_FloatPoint& point) { | 237 const CFX_FloatPoint& point) { |
238 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 238 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
239 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); | 239 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
240 | 240 |
241 switch (pWidget->GetFieldType()) { | 241 switch (pWidget->GetFieldType()) { |
242 case FIELDTYPE_PUSHBUTTON: | 242 case FIELDTYPE_PUSHBUTTON: |
243 case FIELDTYPE_CHECKBOX: | 243 case FIELDTYPE_CHECKBOX: |
244 case FIELDTYPE_RADIOBUTTON: | 244 case FIELDTYPE_RADIOBUTTON: |
245 if (GetViewBBox(pPageView, pAnnot->Get()) | 245 if (GetViewBBox(pPageView, pAnnot->Get()) |
246 .Contains((int)point.x, (int)point.y)) | 246 .Contains((int)point.x, (int)point.y)) |
247 m_pEnv->SetFocusAnnot(pAnnot); | 247 m_pFormFillEnv->SetFocusAnnot(pAnnot); |
248 break; | 248 break; |
249 default: | 249 default: |
250 m_pEnv->SetFocusAnnot(pAnnot); | 250 m_pFormFillEnv->SetFocusAnnot(pAnnot); |
251 break; | 251 break; |
252 } | 252 } |
253 | 253 |
254 FX_BOOL bRet = FALSE; | 254 FX_BOOL bRet = FALSE; |
255 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE)) | 255 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE)) |
256 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot->Get(), nFlags, point); | 256 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot->Get(), nFlags, point); |
257 | 257 |
258 if (m_pEnv->GetFocusAnnot() == pAnnot->Get()) { | 258 if (m_pFormFillEnv->GetFocusAnnot() == pAnnot->Get()) { |
259 FX_BOOL bExit = FALSE; | 259 FX_BOOL bExit = FALSE; |
260 FX_BOOL bReset = FALSE; | 260 FX_BOOL bReset = FALSE; |
261 OnButtonUp(pAnnot, pPageView, bReset, bExit, nFlags); | 261 OnButtonUp(pAnnot, pPageView, bReset, bExit, nFlags); |
262 if (!pAnnot || bExit) | 262 if (!pAnnot || bExit) |
263 return TRUE; | 263 return TRUE; |
264 #ifdef PDF_ENABLE_XFA | 264 #ifdef PDF_ENABLE_XFA |
265 OnClick(pWidget, pPageView, bReset, bExit, nFlags); | 265 OnClick(pWidget, pPageView, bReset, bExit, nFlags); |
266 if (!pAnnot || bExit) | 266 if (!pAnnot || bExit) |
267 return TRUE; | 267 return TRUE; |
268 #endif // PDF_ENABLE_XFA | 268 #endif // PDF_ENABLE_XFA |
269 } | 269 } |
270 return bRet; | 270 return bRet; |
271 } | 271 } |
272 | 272 |
273 void CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, | 273 void CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, |
274 CPDFSDK_PageView* pPageView, | 274 CPDFSDK_PageView* pPageView, |
275 FX_BOOL& bReset, | 275 FX_BOOL& bReset, |
276 FX_BOOL& bExit, | 276 FX_BOOL& bExit, |
277 uint32_t nFlag) { | 277 uint32_t nFlag) { |
278 if (!m_bNotifying) { | 278 if (!m_bNotifying) { |
279 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); | 279 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
280 if (pWidget->GetAAction(CPDF_AAction::ButtonUp).GetDict()) { | 280 if (pWidget->GetAAction(CPDF_AAction::ButtonUp).GetDict()) { |
281 m_bNotifying = TRUE; | 281 m_bNotifying = TRUE; |
282 | 282 |
283 int nAge = pWidget->GetAppearanceAge(); | 283 int nAge = pWidget->GetAppearanceAge(); |
284 int nValueAge = pWidget->GetValueAge(); | 284 int nValueAge = pWidget->GetValueAge(); |
285 ASSERT(pPageView); | 285 ASSERT(pPageView); |
286 | 286 |
287 PDFSDK_FieldAction fa; | 287 PDFSDK_FieldAction fa; |
288 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 288 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); |
289 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 289 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); |
290 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); | 290 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); |
291 m_bNotifying = FALSE; | 291 m_bNotifying = FALSE; |
292 if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) { | 292 if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) { |
293 bExit = TRUE; | 293 bExit = TRUE; |
294 return; | 294 return; |
295 } | 295 } |
296 if (nAge != pWidget->GetAppearanceAge()) { | 296 if (nAge != pWidget->GetAppearanceAge()) { |
297 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 297 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
298 pFormFiller->ResetPDFWindow(pPageView, | 298 pFormFiller->ResetPDFWindow(pPageView, |
299 nValueAge == pWidget->GetValueAge()); | 299 nValueAge == pWidget->GetValueAge()); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 pWidget->ClearAppModified(); | 403 pWidget->ClearAppModified(); |
404 | 404 |
405 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); | 405 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); |
406 if (!pFormFiller) | 406 if (!pFormFiller) |
407 return FALSE; | 407 return FALSE; |
408 | 408 |
409 CPDFSDK_PageView* pPageView = (*pAnnot)->GetPageView(); | 409 CPDFSDK_PageView* pPageView = (*pAnnot)->GetPageView(); |
410 ASSERT(pPageView); | 410 ASSERT(pPageView); |
411 | 411 |
412 PDFSDK_FieldAction fa; | 412 PDFSDK_FieldAction fa; |
413 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 413 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); |
414 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 414 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); |
415 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); | 415 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); |
416 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); | 416 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); |
417 m_bNotifying = FALSE; | 417 m_bNotifying = FALSE; |
418 if (!(*pAnnot)) | 418 if (!(*pAnnot)) |
419 return FALSE; | 419 return FALSE; |
420 | 420 |
421 if (pWidget->IsAppModified()) { | 421 if (pWidget->IsAppModified()) { |
422 if (CFFL_FormFiller* pFiller = GetFormFiller(pWidget, FALSE)) { | 422 if (CFFL_FormFiller* pFiller = GetFormFiller(pWidget, FALSE)) { |
423 pFiller->ResetPDFWindow(pPageView, | 423 pFiller->ResetPDFWindow(pPageView, |
424 nValueAge == pWidget->GetValueAge()); | 424 nValueAge == pWidget->GetValueAge()); |
(...skipping 20 matching lines...) Expand all Loading... |
445 if (!m_bNotifying) { | 445 if (!m_bNotifying) { |
446 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); | 446 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
447 if (pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) { | 447 if (pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) { |
448 m_bNotifying = TRUE; | 448 m_bNotifying = TRUE; |
449 pWidget->ClearAppModified(); | 449 pWidget->ClearAppModified(); |
450 | 450 |
451 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | 451 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
452 ASSERT(pPageView); | 452 ASSERT(pPageView); |
453 | 453 |
454 PDFSDK_FieldAction fa; | 454 PDFSDK_FieldAction fa; |
455 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 455 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); |
456 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 456 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); |
457 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); | 457 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); |
458 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); | 458 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); |
459 m_bNotifying = FALSE; | 459 m_bNotifying = FALSE; |
460 if (!(*pAnnot)) | 460 if (!(*pAnnot)) |
461 return FALSE; | 461 return FALSE; |
462 } | 462 } |
463 } | 463 } |
464 } | 464 } |
465 return TRUE; | 465 return TRUE; |
466 } | 466 } |
(...skipping 27 matching lines...) Expand all Loading... |
494 return it->second.get(); | 494 return it->second.get(); |
495 | 495 |
496 if (!bRegister) | 496 if (!bRegister) |
497 return nullptr; | 497 return nullptr; |
498 | 498 |
499 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 499 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
500 int nFieldType = pWidget->GetFieldType(); | 500 int nFieldType = pWidget->GetFieldType(); |
501 CFFL_FormFiller* pFormFiller; | 501 CFFL_FormFiller* pFormFiller; |
502 switch (nFieldType) { | 502 switch (nFieldType) { |
503 case FIELDTYPE_PUSHBUTTON: | 503 case FIELDTYPE_PUSHBUTTON: |
504 pFormFiller = new CFFL_PushButton(m_pEnv, pWidget); | 504 pFormFiller = new CFFL_PushButton(m_pFormFillEnv, pWidget); |
505 break; | 505 break; |
506 case FIELDTYPE_CHECKBOX: | 506 case FIELDTYPE_CHECKBOX: |
507 pFormFiller = new CFFL_CheckBox(m_pEnv, pWidget); | 507 pFormFiller = new CFFL_CheckBox(m_pFormFillEnv, pWidget); |
508 break; | 508 break; |
509 case FIELDTYPE_RADIOBUTTON: | 509 case FIELDTYPE_RADIOBUTTON: |
510 pFormFiller = new CFFL_RadioButton(m_pEnv, pWidget); | 510 pFormFiller = new CFFL_RadioButton(m_pFormFillEnv, pWidget); |
511 break; | 511 break; |
512 case FIELDTYPE_TEXTFIELD: | 512 case FIELDTYPE_TEXTFIELD: |
513 pFormFiller = new CFFL_TextField(m_pEnv, pWidget); | 513 pFormFiller = new CFFL_TextField(m_pFormFillEnv, pWidget); |
514 break; | 514 break; |
515 case FIELDTYPE_LISTBOX: | 515 case FIELDTYPE_LISTBOX: |
516 pFormFiller = new CFFL_ListBox(m_pEnv, pWidget); | 516 pFormFiller = new CFFL_ListBox(m_pFormFillEnv, pWidget); |
517 break; | 517 break; |
518 case FIELDTYPE_COMBOBOX: | 518 case FIELDTYPE_COMBOBOX: |
519 pFormFiller = new CFFL_ComboBox(m_pEnv, pWidget); | 519 pFormFiller = new CFFL_ComboBox(m_pFormFillEnv, pWidget); |
520 break; | 520 break; |
521 case FIELDTYPE_UNKNOWN: | 521 case FIELDTYPE_UNKNOWN: |
522 default: | 522 default: |
523 pFormFiller = nullptr; | 523 pFormFiller = nullptr; |
524 break; | 524 break; |
525 } | 525 } |
526 | 526 |
527 if (!pFormFiller) | 527 if (!pFormFiller) |
528 return nullptr; | 528 return nullptr; |
529 | 529 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 FX_BOOL& bExit, | 625 FX_BOOL& bExit, |
626 uint32_t nFlag) { | 626 uint32_t nFlag) { |
627 if (!m_bNotifying) { | 627 if (!m_bNotifying) { |
628 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); | 628 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
629 if (pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { | 629 if (pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { |
630 ASSERT(pPageView); | 630 ASSERT(pPageView); |
631 m_bNotifying = TRUE; | 631 m_bNotifying = TRUE; |
632 pWidget->ClearAppModified(); | 632 pWidget->ClearAppModified(); |
633 | 633 |
634 PDFSDK_FieldAction fa; | 634 PDFSDK_FieldAction fa; |
635 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 635 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); |
636 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 636 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); |
637 fa.bWillCommit = TRUE; | 637 fa.bWillCommit = TRUE; |
638 fa.bKeyDown = TRUE; | 638 fa.bKeyDown = TRUE; |
639 fa.bRC = TRUE; | 639 fa.bRC = TRUE; |
640 | 640 |
641 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); | 641 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
642 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); | 642 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); |
643 pFormFiller->SaveState(pPageView); | 643 pFormFiller->SaveState(pPageView); |
644 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); | 644 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); |
645 if (!(*pAnnot)) | 645 if (!(*pAnnot)) |
646 return; | 646 return; |
(...skipping 10 matching lines...) Expand all Loading... |
657 FX_BOOL& bExit, | 657 FX_BOOL& bExit, |
658 uint32_t nFlag) { | 658 uint32_t nFlag) { |
659 if (!m_bNotifying) { | 659 if (!m_bNotifying) { |
660 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); | 660 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
661 if (pWidget->GetAAction(CPDF_AAction::Validate).GetDict()) { | 661 if (pWidget->GetAAction(CPDF_AAction::Validate).GetDict()) { |
662 ASSERT(pPageView); | 662 ASSERT(pPageView); |
663 m_bNotifying = TRUE; | 663 m_bNotifying = TRUE; |
664 pWidget->ClearAppModified(); | 664 pWidget->ClearAppModified(); |
665 | 665 |
666 PDFSDK_FieldAction fa; | 666 PDFSDK_FieldAction fa; |
667 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 667 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); |
668 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 668 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); |
669 fa.bKeyDown = TRUE; | 669 fa.bKeyDown = TRUE; |
670 fa.bRC = TRUE; | 670 fa.bRC = TRUE; |
671 | 671 |
672 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); | 672 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
673 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); | 673 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); |
674 pFormFiller->SaveState(pPageView); | 674 pFormFiller->SaveState(pPageView); |
675 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); | 675 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); |
676 if (!(*pAnnot)) | 676 if (!(*pAnnot)) |
677 return; | 677 return; |
678 | 678 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 FX_BOOL& bReset, | 724 FX_BOOL& bReset, |
725 FX_BOOL& bExit, | 725 FX_BOOL& bExit, |
726 uint32_t nFlag) { | 726 uint32_t nFlag) { |
727 if (!m_bNotifying) { | 727 if (!m_bNotifying) { |
728 if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) { | 728 if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) { |
729 m_bNotifying = TRUE; | 729 m_bNotifying = TRUE; |
730 int nAge = pWidget->GetAppearanceAge(); | 730 int nAge = pWidget->GetAppearanceAge(); |
731 int nValueAge = pWidget->GetValueAge(); | 731 int nValueAge = pWidget->GetValueAge(); |
732 | 732 |
733 PDFSDK_FieldAction fa; | 733 PDFSDK_FieldAction fa; |
734 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 734 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); |
735 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 735 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); |
736 | 736 |
737 pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); | 737 pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); |
738 m_bNotifying = FALSE; | 738 m_bNotifying = FALSE; |
739 | 739 |
740 if (!IsValidAnnot(pPageView, pWidget)) { | 740 if (!IsValidAnnot(pPageView, pWidget)) { |
741 bExit = TRUE; | 741 bExit = TRUE; |
742 return; | 742 return; |
743 } | 743 } |
744 | 744 |
745 if (nAge != pWidget->GetAppearanceAge()) { | 745 if (nAge != pWidget->GetAppearanceAge()) { |
(...skipping 13 matching lines...) Expand all Loading... |
759 FX_BOOL& bReset, | 759 FX_BOOL& bReset, |
760 FX_BOOL& bExit, | 760 FX_BOOL& bExit, |
761 uint32_t nFlag) { | 761 uint32_t nFlag) { |
762 if (!m_bNotifying) { | 762 if (!m_bNotifying) { |
763 if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) { | 763 if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) { |
764 m_bNotifying = TRUE; | 764 m_bNotifying = TRUE; |
765 int nAge = pWidget->GetAppearanceAge(); | 765 int nAge = pWidget->GetAppearanceAge(); |
766 int nValueAge = pWidget->GetValueAge(); | 766 int nValueAge = pWidget->GetValueAge(); |
767 | 767 |
768 PDFSDK_FieldAction fa; | 768 PDFSDK_FieldAction fa; |
769 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 769 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); |
770 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 770 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); |
771 | 771 |
772 pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); | 772 pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); |
773 m_bNotifying = FALSE; | 773 m_bNotifying = FALSE; |
774 | 774 |
775 if (!IsValidAnnot(pPageView, pWidget)) { | 775 if (!IsValidAnnot(pPageView, pWidget)) { |
776 bExit = TRUE; | 776 bExit = TRUE; |
777 return; | 777 return; |
778 } | 778 } |
779 | 779 |
780 if (nAge != pWidget->GetAppearanceAge()) { | 780 if (nAge != pWidget->GetAppearanceAge()) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 FX_BOOL& bReset, | 822 FX_BOOL& bReset, |
823 FX_BOOL& bExit, | 823 FX_BOOL& bExit, |
824 uint32_t nFlag) { | 824 uint32_t nFlag) { |
825 if (!m_bNotifying) { | 825 if (!m_bNotifying) { |
826 if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) { | 826 if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) { |
827 m_bNotifying = TRUE; | 827 m_bNotifying = TRUE; |
828 int nAge = pWidget->GetAppearanceAge(); | 828 int nAge = pWidget->GetAppearanceAge(); |
829 int nValueAge = pWidget->GetValueAge(); | 829 int nValueAge = pWidget->GetValueAge(); |
830 | 830 |
831 PDFSDK_FieldAction fa; | 831 PDFSDK_FieldAction fa; |
832 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 832 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); |
833 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 833 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); |
834 | 834 |
835 pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView); | 835 pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView); |
836 m_bNotifying = FALSE; | 836 m_bNotifying = FALSE; |
837 | 837 |
838 if (!IsValidAnnot(pPageView, pWidget)) { | 838 if (!IsValidAnnot(pPageView, pWidget)) { |
839 bExit = TRUE; | 839 bExit = TRUE; |
840 return; | 840 return; |
841 } | 841 } |
842 | 842 |
843 if (nAge != pWidget->GetAppearanceAge()) { | 843 if (nAge != pWidget->GetAppearanceAge()) { |
(...skipping 13 matching lines...) Expand all Loading... |
857 FX_BOOL& bReset, | 857 FX_BOOL& bReset, |
858 FX_BOOL& bExit, | 858 FX_BOOL& bExit, |
859 uint32_t nFlag) { | 859 uint32_t nFlag) { |
860 if (!m_bNotifying) { | 860 if (!m_bNotifying) { |
861 if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) { | 861 if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) { |
862 m_bNotifying = TRUE; | 862 m_bNotifying = TRUE; |
863 int nAge = pWidget->GetAppearanceAge(); | 863 int nAge = pWidget->GetAppearanceAge(); |
864 int nValueAge = pWidget->GetValueAge(); | 864 int nValueAge = pWidget->GetValueAge(); |
865 | 865 |
866 PDFSDK_FieldAction fa; | 866 PDFSDK_FieldAction fa; |
867 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 867 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); |
868 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 868 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); |
869 | 869 |
870 pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView); | 870 pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView); |
871 m_bNotifying = FALSE; | 871 m_bNotifying = FALSE; |
872 | 872 |
873 if (!IsValidAnnot(pPageView, pWidget)) { | 873 if (!IsValidAnnot(pPageView, pWidget)) { |
874 bExit = TRUE; | 874 bExit = TRUE; |
875 return; | 875 return; |
876 } | 876 } |
877 | 877 |
878 if (nAge != pWidget->GetAppearanceAge()) { | 878 if (nAge != pWidget->GetAppearanceAge()) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 if (!m_bNotifying) { | 924 if (!m_bNotifying) { |
925 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { | 925 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { |
926 m_bNotifying = TRUE; | 926 m_bNotifying = TRUE; |
927 int nAge = pData->pWidget->GetAppearanceAge(); | 927 int nAge = pData->pWidget->GetAppearanceAge(); |
928 int nValueAge = pData->pWidget->GetValueAge(); | 928 int nValueAge = pData->pWidget->GetValueAge(); |
929 | 929 |
930 CPDFSDK_FormFillEnvironment* pFormFillEnv = | 930 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
931 pData->pPageView->GetFormFillEnv(); | 931 pData->pPageView->GetFormFillEnv(); |
932 | 932 |
933 PDFSDK_FieldAction fa; | 933 PDFSDK_FieldAction fa; |
934 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 934 fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); |
935 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 935 fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); |
936 fa.sChange = strChange; | 936 fa.sChange = strChange; |
937 fa.sChangeEx = strChangeEx; | 937 fa.sChangeEx = strChangeEx; |
938 fa.bKeyDown = bKeyDown; | 938 fa.bKeyDown = bKeyDown; |
939 fa.bWillCommit = FALSE; | 939 fa.bWillCommit = FALSE; |
940 fa.bRC = TRUE; | 940 fa.bRC = TRUE; |
941 fa.nSelStart = nSelStart; | 941 fa.nSelStart = nSelStart; |
942 fa.nSelEnd = nSelEnd; | 942 fa.nSelEnd = nSelEnd; |
943 | 943 |
944 pFormFiller->GetActionData(pData->pPageView, CPDF_AAction::KeyStroke, fa); | 944 pFormFiller->GetActionData(pData->pPageView, CPDF_AAction::KeyStroke, fa); |
945 pFormFiller->SaveState(pData->pPageView); | 945 pFormFiller->SaveState(pData->pPageView); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 bExit = TRUE; | 978 bExit = TRUE; |
979 m_bNotifying = FALSE; | 979 m_bNotifying = FALSE; |
980 return; | 980 return; |
981 } | 981 } |
982 } | 982 } |
983 | 983 |
984 m_bNotifying = FALSE; | 984 m_bNotifying = FALSE; |
985 } | 985 } |
986 } | 986 } |
987 } | 987 } |
OLD | NEW |