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 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 int iRet = 0; | 1153 int iRet = 0; |
1154 if (iType == FIELDTYPE_LISTBOX) { | 1154 if (iType == FIELDTYPE_LISTBOX) { |
1155 iRet = m_pFormNotify->BeforeSelectionChange(pField, csWValue); | 1155 iRet = m_pFormNotify->BeforeSelectionChange(pField, csWValue); |
1156 } else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) { | 1156 } else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) { |
1157 iRet = m_pFormNotify->BeforeValueChange(pField, csWValue); | 1157 iRet = m_pFormNotify->BeforeValueChange(pField, csWValue); |
1158 } | 1158 } |
1159 if (iRet < 0) { | 1159 if (iRet < 0) { |
1160 return; | 1160 return; |
1161 } | 1161 } |
1162 } | 1162 } |
1163 CFX_ByteArray statusArray; | |
1164 if (iType == FIELDTYPE_CHECKBOX || iType == FIELDTYPE_RADIOBUTTON) { | |
1165 SaveCheckedFieldStatus(pField, statusArray); | |
1166 } | |
1167 pField->SetValue(csWValue); | 1163 pField->SetValue(csWValue); |
1168 CPDF_FormField::Type eType = pField->GetType(); | 1164 CPDF_FormField::Type eType = pField->GetType(); |
1169 if ((eType == CPDF_FormField::ListBox || eType == CPDF_FormField::ComboBox) && | 1165 if ((eType == CPDF_FormField::ListBox || eType == CPDF_FormField::ComboBox) && |
1170 pFieldDict->KeyExist("Opt")) { | 1166 pFieldDict->KeyExist("Opt")) { |
1171 pField->m_pDict->SetAt("Opt", | 1167 pField->m_pDict->SetAt("Opt", |
1172 pFieldDict->GetElementValue("Opt")->Clone(TRUE)); | 1168 pFieldDict->GetElementValue("Opt")->Clone(TRUE)); |
1173 } | 1169 } |
1174 if (bNotify && m_pFormNotify) { | 1170 if (bNotify && m_pFormNotify) { |
1175 if (iType == FIELDTYPE_CHECKBOX || iType == FIELDTYPE_RADIOBUTTON) { | 1171 if (iType == FIELDTYPE_CHECKBOX || iType == FIELDTYPE_RADIOBUTTON) { |
1176 m_pFormNotify->AfterCheckedStatusChange(pField, statusArray); | 1172 m_pFormNotify->AfterCheckedStatusChange(pField); |
1177 } else if (iType == FIELDTYPE_LISTBOX) { | 1173 } else if (iType == FIELDTYPE_LISTBOX) { |
1178 m_pFormNotify->AfterSelectionChange(pField); | 1174 m_pFormNotify->AfterSelectionChange(pField); |
1179 } else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) { | 1175 } else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) { |
1180 m_pFormNotify->AfterValueChange(pField); | 1176 m_pFormNotify->AfterValueChange(pField); |
1181 } | 1177 } |
1182 } | 1178 } |
1183 if (CPDF_InterForm::m_bUpdateAP) { | 1179 if (CPDF_InterForm::m_bUpdateAP) { |
1184 pField->UpdateAP(NULL); | 1180 pField->UpdateAP(NULL); |
1185 } | 1181 } |
1186 } | 1182 } |
(...skipping 25 matching lines...) Expand all Loading... |
1212 FDF_ImportField(pField, L"", bNotify); | 1208 FDF_ImportField(pField, L"", bNotify); |
1213 } | 1209 } |
1214 if (bNotify && m_pFormNotify) { | 1210 if (bNotify && m_pFormNotify) { |
1215 m_pFormNotify->AfterFormImportData(this); | 1211 m_pFormNotify->AfterFormImportData(this); |
1216 } | 1212 } |
1217 return TRUE; | 1213 return TRUE; |
1218 } | 1214 } |
1219 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { | 1215 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { |
1220 m_pFormNotify = (CPDF_FormNotify*)pNotify; | 1216 m_pFormNotify = (CPDF_FormNotify*)pNotify; |
1221 } | 1217 } |
OLD | NEW |