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* pInteractiveFormFiller = |
529 pIFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag); | 529 m_pEnv->GetInteractiveFormFiller(); |
| 530 pInteractiveFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, |
| 531 nFlag); |
530 if (bExit) | 532 if (bExit) |
531 return TRUE; | 533 return TRUE; |
532 if (!bRC) { | 534 if (!bRC) { |
533 ResetPDFWindow(pPageView, FALSE); | 535 ResetPDFWindow(pPageView, FALSE); |
534 return TRUE; | 536 return TRUE; |
535 } | 537 } |
536 | 538 |
537 pIFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag); | 539 pInteractiveFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag); |
538 if (bExit) | 540 if (bExit) |
539 return TRUE; | 541 return TRUE; |
540 if (!bRC) { | 542 if (!bRC) { |
541 ResetPDFWindow(pPageView, FALSE); | 543 ResetPDFWindow(pPageView, FALSE); |
542 return TRUE; | 544 return TRUE; |
543 } | 545 } |
544 | 546 |
545 SaveData(pPageView); | 547 SaveData(pPageView); |
546 pIFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag); | 548 pInteractiveFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag); |
547 if (bExit) | 549 if (bExit) |
548 return TRUE; | 550 return TRUE; |
549 | 551 |
550 pIFormFiller->OnFormat(m_pWidget, pPageView, bExit, nFlag); | 552 pInteractiveFormFiller->OnFormat(m_pWidget, pPageView, bExit, nFlag); |
551 } | 553 } |
552 return TRUE; | 554 return TRUE; |
553 } | 555 } |
554 | 556 |
555 FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) { | 557 FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) { |
556 return FALSE; | 558 return FALSE; |
557 } | 559 } |
558 | 560 |
559 void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView) {} | 561 void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView) {} |
560 | 562 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); | 713 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
712 } | 714 } |
713 } | 715 } |
714 | 716 |
715 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 717 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
716 CPDFSDK_Annot* pAnnot, | 718 CPDFSDK_Annot* pAnnot, |
717 CFX_RenderDevice* pDevice, | 719 CFX_RenderDevice* pDevice, |
718 CFX_Matrix* pUser2Device) { | 720 CFX_Matrix* pUser2Device) { |
719 OnDraw(pPageView, pAnnot, pDevice, pUser2Device); | 721 OnDraw(pPageView, pAnnot, pDevice, pUser2Device); |
720 } | 722 } |
OLD | NEW |