summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp4
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp4
-rw-r--r--core/fpdfdoc/ipdf_formnotify.h8
-rw-r--r--fpdfsdk/cpdfsdk_interform.cpp24
-rw-r--r--fpdfsdk/cpdfsdk_interform.h8
5 files changed, 22 insertions, 26 deletions
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 686054f9f1..679acd1dc8 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -928,7 +928,7 @@ void CPDF_FormField::LoadDA() {
bool CPDF_FormField::NotifyBeforeSelectionChange(const WideString& value) {
if (!m_pForm->GetFormNotify())
return true;
- return m_pForm->GetFormNotify()->BeforeSelectionChange(this, value) >= 0;
+ return m_pForm->GetFormNotify()->BeforeSelectionChange(this, value);
}
void CPDF_FormField::NotifyAfterSelectionChange() {
@@ -940,7 +940,7 @@ void CPDF_FormField::NotifyAfterSelectionChange() {
bool CPDF_FormField::NotifyBeforeValueChange(const WideString& value) {
if (!m_pForm->GetFormNotify())
return true;
- return m_pForm->GetFormNotify()->BeforeValueChange(this, value) >= 0;
+ return m_pForm->GetFormNotify()->BeforeValueChange(this, value);
}
void CPDF_FormField::NotifyAfterValueChange() {
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index c8440eac00..2fbc3aa32a 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -1203,11 +1203,11 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
FormFieldType fieldType = pField->GetFieldType();
if (bNotify && m_pFormNotify) {
if (fieldType == FormFieldType::kListBox) {
- if (m_pFormNotify->BeforeSelectionChange(pField, csWValue) < 0)
+ if (!m_pFormNotify->BeforeSelectionChange(pField, csWValue))
return;
} else if (fieldType == FormFieldType::kComboBox ||
fieldType == FormFieldType::kTextField) {
- if (m_pFormNotify->BeforeValueChange(pField, csWValue) < 0)
+ if (!m_pFormNotify->BeforeValueChange(pField, csWValue))
return;
}
}
diff --git a/core/fpdfdoc/ipdf_formnotify.h b/core/fpdfdoc/ipdf_formnotify.h
index 10a97a0d88..053ca12a41 100644
--- a/core/fpdfdoc/ipdf_formnotify.h
+++ b/core/fpdfdoc/ipdf_formnotify.h
@@ -16,12 +16,12 @@ class IPDF_FormNotify {
public:
virtual ~IPDF_FormNotify() {}
- virtual int BeforeValueChange(CPDF_FormField* pField,
- const WideString& csValue) = 0;
+ virtual bool BeforeValueChange(CPDF_FormField* pField,
+ const WideString& csValue) = 0;
virtual void AfterValueChange(CPDF_FormField* pField) = 0;
- virtual int BeforeSelectionChange(CPDF_FormField* pField,
- const WideString& csValue) = 0;
+ virtual bool BeforeSelectionChange(CPDF_FormField* pField,
+ const WideString& csValue) = 0;
virtual void AfterSelectionChange(CPDF_FormField* pField) = 0;
virtual void AfterCheckedStatusChange(CPDF_FormField* pField) = 0;
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 94c9b23473..57f3a6e90e 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -622,16 +622,14 @@ std::vector<CPDF_FormField*> CPDFSDK_InterForm::GetFieldFromObjects(
return fields;
}
-int CPDFSDK_InterForm::BeforeValueChange(CPDF_FormField* pField,
- const WideString& csValue) {
+bool CPDFSDK_InterForm::BeforeValueChange(CPDF_FormField* pField,
+ const WideString& csValue) {
FormFieldType fieldType = pField->GetFieldType();
if (!IsFormFieldTypeComboOrText(fieldType))
- return 0;
+ return true;
if (!OnKeyStrokeCommit(pField, csValue))
- return -1;
- if (!OnValidate(pField, csValue))
- return -1;
- return 1;
+ return false;
+ return OnValidate(pField, csValue);
}
void CPDFSDK_InterForm::AfterValueChange(CPDF_FormField* pField) {
@@ -650,15 +648,13 @@ void CPDFSDK_InterForm::AfterValueChange(CPDF_FormField* pField) {
UpdateField(pField);
}
-int CPDFSDK_InterForm::BeforeSelectionChange(CPDF_FormField* pField,
- const WideString& csValue) {
+bool CPDFSDK_InterForm::BeforeSelectionChange(CPDF_FormField* pField,
+ const WideString& csValue) {
if (pField->GetFieldType() != FormFieldType::kListBox)
- return 0;
+ return true;
if (!OnKeyStrokeCommit(pField, csValue))
- return -1;
- if (!OnValidate(pField, csValue))
- return -1;
- return 1;
+ return false;
+ return OnValidate(pField, csValue);
}
void CPDFSDK_InterForm::AfterSelectionChange(CPDF_FormField* pField) {
diff --git a/fpdfsdk/cpdfsdk_interform.h b/fpdfsdk/cpdfsdk_interform.h
index 893b60168b..58dc2d0993 100644
--- a/fpdfsdk/cpdfsdk_interform.h
+++ b/fpdfsdk/cpdfsdk_interform.h
@@ -102,11 +102,11 @@ class CPDFSDK_InterForm : public IPDF_FormNotify {
private:
// IPDF_FormNotify:
- int BeforeValueChange(CPDF_FormField* pField,
- const WideString& csValue) override;
+ bool BeforeValueChange(CPDF_FormField* pField,
+ const WideString& csValue) override;
void AfterValueChange(CPDF_FormField* pField) override;
- int BeforeSelectionChange(CPDF_FormField* pField,
- const WideString& csValue) override;
+ bool BeforeSelectionChange(CPDF_FormField* pField,
+ const WideString& csValue) override;
void AfterSelectionChange(CPDF_FormField* pField) override;
void AfterCheckedStatusChange(CPDF_FormField* pField) override;
void AfterFormReset(CPDF_InterForm* pForm) override;