1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_VCL_ERRCODE_HXX
21 #define INCLUDED_VCL_ERRCODE_HXX
24 #include <tools/solar.h>
25 #define CAST_TO_UINT32(a) ((sal_uInt32)(a))
27 #define CAST_TO_UINT32(a) (a)
32 01234567012345670123456701234567
49 #define ERRCODE_ERROR_MASK 0x3fffffffUL
50 #define ERRCODE_WARNING_MASK 0x80000000UL
51 #define ERRCODE_RES_MASK 0x7fff
53 #define ERRCODE_CLASS_SHIFT 8
54 #define ERRCODE_AREA_SHIFT 13
55 #define ERRCODE_DYNAMIC_SHIFT 26
57 #define ERRCODE_CLASS_MASK CAST_TO_UINT32(31UL <<ERRCODE_CLASS_SHIFT)
59 #define ERRCODE_DYNAMIC_START CAST_TO_UINT32(1UL <<ERRCODE_DYNAMIC_SHIFT)
60 #define ERRCODE_DYNAMIC_COUNT 31UL
61 #define ERRCODE_DYNAMIC_MASK CAST_TO_UINT32(31UL <<ERRCODE_DYNAMIC_SHIFT)
65 #define ERRCODE_TOERROR(x) \
66 ((x & ERRCODE_WARNING_MASK) ? 0 : (x & ERRCODE_ERROR_MASK))
70 typedef sal_uInt32 ErrCode
;
72 inline sal_uInt32
ERRCODE_TOERROR( ErrCode x
)
74 return ((x
& ERRCODE_WARNING_MASK
) ? 0 : (x
& ERRCODE_ERROR_MASK
));
79 #define ERRCODE_AREA_TOOLS CAST_TO_UINT32(0UL << ERRCODE_AREA_SHIFT)
80 #define ERRCODE_AREA_SV CAST_TO_UINT32(1UL << ERRCODE_AREA_SHIFT)
81 #define ERRCODE_AREA_SFX CAST_TO_UINT32(2UL << ERRCODE_AREA_SHIFT)
82 #define ERRCODE_AREA_INET CAST_TO_UINT32(3UL << ERRCODE_AREA_SHIFT)
83 #define ERRCODE_AREA_IO ERRCODE_AREA_TOOLS
85 #define ERRCODE_AREA_LIB1 CAST_TO_UINT32(8UL << ERRCODE_AREA_SHIFT)
86 #define ERRCODE_AREA_SVX ERRCODE_AREA_LIB1
87 #define ERRCODE_AREA_SVX_END (ERRCODE_AREA_SO-1)
88 #define ERRCODE_AREA_SO CAST_TO_UINT32(9UL << ERRCODE_AREA_SHIFT)
89 #define ERRCODE_AREA_SO_END (ERRCODE_AREA_SBX-1)
90 #define ERRCODE_AREA_SBX CAST_TO_UINT32(10UL << ERRCODE_AREA_SHIFT)
91 #define ERRCODE_AREA_SBX_END CAST_TO_UINT32((11UL << ERRCODE_AREA_SHIFT) - 1)
92 #define ERRCODE_AREA_DB CAST_TO_UINT32(11UL << ERRCODE_AREA_SHIFT)
93 #define ERRCODE_AREA_DB_END CAST_TO_UINT32((12UL << ERRCODE_AREA_SHIFT) - 1)
94 #define ERRCODE_AREA_JAVA CAST_TO_UINT32(12UL << ERRCODE_AREA_SHIFT)
95 #define ERRCODE_AREA_JAVA_END CAST_TO_UINT32((13UL << ERRCODE_AREA_SHIFT) - 1)
96 #define ERRCODE_AREA_UUI CAST_TO_UINT32(13UL << ERRCODE_AREA_SHIFT)
97 #define ERRCODE_AREA_UUI_END CAST_TO_UINT32((14UL << ERRCODE_AREA_SHIFT) - 1)
98 #define ERRCODE_AREA_LIB2 CAST_TO_UINT32(14UL << ERRCODE_AREA_SHIFT)
99 #define ERRCODE_AREA_LIB2_END CAST_TO_UINT32((15UL << ERRCODE_AREA_SHIFT) - 1)
101 #define ERRCODE_AREA_APP1 CAST_TO_UINT32(32UL << ERRCODE_AREA_SHIFT)
102 #define ERRCODE_AREA_APP2 CAST_TO_UINT32(40UL << ERRCODE_AREA_SHIFT)
103 #define ERRCODE_AREA_APP3 CAST_TO_UINT32(48UL << ERRCODE_AREA_SHIFT)
104 #define ERRCODE_AREA_APP4 CAST_TO_UINT32(56UL << ERRCODE_AREA_SHIFT)
105 #define ERRCODE_AREA_APP5 CAST_TO_UINT32(64UL << ERRCODE_AREA_SHIFT)
106 #define ERRCODE_AREA_APP6 CAST_TO_UINT32(72UL << ERRCODE_AREA_SHIFT)
108 #define ERRCODE_AREA_SC ERRCODE_AREA_APP1
109 #define ERRCODE_AREA_SC_END (ERRCODE_AREA_APP2-1)
111 #define ERRCODE_AREA_SD ERRCODE_AREA_APP2
112 #define ERRCODE_AREA_SD_END (ERRCODE_AREA_APP3-1)
114 #define ERRCODE_AREA_SW ERRCODE_AREA_APP4
115 #define ERRCODE_AREA_SW_END (ERRCODE_AREA_APP5-1)
117 #define ERRCODE_AREA_OFA_END (ERRCODE_AREA_APP6-1)
119 #define ERRCODE_CLASS_NONE CAST_TO_UINT32(0UL << ERRCODE_CLASS_SHIFT)
120 #define ERRCODE_CLASS_ABORT CAST_TO_UINT32(1UL << ERRCODE_CLASS_SHIFT)
121 #define ERRCODE_CLASS_GENERAL CAST_TO_UINT32(2UL << ERRCODE_CLASS_SHIFT)
122 #define ERRCODE_CLASS_NOTEXISTS CAST_TO_UINT32(3UL << ERRCODE_CLASS_SHIFT)
123 #define ERRCODE_CLASS_ALREADYEXISTS CAST_TO_UINT32(4UL << ERRCODE_CLASS_SHIFT)
124 #define ERRCODE_CLASS_ACCESS CAST_TO_UINT32(5UL << ERRCODE_CLASS_SHIFT)
125 #define ERRCODE_CLASS_PATH CAST_TO_UINT32(6UL << ERRCODE_CLASS_SHIFT)
126 #define ERRCODE_CLASS_LOCKING CAST_TO_UINT32(7UL << ERRCODE_CLASS_SHIFT)
127 #define ERRCODE_CLASS_PARAMETER CAST_TO_UINT32(8UL << ERRCODE_CLASS_SHIFT)
128 #define ERRCODE_CLASS_SPACE CAST_TO_UINT32(9UL << ERRCODE_CLASS_SHIFT)
129 #define ERRCODE_CLASS_NOTSUPPORTED CAST_TO_UINT32(10UL << ERRCODE_CLASS_SHIFT)
130 #define ERRCODE_CLASS_READ CAST_TO_UINT32(11UL << ERRCODE_CLASS_SHIFT)
131 #define ERRCODE_CLASS_WRITE CAST_TO_UINT32(12UL << ERRCODE_CLASS_SHIFT)
132 #define ERRCODE_CLASS_UNKNOWN CAST_TO_UINT32(13UL << ERRCODE_CLASS_SHIFT)
133 #define ERRCODE_CLASS_VERSION CAST_TO_UINT32(14UL << ERRCODE_CLASS_SHIFT)
134 #define ERRCODE_CLASS_FORMAT CAST_TO_UINT32(15UL << ERRCODE_CLASS_SHIFT)
135 #define ERRCODE_CLASS_CREATE CAST_TO_UINT32(16UL << ERRCODE_CLASS_SHIFT)
136 #define ERRCODE_CLASS_IMPORT CAST_TO_UINT32(17UL << ERRCODE_CLASS_SHIFT)
137 #define ERRCODE_CLASS_EXPORT CAST_TO_UINT32(18UL << ERRCODE_CLASS_SHIFT)
138 #define ERRCODE_CLASS_FILTER CAST_TO_UINT32(19UL << ERRCODE_CLASS_SHIFT)
139 #define ERRCODE_CLASS_SO CAST_TO_UINT32(20UL << ERRCODE_CLASS_SHIFT)
140 #define ERRCODE_CLASS_SBX CAST_TO_UINT32(21UL << ERRCODE_CLASS_SHIFT)
141 #define ERRCODE_CLASS_RUNTIME CAST_TO_UINT32(22UL << ERRCODE_CLASS_SHIFT)
142 #define ERRCODE_CLASS_COMPILER CAST_TO_UINT32(23UL << ERRCODE_CLASS_SHIFT)
144 #define ERRCODE_NONE CAST_TO_UINT32(0UL)
145 #define ERRCODE_ABORT ERRCODE_IO_ABORT
147 #define ERRCODE_IO_MISPLACEDCHAR CAST_TO_UINT32(1UL |ERRCODE_CLASS_PARAMETER|\
149 #define ERRCODE_IO_NOTEXISTS CAST_TO_UINT32(2UL |ERRCODE_CLASS_NOTEXISTS|\
151 #define ERRCODE_IO_ALREADYEXISTS CAST_TO_UINT32(3UL |ERRCODE_CLASS_ALREADYEXISTS|\
153 #define ERRCODE_IO_NOTADIRECTORY CAST_TO_UINT32(4UL |ERRCODE_CLASS_PARAMETER|\
155 #define ERRCODE_IO_NOTAFILE CAST_TO_UINT32(5UL |ERRCODE_CLASS_PARAMETER|\
157 #define ERRCODE_IO_INVALIDDEVICE CAST_TO_UINT32(6UL |ERRCODE_CLASS_PATH|\
159 #define ERRCODE_IO_ACCESSDENIED CAST_TO_UINT32(7UL |ERRCODE_CLASS_ACCESS|\
161 #define ERRCODE_IO_LOCKVIOLATION CAST_TO_UINT32(8UL |ERRCODE_CLASS_LOCKING|\
163 #define ERRCODE_IO_OUTOFSPACE CAST_TO_UINT32(9UL |ERRCODE_CLASS_SPACE|\
165 #define ERRCODE_IO_ISWILDCARD CAST_TO_UINT32(11UL|ERRCODE_CLASS_PARAMETER|\
167 #define ERRCODE_IO_NOTSUPPORTED CAST_TO_UINT32(12UL|ERRCODE_CLASS_NOTSUPPORTED|\
169 #define ERRCODE_IO_GENERAL CAST_TO_UINT32(13UL|ERRCODE_CLASS_GENERAL|\
171 #define ERRCODE_IO_TOOMANYOPENFILES CAST_TO_UINT32(14UL|ERRCODE_CLASS_SPACE|\
173 #define ERRCODE_IO_CANTREAD CAST_TO_UINT32(15UL|ERRCODE_CLASS_READ|\
175 #define ERRCODE_IO_CANTWRITE CAST_TO_UINT32(16UL|ERRCODE_CLASS_WRITE|\
177 #define ERRCODE_IO_OUTOFMEMORY CAST_TO_UINT32(17UL|ERRCODE_CLASS_SPACE|\
179 #define ERRCODE_IO_CANTSEEK CAST_TO_UINT32(18UL|ERRCODE_CLASS_GENERAL|\
181 #define ERRCODE_IO_CANTTELL CAST_TO_UINT32(19UL|ERRCODE_CLASS_GENERAL|\
183 #define ERRCODE_IO_WRONGVERSION CAST_TO_UINT32(20UL|ERRCODE_CLASS_VERSION|\
185 #define ERRCODE_IO_WRONGFORMAT CAST_TO_UINT32(21UL|ERRCODE_CLASS_FORMAT|\
187 #define ERRCODE_IO_INVALIDCHAR CAST_TO_UINT32(22UL|ERRCODE_CLASS_PARAMETER|\
189 #define ERRCODE_IO_UNKNOWN CAST_TO_UINT32(23UL|ERRCODE_CLASS_UNKNOWN|\
191 #define ERRCODE_IO_INVALIDACCESS CAST_TO_UINT32(24UL|ERRCODE_CLASS_ACCESS|\
193 #define ERRCODE_IO_CANTCREATE CAST_TO_UINT32(25UL|ERRCODE_CLASS_CREATE|\
195 #define ERRCODE_IO_INVALIDPARAMETER CAST_TO_UINT32(26UL|ERRCODE_CLASS_PARAMETER|\
197 #define ERRCODE_IO_ABORT CAST_TO_UINT32(27UL|ERRCODE_CLASS_ABORT|\
199 #define ERRCODE_IO_NOTEXISTSPATH CAST_TO_UINT32(28UL |ERRCODE_CLASS_NOTEXISTS|\
201 #define ERRCODE_IO_PENDING CAST_TO_UINT32(29UL |ERRCODE_CLASS_NOTEXISTS|\
203 #define ERRCODE_IO_RECURSIVE CAST_TO_UINT32(30UL |ERRCODE_CLASS_PARAMETER|\
205 #define ERRCODE_IO_NAMETOOLONG CAST_TO_UINT32(31UL |ERRCODE_CLASS_PARAMETER|\
207 #define ERRCODE_IO_INVALIDLENGTH CAST_TO_UINT32(32UL |ERRCODE_CLASS_PARAMETER|\
209 #define ERRCODE_IO_CURRENTDIR CAST_TO_UINT32(33UL |ERRCODE_CLASS_PARAMETER|\
211 #define ERRCODE_IO_NOTSAMEDEVICE CAST_TO_UINT32(34UL |ERRCODE_CLASS_PARAMETER|\
213 #define ERRCODE_IO_DEVICENOTREADY CAST_TO_UINT32(35UL |ERRCODE_CLASS_READ|\
215 #define ERRCODE_IO_BADCRC CAST_TO_UINT32(36UL |ERRCODE_CLASS_READ|\
217 #define ERRCODE_IO_WRITEPROTECTED CAST_TO_UINT32(37UL |ERRCODE_CLASS_ACCESS|\
219 #define ERRCODE_IO_BROKENPACKAGE CAST_TO_UINT32(38UL |ERRCODE_CLASS_FORMAT|\
221 #define ERRCODE_IO_NOTSTORABLEINBINARYFORMAT CAST_TO_UINT32(39UL |ERRCODE_CLASS_FORMAT|\
227 #define SVSTREAM_OK ERRCODE_NONE
229 #define SVSTREAM_GENERALERROR ERRCODE_IO_GENERAL
230 #define SVSTREAM_FILE_NOT_FOUND ERRCODE_IO_NOTEXISTS
231 #define SVSTREAM_PATH_NOT_FOUND ERRCODE_IO_NOTEXISTSPATH
232 #define SVSTREAM_TOO_MANY_OPEN_FILES ERRCODE_IO_TOOMANYOPENFILES
233 #define SVSTREAM_ACCESS_DENIED ERRCODE_IO_ACCESSDENIED
234 #define SVSTREAM_SHARING_VIOLATION ERRCODE_IO_LOCKVIOLATION
235 #define SVSTREAM_LOCKING_VIOLATION ERRCODE_IO_LOCKVIOLATION
236 #define SVSTREAM_SHARE_BUFF_EXCEEDED ERRCODE_IO_LOCKVIOLATION
238 #define SVSTREAM_INVALID_ACCESS ERRCODE_IO_INVALIDACCESS
239 #define SVSTREAM_INVALID_HANDLE ERRCODE_IO_GENERAL
240 #define SVSTREAM_CANNOT_MAKE ERRCODE_IO_CANTCREATE
241 #define SVSTREAM_INVALID_PARAMETER ERRCODE_IO_INVALIDPARAMETER
243 #define SVSTREAM_READ_ERROR ERRCODE_IO_CANTREAD
244 #define SVSTREAM_WRITE_ERROR ERRCODE_IO_CANTWRITE
245 #define SVSTREAM_SEEK_ERROR ERRCODE_IO_CANTSEEK
247 #define SVSTREAM_OUTOFMEMORY ERRCODE_IO_OUTOFMEMORY
249 #define SVSTREAM_FILEFORMAT_ERROR ERRCODE_IO_WRONGFORMAT
250 #define SVSTREAM_WRONGVERSION ERRCODE_IO_WRONGVERSION
252 #define SVSTREAM_DISK_FULL ERRCODE_IO_OUTOFSPACE
254 // For the EditEngine:
255 #define SVSTREAM_ERRBASE_USER ERRCODE_AREA_LIB1
257 #define PRINTER_OK ERRCODE_NONE
258 #define PRINTER_ABORT ERRCODE_IO_ABORT
259 #define PRINTER_GENERALERROR ERRCODE_IO_GENERAL
261 #define ERRCODE_INET_NAME_RESOLVE (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 1)
262 #define ERRCODE_INET_CONNECT (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 2)
263 #define ERRCODE_INET_READ (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 3)
264 #define ERRCODE_INET_WRITE (ERRCODE_AREA_INET | ERRCODE_CLASS_WRITE| 4)
265 #define ERRCODE_INET_GENERAL (ERRCODE_AREA_INET | ERRCODE_CLASS_WRITE |5)
266 #define ERRCODE_INET_OFFLINE (ERRCODE_AREA_INET | ERRCODE_CLASS_READ |6)
270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */