summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-08 11:12:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-09 05:47:36 +0000
commitbcad173faaffd3a3c1e6737d94d2108cf590338d (patch)
tree8370b2186548de7302eb9109ce6ac520ecf17c3b /include
parentloplugin:unusedenumconstants read-only constants in vcl (2) (diff)
downloadcore-bcad173faaffd3a3c1e6737d94d2108cf590338d.tar.gz
core-bcad173faaffd3a3c1e6737d94d2108cf590338d.zip
Reapply "create ErrorHandlerFlags scoped enum for error handling flags""
This effectively reverts commit 32cae6a2eaa41568888df9c8fc5605debd8d704a. Change-Id: I15bb0a5c4acaeee6d47dd93a71601d9687d701bc Reviewed-on: https://gerrit.libreoffice.org/34028 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/tools/errcode.hxx19
-rw-r--r--include/tools/errinf.hxx48
2 files changed, 39 insertions, 28 deletions
diff --git a/include/tools/errcode.hxx b/include/tools/errcode.hxx
index 32edbe72f052..6eaef4b1b77e 100644
--- a/include/tools/errcode.hxx
+++ b/include/tools/errcode.hxx
@@ -46,25 +46,6 @@ Warning || || |
Code
*/
-#define ERRCODE_BUTTON_OK 0x01
-#define ERRCODE_BUTTON_CANCEL 0x02
-#define ERRCODE_BUTTON_RETRY 0x04
-#define ERRCODE_BUTTON_OK_CANCEL 0x03
-#define ERRCODE_BUTTON_NO 0x08
-#define ERRCODE_BUTTON_YES 0x10
-#define ERRCODE_BUTTON_YES_NO 0x18
-#define ERRCODE_BUTTON_YES_NO_CANCEL 0x1a
-
-#define ERRCODE_BUTTON_DEF_OK 0x100
-#define ERRCODE_BUTTON_DEF_CANCEL 0x200
-#define ERRCODE_BUTTON_DEF_YES 0x300
-#define ERRCODE_BUTTON_DEF_NO 0x400
-
-#define ERRCODE_MSG_ERROR 0x1000
-#define ERRCODE_MSG_WARNING 0x2000
-#define ERRCODE_MSG_INFO 0x3000
-#define ERRCODE_MSG_QUERY 0x4000
-
#define ERRCODE_ERROR_MASK 0x3fffffffUL
#define ERRCODE_WARNING_MASK 0x80000000UL
#define ERRCODE_RES_MASK 0x7fff
diff --git a/include/tools/errinf.hxx b/include/tools/errinf.hxx
index 6934d53e0058..319dfc08ca80 100644
--- a/include/tools/errinf.hxx
+++ b/include/tools/errinf.hxx
@@ -26,6 +26,7 @@
#include <rtl/ustring.hxx>
#include <tools/errcode.hxx>
#include <tools/toolsdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
#include <memory>
// FIXME: horrible legacy dependency on VCL from tools.
@@ -34,6 +35,35 @@ namespace vcl { class Window; }
class DynamicErrorInfo_Impl;
class ErrorHandler_Impl;
+enum class ErrorHandlerFlags
+{
+ NONE = 0x0000,
+ ButtonsOk = 0x0001,
+ ButtonsCancel = 0x0002,
+ ButtonsRetry = 0x0004,
+ ButtonsOkCancel = 0x0003,
+ ButtonsNo = 0x0008,
+ ButtonsYes = 0x0010,
+ ButtonsYesNo = 0x0018,
+ ButtonsYesNoCancel = 0x001a,
+
+ ButtonDefaultsOk = 0x0100,
+ ButtonDefaultsCancel = 0x0200,
+ ButtonDefaultsYes = 0x0300,
+ ButtonDefaultsNo = 0x0400,
+
+ MessageError = 0x1000,
+ MessageWarning = 0x2000,
+ MessageInfo = 0x3000,
+ MessageQuery = 0x4000,
+
+ MAX = USHRT_MAX,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ErrorHandlerFlags> : is_typed_flags<ErrorHandlerFlags, 0xffff> {};
+}
+
class SAL_WARN_UNUSED TOOLS_DLLPUBLIC ErrorInfo
{
private:
@@ -59,11 +89,11 @@ private:
public:
- DynamicErrorInfo(sal_uIntPtr lUserId, sal_uInt16 nMask);
+ DynamicErrorInfo(sal_uIntPtr lUserId, ErrorHandlerFlags nMask);
virtual ~DynamicErrorInfo() override;
operator sal_uIntPtr() const;
- sal_uInt16 GetDialogMask() const;
+ ErrorHandlerFlags GetDialogMask() const;
};
class SAL_WARN_UNUSED TOOLS_DLLPUBLIC StringErrorInfo : public DynamicErrorInfo
@@ -75,7 +105,7 @@ public:
StringErrorInfo( sal_uIntPtr lUserId,
const OUString& aStringP,
- sal_uInt16 nMask = 0);
+ ErrorHandlerFlags nMask = ErrorHandlerFlags::NONE);
const OUString& GetErrorString() const { return aString; }
};
@@ -88,7 +118,7 @@ private:
public:
TwoStringErrorInfo(sal_uIntPtr nUserID, const OUString & rTheArg1,
- const OUString & rTheArg2, sal_uInt16 nMask):
+ const OUString & rTheArg2, ErrorHandlerFlags nMask):
DynamicErrorInfo(nUserID, nMask), aArg1(rTheArg1), aArg2(rTheArg2) {}
const OUString& GetArg1() const { return aArg1; }
@@ -113,8 +143,8 @@ public:
static ErrorContext* GetContext();
};
-typedef sal_uInt16 WindowDisplayErrorFunc(
- vcl::Window *, sal_uInt16 nMask, const OUString &rErr, const OUString &rAction);
+typedef ErrorHandlerFlags WindowDisplayErrorFunc(
+ vcl::Window *, ErrorHandlerFlags nMask, const OUString &rErr, const OUString &rAction);
typedef void BasicDisplayErrorFunc(
const OUString &rErr, const OUString &rAction);
@@ -124,8 +154,8 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC ErrorHandler
friend class ErrorHandler_Impl;
private:
- static sal_uInt16 HandleError_Impl( sal_uIntPtr lId,
- sal_uInt16 nFlags,
+ static ErrorHandlerFlags HandleError_Impl( sal_uIntPtr lId,
+ ErrorHandlerFlags nFlags,
bool bJustCreateString,
OUString & rError);
protected:
@@ -135,7 +165,7 @@ public:
ErrorHandler();
virtual ~ErrorHandler();
- static sal_uInt16 HandleError ( sal_uIntPtr lId, sal_uInt16 nMask = USHRT_MAX );
+ static ErrorHandlerFlags HandleError ( sal_uIntPtr lId, ErrorHandlerFlags nMask = ErrorHandlerFlags::MAX );
static bool GetErrorString( sal_uIntPtr lId, OUString& rStr );
static void RegisterDisplay( BasicDisplayErrorFunc* );