| 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_iformfiller.h" | 7 #include "fpdfsdk/formfiller/cffl_iformfiller.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/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 ASSERT(pPageView); | 45 ASSERT(pPageView); |
| 46 | 46 |
| 47 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 47 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
| 48 CFX_FloatRect rcWin = CPWL_Utils::InflateRect(pPDFAnnot->GetRect(), 1); | 48 CFX_FloatRect rcWin = CPWL_Utils::InflateRect(pPDFAnnot->GetRect(), 1); |
| 49 return rcWin.GetOuterRect(); | 49 return rcWin.GetOuterRect(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, | 52 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, |
| 53 CPDFSDK_Annot* pAnnot, | 53 CPDFSDK_Annot* pAnnot, |
| 54 CFX_RenderDevice* pDevice, | 54 CFX_RenderDevice* pDevice, |
| 55 CFX_Matrix* pUser2Device, | 55 CFX_Matrix* pUser2Device) { |
| 56 uint32_t dwFlags) { | |
| 57 ASSERT(pPageView); | 56 ASSERT(pPageView); |
| 58 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 57 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 59 | 58 |
| 60 if (!IsVisible(pWidget)) | 59 if (!IsVisible(pWidget)) |
| 61 return; | 60 return; |
| 62 | 61 |
| 63 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 62 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 64 if (pFormFiller->IsValid()) { | 63 if (pFormFiller->IsValid()) { |
| 65 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); | 64 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device); |
| 66 pAnnot->GetPDFPage(); | 65 pAnnot->GetPDFPage(); |
| 67 | 66 |
| 68 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); | 67 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); |
| 69 if (pDocument->GetFocusAnnot() == pAnnot) { | 68 if (pDocument->GetFocusAnnot() == pAnnot) { |
| 70 CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView); | 69 CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView); |
| 71 if (!rcFocus.IsEmpty()) { | 70 if (!rcFocus.IsEmpty()) { |
| 72 CFX_PathData path; | 71 CFX_PathData path; |
| 73 path.SetPointCount(5); | 72 path.SetPointCount(5); |
| 74 path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); | 73 path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); |
| 75 path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); | 74 path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); |
| 76 path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); | 75 path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); |
| 77 path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); | 76 path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); |
| 78 path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); | 77 path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); |
| 79 | 78 |
| 80 CFX_GraphStateData gsd; | 79 CFX_GraphStateData gsd; |
| 81 gsd.SetDashCount(1); | 80 gsd.SetDashCount(1); |
| 82 gsd.m_DashArray[0] = 1.0f; | 81 gsd.m_DashArray[0] = 1.0f; |
| 83 gsd.m_DashPhase = 0; | 82 gsd.m_DashPhase = 0; |
| 84 gsd.m_LineWidth = 1.0f; | 83 gsd.m_LineWidth = 1.0f; |
| 85 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, | 84 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, |
| 86 ArgbEncode(255, 0, 0, 0), FXFILL_ALTERNATE); | 85 ArgbEncode(255, 0, 0, 0), FXFILL_ALTERNATE); |
| 87 } | 86 } |
| 88 } | 87 } |
| 89 return; | 88 return; |
| 90 } | 89 } |
| 91 } | 90 } |
| 92 | 91 |
| 93 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 92 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 94 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device, | 93 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device); |
| 95 dwFlags); | |
| 96 } else { | 94 } else { |
| 97 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); | 95 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
| 98 } | 96 } |
| 99 | 97 |
| 100 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) | 98 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) |
| 101 pWidget->DrawShadow(pDevice, pPageView); | 99 pWidget->DrawShadow(pDevice, pPageView); |
| 102 } | 100 } |
| 103 | 101 |
| 104 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) { | 102 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) { |
| 105 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 103 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 bExit = TRUE; | 997 bExit = TRUE; |
| 1000 m_bNotifying = FALSE; | 998 m_bNotifying = FALSE; |
| 1001 return; | 999 return; |
| 1002 } | 1000 } |
| 1003 } | 1001 } |
| 1004 | 1002 |
| 1005 m_bNotifying = FALSE; | 1003 m_bNotifying = FALSE; |
| 1006 } | 1004 } |
| 1007 } | 1005 } |
| 1008 } | 1006 } |
| OLD | NEW |