| 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_checkbox.h" | 7 #include "fpdfsdk/formfiller/cffl_checkbox.h" |
| 8 | 8 |
| 9 #include "fpdfsdk/formfiller/cffl_formfiller.h" | 9 #include "fpdfsdk/formfiller/cffl_formfiller.h" |
| 10 #include "fpdfsdk/include/cpdfsdk_environment.h" | 10 #include "fpdfsdk/include/cpdfsdk_environment.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 uint32_t nChar, | 40 uint32_t nChar, |
| 41 uint32_t nFlags) { | 41 uint32_t nFlags) { |
| 42 switch (nChar) { | 42 switch (nChar) { |
| 43 case FWL_VKEY_Return: | 43 case FWL_VKEY_Return: |
| 44 case FWL_VKEY_Space: { | 44 case FWL_VKEY_Space: { |
| 45 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 45 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
| 46 ASSERT(pPageView); | 46 ASSERT(pPageView); |
| 47 | 47 |
| 48 FX_BOOL bReset = FALSE; | 48 FX_BOOL bReset = FALSE; |
| 49 FX_BOOL bExit = FALSE; | 49 FX_BOOL bExit = FALSE; |
| 50 m_pEnv->GetInteractiveFormFiller()->OnButtonUp(m_pWidget, pPageView, | 50 CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget); |
| 51 m_pEnv->GetInteractiveFormFiller()->OnButtonUp(&pObserved, pPageView, |
| 51 bReset, bExit, nFlags); | 52 bReset, bExit, nFlags); |
| 52 if (bReset) | 53 if (!pObserved) { |
| 54 m_pWidget = nullptr; |
| 53 return TRUE; | 55 return TRUE; |
| 54 if (bExit) | 56 } |
| 57 if (bReset || bExit) |
| 55 return TRUE; | 58 return TRUE; |
| 56 | 59 |
| 57 CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); | 60 CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); |
| 58 | |
| 59 if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE)) | 61 if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE)) |
| 60 pWnd->SetCheck(!pWnd->IsChecked()); | 62 pWnd->SetCheck(!pWnd->IsChecked()); |
| 61 | 63 |
| 62 CommitData(pPageView, nFlags); | 64 CommitData(pPageView, nFlags); |
| 63 return TRUE; | 65 return TRUE; |
| 64 } | 66 } |
| 65 default: | 67 default: |
| 66 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); | 68 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); |
| 67 } | 69 } |
| 68 } | 70 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 106 } |
| 105 } | 107 } |
| 106 } | 108 } |
| 107 } | 109 } |
| 108 | 110 |
| 109 m_pWidget->SetCheck(bNewChecked, false); | 111 m_pWidget->SetCheck(bNewChecked, false); |
| 110 m_pWidget->UpdateField(); | 112 m_pWidget->UpdateField(); |
| 111 SetChangeMark(); | 113 SetChangeMark(); |
| 112 } | 114 } |
| 113 } | 115 } |
| OLD | NEW |