summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-07 11:26:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-07 12:04:35 +0000
commit05e78bde26d8b8b257ed22a0ce20c5b386a629d1 (patch)
treebbcbccae5942edaf4557018cdb82b1b147f1d9cf /include
parentClean up some OUString creation (diff)
downloadcore-05e78bde26d8b8b257ed22a0ce20c5b386a629d1.tar.gz
core-05e78bde26d8b8b257ed22a0ce20c5b386a629d1.zip
create ErrorHandlerFlags scoped enum for error handling flags
Change-Id: I30c80979c87bad7bc98f36a158c31c88d80d1caf Reviewed-on: https://gerrit.libreoffice.org/33991 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/svtools/ehdl.hxx4
-rw-r--r--include/svtools/sfxecode.hxx1
-rw-r--r--include/tools/errcode.hxx19
-rw-r--r--include/tools/errinf.hxx50
4 files changed, 42 insertions, 32 deletions
diff --git a/include/svtools/ehdl.hxx b/include/svtools/ehdl.hxx
index cb73990d31ce..2865e26c8a6c 100644
--- a/include/svtools/ehdl.hxx
+++ b/include/svtools/ehdl.hxx
@@ -54,7 +54,7 @@ public:
virtual ~SfxErrorHandler() override;
protected:
- bool GetErrorString(sal_uLong lErrId, OUString &, sal_uInt16&) const;
+ bool GetErrorString(sal_uLong lErrId, OUString &, ErrorHandlerFlags&) const;
private:
@@ -66,7 +66,7 @@ private:
pFreeMgr;
SVT_DLLPRIVATE static void GetClassString(sal_uLong lErrId, OUString &);
- virtual bool CreateString( const ErrorInfo *, OUString &, sal_uInt16 &) const override;
+ virtual bool CreateString( const ErrorInfo *, OUString &, ErrorHandlerFlags &) const override;
};
#endif
diff --git a/include/svtools/sfxecode.hxx b/include/svtools/sfxecode.hxx
index 99083f298ec3..77c3ee43bfaa 100644
--- a/include/svtools/sfxecode.hxx
+++ b/include/svtools/sfxecode.hxx
@@ -34,7 +34,6 @@
#define ERRCODE_SFX_WRONGPASSWORD (ERRCODE_AREA_SFX|ERRCODE_CLASS_READ|11)
#define ERRCODE_SFX_DOCUMENTREADONLY (ERRCODE_AREA_SFX|ERRCODE_CLASS_WRITE|12)
#define ERRCODE_SFX_OLEGENERAL (ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|14)
-#define ERRCODE_SFXMSG_STYLEREPLACE (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|13)
#define ERRCODE_SFX_TEMPLATENOTFOUND (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|15)
#define ERRCODE_SFX_ISRELATIVE (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|16)
#define ERRCODE_SFX_FORCEDOCLOAD (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|17)
diff --git a/include/tools/errcode.hxx b/include/tools/errcode.hxx
index 5a8f57af462b..f9859d388099 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 2b9f6b533d9b..d83fa54151ac 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;
sal_uIntPtr GetErrorCode() 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,19 +154,19 @@ 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:
virtual bool CreateString( const ErrorInfo *,
- OUString &, sal_uInt16& nMask ) const = 0;
+ OUString &, ErrorHandlerFlags& nMask ) const = 0;
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* );