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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 CFX_FloatRect rect = CPWL_Utils::InflateRect(rcWin, 1); | 72 CFX_FloatRect rect = CPWL_Utils::InflateRect(rcWin, 1); |
73 | 73 |
74 return rect.GetOutterRect(); | 74 return rect.GetOutterRect(); |
75 } | 75 } |
76 | 76 |
77 void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, | 77 void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, |
78 CPDFSDK_Annot* pAnnot, | 78 CPDFSDK_Annot* pAnnot, |
79 CFX_RenderDevice* pDevice, | 79 CFX_RenderDevice* pDevice, |
80 CFX_Matrix* pUser2Device, | 80 CFX_Matrix* pUser2Device, |
81 FX_DWORD 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, NULL); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 95 void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
96 CPDFSDK_Annot* pAnnot, | 96 CPDFSDK_Annot* pAnnot, |
97 CFX_RenderDevice* pDevice, | 97 CFX_RenderDevice* pDevice, |
98 CFX_Matrix* pUser2Device, | 98 CFX_Matrix* pUser2Device, |
99 FX_DWORD dwFlags) { | 99 uint32_t dwFlags) { |
100 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 100 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
101 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 101 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
102 } | 102 } |
103 | 103 |
104 void CFFL_FormFiller::OnCreate(CPDFSDK_Annot* pAnnot) {} | 104 void CFFL_FormFiller::OnCreate(CPDFSDK_Annot* pAnnot) {} |
105 | 105 |
106 void CFFL_FormFiller::OnLoad(CPDFSDK_Annot* pAnnot) {} | 106 void CFFL_FormFiller::OnLoad(CPDFSDK_Annot* pAnnot) {} |
107 | 107 |
108 void CFFL_FormFiller::OnDelete(CPDFSDK_Annot* pAnnot) {} | 108 void CFFL_FormFiller::OnDelete(CPDFSDK_Annot* pAnnot) {} |
109 | 109 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 290 } |
291 | 291 |
292 PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { | 292 PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { |
293 ASSERT(m_pApp); | 293 ASSERT(m_pApp); |
294 | 294 |
295 PWL_CREATEPARAM cp; | 295 PWL_CREATEPARAM cp; |
296 cp.pParentWnd = NULL; | 296 cp.pParentWnd = NULL; |
297 cp.pProvider = this; | 297 cp.pProvider = this; |
298 cp.rcRectWnd = GetPDFWindowRect(); | 298 cp.rcRectWnd = GetPDFWindowRect(); |
299 | 299 |
300 FX_DWORD dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE; | 300 uint32_t dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE; |
301 FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags(); | 301 uint32_t dwFieldFlag = m_pWidget->GetFieldFlags(); |
302 if (dwFieldFlag & FIELDFLAG_READONLY) { | 302 if (dwFieldFlag & FIELDFLAG_READONLY) { |
303 dwCreateFlags |= PWS_READONLY; | 303 dwCreateFlags |= PWS_READONLY; |
304 } | 304 } |
305 | 305 |
306 FX_COLORREF color; | 306 FX_COLORREF color; |
307 if (m_pWidget->GetFillColor(color)) { | 307 if (m_pWidget->GetFillColor(color)) { |
308 cp.sBackgroundColor = | 308 cp.sBackgroundColor = |
309 CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color)); | 309 CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color)); |
310 } | 310 } |
311 | 311 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 const CFX_FloatPoint& point) { | 685 const CFX_FloatPoint& point) { |
686 ASSERT(m_pApp); | 686 ASSERT(m_pApp); |
687 | 687 |
688 return TRUE; | 688 return TRUE; |
689 } | 689 } |
690 | 690 |
691 void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView, | 691 void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView, |
692 CPDFSDK_Annot* pAnnot, | 692 CPDFSDK_Annot* pAnnot, |
693 CFX_RenderDevice* pDevice, | 693 CFX_RenderDevice* pDevice, |
694 CFX_Matrix* pUser2Device, | 694 CFX_Matrix* pUser2Device, |
695 FX_DWORD dwFlags) { | 695 uint32_t dwFlags) { |
696 ASSERT(pPageView); | 696 ASSERT(pPageView); |
697 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 697 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
698 CPDF_FormControl* pCtrl = pWidget->GetFormControl(); | 698 CPDF_FormControl* pCtrl = pWidget->GetFormControl(); |
699 CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode(); | 699 CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode(); |
700 | 700 |
701 if (eHM != CPDF_FormControl::Push) { | 701 if (eHM != CPDF_FormControl::Push) { |
702 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 702 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
703 return; | 703 return; |
704 } | 704 } |
705 | 705 |
(...skipping 10 matching lines...) Expand all Loading... |
716 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 716 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
717 } else { | 717 } else { |
718 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 718 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
719 } | 719 } |
720 } | 720 } |
721 | 721 |
722 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 722 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
723 CPDFSDK_Annot* pAnnot, | 723 CPDFSDK_Annot* pAnnot, |
724 CFX_RenderDevice* pDevice, | 724 CFX_RenderDevice* pDevice, |
725 CFX_Matrix* pUser2Device, | 725 CFX_Matrix* pUser2Device, |
726 FX_DWORD dwFlags) { | 726 uint32_t dwFlags) { |
727 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); | 727 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
728 } | 728 } |
OLD | NEW |