tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / include / basic / sbxdef.hxx
blob00e9af8ba01a0ff44c8a1181a14c11ff4bb1a568
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 .
21 #pragma once
23 #include <o3tl/typed_flags_set.hxx>
24 #include <sal/types.h>
26 enum class SbxClassType { // SBX-class-IDs (order is important!)
27 DontCare = 1, // don't care (search, not 0 due to StarBASIC)
28 Array, // Array of SbxVariables
29 Value, // simple value
30 Variable, // Variable (from here there is Broadcaster)
31 Method, // Method (Function or Sub)
32 Property, // Property
33 Object // Object
36 enum SbxDataType {
37 SbxEMPTY = 0, // * Uninitialized
38 SbxNULL = 1, // * Contains no valid data
39 SbxINTEGER = 2, // * Integer (sal_Int16)
40 SbxLONG = 3, // * Long integer (sal_Int32)
41 SbxSINGLE = 4, // * Single-precision floating point number (float)
42 SbxDOUBLE = 5, // * Double-precision floating point number (double)
43 SbxCURRENCY = 6, // Currency (sal_Int64)
44 SbxDATE = 7, // * Date (double)
45 SbxSTRING = 8, // * String (StarView)
46 SbxOBJECT = 9, // * SbxBase object pointer
47 SbxERROR = 10, // * Error (sal_uInt16)
48 SbxBOOL = 11, // * Boolean (0 or -1)
50 SbxVARIANT = 12, // * Display for variant datatype
51 SbxDATAOBJECT = 13, // * Common data object w/o ref count
53 SbxCHAR = 16, // * signed char
54 SbxBYTE = 17, // * unsigned char
55 SbxUSHORT = 18, // * unsigned short (sal_uInt16)
56 SbxULONG = 19, // * unsigned long (sal_uInt32)
58 SbxINT = 22, // * signed machine-dependent int
59 SbxUINT = 23, // * unsigned machine-dependent int
61 SbxVOID = 24, // * no value (= SbxEMPTY)
62 SbxHRESULT = 25, // HRESULT
63 SbxPOINTER = 26, // generic pointer
64 SbxDIMARRAY = 27, // dimensioned array
65 SbxCARRAY = 28, // C style array
66 SbxUSERDEF = 29, // user defined
67 SbxLPSTR = 30, // * null terminated string
69 SbxLPWSTR = 31, // wide null terminated string
70 SbxCoreSTRING = 32, // from 1997-4-10 for GetCoreString(), only for converting<
72 SbxWSTRING = 33, // from 2000-10-4 Reimplemented for backwards compatibility (#78919)
73 SbxWCHAR = 34, // from 2000-10-4 Reimplemented for backwards compatibility (#78919)
74 SbxSALINT64 = 35, // for currency internal, signed 64-bit int and UNO hyper
75 SbxSALUINT64= 36, // for currency internal, unsigned 64-bit int and UNO unsigned hyper
76 SbxDECIMAL = 37, // for UNO/automation Decimal
78 SbxVECTOR = 0x1000, // simple counted array
79 SbxARRAY = 0x2000, // array
80 SbxBYREF = 0x4000, // access by reference
82 // tdf#79426, tdf#125180
83 SbxMISSING = 0x8000, // Parameter is missing
86 const sal_uInt32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000;
87 const sal_uInt32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000;
88 const sal_uInt32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible
89 const sal_uInt32 SBX_TYPE_VAR_TO_DIM_FLAG = 0x40000;
91 enum SbxOperator {
92 // Arithmetical:
93 SbxEXP, // this ^ var
94 SbxMUL, // this * var
95 SbxDIV, // this / var
96 SbxMOD, // this MOD var (max INT32!)
97 SbxPLUS, // this + var
98 SbxMINUS, // this - var
99 SbxNEG, // -this (var is ignored)
100 SbxIDIV, // this / var (both operands max. sal_Int32!)
101 // Boolean operators (max sal_Int32!):
102 // Boolean operators (TODO deprecate this limit: max INT32!)
103 SbxAND, // this & var
104 SbxOR, // this | var
105 SbxXOR, // this ^ var
106 SbxEQV, // ~this ^ var
107 SbxIMP, // ~this | var
108 SbxNOT, // ~this (var is ignored)
110 // String concatenation:
111 SbxCAT, // this & var (VBA: this + var)
113 // Comparisons:
114 SbxEQ, // this = var
115 SbxNE, // this <> var
116 SbxLT, // this < var
117 SbxGT, // this > var
118 SbxLE, // this <= var
119 SbxGE // this >= var
122 enum class SbxNameType { // Type of the questioned name of a variable
123 NONE, // plain name
124 CaseInsensitive, // plain name - case insensitive
125 ShortTypes, // Name%(A%,B$)
129 // Flag-Bits:
130 enum class SbxFlagBits {
131 NONE = 0x0000,
132 Read = 0x0001, // Read permission
133 Write = 0x0002, // Write permission
134 ReadWrite = 0x0003, // Read/Write permission
135 DontStore = 0x0004, // Don't store object
136 Modified = 0x0008, // Object was changed
137 Fixed = 0x0010, // Fixed data type (SbxVariable)
138 Const = 0x0020, // Definition of const value
139 Optional = 0x0040, // Parameter is optional
140 Hidden = 0x0080, // Element is invisible
141 Invisible = 0x0100, // Element is not found by Find()
142 ExtSearch = 0x0200, // Object is searched completely
143 ExtFound = 0x0400, // Variable was found through extended search
144 GlobalSearch = 0x0800, // Global search via Parents
145 Reserved = 0x1000, // reserved
146 Private = 0x1000, // #110004, #112015, cannot conflict with SbxFlagBits::Reserved
147 NoBroadcast = 0x2000, // No broadcast on Get/Put
148 Reference = 0x4000, // Parameter is Reference (DLL-call)
149 NoModify = 0x8000, // SetModified is suppressed
150 WithEvents = 0x0080, // Same value as unused SbxFlagBits::Hidden
151 DimAsNew = 0x0800, // Same value as SbxFlagBits::GlobalSearch, cannot conflict as one
152 // is used for objects, the other for variables only
153 VarToDim = 0x2000, // Same value as SbxFlagBits::NoBroadcast, cannot conflict as
154 // used for variables without broadcaster only
156 namespace o3tl
158 template<> struct typed_flags<SbxFlagBits> : is_typed_flags<SbxFlagBits, 0xffff> {};
161 // List of all creators for Load/Store
163 constexpr auto SBXCR_SBX = 0x20584253; // SBX(blank)
165 // List of predefined SBX-IDs. New SBX-IDs must be precisely defined so that
166 // they are unique within the Stream and appropriate Factory.
168 constexpr auto SBXID_VALUE = 0x4E4E; // NN: SbxValue
169 constexpr auto SBXID_VARIABLE = 0x4156; // VA: SbxVariable
170 constexpr auto SBXID_ARRAY = 0x5241; // AR: SbxArray
171 constexpr auto SBXID_DIMARRAY = 0x4944; // DI: SbxDimArray
172 constexpr auto SBXID_OBJECT = 0x424F; // OB: SbxObject
173 constexpr auto SBXID_COLLECTION = 0x4F43; // CO: SbxCollection
174 constexpr auto SBXID_FIXCOLLECTION = 0x4346; // FC: SbxStdCollection
175 constexpr auto SBXID_METHOD = 0x454D; // ME: SbxMethod
176 constexpr auto SBXID_PROPERTY = 0x5250; // PR: SbxProperty
178 // StarBASIC restricts the base data type to different intervals.
179 // These intervals are fixed to create 'portability and independent
180 // of the implementation. Only type double is greedy and takes
181 // what it gets.
183 constexpr auto SbxMAXCHAR = u'\xFFFF';
184 constexpr auto SbxMINCHAR = 0;
185 constexpr auto SbxMAXBYTE = 255;
186 constexpr auto SbxMAXINT = 32767;
187 constexpr auto SbxMININT = -32768;
188 constexpr sal_uInt16 SbxMAXUINT = 65535;
189 constexpr auto SbxMAXLNG = 2147483647;
190 constexpr sal_Int32 SbxMINLNG = -2147483647-1;
191 constexpr sal_uInt32 SbxMAXULNG = 0xffffffff;
193 // Currency stored as SbxSALINT64 == sal_Int64
194 // value range limits are ~(2^63 - 1)/10000
195 // fixed precision has 4 digits right of decimal pt
196 constexpr sal_Int64 CURRENCY_FACTOR = 10000;
197 constexpr auto CURRENCY_FACTOR_SQUARE = 100000000;
199 // TODO effective MAX/MINCURR limits:
200 // true value ( 922337203685477.5807) is too precise for correct comparison to 64bit double
201 constexpr auto SbxMAXCURR = 922337203685477.5807;
202 constexpr auto SbxMINCURR = -922337203685477.5808;
204 constexpr auto SbxMAXSNG = 3.402823e+38;
205 constexpr auto SbxMINSNG = -3.402823e+38;
206 constexpr auto SbxMAXSNG2 = 1.175494351e-38;
207 constexpr auto SbxMINSNG2 = -1.175494351e-38;
209 // Max valid offset index of a Sbx-Array (due to 64K limit)
210 constexpr auto SBX_MAXINDEX = 0x3FF0;
211 constexpr auto SBX_MAXINDEX32 = SbxMAXLNG;
213 // The numeric values of sal_True and FALSE
214 enum SbxBOOL { SbxFALSE = 0, SbxTRUE = -1 };
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */