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/include/formfiller/FFL_CheckBox.h" | 7 #include "fpdfsdk/include/formfiller/FFL_CheckBox.h" |
8 | 8 |
9 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" | 9 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" |
10 #include "fpdfsdk/include/fsdk_mgr.h" | 10 #include "fpdfsdk/include/fsdk_mgr.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE); | 93 CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE); |
94 return pWnd && pWnd->IsChecked() != m_pWidget->IsChecked(); | 94 return pWnd && pWnd->IsChecked() != m_pWidget->IsChecked(); |
95 } | 95 } |
96 | 96 |
97 void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) { | 97 void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) { |
98 if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) { | 98 if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) { |
99 FX_BOOL bNewChecked = pWnd->IsChecked(); | 99 FX_BOOL bNewChecked = pWnd->IsChecked(); |
100 | 100 |
101 if (bNewChecked) { | 101 if (bNewChecked) { |
102 CPDF_FormField* pField = m_pWidget->GetFormField(); | 102 CPDF_FormField* pField = m_pWidget->GetFormField(); |
103 ASSERT(pField != NULL); | |
104 | |
105 for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) { | 103 for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) { |
106 if (CPDF_FormControl* pCtrl = pField->GetControl(i)) { | 104 if (CPDF_FormControl* pCtrl = pField->GetControl(i)) { |
107 if (pCtrl->IsChecked()) { | 105 if (pCtrl->IsChecked()) { |
108 break; | 106 break; |
109 } | 107 } |
110 } | 108 } |
111 } | 109 } |
112 } | 110 } |
113 | 111 |
114 m_pWidget->SetCheck(bNewChecked, FALSE); | 112 m_pWidget->SetCheck(bNewChecked, FALSE); |
115 m_pWidget->UpdateField(); | 113 m_pWidget->UpdateField(); |
116 SetChangeMark(); | 114 SetChangeMark(); |
117 } | 115 } |
118 } | 116 } |
OLD | NEW |