diff options
Diffstat (limited to 'include/tools/errinf.hxx')
-rw-r--r-- | include/tools/errinf.hxx | 50 |
1 files changed, 40 insertions, 10 deletions
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* ); |