Branch libreoffice-5-0-4
[LibreOffice.git] / include / tools / errcode.hxx
blob99149604349d900dcf5202a16097c961ce500c12
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_TOOLS_ERRCODE_HXX
21 #define INCLUDED_TOOLS_ERRCODE_HXX
23 #ifndef __RSC
24 #include <tools/solar.h>
25 #endif
29 01234567012345670123456701234567
30 || || ||| || |
31 Warning || || |
32 | || || || |
33 Dynamic || || |
34 | || || |
35 Subsystemarea| || |
36 | || |
37 | || |
38 | || |
39 Class| |
40 | |
41 | |
42 | |
43 Code
46 #define ERRCODE_BUTTON_OK 0x01
47 #define ERRCODE_BUTTON_CANCEL 0x02
48 #define ERRCODE_BUTTON_RETRY 0x04
49 #define ERRCODE_BUTTON_OK_CANCEL 0x03
50 #define ERRCODE_BUTTON_NO 0x08
51 #define ERRCODE_BUTTON_YES 0x10
52 #define ERRCODE_BUTTON_YES_NO 0x18
53 #define ERRCODE_BUTTON_YES_NO_CANCEL 0x1a
55 #define ERRCODE_BUTTON_DEF_OK 0x100
56 #define ERRCODE_BUTTON_DEF_CANCEL 0x200
57 #define ERRCODE_BUTTON_DEF_YES 0x300
58 #define ERRCODE_BUTTON_DEF_NO 0x400
60 #define ERRCODE_MSG_ERROR 0x1000
61 #define ERRCODE_MSG_WARNING 0x2000
62 #define ERRCODE_MSG_INFO 0x3000
63 #define ERRCODE_MSG_QUERY 0x4000
65 #define ERRCODE_ERROR_MASK 0x3fffffffUL
66 #define ERRCODE_WARNING_MASK 0x80000000UL
67 #define ERRCODE_RES_MASK 0x7fff
69 #define ERRCODE_CLASS_SHIFT 8
70 #define ERRCODE_AREA_SHIFT 13
71 #define ERRCODE_DYNAMIC_SHIFT 26
73 #define ERRCODE_CLASS_MASK (31UL <<ERRCODE_CLASS_SHIFT)
75 #define ERRCODE_DYNAMIC_START (1UL <<ERRCODE_DYNAMIC_SHIFT)
76 #define ERRCODE_DYNAMIC_COUNT 31UL
77 #define ERRCODE_DYNAMIC_MASK (31UL <<ERRCODE_DYNAMIC_SHIFT)
79 #ifdef __RSC
81 #define ERRCODE_TOERRID(x) (x & ~ERRCODE_DYNAMIC_MASK)
82 #define ERRCODE_TOERROR(x) \
83 ((x & ERRCODE_WARNING_MASK) ? 0 : (x & ERRCODE_ERROR_MASK))
85 #else
87 typedef sal_uIntPtr ErrCode;
89 inline sal_uIntPtr ERRCODE_TOERRID( sal_uIntPtr x )
91 return x & ~ERRCODE_DYNAMIC_MASK;
94 inline sal_uIntPtr ERRCODE_TOERROR( sal_uIntPtr x )
96 return ((x & ERRCODE_WARNING_MASK) ? 0 : (x & ERRCODE_ERROR_MASK));
99 #endif
101 #define ERRCODE_AREA_TOOLS (0UL << ERRCODE_AREA_SHIFT)
102 #define ERRCODE_AREA_SV (1UL << ERRCODE_AREA_SHIFT)
103 #define ERRCODE_AREA_SFX (2UL << ERRCODE_AREA_SHIFT)
104 #define ERRCODE_AREA_INET (3UL << ERRCODE_AREA_SHIFT)
105 #define ERRCODE_AREA_IO ERRCODE_AREA_TOOLS
107 #define ERRCODE_AREA_LIB1 (8UL << ERRCODE_AREA_SHIFT)
108 #define ERRCODE_AREA_SVX ERRCODE_AREA_LIB1
109 #define ERRCODE_AREA_SVX_END (ERRCODE_AREA_SO-1)
110 #define ERRCODE_AREA_SO (9UL << ERRCODE_AREA_SHIFT)
111 #define ERRCODE_AREA_SO_END (ERRCODE_AREA_SBX-1)
112 #define ERRCODE_AREA_SBX (10UL << ERRCODE_AREA_SHIFT)
113 #define ERRCODE_AREA_SBX_END ((11UL << ERRCODE_AREA_SHIFT) - 1)
114 #define ERRCODE_AREA_DB (11UL << ERRCODE_AREA_SHIFT)
115 #define ERRCODE_AREA_DB_END ((12UL << ERRCODE_AREA_SHIFT) - 1)
116 #define ERRCODE_AREA_JAVA (12UL << ERRCODE_AREA_SHIFT)
117 #define ERRCODE_AREA_JAVA_END ((13UL << ERRCODE_AREA_SHIFT) - 1)
118 #define ERRCODE_AREA_UUI (13UL << ERRCODE_AREA_SHIFT)
119 #define ERRCODE_AREA_UUI_END ((14UL << ERRCODE_AREA_SHIFT) - 1)
120 #define ERRCODE_AREA_LIB2 (14UL << ERRCODE_AREA_SHIFT)
121 #define ERRCODE_AREA_LIB2_END ((15UL << ERRCODE_AREA_SHIFT) - 1)
122 #define ERRCODE_AREA_CHAOS (15UL << ERRCODE_AREA_SHIFT)
123 #define ERRCODE_AREA_CHAOS_END ((16UL << ERRCODE_AREA_SHIFT) - 1)
125 #define ERRCODE_AREA_APP1 (32UL << ERRCODE_AREA_SHIFT)
126 #define ERRCODE_AREA_APP2 (40UL << ERRCODE_AREA_SHIFT)
127 #define ERRCODE_AREA_APP3 (48UL << ERRCODE_AREA_SHIFT)
128 #define ERRCODE_AREA_APP4 (56UL << ERRCODE_AREA_SHIFT)
129 #define ERRCODE_AREA_APP5 (64UL << ERRCODE_AREA_SHIFT)
130 #define ERRCODE_AREA_APP6 (72UL << ERRCODE_AREA_SHIFT)
132 #define ERRCODE_AREA_SC ERRCODE_AREA_APP1
133 #define ERRCODE_AREA_SC_END (ERRCODE_AREA_APP2-1)
135 #define ERRCODE_AREA_SD ERRCODE_AREA_APP2
136 #define ERRCODE_AREA_SD_END (ERRCODE_AREA_APP3-1)
138 #define ERRCODE_AREA_SW ERRCODE_AREA_APP4
139 #define ERRCODE_AREA_SW_END (ERRCODE_AREA_APP5-1)
141 #define ERRCODE_AREA_OFA_END (ERRCODE_AREA_APP6-1)
143 #define ERRCODE_CLASS_NONE (0UL << ERRCODE_CLASS_SHIFT)
144 #define ERRCODE_CLASS_ABORT (1UL << ERRCODE_CLASS_SHIFT)
145 #define ERRCODE_CLASS_GENERAL (2UL << ERRCODE_CLASS_SHIFT)
146 #define ERRCODE_CLASS_NOTEXISTS (3UL << ERRCODE_CLASS_SHIFT)
147 #define ERRCODE_CLASS_ALREADYEXISTS (4UL << ERRCODE_CLASS_SHIFT)
148 #define ERRCODE_CLASS_ACCESS (5UL << ERRCODE_CLASS_SHIFT)
149 #define ERRCODE_CLASS_PATH (6UL << ERRCODE_CLASS_SHIFT)
150 #define ERRCODE_CLASS_LOCKING (7UL << ERRCODE_CLASS_SHIFT)
151 #define ERRCODE_CLASS_PARAMETER (8UL << ERRCODE_CLASS_SHIFT)
152 #define ERRCODE_CLASS_SPACE (9UL << ERRCODE_CLASS_SHIFT)
153 #define ERRCODE_CLASS_NOTSUPPORTED (10UL << ERRCODE_CLASS_SHIFT)
154 #define ERRCODE_CLASS_READ (11UL << ERRCODE_CLASS_SHIFT)
155 #define ERRCODE_CLASS_WRITE (12UL << ERRCODE_CLASS_SHIFT)
156 #define ERRCODE_CLASS_UNKNOWN (13UL << ERRCODE_CLASS_SHIFT)
157 #define ERRCODE_CLASS_VERSION (14UL << ERRCODE_CLASS_SHIFT)
158 #define ERRCODE_CLASS_FORMAT (15UL << ERRCODE_CLASS_SHIFT)
159 #define ERRCODE_CLASS_CREATE (16UL << ERRCODE_CLASS_SHIFT)
160 #define ERRCODE_CLASS_IMPORT (17UL << ERRCODE_CLASS_SHIFT)
161 #define ERRCODE_CLASS_EXPORT (18UL << ERRCODE_CLASS_SHIFT)
162 #define ERRCODE_CLASS_FILTER (19UL << ERRCODE_CLASS_SHIFT)
163 #define ERRCODE_CLASS_SO (20UL << ERRCODE_CLASS_SHIFT)
164 #define ERRCODE_CLASS_SBX (21UL << ERRCODE_CLASS_SHIFT)
165 #define ERRCODE_CLASS_RUNTIME (22UL << ERRCODE_CLASS_SHIFT)
166 #define ERRCODE_CLASS_COMPILER (23UL << ERRCODE_CLASS_SHIFT)
168 #define ERRCODE_NONE (0UL)
169 #define ERRCODE_ABORT ERRCODE_IO_ABORT
171 #define ERRCODE_IO_MISPLACEDCHAR (1UL |ERRCODE_CLASS_PARAMETER|\
172 ERRCODE_AREA_IO)
173 #define ERRCODE_IO_NOTEXISTS (2UL |ERRCODE_CLASS_NOTEXISTS|\
174 ERRCODE_AREA_IO)
175 #define ERRCODE_IO_ALREADYEXISTS (3UL |ERRCODE_CLASS_ALREADYEXISTS|\
176 ERRCODE_AREA_IO)
177 #define ERRCODE_IO_NOTADIRECTORY (4UL |ERRCODE_CLASS_PARAMETER|\
178 ERRCODE_AREA_IO)
179 #define ERRCODE_IO_NOTAFILE (5UL |ERRCODE_CLASS_PARAMETER|\
180 ERRCODE_AREA_IO)
181 #define ERRCODE_IO_INVALIDDEVICE (6UL |ERRCODE_CLASS_PATH|\
182 ERRCODE_AREA_IO)
183 #define ERRCODE_IO_ACCESSDENIED (7UL |ERRCODE_CLASS_ACCESS|\
184 ERRCODE_AREA_IO)
185 #define ERRCODE_IO_LOCKVIOLATION (8UL |ERRCODE_CLASS_LOCKING|\
186 ERRCODE_AREA_IO)
187 #define ERRCODE_IO_OUTOFSPACE (9UL |ERRCODE_CLASS_SPACE|\
188 ERRCODE_AREA_IO)
189 #define ERRCODE_IO_ISWILDCARD (11UL|ERRCODE_CLASS_PARAMETER|\
190 ERRCODE_AREA_IO)
191 #define ERRCODE_IO_NOTSUPPORTED (12UL|ERRCODE_CLASS_NOTSUPPORTED|\
192 ERRCODE_AREA_IO)
193 #define ERRCODE_IO_GENERAL (13UL|ERRCODE_CLASS_GENERAL|\
194 ERRCODE_AREA_IO)
195 #define ERRCODE_IO_TOOMANYOPENFILES (14UL|ERRCODE_CLASS_SPACE|\
196 ERRCODE_AREA_IO)
197 #define ERRCODE_IO_CANTREAD (15UL|ERRCODE_CLASS_READ|\
198 ERRCODE_AREA_IO)
199 #define ERRCODE_IO_CANTWRITE (16UL|ERRCODE_CLASS_WRITE|\
200 ERRCODE_AREA_IO)
201 #define ERRCODE_IO_OUTOFMEMORY (17UL|ERRCODE_CLASS_SPACE|\
202 ERRCODE_AREA_IO)
203 #define ERRCODE_IO_CANTSEEK (18UL|ERRCODE_CLASS_GENERAL|\
204 ERRCODE_AREA_IO)
205 #define ERRCODE_IO_CANTTELL (19UL|ERRCODE_CLASS_GENERAL|\
206 ERRCODE_AREA_IO)
207 #define ERRCODE_IO_WRONGVERSION (20UL|ERRCODE_CLASS_VERSION|\
208 ERRCODE_AREA_IO)
209 #define ERRCODE_IO_WRONGFORMAT (21UL|ERRCODE_CLASS_FORMAT|\
210 ERRCODE_AREA_IO)
211 #define ERRCODE_IO_INVALIDCHAR (22UL|ERRCODE_CLASS_PARAMETER|\
212 ERRCODE_AREA_IO)
213 #define ERRCODE_IO_UNKNOWN (23UL|ERRCODE_CLASS_UNKNOWN|\
214 ERRCODE_AREA_IO)
215 #define ERRCODE_IO_INVALIDACCESS (24UL|ERRCODE_CLASS_ACCESS|\
216 ERRCODE_AREA_IO)
217 #define ERRCODE_IO_CANTCREATE (25UL|ERRCODE_CLASS_CREATE|\
218 ERRCODE_AREA_IO)
219 #define ERRCODE_IO_INVALIDPARAMETER (26UL|ERRCODE_CLASS_PARAMETER|\
220 ERRCODE_AREA_IO)
221 #define ERRCODE_IO_ABORT (27UL|ERRCODE_CLASS_ABORT|\
222 ERRCODE_AREA_IO)
223 #define ERRCODE_IO_NOTEXISTSPATH (28UL |ERRCODE_CLASS_NOTEXISTS|\
224 ERRCODE_AREA_IO)
225 #define ERRCODE_IO_PENDING (29UL |ERRCODE_CLASS_NOTEXISTS|\
226 ERRCODE_AREA_IO)
227 #define ERRCODE_IO_RECURSIVE (30UL |ERRCODE_CLASS_PARAMETER|\
228 ERRCODE_AREA_IO)
229 #define ERRCODE_IO_NAMETOOLONG (31UL |ERRCODE_CLASS_PARAMETER|\
230 ERRCODE_AREA_IO)
231 #define ERRCODE_IO_INVALIDLENGTH (32UL |ERRCODE_CLASS_PARAMETER|\
232 ERRCODE_AREA_IO)
233 #define ERRCODE_IO_CURRENTDIR (33UL |ERRCODE_CLASS_PARAMETER|\
234 ERRCODE_AREA_IO)
235 #define ERRCODE_IO_NOTSAMEDEVICE (34UL |ERRCODE_CLASS_PARAMETER|\
236 ERRCODE_AREA_IO)
237 #define ERRCODE_IO_DEVICENOTREADY (35UL |ERRCODE_CLASS_READ|\
238 ERRCODE_AREA_IO)
239 #define ERRCODE_IO_BADCRC (36UL |ERRCODE_CLASS_READ|\
240 ERRCODE_AREA_IO)
241 #define ERRCODE_IO_WRITEPROTECTED (37UL |ERRCODE_CLASS_ACCESS|\
242 ERRCODE_AREA_IO)
243 #define ERRCODE_IO_BROKENPACKAGE (38UL |ERRCODE_CLASS_FORMAT|\
244 ERRCODE_AREA_IO)
245 #define ERRCODE_IO_NOTSTORABLEINBINARYFORMAT (39UL |ERRCODE_CLASS_FORMAT|\
246 ERRCODE_AREA_IO)
248 // FsysErrorCodes
250 // StreamErrorCodes
251 #define SVSTREAM_OK ERRCODE_NONE
253 #define SVSTREAM_GENERALERROR ERRCODE_IO_GENERAL
254 #define SVSTREAM_FILE_NOT_FOUND ERRCODE_IO_NOTEXISTS
255 #define SVSTREAM_PATH_NOT_FOUND ERRCODE_IO_NOTEXISTSPATH
256 #define SVSTREAM_TOO_MANY_OPEN_FILES ERRCODE_IO_TOOMANYOPENFILES
257 #define SVSTREAM_ACCESS_DENIED ERRCODE_IO_ACCESSDENIED
258 #define SVSTREAM_SHARING_VIOLATION ERRCODE_IO_LOCKVIOLATION
259 #define SVSTREAM_LOCKING_VIOLATION ERRCODE_IO_LOCKVIOLATION
260 #define SVSTREAM_SHARE_BUFF_EXCEEDED ERRCODE_IO_LOCKVIOLATION
262 #define SVSTREAM_INVALID_ACCESS ERRCODE_IO_INVALIDACCESS
263 #define SVSTREAM_INVALID_HANDLE ERRCODE_IO_GENERAL
264 #define SVSTREAM_CANNOT_MAKE ERRCODE_IO_CANTCREATE
265 #define SVSTREAM_INVALID_PARAMETER ERRCODE_IO_INVALIDPARAMETER
267 #define SVSTREAM_READ_ERROR ERRCODE_IO_CANTREAD
268 #define SVSTREAM_WRITE_ERROR ERRCODE_IO_CANTWRITE
269 #define SVSTREAM_SEEK_ERROR ERRCODE_IO_CANTSEEK
271 #define SVSTREAM_OUTOFMEMORY ERRCODE_IO_OUTOFMEMORY
273 #define SVSTREAM_FILEFORMAT_ERROR ERRCODE_IO_WRONGFORMAT
274 #define SVSTREAM_WRONGVERSION ERRCODE_IO_WRONGVERSION
276 #define SVSTREAM_DISK_FULL ERRCODE_IO_OUTOFSPACE
278 // For the EditEngine:
279 #define SVSTREAM_ERRBASE_USER ERRCODE_AREA_LIB1
281 #define PRINTER_OK ERRCODE_NONE
282 #define PRINTER_ABORT ERRCODE_IO_ABORT
283 #define PRINTER_GENERALERROR ERRCODE_IO_GENERAL
285 #define ERRCODE_INET_NAME_RESOLVE (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 1)
286 #define ERRCODE_INET_CONNECT (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 2)
287 #define ERRCODE_INET_READ (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 3)
288 #define ERRCODE_INET_WRITE (ERRCODE_AREA_INET | ERRCODE_CLASS_WRITE| 4)
289 #define ERRCODE_INET_GENERAL (ERRCODE_AREA_INET | ERRCODE_CLASS_WRITE |5)
290 #define ERRCODE_INET_OFFLINE (ERRCODE_AREA_INET | ERRCODE_CLASS_READ |6)
292 #endif
294 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */