summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fxfa.h
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-06-21 21:09:54 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-21 21:09:54 +0000
commitc3cc2ab66d3d8f52dea8083abb6775115e17af7d (patch)
tree227eb764e7ee1f674f9ac992ec6620e4e57e2b01 /xfa/fxfa/fxfa.h
parentaaaf9877478d7add8a74b4db74d97ca19ce1c47e (diff)
downloadpdfium-c3cc2ab66d3d8f52dea8083abb6775115e17af7d.tar.xz
Clean up constant values for JS alert and beep
Define constant values in the public API for the valid values of alert button type, alert icon type, and beep type. Replace various magic numbers through out the code base using these values. Also replace the XFA specific versions with an enum class that is guaranteed to have the same values, instead of #defines that just happen to. This CL does not attempt to add error checking on these values, since it currently doesn't exist so adding it may cause regressions. Change-Id: Ief3aee2a4ad419691c18fc1dba8b984ad222141b Reviewed-on: https://pdfium-review.googlesource.com/35730 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/fxfa.h')
-rw-r--r--xfa/fxfa/fxfa.h39
1 files changed, 27 insertions, 12 deletions
diff --git a/xfa/fxfa/fxfa.h b/xfa/fxfa/fxfa.h
index 1b0c76f584..c1fdd2bcb7 100644
--- a/xfa/fxfa/fxfa.h
+++ b/xfa/fxfa/fxfa.h
@@ -23,18 +23,32 @@ class CXFA_Submit;
class IFWL_AdapterTimerMgr;
class IFX_SeekableReadStream;
-#define XFA_MBICON_Error 0
-#define XFA_MBICON_Warning 1
-#define XFA_MBICON_Question 2
-#define XFA_MBICON_Status 3
-#define XFA_MB_OK 0
-#define XFA_MB_OKCancel 1
-#define XFA_MB_YesNo 2
-#define XFA_MB_YesNoCancel 3
-#define XFA_IDOK 1
-#define XFA_IDCancel 2
-#define XFA_IDNo 3
-#define XFA_IDYes 4
+// Note, values must match fpdf_formfill.h JSPLATFORM_ALERT_BUTTON_* flags.
+enum class AlertButton {
+ kDefault = 0,
+ kOK = 0,
+ kOKCancel = 1,
+ kYesNo = 2,
+ kYesNoCancel = 3,
+};
+
+// Note, values must match fpdf_formfill.h JSPLATFORM_ALERT_ICON_* flags.
+enum class AlertIcon {
+ kDefault = 0,
+ kError = 0,
+ kWarning = 1,
+ kQuestion = 2,
+ kStatus = 3,
+ kAsterisk = 4,
+};
+
+// Note, values must match fpdf_formfill.h JSPLATFORM_ALERT_RETURN_* flags.
+enum class AlertReturn {
+ kOK = 1,
+ kCancel = 2,
+ kNo = 3,
+ kYes = 4,
+};
// Note, values must match fpdf_formfill.h FORMTYPE_* flags.
enum class FormType {
@@ -50,6 +64,7 @@ enum class FormType {
#define XFA_PRINTOPT_AsImage 0x00000008
#define XFA_PRINTOPT_ReverseOrder 0x00000010
#define XFA_PRINTOPT_PrintAnnot 0x00000020
+
#define XFA_PAGEVIEWEVENT_PostAdded 1
#define XFA_PAGEVIEWEVENT_PostRemoved 3
#define XFA_PAGEVIEWEVENT_StopLayout 4