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 --- fpdfsdk/cpdfsdk_interform.h | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'fpdfsdk/cpdfsdk_interform.h') diff --git a/fpdfsdk/cpdfsdk_interform.h b/fpdfsdk/cpdfsdk_interform.h index dc9ac64b5b..ee960ff33c 100644 --- a/fpdfsdk/cpdfsdk_interform.h +++ b/fpdfsdk/cpdfsdk_interform.h @@ -93,12 +93,13 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { const std::vector& fields, bool bIncludeOrExclude); - bool IsNeedHighLight(int nFieldType); - void RemoveAllHighLight(); - void SetHighlightAlpha(uint8_t alpha) { m_iHighlightAlpha = alpha; } - uint8_t GetHighlightAlpha() { return m_iHighlightAlpha; } - void SetHighlightColor(FX_COLORREF clr, int nFieldType); - FX_COLORREF GetHighlightColor(int nFieldType); + bool IsNeedHighLight(FormFieldType fieldType); + void RemoveAllHighLights(); + void SetHighlightAlpha(uint8_t alpha) { m_HighlightAlpha = alpha; } + uint8_t GetHighlightAlpha() { return m_HighlightAlpha; } + void SetHighlightColor(FX_COLORREF clr, FormFieldType fieldType); + void SetAllHighlightColors(FX_COLORREF clr); + FX_COLORREF GetHighlightColor(FormFieldType fieldType); private: // IPDF_FormNotify: @@ -127,16 +128,13 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { std::map m_XFAMap; bool m_bXfaCalculate; bool m_bXfaValidationsEnabled; - static const int kNumFieldTypes = 7; -#else // PDF_ENABLE_XFA - static const int kNumFieldTypes = 6; #endif // PDF_ENABLE_XFA bool m_bCalculate; bool m_bBusy; - FX_COLORREF m_aHighlightColor[kNumFieldTypes]; - uint8_t m_iHighlightAlpha; - bool m_bNeedHightlight[kNumFieldTypes]; + uint8_t m_HighlightAlpha; + FX_COLORREF m_HighlightColor[kFormFieldTypeCount]; + bool m_NeedsHighlight[kFormFieldTypeCount]; }; #endif // FPDFSDK_CPDFSDK_INTERFORM_H_ -- cgit v1.2.3