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 /fpdfsdk/formfiller/cffl_interactiveformfiller.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 'fpdfsdk/formfiller/cffl_interactiveformfiller.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 703fc47808..e74f902bd2 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -228,9 +228,9 @@ bool CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, bool bSetFocus; switch (pWidget->GetFieldType()) { - case FIELDTYPE_PUSHBUTTON: - case FIELDTYPE_CHECKBOX: - case FIELDTYPE_RADIOBUTTON: { + case FormFieldType::kPushButton: + case FormFieldType::kCheckBox: + case FormFieldType::kRadioButton: { FX_RECT bbox = GetViewBBox(pPageView, pAnnot->Get()); bSetFocus = bbox.Contains(static_cast<int>(point.x), static_cast<int>(point.y)); @@ -455,7 +455,7 @@ bool CFFL_InteractiveFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { } bool CFFL_InteractiveFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { - if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) + if (pWidget->GetFieldType() == FormFieldType::kPushButton) return false; CPDF_Page* pPage = pWidget->GetPDFPage(); @@ -477,28 +477,28 @@ CFFL_FormFiller* CFFL_InteractiveFormFiller::GetFormFiller( // TODO(thestig): How do we know |pAnnot| is a CPDFSDK_Widget? CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); - int nFieldType = pWidget->GetFieldType(); + FormFieldType fieldType = pWidget->GetFieldType(); CFFL_FormFiller* pFormFiller; - switch (nFieldType) { - case FIELDTYPE_PUSHBUTTON: + switch (fieldType) { + case FormFieldType::kPushButton: pFormFiller = new CFFL_PushButton(m_pFormFillEnv.Get(), pWidget); break; - case FIELDTYPE_CHECKBOX: + case FormFieldType::kCheckBox: pFormFiller = new CFFL_CheckBox(m_pFormFillEnv.Get(), pWidget); break; - case FIELDTYPE_RADIOBUTTON: + case FormFieldType::kRadioButton: pFormFiller = new CFFL_RadioButton(m_pFormFillEnv.Get(), pWidget); break; - case FIELDTYPE_TEXTFIELD: + case FormFieldType::kTextField: pFormFiller = new CFFL_TextField(m_pFormFillEnv.Get(), pWidget); break; - case FIELDTYPE_LISTBOX: + case FormFieldType::kListBox: pFormFiller = new CFFL_ListBox(m_pFormFillEnv.Get(), pWidget); break; - case FIELDTYPE_COMBOBOX: + case FormFieldType::kComboBox: pFormFiller = new CFFL_ComboBox(m_pFormFillEnv.Get(), pWidget); break; - case FIELDTYPE_UNKNOWN: + case FormFieldType::kUnknown: default: pFormFiller = nullptr; break; |