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_formfiller.h" | 7 #include "fpdfsdk/formfiller/cffl_formfiller.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/fxge/include/cfx_renderdevice.h" | 10 #include "core/fxge/include/cfx_renderdevice.h" |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 return rect; | 520 return rect; |
521 } | 521 } |
522 | 522 |
523 FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, | 523 FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, |
524 uint32_t nFlag) { | 524 uint32_t nFlag) { |
525 if (IsDataChanged(pPageView)) { | 525 if (IsDataChanged(pPageView)) { |
526 FX_BOOL bRC = TRUE; | 526 FX_BOOL bRC = TRUE; |
527 FX_BOOL bExit = FALSE; | 527 FX_BOOL bExit = FALSE; |
528 CFFL_InteractiveFormFiller* pFormFiller = | 528 CFFL_InteractiveFormFiller* pFormFiller = |
529 m_pEnv->GetInteractiveFormFiller(); | 529 m_pEnv->GetInteractiveFormFiller(); |
530 pFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag); | 530 CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget); |
531 if (bExit) | 531 pFormFiller->OnKeyStrokeCommit(&pObserved, pPageView, bRC, bExit, nFlag); |
| 532 if (!pObserved || bExit) |
532 return TRUE; | 533 return TRUE; |
533 if (!bRC) { | 534 if (!bRC) { |
534 ResetPDFWindow(pPageView, FALSE); | 535 ResetPDFWindow(pPageView, FALSE); |
535 return TRUE; | 536 return TRUE; |
536 } | 537 } |
537 | 538 pFormFiller->OnValidate(&pObserved, pPageView, bRC, bExit, nFlag); |
538 pFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag); | 539 if (!pObserved || bExit) |
539 if (bExit) | |
540 return TRUE; | 540 return TRUE; |
541 if (!bRC) { | 541 if (!bRC) { |
542 ResetPDFWindow(pPageView, FALSE); | 542 ResetPDFWindow(pPageView, FALSE); |
543 return TRUE; | 543 return TRUE; |
544 } | 544 } |
545 | |
546 SaveData(pPageView); | 545 SaveData(pPageView); |
547 pFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag); | 546 pFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag); |
548 if (bExit) | 547 if (bExit) |
549 return TRUE; | 548 return TRUE; |
550 | 549 |
551 pFormFiller->OnFormat(m_pWidget, pPageView, bExit, nFlag); | 550 pFormFiller->OnFormat(m_pWidget, pPageView, bExit, nFlag); |
552 } | 551 } |
553 return TRUE; | 552 return TRUE; |
554 } | 553 } |
555 | 554 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); | 711 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
713 } | 712 } |
714 } | 713 } |
715 | 714 |
716 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 715 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
717 CPDFSDK_Annot* pAnnot, | 716 CPDFSDK_Annot* pAnnot, |
718 CFX_RenderDevice* pDevice, | 717 CFX_RenderDevice* pDevice, |
719 CFX_Matrix* pUser2Device) { | 718 CFX_Matrix* pUser2Device) { |
720 OnDraw(pPageView, pAnnot, pDevice, pUser2Device); | 719 OnDraw(pPageView, pAnnot, pDevice, pUser2Device); |
721 } | 720 } |
OLD | NEW |