LibreOffice Module vcl (master)
1
include
vcl
errinf.hxx
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
* This file is part of the LibreOffice project.
4
*
5
* This Source Code Form is subject to the terms of the Mozilla Public
6
* License, v. 2.0. If a copy of the MPL was not distributed with this
7
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
*
9
* This file incorporates work covered by the following license notice:
10
*
11
* Licensed to the Apache Software Foundation (ASF) under one or more
12
* contributor license agreements. See the NOTICE file distributed
13
* with this work for additional information regarding copyright
14
* ownership. The ASF licenses this file to you under the Apache
15
* License, Version 2.0 (the "License"); you may not use this file
16
* except in compliance with the License. You may obtain a copy of
17
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
*/
19
20
#ifndef INCLUDED_VCL_ERRINF_HXX
21
#define INCLUDED_VCL_ERRINF_HXX
22
23
#include <rtl/ustring.hxx>
24
#include <utility>
25
#include <
comphelper/errcode.hxx
>
26
#include <
vcl/dllapi.h
>
27
#include <
o3tl/typed_flags_set.hxx
>
28
29
#include <vector>
30
#include <memory>
31
32
#include <limits.h>
33
34
namespace
weld
{
class
Window
; }
35
36
class
ErrorHandler
;
37
class
ErrorContext
;
38
class
ErrorInfo
;
39
class
DynamicErrorInfo
;
40
class
ImplDynamicErrorInfo
;
41
enum class
DialogMask
;
42
43
class
VCL_DLLPUBLIC
ErrorStringFactory
44
{
45
public
:
46
static
bool
CreateString(
const
ErrorInfo
*, OUString&);
47
};
48
49
typedef
void (*
DisplayFnPtr
)();
50
51
typedef
DialogMask
WindowDisplayErrorFunc
(
52
weld::Window
*,
DialogMask
eMask,
const
OUString &rErr,
const
OUString &rAction);
53
54
typedef
void
BasicDisplayErrorFunc
(
55
const
OUString &rErr,
const
OUString &rAction);
56
57
class
VCL_DLLPUBLIC
ErrorRegistry
58
{
59
friend
class
ErrorHandler
;
60
friend
class
ErrorContext
;
61
friend
class
ErrorStringFactory
;
62
friend
class
ImplDynamicErrorInfo
;
63
64
public
:
65
ErrorRegistry
();
66
67
static
void
RegisterDisplay(
BasicDisplayErrorFunc
*);
68
static
void
RegisterDisplay(
WindowDisplayErrorFunc
*);
69
70
static
void
SetLock(
bool
bLock);
71
static
bool
GetLock();
72
73
static
void
Reset
();
74
75
private
:
76
DisplayFnPtr
pDsp
;
77
bool
bIsWindowDsp
;
78
79
bool
m_bLock
;
80
81
sal_uInt16
nNextError
;
82
83
std::vector<ErrorHandler*>
errorHandlers
;
84
std::vector<ErrorContext*>
contexts
;
85
86
DynamicErrorInfo
* ppDynErrInfo[
ERRCODE_DYNAMIC_COUNT
];
87
};
88
89
enum class
DialogMask
90
{
91
NONE
= 0x0000,
92
ButtonsOk
= 0x0001,
93
ButtonsCancel
= 0x0002,
94
ButtonsRetry
= 0x0004,
95
ButtonsNo
= 0x0008,
96
ButtonsYes
= 0x0010,
97
ButtonsYesNo
= 0x0018,
98
99
ButtonDefaultsOk
= 0x0100,
100
ButtonDefaultsCancel
= 0x0200,
101
ButtonDefaultsYes
= 0x0300,
102
ButtonDefaultsNo
= 0x0400,
103
104
MessageError
= 0x1000,
105
MessageWarning
= 0x2000,
106
MessageInfo
= 0x3000,
107
108
MAX
= USHRT_MAX,
109
};
110
namespace
o3tl
111
{
112
template
<>
struct
typed_flags
<
DialogMask
> :
is_typed_flags
<DialogMask, 0xffff> {};
113
}
114
115
class
SAL_WARN_UNUSED
VCL_DLLPUBLIC
ErrorHandler
116
{
117
friend
class
ErrorStringFactory
;
118
119
public
:
120
ErrorHandler
();
121
virtual
~ErrorHandler
();
122
139
static
DialogMask
HandleError(
ErrCode
nId,
weld::Window
* pParent =
nullptr
,
DialogMask
nMask =
DialogMask::MAX
);
140
static
bool
GetErrorString(
ErrCode
nId, OUString& rStr);
141
142
protected
:
143
virtual
bool
CreateString
(
const
ErrorInfo
*, OUString &)
const
= 0;
144
145
};
146
147
class
SAL_WARN_UNUSED
VCL_DLLPUBLIC
ErrorInfo
148
{
149
public
:
150
ErrorInfo
(
ErrCode
nArgUserId) :
151
nUserId(nArgUserId) {}
152
virtual
~ErrorInfo
();
153
154
ErrCode
const
&
GetErrorCode
()
const
{
return
nUserId; }
155
156
static
std::unique_ptr<ErrorInfo> GetErrorInfo(
ErrCode
);
157
158
private
:
159
ErrCode
nUserId
;
160
};
161
162
class
SAL_WARN_UNUSED
VCL_DLLPUBLIC
DynamicErrorInfo
:
public
ErrorInfo
163
{
164
friend
class
ImplDynamicErrorInfo
;
165
166
public
:
167
DynamicErrorInfo
(
ErrCode
nUserId,
DialogMask
nMask
);
168
virtual
~DynamicErrorInfo
()
override
;
169
170
operator
ErrCode
()
const
;
171
DialogMask
GetDialogMask()
const
;
172
173
private
:
174
std::unique_ptr<ImplDynamicErrorInfo>
pImpl
;
175
176
};
177
178
class
SAL_WARN_UNUSED
VCL_DLLPUBLIC
StringErrorInfo
final :
public
DynamicErrorInfo
179
{
180
public
:
181
StringErrorInfo
(
ErrCode
nUserId,
182
OUString aStringP,
183
DialogMask
nMask =
DialogMask::NONE
);
184
185
const
OUString&
GetErrorString
()
const
{
return
aString; }
186
187
private
:
188
OUString
aString
;
189
190
};
191
192
class
SAL_WARN_UNUSED
VCL_DLLPUBLIC
TwoStringErrorInfo
final :
public
DynamicErrorInfo
193
{
194
public
:
195
TwoStringErrorInfo
(
ErrCode
nUserID, OUString aTheArg1,
196
OUString aTheArg2,
DialogMask
nMask):
197
DynamicErrorInfo
(nUserID, nMask), aArg1(
std
::move(aTheArg1)), aArg2(
std
::move(aTheArg2)) {}
198
199
const
OUString&
GetArg1
()
const
{
return
aArg1; }
200
const
OUString&
GetArg2
()
const
{
return
aArg2; }
201
202
private
:
203
OUString
aArg1
;
204
OUString
aArg2
;
205
206
};
207
208
struct
ImplErrorContext
;
209
210
class
SAL_WARN_UNUSED
VCL_DLLPUBLIC
ErrorContext
211
{
212
friend
class
ErrorHandler
;
213
214
public
:
215
ErrorContext
(
weld::Window
*pWin);
216
virtual
~ErrorContext
();
217
218
virtual
bool
GetString
(
ErrCode
nErrId, OUString& rCtxStr) = 0;
219
weld::Window
* GetParent();
220
221
static
ErrorContext
* GetContext();
222
223
private
:
224
std::unique_ptr<ImplErrorContext>
pImpl
;
225
226
};
227
228
#endif
229
230
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DynamicErrorInfo
Definition:
errinf.hxx:163
DynamicErrorInfo::pImpl
std::unique_ptr< ImplDynamicErrorInfo > pImpl
Definition:
errinf.hxx:174
ErrCode
ErrorContext
Definition:
errinf.hxx:211
ErrorContext::GetString
virtual bool GetString(ErrCode nErrId, OUString &rCtxStr)=0
ErrorContext::pImpl
std::unique_ptr< ImplErrorContext > pImpl
Definition:
errinf.hxx:224
ErrorHandler
Definition:
errinf.hxx:116
ErrorHandler::CreateString
virtual bool CreateString(const ErrorInfo *, OUString &) const =0
ErrorInfo
Definition:
errinf.hxx:148
ErrorInfo::nUserId
ErrCode nUserId
Definition:
errinf.hxx:159
ErrorInfo::ErrorInfo
ErrorInfo(ErrCode nArgUserId)
Definition:
errinf.hxx:150
ErrorInfo::GetErrorCode
ErrCode const & GetErrorCode() const
Definition:
errinf.hxx:154
ErrorRegistry
Definition:
errinf.hxx:58
ErrorRegistry::bIsWindowDsp
bool bIsWindowDsp
Definition:
errinf.hxx:77
ErrorRegistry::errorHandlers
std::vector< ErrorHandler * > errorHandlers
Definition:
errinf.hxx:83
ErrorRegistry::m_bLock
bool m_bLock
Definition:
errinf.hxx:79
ErrorRegistry::pDsp
DisplayFnPtr pDsp
Definition:
errinf.hxx:76
ErrorRegistry::nNextError
sal_uInt16 nNextError
Definition:
errinf.hxx:81
ErrorRegistry::contexts
std::vector< ErrorContext * > contexts
Definition:
errinf.hxx:84
ErrorStringFactory
Definition:
errinf.hxx:44
ImplDynamicErrorInfo
Definition:
errinf.cxx:235
ImplDynamicErrorInfo::DynamicErrorInfo
friend class DynamicErrorInfo
Definition:
errinf.cxx:236
ImplDynamicErrorInfo::nMask
DialogMask nMask
Definition:
errinf.cxx:249
StringErrorInfo
Definition:
errinf.hxx:179
StringErrorInfo::aString
OUString aString
Definition:
errinf.hxx:188
StringErrorInfo::GetErrorString
const OUString & GetErrorString() const
Definition:
errinf.hxx:185
TwoStringErrorInfo
Definition:
errinf.hxx:193
TwoStringErrorInfo::GetArg1
const OUString & GetArg1() const
Definition:
errinf.hxx:199
TwoStringErrorInfo::aArg1
OUString aArg1
Definition:
errinf.hxx:203
TwoStringErrorInfo::GetArg2
const OUString & GetArg2() const
Definition:
errinf.hxx:200
TwoStringErrorInfo::aArg2
OUString aArg2
Definition:
errinf.hxx:204
TwoStringErrorInfo::TwoStringErrorInfo
TwoStringErrorInfo(ErrCode nUserID, OUString aTheArg1, OUString aTheArg2, DialogMask nMask)
Definition:
errinf.hxx:195
weld::Window
Definition:
weld.hxx:525
dllapi.h
VCL_DLLPUBLIC
#define VCL_DLLPUBLIC
Definition:
dllapi.h:29
errcode.hxx
ERRCODE_DYNAMIC_COUNT
#define ERRCODE_DYNAMIC_COUNT
WindowDisplayErrorFunc
DialogMask WindowDisplayErrorFunc(weld::Window *, DialogMask eMask, const OUString &rErr, const OUString &rAction)
Definition:
errinf.hxx:51
BasicDisplayErrorFunc
void BasicDisplayErrorFunc(const OUString &rErr, const OUString &rAction)
Definition:
errinf.hxx:54
DialogMask
DialogMask
Definition:
errinf.hxx:90
DialogMask::ButtonDefaultsCancel
@ ButtonDefaultsCancel
DialogMask::ButtonsYes
@ ButtonsYes
DialogMask::MAX
@ MAX
DialogMask::MessageWarning
@ MessageWarning
DialogMask::ButtonDefaultsNo
@ ButtonDefaultsNo
DialogMask::ButtonsYesNo
@ ButtonsYesNo
DialogMask::ButtonsRetry
@ ButtonsRetry
DialogMask::ButtonDefaultsOk
@ ButtonDefaultsOk
DialogMask::ButtonsNo
@ ButtonsNo
DialogMask::NONE
@ NONE
DialogMask::MessageInfo
@ MessageInfo
DialogMask::ButtonDefaultsYes
@ ButtonDefaultsYes
DialogMask::MessageError
@ MessageError
DialogMask::ButtonsCancel
@ ButtonsCancel
DialogMask::ButtonsOk
@ ButtonsOk
DisplayFnPtr
void(* DisplayFnPtr)()
Definition:
errinf.hxx:49
ScGeneralFunction::MAX
@ MAX
NONE
NONE
o3tl
std
weld
HTMLInputType::Reset
@ Reset
ImplErrorContext
Definition:
errinf.cxx:207
o3tl::is_typed_flags
o3tl::typed_flags
typed_flags_set.hxx
SAL_WARN_UNUSED
#define SAL_WARN_UNUSED
EViewType::Window
@ Window
Generated on Sun Jul 30 2023 04:34:48 for LibreOffice Module vcl (master) by
1.9.3