| 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_interactiveformfiller.h" | 7 #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/page/cpdf_page.h" | 9 #include "core/fpdfapi/page/cpdf_page.h" |
| 10 #include "core/fpdfapi/parser/cpdf_document.h" | 10 #include "core/fpdfapi/parser/cpdf_document.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 94 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 95 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device); | 95 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device); |
| 96 } else { | 96 } else { |
| 97 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); | 97 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
| 98 } | 98 } |
| 99 | 99 |
| 100 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) | 100 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) |
| 101 pWidget->DrawShadow(pDevice, pPageView); | 101 pWidget->DrawShadow(pDevice, pPageView); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void CFFL_InteractiveFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) { | |
| 105 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | |
| 106 pFormFiller->OnCreate(pAnnot); | |
| 107 } | |
| 108 } | |
| 109 | |
| 110 void CFFL_InteractiveFormFiller::OnLoad(CPDFSDK_Annot* pAnnot) { | |
| 111 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | |
| 112 pFormFiller->OnLoad(pAnnot); | |
| 113 } | |
| 114 } | |
| 115 | |
| 116 void CFFL_InteractiveFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) { | 104 void CFFL_InteractiveFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) { |
| 117 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | |
| 118 pFormFiller->OnDelete(pAnnot); | |
| 119 } | |
| 120 | |
| 121 UnRegisterFormFiller(pAnnot); | 105 UnRegisterFormFiller(pAnnot); |
| 122 } | 106 } |
| 123 | 107 |
| 124 void CFFL_InteractiveFormFiller::OnMouseEnter( | 108 void CFFL_InteractiveFormFiller::OnMouseEnter( |
| 125 CPDFSDK_PageView* pPageView, | 109 CPDFSDK_PageView* pPageView, |
| 126 CPDFSDK_Annot::ObservedPtr* pAnnot, | 110 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 127 uint32_t nFlag) { | 111 uint32_t nFlag) { |
| 128 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 112 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
| 129 if (!m_bNotifying) { | 113 if (!m_bNotifying) { |
| 130 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); | 114 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 } | 510 } |
| 527 | 511 |
| 528 if (!pFormFiller) | 512 if (!pFormFiller) |
| 529 return nullptr; | 513 return nullptr; |
| 530 | 514 |
| 531 m_Maps[pAnnot].reset(pFormFiller); | 515 m_Maps[pAnnot].reset(pFormFiller); |
| 532 return pFormFiller; | 516 return pFormFiller; |
| 533 } | 517 } |
| 534 | 518 |
| 535 void CFFL_InteractiveFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) { | 519 void CFFL_InteractiveFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) { |
| 536 if (pAnnot) { | 520 if (pAnnot) |
| 537 UnRegisterFormFiller(pAnnot); | 521 UnRegisterFormFiller(pAnnot); |
| 538 } | |
| 539 } | 522 } |
| 540 | 523 |
| 541 void CFFL_InteractiveFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) { | 524 void CFFL_InteractiveFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) { |
| 542 auto it = m_Maps.find(pAnnot); | 525 auto it = m_Maps.find(pAnnot); |
| 543 if (it == m_Maps.end()) | 526 if (it == m_Maps.end()) |
| 544 return; | 527 return; |
| 545 | 528 |
| 546 m_Maps.erase(it); | 529 m_Maps.erase(it); |
| 547 } | 530 } |
| 548 | 531 |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 bExit = TRUE; | 964 bExit = TRUE; |
| 982 m_bNotifying = FALSE; | 965 m_bNotifying = FALSE; |
| 983 return; | 966 return; |
| 984 } | 967 } |
| 985 } | 968 } |
| 986 | 969 |
| 987 m_bNotifying = FALSE; | 970 m_bNotifying = FALSE; |
| 988 } | 971 } |
| 989 } | 972 } |
| 990 } | 973 } |
| OLD | NEW |