1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 25 #ifndef _SBXDEF_HXX 26 #define _SBXDEF_HXX 27 28 29 #ifndef __RSC 30 #ifndef _SOLAR_H 31 #include <tools/solar.h> 32 #endif 33 #include "tools/errcode.hxx" 34 35 #ifndef _SBX_CLASS_TYPE 36 #define _SBX_CLASS_TYPE 37 38 enum SbxClassType { // SBX-class-IDs (order is important!) 39 SbxCLASS_DONTCARE = 1, // don't care (search, not 0 due to StarBASIC) 40 SbxCLASS_ARRAY, // Array of SbxVariables 41 SbxCLASS_VALUE, // simple value 42 SbxCLASS_VARIABLE, // Variable (from here there is Broadcaster) 43 SbxCLASS_METHOD, // Method (Function or Sub) 44 SbxCLASS_PROPERTY, // Property 45 SbxCLASS_OBJECT // Object 46 }; 47 48 #endif 49 50 #ifndef _SBX_DATA_TYPE 51 #define _SBX_DATA_TYPE 52 53 enum SbxDataType { 54 SbxEMPTY = 0, // * Uninitialized 55 SbxNULL = 1, // * Contains no valid data 56 SbxINTEGER = 2, // * Integer (sal_Int16) 57 SbxLONG = 3, // * Long integer (sal_Int32) 58 SbxSINGLE = 4, // * Single-precision floating point number (float) 59 SbxDOUBLE = 5, // * Double-precision floating point number (double) 60 SbxCURRENCY = 6, // Currency (sal_Int64) 61 SbxDATE = 7, // * Date (double) 62 SbxSTRING = 8, // * String (StarView) 63 SbxOBJECT = 9, // * SbxBase object pointer 64 SbxERROR = 10, // * Error (sal_uInt16) 65 SbxBOOL = 11, // * Boolean (0 or -1) 66 SbxVARIANT = 12, // * Anzeige fuer varianten Datentyp 67 SbxDATAOBJECT = 13, // * Common data object w/o ref count 68 69 SbxCHAR = 16, // * signed char 70 SbxBYTE = 17, // * unsigned char 71 SbxUSHORT = 18, // * unsigned short (sal_uInt16) 72 SbxULONG = 19, // * unsigned long (sal_uInt32) 73 SbxLONG64 = 20, // signed 64-bit int 74 SbxULONG64 = 21, // unsigned 64-bit int 75 SbxINT = 22, // * signed machine-dependent int 76 SbxUINT = 23, // * unsigned machine-dependent int 77 SbxVOID = 24, // * no value (= SbxEMPTY) 78 SbxHRESULT = 25, // HRESULT 79 SbxPOINTER = 26, // generic pointer 80 SbxDIMARRAY = 27, // dimensioned array 81 SbxCARRAY = 28, // C style array 82 SbxUSERDEF = 29, // user defined 83 SbxLPSTR = 30, // * null terminated string 84 SbxLPWSTR = 31, // wide null terminated string 85 SbxCoreSTRING = 32, // AB 10.4.97, fuer GetCoreString(), nur zum Konvertieren 86 SbxWSTRING = 33, // AB 4.10.2000 Reimplemented for backwards compatibility (#78919) 87 SbxWCHAR = 34, // AB 4.10.2000 Reimplemented for backwards compatibility (#78919) 88 SbxSALINT64 = 35, // for UNO hyper 89 SbxSALUINT64 = 36, // for UNO unsigned hyper 90 SbxDECIMAL = 37, // for UNO/automation Decimal 91 92 SbxVECTOR = 0x1000, // simple counted array 93 SbxARRAY = 0x2000, // array 94 SbxBYREF = 0x4000, // access by reference 95 96 SbxSV1 = 128, // first defined data type for StarView 97 SbxMEMORYSTREAM, // SvMemoryStream 98 SbxSTORAGE, // SvStorage 99 100 SbxUSER1 = 256, // first user defined data type 101 SbxUSERn = 2047 // last user defined data type 102 }; 103 104 const sal_uInt32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000; 105 const sal_uInt32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000; 106 const sal_uInt32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible 107 const sal_uInt32 SBX_TYPE_VAR_TO_DIM_FLAG = 0x40000; 108 109 #endif 110 111 #ifndef _SBX_OPERATOR 112 #define _SBX_OPERATOR 113 114 enum SbxOperator { 115 // Arithmetical: 116 SbxEXP, // this ^ var 117 SbxMUL, // this * var 118 SbxDIV, // this / var 119 SbxMOD, // this MOD var 120 SbxPLUS, // this + var 121 SbxMINUS, // this - var 122 SbxNEG, // -this (var is ignored) 123 SbxIDIV, // this / var (both operands max. sal_Int32!) 124 // Boolean operators (max sal_Int32!): 125 SbxAND, // this & var 126 SbxOR, // this | var 127 SbxXOR, // this ^ var 128 SbxEQV, // ~this ^ var 129 SbxIMP, // ~this | var 130 SbxNOT, // ~this (var is ignored) 131 // String-concat: 132 SbxCAT, // this & var 133 // Comparisons: 134 SbxEQ, // this = var 135 SbxNE, // this <> var 136 SbxLT, // this < var 137 SbxGT, // this > var 138 SbxLE, // this <= var 139 SbxGE // this >= var 140 }; 141 142 #endif 143 144 #ifndef _SBX_NAME_TYPE 145 #define _SBX_NAME_TYPE 146 147 enum SbxNameType { // Type of the questioned name of a variable 148 SbxNAME_NONE, // plain name 149 SbxNAME_SHORT, // Name(A,B) 150 SbxNAME_SHORT_TYPES, // Name%(A%,B$) 151 SbxNAME_LONG_TYPES // Name(A As Integer, B As String) As Integer 152 }; 153 154 #endif 155 156 // AB: 20.3.96: New error messages 157 typedef sal_uIntPtr SbxError; // Preserve old type 158 159 #endif 160 // von #ifndef __RSC 161 162 163 // New error codes per define 164 #define ERRCODE_SBX_OK ERRCODE_NONE // processed 165 #define ERRCODE_SBX_SYNTAX (1UL | ERRCODE_AREA_SBX | \ 166 ERRCODE_CLASS_COMPILER) // Syntaxerror in parser (where else could syntax errors happen? ;-) 167 #define ERRCODE_SBX_NOTIMP (2UL | ERRCODE_AREA_SBX | \ 168 ERRCODE_CLASS_NOTSUPPORTED) // not possible 169 #define ERRCODE_SBX_OVERFLOW (3UL | ERRCODE_AREA_SBX | \ 170 ERRCODE_CLASS_SBX) // overflow 171 #define ERRCODE_SBX_BOUNDS (4UL | ERRCODE_AREA_SBX | \ 172 ERRCODE_CLASS_SBX) // Invalid array index 173 #define ERRCODE_SBX_ZERODIV (5UL | ERRCODE_AREA_SBX | \ 174 ERRCODE_CLASS_SBX) // Division by zero 175 #define ERRCODE_SBX_CONVERSION (6UL | ERRCODE_AREA_SBX | \ 176 ERRCODE_CLASS_SBX) // wrong data type 177 #define ERRCODE_SBX_BAD_PARAMETER (7UL | ERRCODE_AREA_SBX | \ 178 ERRCODE_CLASS_RUNTIME) // invalid Parameter 179 #define ERRCODE_SBX_PROC_UNDEFINED (8UL | ERRCODE_AREA_SBX | \ 180 ERRCODE_CLASS_RUNTIME) // BASIC-Sub or Function undefined 181 #define ERRCODE_SBX_ERROR (9UL | ERRCODE_AREA_SBX | \ 182 ERRCODE_CLASS_UNKNOWN) // other object-related error 183 #define ERRCODE_SBX_NO_OBJECT (10UL | ERRCODE_AREA_SBX | \ 184 ERRCODE_CLASS_RUNTIME) // Object variable unassigned 185 #define ERRCODE_SBX_CANNOT_LOAD (11UL | ERRCODE_AREA_SBX | \ 186 ERRCODE_CLASS_CREATE) // Object cannot be loaded or initialized 187 #define ERRCODE_SBX_BAD_INDEX (12UL | ERRCODE_AREA_SBX | \ 188 ERRCODE_CLASS_SBX) // Invalid object index 189 #define ERRCODE_SBX_NO_ACTIVE_OBJECT (13UL | ERRCODE_AREA_SBX | \ 190 ERRCODE_CLASS_ACCESS) // Object ist not activated 191 #define ERRCODE_SBX_BAD_PROP_VALUE (14UL | ERRCODE_AREA_SBX | \ 192 ERRCODE_CLASS_RUNTIME) // Bad property value 193 #define ERRCODE_SBX_PROP_READONLY (15UL | ERRCODE_AREA_SBX | \ 194 ERRCODE_CLASS_READ) // Property is read only 195 #define ERRCODE_SBX_PROP_WRITEONLY (16UL | ERRCODE_AREA_SBX | \ 196 ERRCODE_CLASS_WRITE) // Property is write only 197 #define ERRCODE_SBX_INVALID_OBJECT (17UL | ERRCODE_AREA_SBX | \ 198 ERRCODE_CLASS_ACCESS) // Invalid object reference 199 #define ERRCODE_SBX_NO_METHOD (18UL | ERRCODE_AREA_SBX | \ 200 ERRCODE_CLASS_RUNTIME) // Property oder Methode unbekannt 201 #define ERRCODE_SBX_INVALID_USAGE_OBJECT (19UL | ERRCODE_AREA_SBX | \ 202 ERRCODE_CLASS_ACCESS) // Invalid object usage 203 #define ERRCODE_SBX_NO_OLE (20UL | ERRCODE_AREA_SBX | \ 204 ERRCODE_CLASS_ACCESS) // No OLE-Object 205 #define ERRCODE_SBX_BAD_METHOD (21UL | ERRCODE_AREA_SBX | \ 206 ERRCODE_CLASS_RUNTIME) // Method not supported 207 #define ERRCODE_SBX_OLE_ERROR (22UL | ERRCODE_AREA_SBX | \ 208 ERRCODE_CLASS_RUNTIME) // OLE Automation Error 209 #define ERRCODE_SBX_BAD_ACTION (23UL | ERRCODE_AREA_SBX | \ 210 ERRCODE_CLASS_NOTSUPPORTED) // Action not supported 211 #define ERRCODE_SBX_NO_NAMED_ARGS (24UL | ERRCODE_AREA_SBX | \ 212 ERRCODE_CLASS_RUNTIME) // No named arguments 213 #define ERRCODE_SBX_BAD_LOCALE (25UL | ERRCODE_AREA_SBX | \ 214 ERRCODE_CLASS_NOTSUPPORTED) // Locale settings not supported 215 #define ERRCODE_SBX_NAMED_NOT_FOUND (26UL | ERRCODE_AREA_SBX | \ 216 ERRCODE_CLASS_RUNTIME) // Unknown named argument 217 #define ERRCODE_SBX_NOT_OPTIONAL (27UL | ERRCODE_AREA_SBX | \ 218 ERRCODE_CLASS_RUNTIME) // Argument not optional 219 #define ERRCODE_SBX_WRONG_ARGS (28UL | ERRCODE_AREA_SBX | \ 220 ERRCODE_CLASS_SBX) // Invalid number of arguments 221 #define ERRCODE_SBX_NOT_A_COLL (29UL | ERRCODE_AREA_SBX | \ 222 ERRCODE_CLASS_RUNTIME) // Object contains no elements 223 #define LAST_SBX_ERROR_ID 29UL 224 225 226 // Less important for resources 227 #ifndef __RSC 228 229 // Map old codes to new ones 230 #define SbxERR_OK ERRCODE_SBX_OK 231 #define SbxERR_SYNTAX ERRCODE_SBX_SYNTAX 232 #define SbxERR_NOTIMP ERRCODE_SBX_NOTIMP 233 #define SbxERR_OVERFLOW ERRCODE_SBX_OVERFLOW 234 #define SbxERR_BOUNDS ERRCODE_SBX_BOUNDS 235 #define SbxERR_ZERODIV ERRCODE_SBX_ZERODIV 236 #define SbxERR_CONVERSION ERRCODE_SBX_CONVERSION 237 #define SbxERR_BAD_PARAMETER ERRCODE_SBX_BAD_PARAMETER 238 #define SbxERR_PROC_UNDEFINED ERRCODE_SBX_PROC_UNDEFINED 239 #define SbxERR_ERROR ERRCODE_SBX_ERROR 240 #define SbxERR_NO_OBJECT ERRCODE_SBX_NO_OBJECT 241 #define SbxERR_CANNOT_LOAD ERRCODE_SBX_CANNOT_LOAD 242 #define SbxERR_BAD_INDEX ERRCODE_SBX_BAD_INDEX 243 #define SbxERR_NO_ACTIVE_OBJECT ERRCODE_SBX_NO_ACTIVE_OBJECT 244 #define SbxERR_BAD_PROP_VALUE ERRCODE_SBX_BAD_PROP_VALUE 245 #define SbxERR_PROP_READONLY ERRCODE_SBX_PROP_READONLY 246 #define SbxERR_PROP_WRITEONLY ERRCODE_SBX_PROP_WRITEONLY 247 #define SbxERR_INVALID_OBJECT ERRCODE_SBX_INVALID_OBJECT 248 #define SbxERR_NO_METHOD ERRCODE_SBX_NO_METHOD 249 #define SbxERR_INVALID_USAGE_OBJECT ERRCODE_SBX_INVALID_USAGE_OBJECT 250 #define SbxERR_NO_OLE ERRCODE_SBX_NO_OLE 251 #define SbxERR_BAD_METHOD ERRCODE_SBX_BAD_METHOD 252 #define SbxERR_OLE_ERROR ERRCODE_SBX_OLE_ERROR 253 #define SbxERR_BAD_ACTION ERRCODE_SBX_BAD_ACTION 254 #define SbxERR_NO_NAMED_ARGS ERRCODE_SBX_NO_NAMED_ARGS 255 #define SbxERR_BAD_LOCALE ERRCODE_SBX_BAD_LOCALE 256 #define SbxERR_NAMED_NOT_FOUND ERRCODE_SBX_NAMED_NOT_FOUND 257 #define SbxERR_NOT_OPTIONAL ERRCODE_SBX_NOT_OPTIONAL 258 #define SbxERR_WRONG_ARGS ERRCODE_SBX_WRONG_ARGS 259 #define SbxERR_NOT_A_COLL ERRCODE_SBX_NOT_A_COLL 260 261 262 /* Old codes with VB error codes 263 enum SbxError { // Ergebnis einer Rechenoperation/Konversion 264 SbxERR_OK = 0, // durchgefuehrt 265 SbxERR_SYNTAX = 2, // Syntaxfehler im Parser 266 SbxERR_NOTIMP = 5, // nicht moeglich 267 SbxERR_OVERFLOW = 6, // Ueberlauf 268 SbxERR_BOUNDS = 9, // Array-Index ungueltig 269 SbxERR_ZERODIV = 11, // Division durch Null 270 SbxERR_CONVERSION = 13, // falscher Datentyp 271 SbxERR_BAD_PARAMETER = 14, // ung�ltiger Parameter 272 SbxERR_PROC_UNDEFINED = 35, // BASIC-Sub oder Function undefiniert 273 SbxERR_ERROR = 51, // andere Fehler 274 // Objektbezogene Fehler 275 SbxERR_NO_OBJECT = 91, // Objektvariable nicht belegt 276 SbxERR_CANNOT_LOAD = 323, // Objekt kann nicht geladen/eingerichtet werden 277 SbxERR_BAD_INDEX = 341, // Invalid object index 278 SbxERR_NO_ACTIVE_OBJECT=366,// Objekt ist nicht aktiviert 279 SbxERR_BAD_PROP_VALUE = 380,// Bad property value 280 SbxERR_PROP_READONLY = 382, // Property is read only 281 SbxERR_PROP_WRITEONLY = 394,// Property is write only 282 SbxERR_INVALID_OBJECT = 420,// Invalid object reference 283 SbxERR_NO_METHOD = 423, // Property oder Methode unbekannt 284 SbxERR_INVALID_USAGE_OBJECT=425,// Falsche Verwendung eines Objekts 285 SbxERR_NO_OLE = 430, // Kein OLE-Objekt 286 SbxERR_BAD_METHOD = 438, // Methode nicht unterst�tzt 287 SbxERR_OLE_ERROR = 440, // OLE Automation-Fehler 288 SbxERR_BAD_ACTION = 445, // Aktion nicht unterst�tzt 289 SbxERR_NO_NAMED_ARGS = 446, // Keine benannten Argumente 290 SbxERR_BAD_LOCALE = 447, // Laenderspezifische Einstellungen nicht unterst�tzt 291 SbxERR_NAMED_NOT_FOUND = 448,// Unbekanntes benanntes Argument 292 SbxERR_NOT_OPTIONAL = 449, // Argument nicht optional 293 SbxERR_WRONG_ARGS = 450, // Falsche Zahl von Argumenten 294 SbxERR_NOT_A_COLL = 451 // Objekt enth�lt keine Elemente 295 }; 296 */ 297 298 // Flag-Bits: 299 #define SBX_READ 0x0001 // Read permission 300 #define SBX_WRITE 0x0002 // Write permission 301 #define SBX_READWRITE 0x0003 // Read/Write permission 302 #define SBX_DONTSTORE 0x0004 // Don't store object 303 #define SBX_MODIFIED 0x0008 // Object was changed 304 #define SBX_FIXED 0x0010 // Fixed data type (SbxVariable) 305 #define SBX_CONST 0x0020 // Definition of const value 306 #define SBX_OPTIONAL 0x0040 // Parameter is optional 307 #define SBX_HIDDEN 0x0080 // Element is invisible 308 #define SBX_INVISIBLE 0x0100 // Element is not found by Find() 309 #define SBX_EXTSEARCH 0x0200 // Object is searched completely 310 #define SBX_EXTFOUND 0x0400 // Variable was found through extended search 311 #define SBX_GBLSEARCH 0x0800 // Global search via Parents 312 #define SBX_RESERVED 0x1000 // reserved 313 #define SBX_PRIVATE 0x1000 // #110004, #112015, cannot conflict with SBX_RESERVED 314 #define SBX_NO_BROADCAST 0x2000 // No broadcast on Get/Put 315 #define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call) 316 #define SBX_NO_MODIFY 0x8000 // SetModified is suppressed 317 #define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN 318 #define SBX_DIM_AS_NEW 0x0800 // Same value as SBX_GBLSEARCH, cannot conflict as one 319 // is used for objects, the other for variables only 320 #define SBX_VAR_TO_DIM 0x2000 // Same value as SBX_NO_BROADCAST, cannot conflict as 321 // used for variables without broadcaster only 322 323 // Broadcaster-IDs: 324 #define SBX_HINT_DYING SFX_HINT_DYING 325 #define SBX_HINT_DATAWANTED SFX_HINT_USER00 326 #define SBX_HINT_DATACHANGED SFX_HINT_DATACHANGED 327 #define SBX_HINT_CONVERTED SFX_HINT_USER01 328 #define SBX_HINT_INFOWANTED SFX_HINT_USER02 329 #define SBX_HINT_OBJECTCHANGED SFX_HINT_USER03 330 331 // List of all creators for Load/Store 332 333 #define SBXCR_SBX 0x20584253 // SBX(blank) 334 335 // List of predefined SBX-IDs. New SBX-IDs must be precisly defined so that 336 // they are unique within the Stream and appropriate Factory. 337 338 #define SBXID_VALUE 0x4E4E // NN: SbxValue 339 #define SBXID_VARIABLE 0x4156 // VA: SbxVariable 340 #define SBXID_ARRAY 0x5241 // AR: SbxArray 341 #define SBXID_DIMARRAY 0x4944 // DI: SbxDimArray 342 #define SBXID_OBJECT 0x424F // OB: SbxObject 343 #define SBXID_COLLECTION 0x4F43 // CO: SbxCollection 344 #define SBXID_FIXCOLLECTION 0x4346 // FC: SbxStdCollection 345 #define SBXID_METHOD 0x454D // ME: SbxMethod 346 #define SBXID_PROPERTY 0x5250 // PR: SbxProperty 347 348 // StarBASIC restricts the base data type to different intervals. 349 // These intervals are fixed due to portability and independent 350 // of the implementation. Only type double is greedy and takes 351 // what it gets. 352 353 #define SbxMAXCHAR ((sal_Unicode)65535) 354 #define SbxMINCHAR (0) 355 #define SbxMAXBYTE ( 255) 356 #define SbxMAXINT ( 32767) 357 #define SbxMININT (-32768) 358 #define SbxMAXUINT ((sal_uInt16) 65535) 359 #define SbxMAXLNG ( 2147483647) 360 #define SbxMINLNG ((sal_Int32)(-2147483647-1)) 361 #define SbxMAXULNG ((sal_uInt32) 0xffffffff) 362 363 #define SbxMAXSALINT64 SAL_MAX_INT64 364 #define SbxMINSALINT64 SAL_MIN_INT64 365 #define SbxMAXSALUINT64 SAL_MAX_UINT64 366 367 #define SbxMAXSNG ( 3.402823e+38) 368 #define SbxMINSNG (-3.402823e+38) 369 #define SbxMAXSNG2 ( 1.175494351e-38) 370 #define SbxMINSNG2 (-1.175494351e-38) 371 #define SbxMAXCURR ( 922337203685477.5807) 372 #define SbxMINCURR (-922337203685477.5808) 373 #define CURRENCY_FACTOR 10000 374 #define SbxMAXCURRLNG (SbxMAXLNG/CURRENCY_FACTOR) 375 #define SbxMINCURRLNG (SbxMINLNG/CURRENCY_FACTOR) 376 377 // Max valid offset index of a Sbx-Array (due to 64K limit) 378 #define SBX_MAXINDEX 0x3FF0 379 #define SBX_MAXINDEX32 SbxMAXLNG 380 381 // The numeric values of sal_True and FALSE 382 enum SbxBOOL { SbxFALSE = 0, SbxTRUE = -1 }; 383 384 #endif // __RSC 385 386 #endif 387