From 9baf31f8c38e1c5266609e184cc07e369b744760 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Fri, 12 Jan 2018 18:36:30 +0000 Subject: 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 Reviewed-by: Henrique Nakashima --- fxjs/cjs_publicmethods.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'fxjs/cjs_publicmethods.cpp') diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp index eaa16c9fe1..45eae7f8d2 100644 --- a/fxjs/cjs_publicmethods.cpp +++ b/fxjs/cjs_publicmethods.cpp @@ -1599,18 +1599,18 @@ CJS_Return CJS_PublicMethods::AFSimple_Calculate( double dTemp = 0.0; switch (pFormField->GetFieldType()) { - case FIELDTYPE_TEXTFIELD: - case FIELDTYPE_COMBOBOX: { + case FormFieldType::kTextField: + case FormFieldType::kComboBox: { WideString trimmed = pFormField->GetValue(); trimmed.TrimRight(); trimmed.TrimLeft(); dTemp = FX_atof(trimmed.AsStringView()); break; } - case FIELDTYPE_PUSHBUTTON: + case FormFieldType::kPushButton: break; - case FIELDTYPE_CHECKBOX: - case FIELDTYPE_RADIOBUTTON: + case FormFieldType::kCheckBox: + case FormFieldType::kRadioButton: for (int c = 0; c < pFormField->CountControls(); ++c) { CPDF_FormControl* pFormCtrl = pFormField->GetControl(c); if (!pFormField || !pFormCtrl->IsChecked()) @@ -1623,7 +1623,7 @@ CJS_Return CJS_PublicMethods::AFSimple_Calculate( break; } break; - case FIELDTYPE_LISTBOX: + case FormFieldType::kListBox: if (pFormField->CountSelectedItems() <= 1) { WideString trimmed = pFormField->GetValue(); trimmed.TrimRight(); -- cgit v1.2.3