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 "fpdfsdk/formfiller/cba_fontmap.h" | 10 #include "fpdfsdk/formfiller/cba_fontmap.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 uint32_t dwFlags) { | 81 uint32_t dwFlags) { |
82 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 82 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
83 | 83 |
84 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 84 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
85 CFX_Matrix mt = GetCurMatrix(); | 85 CFX_Matrix mt = GetCurMatrix(); |
86 mt.Concat(*pUser2Device); | 86 mt.Concat(*pUser2Device); |
87 pWnd->DrawAppearance(pDevice, &mt); | 87 pWnd->DrawAppearance(pDevice, &mt); |
88 } else { | 88 } else { |
89 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 89 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
90 if (CFFL_IFormFiller::IsVisible(pWidget)) | 90 if (CFFL_IFormFiller::IsVisible(pWidget)) |
91 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 91 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, |
| 92 nullptr); |
92 } | 93 } |
93 } | 94 } |
94 | 95 |
95 void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 96 void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
96 CPDFSDK_Annot* pAnnot, | 97 CPDFSDK_Annot* pAnnot, |
97 CFX_RenderDevice* pDevice, | 98 CFX_RenderDevice* pDevice, |
98 CFX_Matrix* pUser2Device, | 99 CFX_Matrix* pUser2Device, |
99 uint32_t dwFlags) { | 100 uint32_t dwFlags) { |
100 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 101 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
101 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 102 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
102 } | 103 } |
103 | 104 |
104 void CFFL_FormFiller::OnCreate(CPDFSDK_Annot* pAnnot) {} | 105 void CFFL_FormFiller::OnCreate(CPDFSDK_Annot* pAnnot) {} |
105 | 106 |
106 void CFFL_FormFiller::OnLoad(CPDFSDK_Annot* pAnnot) {} | 107 void CFFL_FormFiller::OnLoad(CPDFSDK_Annot* pAnnot) {} |
107 | 108 |
108 void CFFL_FormFiller::OnDelete(CPDFSDK_Annot* pAnnot) {} | 109 void CFFL_FormFiller::OnDelete(CPDFSDK_Annot* pAnnot) {} |
109 | 110 |
110 void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, | 111 void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, |
111 CPDFSDK_Annot* pAnnot) {} | 112 CPDFSDK_Annot* pAnnot) {} |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 } | 287 } |
287 | 288 |
288 FX_BOOL CFFL_FormFiller::IsValid() const { | 289 FX_BOOL CFFL_FormFiller::IsValid() const { |
289 return m_bValid; | 290 return m_bValid; |
290 } | 291 } |
291 | 292 |
292 PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { | 293 PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { |
293 ASSERT(m_pApp); | 294 ASSERT(m_pApp); |
294 | 295 |
295 PWL_CREATEPARAM cp; | 296 PWL_CREATEPARAM cp; |
296 cp.pParentWnd = NULL; | 297 cp.pParentWnd = nullptr; |
297 cp.pProvider = this; | 298 cp.pProvider = this; |
298 cp.rcRectWnd = GetPDFWindowRect(); | 299 cp.rcRectWnd = GetPDFWindowRect(); |
299 | 300 |
300 uint32_t dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE; | 301 uint32_t dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE; |
301 uint32_t dwFieldFlag = m_pWidget->GetFieldFlags(); | 302 uint32_t dwFieldFlag = m_pWidget->GetFieldFlags(); |
302 if (dwFieldFlag & FIELDFLAG_READONLY) { | 303 if (dwFieldFlag & FIELDFLAG_READONLY) { |
303 dwCreateFlags |= PWS_READONLY; | 304 dwCreateFlags |= PWS_READONLY; |
304 } | 305 } |
305 | 306 |
306 FX_COLORREF color; | 307 FX_COLORREF color; |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 CPDFSDK_Annot* pAnnot, | 684 CPDFSDK_Annot* pAnnot, |
684 CFX_RenderDevice* pDevice, | 685 CFX_RenderDevice* pDevice, |
685 CFX_Matrix* pUser2Device, | 686 CFX_Matrix* pUser2Device, |
686 uint32_t dwFlags) { | 687 uint32_t dwFlags) { |
687 ASSERT(pPageView); | 688 ASSERT(pPageView); |
688 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 689 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
689 CPDF_FormControl* pCtrl = pWidget->GetFormControl(); | 690 CPDF_FormControl* pCtrl = pWidget->GetFormControl(); |
690 CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode(); | 691 CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode(); |
691 | 692 |
692 if (eHM != CPDF_FormControl::Push) { | 693 if (eHM != CPDF_FormControl::Push) { |
693 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 694 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
694 return; | 695 return; |
695 } | 696 } |
696 | 697 |
697 if (m_bMouseDown) { | 698 if (m_bMouseDown) { |
698 if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down)) | 699 if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down)) |
699 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, NULL); | 700 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, nullptr); |
700 else | 701 else |
701 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 702 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, |
| 703 nullptr); |
702 } else if (m_bMouseIn) { | 704 } else if (m_bMouseIn) { |
703 if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover)) | 705 if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover)) |
704 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Rollover, | 706 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Rollover, |
705 NULL); | 707 nullptr); |
706 else | 708 else |
707 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 709 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, |
| 710 nullptr); |
708 } else { | 711 } else { |
709 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 712 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
710 } | 713 } |
711 } | 714 } |
712 | 715 |
713 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 716 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
714 CPDFSDK_Annot* pAnnot, | 717 CPDFSDK_Annot* pAnnot, |
715 CFX_RenderDevice* pDevice, | 718 CFX_RenderDevice* pDevice, |
716 CFX_Matrix* pUser2Device, | 719 CFX_Matrix* pUser2Device, |
717 uint32_t dwFlags) { | 720 uint32_t dwFlags) { |
718 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); | 721 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
719 } | 722 } |
OLD | NEW |