summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-08-16 20:53:58 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-16 20:53:58 +0000
commitb2e6b4c44a38ea2ca9e021df31cd27eb67a45e35 (patch)
tree8e9392c73c3905d38d9e9e636adf8df9c7af072e /fpdfsdk/formfiller
parentaa987a9a895d42749c0f5e4092618fe7ded6667e (diff)
downloadpdfium-b2e6b4c44a38ea2ca9e021df31cd27eb67a45e35.tar.xz
Replace optional bool bNotify with enum type.
Adds clarity to the call sites. Change-Id: Id4deed9adda2ad79f0847d618792429044d4f7d6 Reviewed-on: https://pdfium-review.googlesource.com/40351 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/formfiller')
-rw-r--r--fpdfsdk/formfiller/cffl_checkbox.cpp5
-rw-r--r--fpdfsdk/formfiller/cffl_combobox.cpp10
-rw-r--r--fpdfsdk/formfiller/cffl_listbox.cpp15
-rw-r--r--fpdfsdk/formfiller/cffl_radiobutton.cpp9
-rw-r--r--fpdfsdk/formfiller/cffl_textfield.cpp7
5 files changed, 26 insertions, 20 deletions
diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp
index 57119c5c31..4308c1a1a5 100644
--- a/fpdfsdk/formfiller/cffl_checkbox.cpp
+++ b/fpdfsdk/formfiller/cffl_checkbox.cpp
@@ -113,13 +113,14 @@ void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) {
}
CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get());
CFFL_CheckBox::ObservedPtr observed_this(this);
-
- m_pWidget->SetCheck(bNewChecked, false);
+ m_pWidget->SetCheck(bNewChecked, NotificationOption::kDoNotNotify);
if (!observed_widget)
return;
+
m_pWidget->UpdateField();
if (!observed_widget || !observed_this)
return;
+
SetChangeMark();
}
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index 8aa656b856..e0f0f3fbe5 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -96,27 +96,27 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) {
WideString swText = pWnd->GetText();
int32_t nCurSel = pWnd->GetSelect();
-
bool bSetValue = false;
-
if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT)
bSetValue = (nCurSel < 0) || (swText != m_pWidget->GetOptionLabel(nCurSel));
if (bSetValue) {
- m_pWidget->SetValue(swText, false);
+ m_pWidget->SetValue(swText, NotificationOption::kDoNotNotify);
} else {
m_pWidget->GetSelectedIndex(0);
- m_pWidget->SetOptionSelection(nCurSel, true, false);
+ m_pWidget->SetOptionSelection(nCurSel, true,
+ NotificationOption::kDoNotNotify);
}
CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get());
CFFL_ComboBox::ObservedPtr observed_this(this);
-
m_pWidget->ResetFieldAppearance(true);
if (!observed_widget)
return;
+
m_pWidget->UpdateField();
if (!observed_widget || !observed_this)
return;
+
SetChangeMark();
m_pWidget->GetPDFPage();
}
diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp
index bf24e116e5..c05400d13c 100644
--- a/fpdfsdk/formfiller/cffl_listbox.cpp
+++ b/fpdfsdk/formfiller/cffl_listbox.cpp
@@ -108,27 +108,32 @@ void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) {
return;
int32_t nNewTopIndex = pListBox->GetTopVisibleIndex();
- m_pWidget->ClearSelection(false);
+ m_pWidget->ClearSelection(NotificationOption::kDoNotNotify);
if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) {
- if (pListBox->IsItemSelected(i))
- m_pWidget->SetOptionSelection(i, true, false);
+ if (pListBox->IsItemSelected(i)) {
+ m_pWidget->SetOptionSelection(i, true,
+ NotificationOption::kDoNotNotify);
+ }
}
} else {
- m_pWidget->SetOptionSelection(pListBox->GetCurSel(), true, false);
+ m_pWidget->SetOptionSelection(pListBox->GetCurSel(), true,
+ NotificationOption::kDoNotNotify);
}
CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get());
CFFL_ListBox::ObservedPtr observed_this(this);
-
m_pWidget->SetTopVisibleIndex(nNewTopIndex);
if (!observed_widget)
return;
+
m_pWidget->ResetFieldAppearance(true);
if (!observed_widget)
return;
+
m_pWidget->UpdateField();
if (!observed_widget || !observed_this)
return;
+
SetChangeMark();
}
diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp
index 73ac44de46..8105b0cdea 100644
--- a/fpdfsdk/formfiller/cffl_radiobutton.cpp
+++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp
@@ -91,26 +91,25 @@ void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) {
return;
bool bNewChecked = pWnd->IsChecked();
-
if (bNewChecked) {
CPDF_FormField* pField = m_pWidget->GetFormField();
for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) {
if (CPDF_FormControl* pCtrl = pField->GetControl(i)) {
- if (pCtrl->IsChecked()) {
+ if (pCtrl->IsChecked())
break;
- }
}
}
}
CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get());
CFFL_RadioButton::ObservedPtr observed_this(this);
-
- m_pWidget->SetCheck(bNewChecked, false);
+ m_pWidget->SetCheck(bNewChecked, NotificationOption::kDoNotNotify);
if (!observed_widget)
return;
+
m_pWidget->UpdateField();
if (!observed_widget || !observed_this)
return;
+
SetChangeMark();
}
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index da011e40ab..7293d426bc 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -138,19 +138,20 @@ void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) {
WideString sOldValue = m_pWidget->GetValue();
WideString sNewValue = pWnd->GetText();
-
CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get());
CFFL_TextField::ObservedPtr observed_this(this);
-
- m_pWidget->SetValue(sNewValue, false);
+ m_pWidget->SetValue(sNewValue, NotificationOption::kDoNotNotify);
if (!observed_widget)
return;
+
m_pWidget->ResetFieldAppearance(true);
if (!observed_widget)
return;
+
m_pWidget->UpdateField();
if (!observed_widget || !observed_this)
return;
+
SetChangeMark();
}