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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 CFX_RenderDevice* pDevice, | 87 CFX_RenderDevice* pDevice, |
88 CFX_Matrix* pUser2Device) { | 88 CFX_Matrix* pUser2Device) { |
89 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 89 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
90 | 90 |
91 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 91 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
92 CFX_Matrix mt = GetCurMatrix(); | 92 CFX_Matrix mt = GetCurMatrix(); |
93 mt.Concat(*pUser2Device); | 93 mt.Concat(*pUser2Device); |
94 pWnd->DrawAppearance(pDevice, &mt); | 94 pWnd->DrawAppearance(pDevice, &mt); |
95 } else { | 95 } else { |
96 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 96 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
97 if (CFFL_IFormFiller::IsVisible(pWidget)) | 97 if (CFFL_InteractiveFormFiller::IsVisible(pWidget)) |
98 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, | 98 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, |
99 nullptr); | 99 nullptr); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 103 void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
104 CPDFSDK_Annot* pAnnot, | 104 CPDFSDK_Annot* pAnnot, |
105 CFX_RenderDevice* pDevice, | 105 CFX_RenderDevice* pDevice, |
106 CFX_Matrix* pUser2Device) { | 106 CFX_Matrix* pUser2Device) { |
107 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 107 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 CFX_FloatRect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, | 518 CFX_FloatRect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, |
519 const CFX_FloatRect& rect) { | 519 const CFX_FloatRect& rect) { |
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_IFormFiller* pIFormFiller = m_pEnv->GetIFormFiller(); | 528 CFFL_InteractiveFormFiller* pFormFiller = |
529 pIFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag); | 529 m_pEnv->GetInteractiveFormFiller(); |
| 530 pFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag); |
530 if (bExit) | 531 if (bExit) |
531 return TRUE; | 532 return TRUE; |
532 if (!bRC) { | 533 if (!bRC) { |
533 ResetPDFWindow(pPageView, FALSE); | 534 ResetPDFWindow(pPageView, FALSE); |
534 return TRUE; | 535 return TRUE; |
535 } | 536 } |
536 | 537 |
537 pIFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag); | 538 pFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag); |
538 if (bExit) | 539 if (bExit) |
539 return TRUE; | 540 return TRUE; |
540 if (!bRC) { | 541 if (!bRC) { |
541 ResetPDFWindow(pPageView, FALSE); | 542 ResetPDFWindow(pPageView, FALSE); |
542 return TRUE; | 543 return TRUE; |
543 } | 544 } |
544 | 545 |
545 SaveData(pPageView); | 546 SaveData(pPageView); |
546 pIFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag); | 547 pFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag); |
547 if (bExit) | 548 if (bExit) |
548 return TRUE; | 549 return TRUE; |
549 | 550 |
550 pIFormFiller->OnFormat(m_pWidget, pPageView, bExit, nFlag); | 551 pFormFiller->OnFormat(m_pWidget, pPageView, bExit, nFlag); |
551 } | 552 } |
552 return TRUE; | 553 return TRUE; |
553 } | 554 } |
554 | 555 |
555 FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) { | 556 FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) { |
556 return FALSE; | 557 return FALSE; |
557 } | 558 } |
558 | 559 |
559 void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView) {} | 560 void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView) {} |
560 | 561 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); | 712 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
712 } | 713 } |
713 } | 714 } |
714 | 715 |
715 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 716 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
716 CPDFSDK_Annot* pAnnot, | 717 CPDFSDK_Annot* pAnnot, |
717 CFX_RenderDevice* pDevice, | 718 CFX_RenderDevice* pDevice, |
718 CFX_Matrix* pUser2Device) { | 719 CFX_Matrix* pUser2Device) { |
719 OnDraw(pPageView, pAnnot, pDevice, pUser2Device); | 720 OnDraw(pPageView, pAnnot, pDevice, pUser2Device); |
720 } | 721 } |
OLD | NEW |