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 "core/include/fpdfdoc/fpdf_doc.h" | 7 #include "core/include/fpdfdoc/fpdf_doc.h" |
8 #include "doc_utils.h" | 8 #include "doc_utils.h" |
9 #include "third_party/base/stl_util.h" | 9 #include "third_party/base/stl_util.h" |
10 | 10 |
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 int iRet = 0; | 1168 int iRet = 0; |
1169 if (iType == FIELDTYPE_LISTBOX) { | 1169 if (iType == FIELDTYPE_LISTBOX) { |
1170 iRet = m_pFormNotify->BeforeSelectionChange(pField, csWValue); | 1170 iRet = m_pFormNotify->BeforeSelectionChange(pField, csWValue); |
1171 } else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) { | 1171 } else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) { |
1172 iRet = m_pFormNotify->BeforeValueChange(pField, csWValue); | 1172 iRet = m_pFormNotify->BeforeValueChange(pField, csWValue); |
1173 } | 1173 } |
1174 if (iRet < 0) { | 1174 if (iRet < 0) { |
1175 return; | 1175 return; |
1176 } | 1176 } |
1177 } | 1177 } |
1178 CFX_ByteArray statusArray; | |
1179 if (iType == FIELDTYPE_CHECKBOX || iType == FIELDTYPE_RADIOBUTTON) { | |
1180 SaveCheckedFieldStatus(pField, statusArray); | |
1181 } | |
1182 pField->SetValue(csWValue); | 1178 pField->SetValue(csWValue); |
1183 CPDF_FormField::Type eType = pField->GetType(); | 1179 CPDF_FormField::Type eType = pField->GetType(); |
1184 if ((eType == CPDF_FormField::ListBox || eType == CPDF_FormField::ComboBox) && | 1180 if ((eType == CPDF_FormField::ListBox || eType == CPDF_FormField::ComboBox) && |
1185 pFieldDict->KeyExist("Opt")) { | 1181 pFieldDict->KeyExist("Opt")) { |
1186 pField->m_pDict->SetAt("Opt", | 1182 pField->m_pDict->SetAt("Opt", |
1187 pFieldDict->GetElementValue("Opt")->Clone(TRUE)); | 1183 pFieldDict->GetElementValue("Opt")->Clone(TRUE)); |
1188 } | 1184 } |
1189 if (bNotify && m_pFormNotify) { | 1185 if (bNotify && m_pFormNotify) { |
1190 if (iType == FIELDTYPE_CHECKBOX || iType == FIELDTYPE_RADIOBUTTON) { | 1186 if (iType == FIELDTYPE_CHECKBOX || iType == FIELDTYPE_RADIOBUTTON) { |
1191 m_pFormNotify->AfterCheckedStatusChange(pField, statusArray); | 1187 m_pFormNotify->AfterCheckedStatusChange(pField); |
1192 } else if (iType == FIELDTYPE_LISTBOX) { | 1188 } else if (iType == FIELDTYPE_LISTBOX) { |
1193 m_pFormNotify->AfterSelectionChange(pField); | 1189 m_pFormNotify->AfterSelectionChange(pField); |
1194 } else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) { | 1190 } else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) { |
1195 m_pFormNotify->AfterValueChange(pField); | 1191 m_pFormNotify->AfterValueChange(pField); |
1196 } | 1192 } |
1197 } | 1193 } |
1198 if (CPDF_InterForm::m_bUpdateAP) { | 1194 if (CPDF_InterForm::m_bUpdateAP) { |
1199 pField->UpdateAP(NULL); | 1195 pField->UpdateAP(NULL); |
1200 } | 1196 } |
1201 } | 1197 } |
(...skipping 25 matching lines...) Expand all Loading... |
1227 FDF_ImportField(pField, L"", bNotify); | 1223 FDF_ImportField(pField, L"", bNotify); |
1228 } | 1224 } |
1229 if (bNotify && m_pFormNotify) { | 1225 if (bNotify && m_pFormNotify) { |
1230 m_pFormNotify->AfterFormImportData(this); | 1226 m_pFormNotify->AfterFormImportData(this); |
1231 } | 1227 } |
1232 return TRUE; | 1228 return TRUE; |
1233 } | 1229 } |
1234 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { | 1230 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { |
1235 m_pFormNotify = (CPDF_FormNotify*)pNotify; | 1231 m_pFormNotify = (CPDF_FormNotify*)pNotify; |
1236 } | 1232 } |
OLD | NEW |