diff options
author | Ryan Harrison <rharrison@chromium.org> | 2018-01-12 18:36:30 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-12 18:36:30 +0000 |
commit | 9baf31f8c38e1c5266609e184cc07e369b744760 (patch) | |
tree | 37002a8148539b21f2562454b4864f0056f2aed2 /core/fpdfdoc/cpdf_interform.cpp | |
parent | 72d34be06324624ee4dcf27b1f001ab573ddec06 (diff) | |
download | pdfium-9baf31f8c38e1c5266609e184cc07e369b744760.tar.xz |
Use enum for tracking form field types
Within PDFium use enum class for better type safety when working with
form field types. These values will still be converted to ints as part
of the public API, since that is the existing API.
This work is preperation for extending the number of form field types
to have more specific entries for XFA.
BUG=pdfium:952,chromium:763129,chromium:592758
Change-Id: Ie6c29f02ae22be782ff36eb87d27f1a4bf2c099e
Reviewed-on: https://pdfium-review.googlesource.com/22742
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpdf_interform.cpp')
-rw-r--r-- | core/fpdfdoc/cpdf_interform.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp index 281d4d33fc..1596b17d82 100644 --- a/core/fpdfdoc/cpdf_interform.cpp +++ b/core/fpdfdoc/cpdf_interform.cpp @@ -1206,12 +1206,13 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, return; WideString csWValue = GetFieldValue(*pFieldDict, m_bsEncoding); - int iType = pField->GetFieldType(); + FormFieldType fieldType = pField->GetFieldType(); if (bNotify && m_pFormNotify) { - if (iType == FIELDTYPE_LISTBOX) { + if (fieldType == FormFieldType::kListBox) { if (m_pFormNotify->BeforeSelectionChange(pField, csWValue) < 0) return; - } else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) { + } else if (fieldType == FormFieldType::kComboBox || + fieldType == FormFieldType::kTextField) { if (m_pFormNotify->BeforeValueChange(pField, csWValue) < 0) return; } @@ -1224,12 +1225,15 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, } if (bNotify && m_pFormNotify) { - if (iType == FIELDTYPE_CHECKBOX || iType == FIELDTYPE_RADIOBUTTON) + if (fieldType == FormFieldType::kCheckBox || + fieldType == FormFieldType::kRadioButton) { m_pFormNotify->AfterCheckedStatusChange(pField); - else if (iType == FIELDTYPE_LISTBOX) + } else if (fieldType == FormFieldType::kListBox) { m_pFormNotify->AfterSelectionChange(pField); - else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) + } else if (fieldType == FormFieldType::kComboBox || + fieldType == FormFieldType::kTextField) { m_pFormNotify->AfterValueChange(pField); + } } } |