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 "../../include/formfiller/FFL_FormFiller.h" | 7 #include "../../include/formfiller/FFL_FormFiller.h" |
8 #include "../../include/formfiller/FFL_IFormFiller.h" | 8 #include "../../include/formfiller/FFL_IFormFiller.h" |
9 #include "../../include/formfiller/FFL_CheckBox.h" | 9 #include "../../include/formfiller/FFL_CheckBox.h" |
10 #include "../../include/formfiller/FFL_ComboBox.h" | 10 #include "../../include/formfiller/FFL_ComboBox.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 if (pWidget->IsAppModified()) { | 456 if (pWidget->IsAppModified()) { |
457 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 457 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
458 pFormFiller->ResetPDFWindow(pPageView, | 458 pFormFiller->ResetPDFWindow(pPageView, |
459 nValueAge == pWidget->GetValueAge()); | 459 nValueAge == pWidget->GetValueAge()); |
460 } | 460 } |
461 } | 461 } |
462 } | 462 } |
463 } | 463 } |
464 | 464 |
465 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 465 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) |
466 return pFormFiller->OnSetFocus(pAnnot, nFlag); | 466 return pFormFiller->SetFocusForAnnot(pAnnot, nFlag); |
467 | 467 |
468 return TRUE; | 468 return TRUE; |
469 } | 469 } |
470 | 470 |
471 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { | 471 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { |
472 if (!pAnnot) | 472 if (!pAnnot) |
473 return FALSE; | 473 return FALSE; |
474 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 474 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
475 | 475 |
476 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 476 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
477 if (pFormFiller->OnKillFocus(pAnnot, nFlag)) { | 477 if (!pFormFiller->KillFocusForAnnot(pAnnot, nFlag)) |
478 if (!m_bNotifying) { | 478 return FALSE; |
479 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | |
480 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) { | |
481 m_bNotifying = TRUE; | |
482 pWidget->ClearAppModified(); | |
483 | 479 |
484 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | 480 if (!m_bNotifying) { |
485 ASSERT(pPageView != NULL); | 481 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 482 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) { |
| 483 m_bNotifying = TRUE; |
| 484 pWidget->ClearAppModified(); |
486 | 485 |
487 PDFSDK_FieldAction fa; | 486 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
488 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 487 ASSERT(pPageView != NULL); |
489 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | |
490 | 488 |
491 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); | 489 PDFSDK_FieldAction fa; |
| 490 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 491 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
492 | 492 |
493 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); | 493 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); |
494 m_bNotifying = FALSE; | 494 |
495 } | 495 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); |
| 496 m_bNotifying = FALSE; |
496 } | 497 } |
497 } else | 498 } |
498 return FALSE; | |
499 } | 499 } |
500 | 500 |
501 return TRUE; | 501 return TRUE; |
502 } | 502 } |
503 | 503 |
504 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { | 504 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { |
505 return pWidget->IsVisible(); | 505 return pWidget->IsVisible(); |
506 } | 506 } |
507 | 507 |
508 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { | 508 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 | 1077 |
1078 m_bNotifying = FALSE; | 1078 m_bNotifying = FALSE; |
1079 } | 1079 } |
1080 } | 1080 } |
1081 } | 1081 } |
1082 | 1082 |
1083 void CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, | 1083 void CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, |
1084 void* pPrivateData, | 1084 void* pPrivateData, |
1085 FX_BOOL& bExit, | 1085 FX_BOOL& bExit, |
1086 FX_DWORD nFlag) { | 1086 FX_DWORD nFlag) { |
1087 ASSERT(pPrivateData != NULL); | |
1088 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 1087 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
1089 ASSERT(pData->pWidget != NULL); | 1088 ASSERT(pData->pWidget); |
1090 | 1089 |
1091 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 1090 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
1092 ASSERT(pFormFiller != NULL); | |
1093 | 1091 |
1094 if (!bEditOrList) | 1092 if (!bEditOrList) |
1095 pFormFiller->OnKeyStroke(bExit); | 1093 pFormFiller->OnKeyStroke(bExit, nFlag); |
1096 } | 1094 } |
OLD | NEW |