LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / basic / source / runtime / stdobj.cxx
blob810f53ad4912f3d346e0d2d1f01a262b12b50357
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 #include <runtime.hxx>
22 #include <stdobj.hxx>
23 #include <sbstdobj.hxx>
24 #include <rtlproto.hxx>
25 #include <sbintern.hxx>
26 // The nArgs-field of a table entry is encrypted as follows:
27 // At the moment it is assumed that properties don't need any
28 // parameters!
30 // previously ARGSMASK_ was 0x007F ( e.g. up to 127 args ) however 63 should be
31 // enough, if not we need to increase the size of nArgs member in the Methods
32 // struct below.
33 // note: the limitation of 63 args is only for RTL functions defined here and
34 // does NOT impose a limit on User defined procedures ). This changes is to
35 // allow us space for a flag to denylist some functions in vba mode
37 #define ARGSMASK_ 0x003F // 63 Arguments
38 #define COMPTMASK_ 0x00C0 // COMPATIBILITY mask
39 #define COMPATONLY_ 0x0080 // procedure is visible in vba mode only
40 #define NORMONLY_ 0x0040 // procedure is visible in normal mode only
42 #define RWMASK_ 0x0F00 // mask for R/W-bits
43 #define TYPEMASK_ 0xF000 // mask for the entry's type
45 #define OPT_ 0x0400 // parameter is optional
46 #define CONST_ 0x0800 // property is const
47 #define METHOD_ 0x3000
48 #define PROPERTY_ 0x4000
49 #define OBJECT_ 0x8000
50 // combination of bits above:
51 #define FUNCTION_ 0x1100
52 #define LFUNCTION_ 0x1300 // mask for function which also works as Lvalue
53 #define SUB_ 0x2100
54 #define ROPROP_ 0x4100 // mask Read Only-Property
55 #define RWPROP_ 0x4300 // mask Read/Write-Property
56 #define CPROP_ 0x4900 // mask for constant
58 namespace {
60 struct Method {
61 RtlCall pFunc;
62 std::u16string_view sName;
63 SbxDataType eType;
64 short nArgs;
65 sal_uInt16 nHash;
66 constexpr Method(std::u16string_view name, SbxDataType type, short args, RtlCall func)
67 : pFunc(func)
68 , sName(name)
69 , eType(type)
70 , nArgs(args)
71 , nHash(SbxVariable::MakeHashCode(name))
76 constexpr Method arg(std::u16string_view name, SbxDataType type, short args = 0)
78 return Method(name, type, args, nullptr);
81 template <int N> constexpr bool MethodsTableValid(const Method (&rMethods)[N])
83 int nCurMethArgs = 0;
84 int nArgsChecked = 0;
85 bool bFinished = false;
86 for (const auto& m : rMethods)
88 assert(!bFinished); // no entries after end-of-table entry
89 if (bFinished)
90 return false;
91 if (m.nArgs == -1) // end-of-table entry
93 assert(nCurMethArgs == nArgsChecked); // last method had correct # of arguments
94 if (nCurMethArgs != nArgsChecked)
95 return false;
96 bFinished = true;
98 else if (m.pFunc) // main (function/sub/etc) entry
100 assert(nCurMethArgs == nArgsChecked); // previous method had correct # of arguments
101 if (nCurMethArgs != nArgsChecked)
102 return false;
103 nCurMethArgs = m.nArgs & ARGSMASK_;
104 nArgsChecked = 0;
106 else // subordinate (argument) entry
107 ++nArgsChecked;
109 assert(bFinished); // its last entry was end-of-table entry
110 return bFinished;
115 constexpr Method aMethods[] = {
117 { u"Abs", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Abs },
118 arg(u"number", SbxDOUBLE),
120 { u"Array", SbxOBJECT, FUNCTION_, SbRtl_Array },
121 { u"Asc", SbxLONG, 1 | FUNCTION_, SbRtl_Asc },
122 arg(u"string", SbxSTRING),
124 { u"AscW", SbxLONG, 1 | FUNCTION_ | COMPATONLY_, SbRtl_Asc },
125 arg(u"string", SbxSTRING),
127 { u"Atn", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Atn },
128 arg(u"number", SbxDOUBLE),
130 { u"ATTR_ARCHIVE", SbxINTEGER, CPROP_, SbRtl_ATTR_ARCHIVE },
131 { u"ATTR_DIRECTORY", SbxINTEGER, CPROP_, SbRtl_ATTR_DIRECTORY },
132 { u"ATTR_HIDDEN", SbxINTEGER, CPROP_, SbRtl_ATTR_HIDDEN },
133 { u"ATTR_NORMAL", SbxINTEGER, CPROP_, SbRtl_ATTR_NORMAL },
134 { u"ATTR_READONLY", SbxINTEGER, CPROP_, SbRtl_ATTR_READONLY },
135 { u"ATTR_SYSTEM", SbxINTEGER, CPROP_, SbRtl_ATTR_SYSTEM },
136 { u"ATTR_VOLUME", SbxINTEGER, CPROP_, SbRtl_ATTR_VOLUME },
138 { u"Beep", SbxNULL, FUNCTION_, SbRtl_Beep },
139 { u"Blue", SbxINTEGER, 1 | FUNCTION_ | NORMONLY_, SbRtl_Blue },
140 arg(u"RGB-Value", SbxLONG),
142 { u"CallByName", SbxVARIANT, 3 | FUNCTION_, SbRtl_CallByName },
143 arg(u"Object", SbxOBJECT),
144 arg(u"ProcName", SbxSTRING),
145 arg(u"CallType", SbxINTEGER),
147 { u"CBool", SbxBOOL, 1 | FUNCTION_, SbRtl_CBool },
148 arg(u"expression", SbxVARIANT),
150 { u"CByte", SbxBYTE, 1 | FUNCTION_, SbRtl_CByte },
151 arg(u"expression", SbxVARIANT),
153 { u"CCur", SbxCURRENCY, 1 | FUNCTION_, SbRtl_CCur },
154 arg(u"expression", SbxVARIANT),
156 { u"CDate", SbxDATE, 1 | FUNCTION_, SbRtl_CDate },
157 arg(u"expression", SbxVARIANT),
159 { u"CDateFromUnoDate", SbxDATE, 1 | FUNCTION_, SbRtl_CDateFromUnoDate },
160 arg(u"UnoDate", SbxOBJECT),
162 { u"CDateToUnoDate", SbxOBJECT, 1 | FUNCTION_, SbRtl_CDateToUnoDate },
163 arg(u"Date", SbxDATE),
165 { u"CDateFromUnoTime", SbxDATE, 1 | FUNCTION_, SbRtl_CDateFromUnoTime },
166 arg(u"UnoTime", SbxOBJECT),
168 { u"CDateToUnoTime", SbxOBJECT, 1 | FUNCTION_, SbRtl_CDateToUnoTime },
169 arg(u"Time", SbxDATE),
171 { u"CDateFromUnoDateTime", SbxDATE, 1 | FUNCTION_, SbRtl_CDateFromUnoDateTime },
172 arg(u"UnoDateTime", SbxOBJECT),
174 { u"CDateToUnoDateTime", SbxOBJECT, 1 | FUNCTION_, SbRtl_CDateToUnoDateTime },
175 arg(u"DateTime", SbxDATE),
177 { u"CDateFromIso", SbxDATE, 1 | FUNCTION_, SbRtl_CDateFromIso },
178 arg(u"IsoDate", SbxSTRING),
180 { u"CDateToIso", SbxSTRING, 1 | FUNCTION_, SbRtl_CDateToIso },
181 arg(u"Date", SbxDATE),
183 { u"CDec", SbxDECIMAL, 1 | FUNCTION_, SbRtl_CDec },
184 arg(u"expression", SbxVARIANT),
186 { u"CDbl", SbxDOUBLE, 1 | FUNCTION_, SbRtl_CDbl },
187 arg(u"expression", SbxVARIANT),
189 { u"CF_BITMAP", SbxINTEGER, CPROP_, SbRtl_CF_BITMAP },
190 { u"CF_METAFILEPICT", SbxINTEGER, CPROP_, SbRtl_CF_METAFILEPICT },
191 { u"CF_TEXT", SbxINTEGER, CPROP_, SbRtl_CF_TEXT },
192 { u"ChDir", SbxNULL, 1 | FUNCTION_, SbRtl_ChDir },
193 arg(u"string", SbxSTRING),
195 { u"ChDrive", SbxNULL, 1 | FUNCTION_, SbRtl_ChDrive },
196 arg(u"string", SbxSTRING),
198 { u"Choose", SbxVARIANT, 2 | FUNCTION_, SbRtl_Choose },
199 arg(u"Index", SbxINTEGER),
200 arg(u"Expression", SbxVARIANT),
202 { u"Chr", SbxSTRING, 1 | FUNCTION_, SbRtl_Chr },
203 arg(u"charcode", SbxLONG),
205 { u"ChrW", SbxSTRING, 1 | FUNCTION_ | COMPATONLY_, SbRtl_ChrW },
206 arg(u"charcode", SbxLONG),
208 { u"CInt", SbxINTEGER, 1 | FUNCTION_, SbRtl_CInt },
209 arg(u"expression", SbxVARIANT),
211 { u"CLEAR_ALLTABS", SbxINTEGER, CPROP_, SbRtl_CLEAR_ALLTABS },
212 { u"CLEAR_TAB", SbxINTEGER, CPROP_, SbRtl_CLEAR_TAB },
213 { u"CLng", SbxLONG, 1 | FUNCTION_, SbRtl_CLng },
214 arg(u"expression", SbxVARIANT),
216 { u"CompatibilityMode", SbxBOOL, 1 | FUNCTION_, SbRtl_CompatibilityMode },
217 arg(u"bEnable", SbxBOOL),
219 { u"ConvertFromUrl", SbxSTRING, 1 | FUNCTION_, SbRtl_ConvertFromUrl },
220 arg(u"Url", SbxSTRING),
222 { u"ConvertToUrl", SbxSTRING, 1 | FUNCTION_, SbRtl_ConvertToUrl },
223 arg(u"SystemPath", SbxSTRING),
225 { u"Cos", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Cos },
226 arg(u"number", SbxDOUBLE),
228 { u"CreateObject", SbxOBJECT, 1 | FUNCTION_, SbRtl_CreateObject },
229 arg(u"class", SbxSTRING),
231 { u"CreateUnoListener", SbxOBJECT, 2 | FUNCTION_, SbRtl_CreateUnoListener },
232 arg(u"prefix", SbxSTRING),
233 arg(u"typename", SbxSTRING),
235 { u"CreateUnoDialog", SbxOBJECT, 2 | FUNCTION_, SbRtl_CreateUnoDialog },
236 arg(u"dialoglibrary", SbxOBJECT),
237 arg(u"dialogname", SbxSTRING),
239 { u"CreateUnoService", SbxOBJECT, 1 | FUNCTION_, SbRtl_CreateUnoService },
240 arg(u"servicename", SbxSTRING),
242 { u"CreateUnoServiceWithArguments", SbxOBJECT, 2 | FUNCTION_, SbRtl_CreateUnoServiceWithArguments },
243 arg(u"servicename", SbxSTRING),
244 arg(u"arguments", SbxARRAY),
246 { u"CreateUnoStruct", SbxOBJECT, 1 | FUNCTION_, SbRtl_CreateUnoStruct },
247 arg(u"classname", SbxSTRING),
249 { u"CreateUnoValue", SbxOBJECT, 2 | FUNCTION_, SbRtl_CreateUnoValue },
250 arg(u"type", SbxSTRING),
251 arg(u"value", SbxVARIANT),
253 { u"CreatePropertySet", SbxOBJECT, 1 | FUNCTION_, SbRtl_CreatePropertySet },
254 arg(u"values", SbxARRAY),
256 { u"CSng", SbxSINGLE, 1 | FUNCTION_, SbRtl_CSng },
257 arg(u"expression", SbxVARIANT),
259 { u"CStr", SbxSTRING, 1 | FUNCTION_, SbRtl_CStr },
260 arg(u"expression", SbxVARIANT),
262 { u"CurDir", SbxSTRING, 1 | FUNCTION_, SbRtl_CurDir },
263 arg(u"string", SbxSTRING),
265 { u"CVar", SbxVARIANT, 1 | FUNCTION_, SbRtl_CVar },
266 arg(u"expression", SbxVARIANT),
268 { u"CVErr", SbxVARIANT, 1 | FUNCTION_, SbRtl_CVErr },
269 arg(u"expression", SbxVARIANT),
271 { u"DDB", SbxDOUBLE, 5 | FUNCTION_ | COMPATONLY_, SbRtl_DDB },
272 arg(u"Cost", SbxDOUBLE),
273 arg(u"Salvage", SbxDOUBLE),
274 arg(u"Life", SbxDOUBLE),
275 arg(u"Period", SbxDOUBLE),
276 arg(u"Factor", SbxVARIANT, OPT_),
278 { u"Date", SbxDATE, LFUNCTION_, SbRtl_Date },
279 { u"DateAdd", SbxDATE, 3 | FUNCTION_, SbRtl_DateAdd },
280 arg(u"Interval", SbxSTRING),
281 arg(u"Number", SbxLONG),
282 arg(u"Date", SbxDATE),
284 { u"DateDiff", SbxDOUBLE, 5 | FUNCTION_, SbRtl_DateDiff },
285 arg(u"Interval", SbxSTRING),
286 arg(u"Date1", SbxDATE),
287 arg(u"Date2", SbxDATE),
288 arg(u"Firstdayofweek", SbxINTEGER, OPT_),
289 arg(u"Firstweekofyear", SbxINTEGER, OPT_),
291 { u"DatePart", SbxLONG, 4 | FUNCTION_, SbRtl_DatePart },
292 arg(u"Interval", SbxSTRING),
293 arg(u"Date", SbxDATE),
294 arg(u"Firstdayofweek", SbxINTEGER, OPT_),
295 arg(u"Firstweekofyear", SbxINTEGER, OPT_),
297 { u"DateSerial", SbxDATE, 3 | FUNCTION_, SbRtl_DateSerial },
298 arg(u"Year", SbxINTEGER),
299 arg(u"Month", SbxINTEGER),
300 arg(u"Day", SbxINTEGER),
302 { u"DateValue", SbxDATE, 1 | FUNCTION_, SbRtl_DateValue },
303 arg(u"String", SbxSTRING),
305 { u"Day", SbxINTEGER, 1 | FUNCTION_, SbRtl_Day },
306 arg(u"Date", SbxDATE),
308 { u"Ddeexecute", SbxNULL, 2 | FUNCTION_, SbRtl_DDEExecute },
309 arg(u"Channel", SbxLONG),
310 arg(u"Command", SbxSTRING),
312 { u"Ddeinitiate", SbxINTEGER, 2 | FUNCTION_, SbRtl_DDEInitiate },
313 arg(u"Application", SbxSTRING),
314 arg(u"Topic", SbxSTRING),
316 { u"Ddepoke", SbxNULL, 3 | FUNCTION_, SbRtl_DDEPoke },
317 arg(u"Channel", SbxLONG),
318 arg(u"Item", SbxSTRING),
319 arg(u"Data", SbxSTRING),
321 { u"Dderequest", SbxSTRING, 2 | FUNCTION_, SbRtl_DDERequest },
322 arg(u"Channel", SbxLONG),
323 arg(u"Item", SbxSTRING),
325 { u"Ddeterminate", SbxNULL, 1 | FUNCTION_, SbRtl_DDETerminate },
326 arg(u"Channel", SbxLONG),
328 { u"Ddeterminateall", SbxNULL, FUNCTION_, SbRtl_DDETerminateAll },
329 { u"DimArray", SbxOBJECT, FUNCTION_, SbRtl_DimArray },
330 { u"Dir", SbxSTRING, 2 | FUNCTION_, SbRtl_Dir },
331 arg(u"FileSpec", SbxSTRING, OPT_),
332 arg(u"attrmask", SbxINTEGER, OPT_),
334 { u"DoEvents", SbxINTEGER, FUNCTION_, SbRtl_DoEvents },
335 { u"DumpAllObjects", SbxEMPTY, 2 | SUB_, SbRtl_DumpAllObjects },
336 arg(u"FileSpec", SbxSTRING),
337 arg(u"DumpAll", SbxINTEGER, OPT_),
339 { u"Empty", SbxVARIANT, CPROP_, SbRtl_Empty },
340 { u"EqualUnoObjects", SbxBOOL, 2 | FUNCTION_, SbRtl_EqualUnoObjects },
341 arg(u"Variant", SbxVARIANT),
342 arg(u"Variant", SbxVARIANT),
344 { u"EnableReschedule", SbxNULL, 1 | FUNCTION_, SbRtl_EnableReschedule },
345 arg(u"bEnable", SbxBOOL),
347 { u"Environ", SbxSTRING, 1 | FUNCTION_, SbRtl_Environ },
348 arg(u"Environmentstring", SbxSTRING),
350 { u"EOF", SbxBOOL, 1 | FUNCTION_, SbRtl_EOF },
351 arg(u"Channel", SbxINTEGER),
353 { u"Erl", SbxLONG, ROPROP_, SbRtl_Erl },
354 { u"Err", SbxVARIANT, RWPROP_, SbRtl_Err },
355 { u"Error", SbxSTRING, 1 | FUNCTION_, SbRtl_Error },
356 arg(u"code", SbxLONG),
358 { u"Exp", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Exp },
359 arg(u"number", SbxDOUBLE),
361 { u"False", SbxBOOL, CPROP_, SbRtl_False },
362 { u"FileAttr", SbxINTEGER, 2 | FUNCTION_, SbRtl_FileAttr },
363 arg(u"Channel", SbxINTEGER),
364 arg(u"Attributes", SbxINTEGER),
366 { u"FileCopy", SbxNULL, 2 | FUNCTION_, SbRtl_FileCopy },
367 arg(u"Source", SbxSTRING),
368 arg(u"Destination", SbxSTRING),
370 { u"FileDateTime", SbxSTRING, 1 | FUNCTION_, SbRtl_FileDateTime },
371 arg(u"filename", SbxSTRING),
373 { u"FileExists", SbxBOOL, 1 | FUNCTION_, SbRtl_FileExists },
374 arg(u"filename", SbxSTRING),
376 { u"FileLen", SbxLONG, 1 | FUNCTION_, SbRtl_FileLen },
377 arg(u"filename", SbxSTRING),
379 { u"FindObject", SbxOBJECT, 1 | FUNCTION_, SbRtl_FindObject },
380 arg(u"Name", SbxSTRING),
382 { u"FindPropertyObject", SbxOBJECT, 2 | FUNCTION_, SbRtl_FindPropertyObject },
383 arg(u"Object", SbxOBJECT),
384 arg(u"Name", SbxSTRING),
386 { u"Fix", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Fix },
387 arg(u"number", SbxDOUBLE),
389 { u"Format", SbxSTRING, 2 | FUNCTION_, SbRtl_Format },
390 arg(u"expression", SbxVARIANT),
391 arg(u"format", SbxSTRING, OPT_),
393 { u"FormatDateTime", SbxSTRING, 2 | FUNCTION_ | COMPATONLY_, SbRtl_FormatDateTime},
394 arg(u"Date", SbxDATE),
395 arg(u"NamedFormat", SbxINTEGER, OPT_),
397 { u"FormatNumber", SbxSTRING, 5 | FUNCTION_ | COMPATONLY_, SbRtl_FormatNumber },
398 arg(u"expression", SbxDOUBLE),
399 arg(u"numDigitsAfterDecimal", SbxINTEGER, OPT_),
400 arg(u"includeLeadingDigit", SbxINTEGER, OPT_), // vbTriState
401 arg(u"useParensForNegativeNumbers", SbxINTEGER, OPT_), // vbTriState
402 arg(u"groupDigits", SbxINTEGER, OPT_), // vbTriState
404 { u"FormatPercent", SbxSTRING, 5 | FUNCTION_ | COMPATONLY_, SbRtl_FormatPercent },
405 arg(u"expression", SbxDOUBLE),
406 arg(u"numDigitsAfterDecimal", SbxINTEGER, OPT_),
407 arg(u"includeLeadingDigit", SbxINTEGER, OPT_), // vbTriState
408 arg(u"useParensForNegativeNumbers", SbxINTEGER, OPT_), // vbTriState
409 arg(u"groupDigits", SbxINTEGER, OPT_), // vbTriState
411 { u"Frac", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Frac },
412 arg(u"number", SbxDOUBLE),
414 { u"FRAMEANCHORCHAR", SbxINTEGER, CPROP_, SbRtl_FRAMEANCHORCHAR },
415 { u"FRAMEANCHORPAGE", SbxINTEGER, CPROP_, SbRtl_FRAMEANCHORPAGE },
416 { u"FRAMEANCHORPARA", SbxINTEGER, CPROP_, SbRtl_FRAMEANCHORPARA },
417 { u"FreeFile", SbxINTEGER, FUNCTION_, SbRtl_FreeFile },
418 { u"FreeLibrary", SbxNULL, 1 | FUNCTION_, SbRtl_FreeLibrary },
419 arg(u"Modulename", SbxSTRING),
421 { u"FV", SbxDOUBLE, 5 | FUNCTION_ | COMPATONLY_, SbRtl_FV },
422 arg(u"Rate", SbxDOUBLE),
423 arg(u"NPer", SbxDOUBLE),
424 arg(u"Pmt", SbxDOUBLE),
425 arg(u"PV", SbxVARIANT, OPT_),
426 arg(u"Due", SbxVARIANT, OPT_),
428 { u"Get", SbxNULL, 3 | FUNCTION_, SbRtl_Get },
429 arg(u"filenumber", SbxINTEGER),
430 arg(u"recordnumber", SbxLONG),
431 arg(u"variablename", SbxVARIANT),
433 { u"GetAttr", SbxINTEGER, 1 | FUNCTION_, SbRtl_GetAttr },
434 arg(u"filename", SbxSTRING),
436 { u"GetDefaultContext", SbxOBJECT, 0 | FUNCTION_, SbRtl_GetDefaultContext },
437 { u"GetDialogZoomFactorX", SbxDOUBLE, FUNCTION_, SbRtl_GetDialogZoomFactorX },
438 { u"GetDialogZoomFactorY", SbxDOUBLE, FUNCTION_, SbRtl_GetDialogZoomFactorY },
439 { u"GetGUIType", SbxINTEGER, FUNCTION_, SbRtl_GetGUIType },
440 { u"GetGUIVersion", SbxLONG, FUNCTION_, SbRtl_GetGUIVersion },
441 { u"GetPathSeparator", SbxSTRING, FUNCTION_, SbRtl_GetPathSeparator },
442 { u"GetProcessServiceManager", SbxOBJECT, 0 | FUNCTION_, SbRtl_GetProcessServiceManager },
443 { u"GetSolarVersion", SbxLONG, FUNCTION_, SbRtl_GetSolarVersion },
444 { u"GetSystemTicks", SbxLONG, FUNCTION_, SbRtl_GetSystemTicks },
445 { u"GetSystemType", SbxINTEGER, FUNCTION_, SbRtl_GetSystemType },
446 { u"GlobalScope", SbxOBJECT, FUNCTION_, SbRtl_GlobalScope },
447 { u"Green", SbxINTEGER, 1 | FUNCTION_ | NORMONLY_, SbRtl_Green },
448 arg(u"RGB-Value", SbxLONG),
450 { u"HasUnoInterfaces", SbxBOOL, 1 | FUNCTION_, SbRtl_HasUnoInterfaces },
451 arg(u"InterfaceName", SbxSTRING),
453 { u"Hex", SbxSTRING, 1 | FUNCTION_, SbRtl_Hex },
454 arg(u"number", SbxLONG),
456 { u"Hour", SbxINTEGER, 1 | FUNCTION_, SbRtl_Hour },
457 arg(u"Date", SbxDATE),
459 { u"IDABORT", SbxINTEGER, CPROP_, SbRtl_IDABORT },
460 { u"IDCANCEL", SbxINTEGER, CPROP_, SbRtl_IDCANCEL },
461 { u"IDIGNORE", SbxINTEGER, CPROP_, SbRtl_IDIGNORE },
462 { u"IDNO", SbxINTEGER, CPROP_, SbRtl_IDNO },
463 { u"IDOK", SbxINTEGER, CPROP_, SbRtl_IDOK },
464 { u"IDRETRY", SbxINTEGER, CPROP_, SbRtl_IDRETRY },
465 { u"IDYES", SbxINTEGER, CPROP_, SbRtl_IDYES },
467 { u"Iif", SbxVARIANT, 3 | FUNCTION_, SbRtl_Iif },
468 arg(u"Bool", SbxBOOL),
469 arg(u"Variant1", SbxVARIANT),
470 arg(u"Variant2", SbxVARIANT),
472 { u"Input", SbxSTRING, 2 | FUNCTION_ | COMPATONLY_, SbRtl_Input },
473 arg(u"Number", SbxLONG),
474 arg(u"FileNumber", SbxLONG),
476 { u"InputBox", SbxSTRING, 5 | FUNCTION_, SbRtl_InputBox },
477 arg(u"Prompt", SbxSTRING),
478 arg(u"Title", SbxSTRING, OPT_),
479 arg(u"Default", SbxSTRING, OPT_),
480 arg(u"XPosTwips", SbxLONG, OPT_),
481 arg(u"YPosTwips", SbxLONG, OPT_),
483 { u"InStr", SbxLONG, 4 | FUNCTION_, SbRtl_InStr },
484 arg(u"Start", SbxSTRING, OPT_),
485 arg(u"String1", SbxSTRING),
486 arg(u"String2", SbxSTRING),
487 arg(u"Compare", SbxINTEGER, OPT_),
489 { u"InStrRev", SbxLONG, 4 | FUNCTION_ | COMPATONLY_, SbRtl_InStrRev },
490 arg(u"String1", SbxSTRING),
491 arg(u"String2", SbxSTRING),
492 arg(u"Start", SbxSTRING, OPT_),
493 arg(u"Compare", SbxINTEGER, OPT_),
495 { u"Int", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Int },
496 arg(u"number", SbxDOUBLE),
498 { u"IPmt", SbxDOUBLE, 6 | FUNCTION_ | COMPATONLY_, SbRtl_IPmt },
499 arg(u"Rate", SbxDOUBLE),
500 arg(u"Per", SbxDOUBLE),
501 arg(u"NPer", SbxDOUBLE),
502 arg(u"PV", SbxDOUBLE),
503 arg(u"FV", SbxVARIANT, OPT_),
504 arg(u"Due", SbxVARIANT, OPT_),
506 { u"IRR", SbxDOUBLE, 2 | FUNCTION_ | COMPATONLY_, SbRtl_IRR },
507 arg(u"ValueArray", SbxARRAY),
508 arg(u"Guess", SbxVARIANT, OPT_),
510 { u"IsArray", SbxBOOL, 1 | FUNCTION_, SbRtl_IsArray },
511 arg(u"Variant", SbxVARIANT),
513 { u"IsDate", SbxBOOL, 1 | FUNCTION_, SbRtl_IsDate },
514 arg(u"Variant", SbxVARIANT),
516 { u"IsEmpty", SbxBOOL, 1 | FUNCTION_, SbRtl_IsEmpty },
517 arg(u"Variant", SbxVARIANT),
519 { u"IsError", SbxBOOL, 1 | FUNCTION_, SbRtl_IsError },
520 arg(u"Variant", SbxVARIANT),
522 { u"IsMissing", SbxBOOL, 1 | FUNCTION_, SbRtl_IsMissing },
523 arg(u"Variant", SbxVARIANT),
525 { u"IsNull", SbxBOOL, 1 | FUNCTION_, SbRtl_IsNull },
526 arg(u"Variant", SbxVARIANT),
528 { u"IsNumeric", SbxBOOL, 1 | FUNCTION_, SbRtl_IsNumeric },
529 arg(u"Variant", SbxVARIANT),
531 { u"IsObject", SbxBOOL, 1 | FUNCTION_, SbRtl_IsObject },
532 arg(u"Variant", SbxVARIANT),
534 { u"IsUnoStruct", SbxBOOL, 1 | FUNCTION_, SbRtl_IsUnoStruct },
535 arg(u"Variant", SbxVARIANT),
537 { u"Join", SbxSTRING, 2 | FUNCTION_, SbRtl_Join },
538 arg(u"list", SbxOBJECT),
539 arg(u"delimiter", SbxSTRING),
541 { u"Kill", SbxNULL, 1 | FUNCTION_, SbRtl_Kill },
542 arg(u"filespec", SbxSTRING),
544 { u"LBound", SbxLONG, 1 | FUNCTION_, SbRtl_LBound },
545 arg(u"Variant", SbxVARIANT),
547 { u"LCase", SbxSTRING, 1 | FUNCTION_, SbRtl_LCase },
548 arg(u"string", SbxSTRING),
550 { u"Left", SbxSTRING, 2 | FUNCTION_, SbRtl_Left },
551 arg(u"String", SbxSTRING),
552 arg(u"Count", SbxLONG),
554 { u"Len", SbxLONG, 1 | FUNCTION_, SbRtl_Len },
555 arg(u"StringOrVariant", SbxVARIANT),
557 { u"LenB", SbxLONG, 1 | FUNCTION_, SbRtl_Len },
558 arg(u"StringOrVariant", SbxVARIANT),
560 { u"Load", SbxNULL, 1 | FUNCTION_, SbRtl_Load },
561 arg(u"object", SbxOBJECT),
563 { u"LoadPicture", SbxOBJECT, 1 | FUNCTION_, SbRtl_LoadPicture },
564 arg(u"string", SbxSTRING),
566 { u"Loc", SbxLONG, 1 | FUNCTION_, SbRtl_Loc },
567 arg(u"Channel", SbxINTEGER),
569 { u"Lof", SbxLONG, 1 | FUNCTION_, SbRtl_Lof },
570 arg(u"Channel", SbxINTEGER),
572 { u"Log", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Log },
573 arg(u"number", SbxDOUBLE),
575 { u"LTrim", SbxSTRING, 1 | FUNCTION_, SbRtl_LTrim },
576 arg(u"string", SbxSTRING),
578 { u"MB_ABORTRETRYIGNORE", SbxINTEGER, CPROP_, SbRtl_MB_ABORTRETRYIGNORE },
579 { u"MB_APPLMODAL", SbxINTEGER, CPROP_, SbRtl_MB_APPLMODAL },
580 { u"MB_DEFBUTTON1", SbxINTEGER, CPROP_, SbRtl_MB_DEFBUTTON1 },
581 { u"MB_DEFBUTTON2", SbxINTEGER, CPROP_, SbRtl_MB_DEFBUTTON2 },
582 { u"MB_DEFBUTTON3", SbxINTEGER, CPROP_, SbRtl_MB_DEFBUTTON3 },
583 { u"MB_ICONEXCLAMATION", SbxINTEGER, CPROP_, SbRtl_MB_ICONEXCLAMATION },
584 { u"MB_ICONINFORMATION", SbxINTEGER, CPROP_, SbRtl_MB_ICONINFORMATION },
585 { u"MB_ICONQUESTION", SbxINTEGER, CPROP_, SbRtl_MB_ICONQUESTION },
586 { u"MB_ICONSTOP", SbxINTEGER, CPROP_, SbRtl_MB_ICONSTOP },
587 { u"MB_OK", SbxINTEGER, CPROP_, SbRtl_MB_OK },
588 { u"MB_OKCANCEL", SbxINTEGER, CPROP_, SbRtl_MB_OKCANCEL },
589 { u"MB_RETRYCANCEL", SbxINTEGER, CPROP_, SbRtl_MB_RETRYCANCEL },
590 { u"MB_SYSTEMMODAL", SbxINTEGER, CPROP_, SbRtl_MB_SYSTEMMODAL },
591 { u"MB_YESNO", SbxINTEGER, CPROP_, SbRtl_MB_YESNO },
592 { u"MB_YESNOCANCEL", SbxINTEGER, CPROP_, SbRtl_MB_YESNOCANCEL },
594 { u"Me", SbxOBJECT, 0 | FUNCTION_ | COMPATONLY_, SbRtl_Me },
595 { u"Mid", SbxSTRING, 3 | LFUNCTION_, SbRtl_Mid },
596 arg(u"String", SbxSTRING),
597 arg(u"StartPos", SbxLONG),
598 arg(u"Length", SbxLONG, OPT_),
600 { u"Minute", SbxINTEGER, 1 | FUNCTION_, SbRtl_Minute },
601 arg(u"Date", SbxDATE),
603 { u"MIRR", SbxDOUBLE, 3 | FUNCTION_ | COMPATONLY_, SbRtl_MIRR },
604 arg(u"ValueArray", SbxARRAY),
605 arg(u"FinanceRate", SbxDOUBLE),
606 arg(u"ReinvestRate", SbxDOUBLE),
608 { u"MkDir", SbxNULL, 1 | FUNCTION_, SbRtl_MkDir },
609 arg(u"pathname", SbxSTRING),
611 { u"Month", SbxINTEGER, 1 | FUNCTION_, SbRtl_Month },
612 arg(u"Date", SbxDATE),
614 { u"MonthName", SbxSTRING, 2 | FUNCTION_ | COMPATONLY_, SbRtl_MonthName },
615 arg(u"Month", SbxINTEGER),
616 arg(u"Abbreviate", SbxBOOL, OPT_),
618 { u"MsgBox", SbxINTEGER, 5 | FUNCTION_, SbRtl_MsgBox },
619 arg(u"Prompt", SbxSTRING),
620 arg(u"Buttons", SbxINTEGER, OPT_),
621 arg(u"Title", SbxSTRING, OPT_),
622 arg(u"Helpfile", SbxSTRING, OPT_),
623 arg(u"Context", SbxINTEGER, OPT_),
625 { u"Nothing", SbxOBJECT, CPROP_, SbRtl_Nothing },
626 { u"Now", SbxDATE, FUNCTION_, SbRtl_Now },
627 { u"NPer", SbxDOUBLE, 5 | FUNCTION_ | COMPATONLY_, SbRtl_NPer },
628 arg(u"Rate", SbxDOUBLE),
629 arg(u"Pmt", SbxDOUBLE),
630 arg(u"PV", SbxDOUBLE),
631 arg(u"FV", SbxVARIANT, OPT_),
632 arg(u"Due", SbxVARIANT, OPT_),
634 { u"NPV", SbxDOUBLE, 2 | FUNCTION_ | COMPATONLY_, SbRtl_NPV },
635 arg(u"Rate", SbxDOUBLE),
636 arg(u"ValueArray", SbxARRAY),
638 { u"Null", SbxNULL, CPROP_, SbRtl_Null },
640 { u"Oct", SbxSTRING, 1 | FUNCTION_, SbRtl_Oct },
641 arg(u"number", SbxLONG),
643 { u"Partition", SbxSTRING, 4 | FUNCTION_, SbRtl_Partition },
644 arg(u"number", SbxLONG),
645 arg(u"start", SbxLONG),
646 arg(u"stop", SbxLONG),
647 arg(u"interval", SbxLONG),
649 { u"Pi", SbxDOUBLE, CPROP_, SbRtl_PI },
651 { u"Pmt", SbxDOUBLE, 5 | FUNCTION_ | COMPATONLY_, SbRtl_Pmt },
652 arg(u"Rate", SbxDOUBLE),
653 arg(u"NPer", SbxDOUBLE),
654 arg(u"PV", SbxDOUBLE),
655 arg(u"FV", SbxVARIANT, OPT_),
656 arg(u"Due", SbxVARIANT, OPT_),
658 { u"PPmt", SbxDOUBLE, 6 | FUNCTION_ | COMPATONLY_, SbRtl_PPmt },
659 arg(u"Rate", SbxDOUBLE),
660 arg(u"Per", SbxDOUBLE),
661 arg(u"NPer", SbxDOUBLE),
662 arg(u"PV", SbxDOUBLE),
663 arg(u"FV", SbxVARIANT, OPT_),
664 arg(u"Due", SbxVARIANT, OPT_),
666 { u"Put", SbxNULL, 3 | FUNCTION_, SbRtl_Put },
667 arg(u"filenumber", SbxINTEGER),
668 arg(u"recordnumber", SbxLONG),
669 arg(u"variablename", SbxVARIANT),
671 { u"PV", SbxDOUBLE, 5 | FUNCTION_ | COMPATONLY_, SbRtl_PV },
672 arg(u"Rate", SbxDOUBLE),
673 arg(u"NPer", SbxDOUBLE),
674 arg(u"Pmt", SbxDOUBLE),
675 arg(u"FV", SbxVARIANT, OPT_),
676 arg(u"Due", SbxVARIANT, OPT_),
678 { u"QBColor", SbxLONG, 1 | FUNCTION_, SbRtl_QBColor },
679 arg(u"number", SbxINTEGER),
681 { u"Randomize", SbxNULL, 1 | FUNCTION_, SbRtl_Randomize },
682 arg(u"Number", SbxDOUBLE, OPT_),
684 { u"Rate", SbxDOUBLE, 6 | FUNCTION_ | COMPATONLY_, SbRtl_Rate },
685 arg(u"NPer", SbxDOUBLE),
686 arg(u"Pmt", SbxDOUBLE),
687 arg(u"PV", SbxDOUBLE),
688 arg(u"FV", SbxVARIANT, OPT_),
689 arg(u"Due", SbxVARIANT, OPT_),
690 arg(u"Guess", SbxVARIANT, OPT_),
692 { u"Red", SbxINTEGER, 1 | FUNCTION_ | NORMONLY_, SbRtl_Red },
693 arg(u"RGB-Value", SbxLONG),
695 { u"Reset", SbxNULL, 0 | FUNCTION_, SbRtl_Reset },
696 { u"ResolvePath", SbxSTRING, 1 | FUNCTION_, SbRtl_ResolvePath },
697 arg(u"Path", SbxSTRING),
699 { u"RGB", SbxLONG, 3 | FUNCTION_, SbRtl_RGB },
700 arg(u"Red", SbxINTEGER),
701 arg(u"Green", SbxINTEGER),
702 arg(u"Blue", SbxINTEGER),
704 { u"Replace", SbxSTRING, 6 | FUNCTION_, SbRtl_Replace },
705 arg(u"Expression", SbxSTRING),
706 arg(u"Find", SbxSTRING),
707 arg(u"Replace", SbxSTRING),
708 arg(u"Start", SbxINTEGER, OPT_),
709 arg(u"Count", SbxINTEGER, OPT_),
710 arg(u"Compare", SbxINTEGER, OPT_),
712 { u"Right", SbxSTRING, 2 | FUNCTION_, SbRtl_Right },
713 arg(u"String", SbxSTRING),
714 arg(u"Count", SbxLONG),
716 { u"RmDir", SbxNULL, 1 | FUNCTION_, SbRtl_RmDir },
717 arg(u"pathname", SbxSTRING),
719 { u"Round", SbxDOUBLE, 2 | FUNCTION_ | COMPATONLY_, SbRtl_Round },
720 arg(u"Expression", SbxDOUBLE),
721 arg(u"Numdecimalplaces", SbxINTEGER, OPT_),
723 { u"Rnd", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Rnd },
724 arg(u"Number", SbxDOUBLE, OPT_),
726 { u"RTL", SbxOBJECT, 0 | FUNCTION_ | COMPATONLY_, SbRtl_RTL },
727 { u"RTrim", SbxSTRING, 1 | FUNCTION_, SbRtl_RTrim },
728 arg(u"string", SbxSTRING),
730 { u"SavePicture", SbxNULL, 2 | FUNCTION_, SbRtl_SavePicture },
731 arg(u"object", SbxOBJECT),
732 arg(u"string", SbxSTRING),
734 { u"Second", SbxINTEGER, 1 | FUNCTION_, SbRtl_Second },
735 arg(u"Date", SbxDATE),
737 { u"Seek", SbxLONG, 1 | FUNCTION_, SbRtl_Seek },
738 arg(u"Channel", SbxINTEGER),
740 { u"SendKeys", SbxNULL, 2 | FUNCTION_, SbRtl_SendKeys },
741 arg(u"String", SbxSTRING),
742 arg(u"Wait", SbxBOOL, OPT_),
744 { u"SetAttr", SbxNULL, 2 | FUNCTION_, SbRtl_SetAttr },
745 arg(u"File", SbxSTRING),
746 arg(u"Attributes", SbxINTEGER),
748 { u"SET_OFF", SbxINTEGER, CPROP_, SbRtl_SET_OFF },
749 { u"SET_ON", SbxINTEGER, CPROP_, SbRtl_SET_ON },
750 { u"SET_TAB", SbxINTEGER, CPROP_, SbRtl_SET_TAB },
751 { u"Sgn", SbxINTEGER, 1 | FUNCTION_, SbRtl_Sgn },
752 arg(u"number", SbxDOUBLE),
754 { u"Shell", SbxLONG, 2 | FUNCTION_, SbRtl_Shell },
755 arg(u"Commandstring", SbxSTRING),
756 arg(u"WindowStyle", SbxINTEGER, OPT_),
758 { u"Sin", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Sin },
759 arg(u"number", SbxDOUBLE),
761 { u"SLN", SbxDOUBLE, 3 | FUNCTION_ | COMPATONLY_, SbRtl_SLN },
762 arg(u"Cost", SbxDOUBLE),
763 arg(u"Double", SbxDOUBLE),
764 arg(u"Life", SbxDOUBLE),
766 { u"SYD", SbxDOUBLE, 4 | FUNCTION_ | COMPATONLY_, SbRtl_SYD },
767 arg(u"Cost", SbxDOUBLE),
768 arg(u"Salvage", SbxDOUBLE),
769 arg(u"Life", SbxDOUBLE),
770 arg(u"Period", SbxDOUBLE),
772 { u"Space", SbxSTRING, 1 | FUNCTION_, SbRtl_Space },
773 arg(u"string", SbxLONG),
775 { u"Spc", SbxSTRING, 1 | FUNCTION_, SbRtl_Spc },
776 arg(u"Count", SbxLONG),
778 { u"Split", SbxOBJECT, 3 | FUNCTION_, SbRtl_Split },
779 arg(u"expression", SbxSTRING),
780 arg(u"delimiter", SbxSTRING),
781 arg(u"count", SbxLONG),
783 { u"Sqr", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Sqr },
784 arg(u"number", SbxDOUBLE),
786 { u"Str", SbxSTRING, 1 | FUNCTION_, SbRtl_Str },
787 arg(u"number", SbxDOUBLE),
789 { u"StrComp", SbxINTEGER, 3 | FUNCTION_, SbRtl_StrComp },
790 arg(u"String1", SbxSTRING),
791 arg(u"String2", SbxSTRING),
792 arg(u"Compare", SbxINTEGER, OPT_),
794 { u"StrConv", SbxOBJECT, 3 | FUNCTION_, SbRtl_StrConv },
795 arg(u"String", SbxSTRING),
796 arg(u"Conversion", SbxSTRING),
797 arg(u"LCID", SbxINTEGER, OPT_),
799 { u"String", SbxSTRING, 2 | FUNCTION_, SbRtl_String },
800 arg(u"Count", SbxLONG),
801 arg(u"Filler", SbxVARIANT),
803 { u"StrReverse", SbxSTRING, 1 | FUNCTION_ | COMPATONLY_, SbRtl_StrReverse },
804 arg(u"String1", SbxSTRING),
806 { u"Switch", SbxVARIANT, 2 | FUNCTION_, SbRtl_Switch },
807 arg(u"Expression", SbxVARIANT),
808 arg(u"Value", SbxVARIANT),
810 { u"Tab", SbxSTRING, 1 | FUNCTION_, SbRtl_Tab },
811 arg(u"Count", SbxLONG),
813 { u"Tan", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Tan },
814 arg(u"number", SbxDOUBLE),
816 { u"Time", SbxVARIANT, LFUNCTION_, SbRtl_Time },
817 { u"Timer", SbxDATE, FUNCTION_, SbRtl_Timer },
818 { u"TimeSerial", SbxDATE, 3 | FUNCTION_, SbRtl_TimeSerial },
819 arg(u"Hour", SbxLONG),
820 arg(u"Minute", SbxLONG),
821 arg(u"Second", SbxLONG),
823 { u"TimeValue", SbxDATE, 1 | FUNCTION_, SbRtl_TimeValue },
824 arg(u"String", SbxSTRING),
826 { u"TOGGLE", SbxINTEGER, CPROP_, SbRtl_TOGGLE },
827 { u"Trim", SbxSTRING, 1 | FUNCTION_, SbRtl_Trim },
828 arg(u"String", SbxSTRING),
830 { u"True", SbxBOOL, CPROP_, SbRtl_True },
831 { u"TwipsPerPixelX", SbxLONG, FUNCTION_, SbRtl_TwipsPerPixelX },
832 { u"TwipsPerPixelY", SbxLONG, FUNCTION_, SbRtl_TwipsPerPixelY },
834 { u"TYP_AUTHORFLD", SbxINTEGER, CPROP_, SbRtl_TYP_AUTHORFLD },
835 { u"TYP_CHAPTERFLD", SbxINTEGER, CPROP_, SbRtl_TYP_CHAPTERFLD },
836 { u"TYP_CONDTXTFLD", SbxINTEGER, CPROP_, SbRtl_TYP_CONDTXTFLD },
837 { u"TYP_DATEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DATEFLD },
838 { u"TYP_DBFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DBFLD },
839 { u"TYP_DBNAMEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DBNAMEFLD },
840 { u"TYP_DBNEXTSETFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DBNEXTSETFLD },
841 { u"TYP_DBNUMSETFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DBNUMSETFLD },
842 { u"TYP_DBSETNUMBERFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DBSETNUMBERFLD },
843 { u"TYP_DDEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DDEFLD },
844 { u"TYP_DOCINFOFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DOCINFOFLD },
845 { u"TYP_DOCSTATFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DOCSTATFLD },
846 { u"TYP_EXTUSERFLD", SbxINTEGER, CPROP_, SbRtl_TYP_EXTUSERFLD },
847 { u"TYP_FILENAMEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_FILENAMEFLD },
848 { u"TYP_FIXDATEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_FIXDATEFLD },
849 { u"TYP_FIXTIMEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_FIXTIMEFLD },
850 { u"TYP_FORMELFLD", SbxINTEGER, CPROP_, SbRtl_TYP_FORMELFLD },
851 { u"TYP_GETFLD", SbxINTEGER, CPROP_, SbRtl_TYP_GETFLD },
852 { u"TYP_GETREFFLD", SbxINTEGER, CPROP_, SbRtl_TYP_GETREFFLD },
853 { u"TYP_GETREFPAGEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_GETREFPAGEFLD },
854 { u"TYP_HIDDENPARAFLD", SbxINTEGER, CPROP_, SbRtl_TYP_HIDDENPARAFLD },
855 { u"TYP_HIDDENTXTFLD", SbxINTEGER, CPROP_, SbRtl_TYP_HIDDENTXTFLD },
856 { u"TYP_INPUTFLD", SbxINTEGER, CPROP_, SbRtl_TYP_INPUTFLD },
857 { u"TYP_INTERNETFLD", SbxINTEGER, CPROP_, SbRtl_TYP_INTERNETFLD },
858 { u"TYP_JUMPEDITFLD", SbxINTEGER, CPROP_, SbRtl_TYP_JUMPEDITFLD },
859 { u"TYP_MACROFLD", SbxINTEGER, CPROP_, SbRtl_TYP_MACROFLD },
860 { u"TYP_NEXTPAGEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_NEXTPAGEFLD },
861 { u"TYP_PAGENUMBERFLD", SbxINTEGER, CPROP_, SbRtl_TYP_PAGENUMBERFLD },
862 { u"TYP_POSTITFLD", SbxINTEGER, CPROP_, SbRtl_TYP_POSTITFLD },
863 { u"TYP_PREVPAGEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_PREVPAGEFLD },
864 { u"TYP_SEQFLD", SbxINTEGER, CPROP_, SbRtl_TYP_SEQFLD },
865 { u"TYP_SETFLD", SbxINTEGER, CPROP_, SbRtl_TYP_SETFLD },
866 { u"TYP_SETINPFLD", SbxINTEGER, CPROP_, SbRtl_TYP_SETINPFLD },
867 { u"TYP_SETREFFLD", SbxINTEGER, CPROP_, SbRtl_TYP_SETREFFLD },
868 { u"TYP_SETREFPAGEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_SETREFPAGEFLD },
869 { u"TYP_TEMPLNAMEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_TEMPLNAMEFLD },
870 { u"TYP_TIMEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_TIMEFLD },
871 { u"TYP_USERFLD", SbxINTEGER, CPROP_, SbRtl_TYP_USERFLD },
872 { u"TYP_USRINPFLD", SbxINTEGER, CPROP_, SbRtl_TYP_USRINPFLD },
874 { u"TypeLen", SbxINTEGER, 1 | FUNCTION_, SbRtl_TypeLen },
875 arg(u"Var", SbxVARIANT),
877 { u"TypeName", SbxSTRING, 1 | FUNCTION_, SbRtl_TypeName },
878 arg(u"Var", SbxVARIANT),
880 { u"UBound", SbxLONG, 1 | FUNCTION_, SbRtl_UBound },
881 arg(u"Var", SbxVARIANT),
883 { u"UCase", SbxSTRING, 1 | FUNCTION_, SbRtl_UCase },
884 arg(u"String", SbxSTRING),
886 { u"Unload", SbxNULL, 1 | FUNCTION_, SbRtl_Unload },
887 arg(u"Dialog", SbxOBJECT),
889 { u"Val", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Val },
890 arg(u"String", SbxSTRING),
892 { u"VarType", SbxINTEGER, 1 | FUNCTION_, SbRtl_VarType },
893 arg(u"Var", SbxVARIANT),
895 { u"V_EMPTY", SbxINTEGER, CPROP_, SbRtl_V_EMPTY },
896 { u"V_NULL", SbxINTEGER, CPROP_, SbRtl_V_NULL },
897 { u"V_INTEGER", SbxINTEGER, CPROP_, SbRtl_V_INTEGER },
898 { u"V_LONG", SbxINTEGER, CPROP_, SbRtl_V_LONG },
899 { u"V_SINGLE", SbxINTEGER, CPROP_, SbRtl_V_SINGLE },
900 { u"V_DOUBLE", SbxINTEGER, CPROP_, SbRtl_V_DOUBLE },
901 { u"V_CURRENCY", SbxINTEGER, CPROP_, SbRtl_V_CURRENCY },
902 { u"V_DATE", SbxINTEGER, CPROP_, SbRtl_V_DATE },
903 { u"V_STRING", SbxINTEGER, CPROP_, SbRtl_V_STRING },
905 { u"Wait", SbxNULL, 1 | FUNCTION_, SbRtl_Wait },
906 arg(u"Milliseconds", SbxLONG),
908 { u"FuncCaller", SbxVARIANT, FUNCTION_, SbRtl_FuncCaller },
909 //#i64882#
910 { u"WaitUntil", SbxNULL, 1 | FUNCTION_, SbRtl_WaitUntil },
911 arg(u"Date", SbxDOUBLE),
913 { u"Weekday", SbxINTEGER, 2 | FUNCTION_, SbRtl_Weekday },
914 arg(u"Date", SbxDATE),
915 arg(u"Firstdayofweek", SbxINTEGER, OPT_),
917 { u"WeekdayName", SbxSTRING, 3 | FUNCTION_ | COMPATONLY_, SbRtl_WeekdayName },
918 arg(u"Weekday", SbxINTEGER),
919 arg(u"Abbreviate", SbxBOOL, OPT_),
920 arg(u"Firstdayofweek", SbxINTEGER, OPT_),
922 { u"Year", SbxINTEGER, 1 | FUNCTION_, SbRtl_Year },
923 arg(u"Date", SbxDATE),
925 { {}, SbxNULL, -1, nullptr }}; // end of the table
927 static_assert(MethodsTableValid(aMethods));
929 SbiStdObject::SbiStdObject( const OUString& r, StarBASIC* pb ) : SbxObject( r )
931 // #i92642: Remove default properties
932 Remove( "Name", SbxClassType::DontCare );
933 Remove( "Parent", SbxClassType::DontCare );
935 SetParent( pb );
937 pStdFactory.reset( new SbStdFactory );
938 SbxBase::AddFactory( pStdFactory.get() );
940 Insert( new SbStdClipboard );
943 SbiStdObject::~SbiStdObject()
945 SbxBase::RemoveFactory( pStdFactory.get() );
946 pStdFactory.reset();
949 // Finding an element:
950 // It runs linearly through the method table here until an
951 // adequate method is has been found. Because of the bits in
952 // the nArgs-field the adequate instance of an SbxObjElement
953 // is created then. If the method/property hasn't been found,
954 // return NULL without error code, so that a whole chain of
955 // objects can be asked for the method/property.
957 SbxVariable* SbiStdObject::Find( const OUString& rName, SbxClassType t )
959 // entered already?
960 SbxVariable* pVar = SbxObject::Find( rName, t );
961 if( !pVar )
963 // else search one
964 sal_uInt16 nHash_ = SbxVariable::MakeHashCode( rName );
965 const Method* p = aMethods;
966 bool bFound = false;
967 short nIndex = 0;
968 sal_uInt16 nSrchMask = TYPEMASK_;
969 switch( t )
971 case SbxClassType::Method: nSrchMask = METHOD_; break;
972 case SbxClassType::Property: nSrchMask = PROPERTY_; break;
973 case SbxClassType::Object: nSrchMask = OBJECT_; break;
974 default: break;
976 while( p->nArgs != -1 )
978 if( ( p->nArgs & nSrchMask )
979 && ( p->nHash == nHash_ )
980 && (rName.equalsIgnoreAsciiCase(p->sName)))
982 bFound = true;
983 if( p->nArgs & COMPTMASK_ )
985 bool bCompatibility = false;
986 SbiInstance* pInst = GetSbData()->pInst;
987 if (pInst)
989 bCompatibility = pInst->IsCompatibility();
991 else
993 // No instance running => compiling a source on module level.
994 const SbModule* pModule = GetSbData()->pCompMod;
995 if (pModule)
996 bCompatibility = pModule->IsVBACompat();
998 if ((bCompatibility && (NORMONLY_ & p->nArgs)) || (!bCompatibility && (COMPATONLY_ & p->nArgs)))
999 bFound = false;
1001 break;
1003 nIndex += ( p->nArgs & ARGSMASK_ ) + 1;
1004 p = aMethods + nIndex;
1007 if( bFound )
1009 // isolate Args-fields:
1010 SbxFlagBits nAccess = static_cast<SbxFlagBits>(( p->nArgs & RWMASK_ ) >> 8);
1011 short nType = ( p->nArgs & TYPEMASK_ );
1012 if( p->nArgs & CONST_ )
1013 nAccess |= SbxFlagBits::Const;
1014 SbxClassType eCT = SbxClassType::Object;
1015 if( nType & PROPERTY_ )
1017 eCT = SbxClassType::Property;
1019 else if( nType & METHOD_ )
1021 eCT = SbxClassType::Method;
1023 pVar = Make(OUString(p->sName), eCT, p->eType, (p->nArgs & FUNCTION_) == FUNCTION_);
1024 pVar->SetUserData( nIndex + 1 );
1025 pVar->SetFlags( nAccess );
1028 return pVar;
1031 // SetModified must be pinched off at the RTL
1032 void SbiStdObject::SetModified( bool )
1037 void SbiStdObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
1040 const SbxHint* pHint = dynamic_cast<const SbxHint*>(&rHint);
1041 if( !pHint )
1042 return;
1044 SbxVariable* pVar = pHint->GetVar();
1045 SbxArray* pPar_ = pVar->GetParameters();
1046 const sal_uInt16 nCallId = static_cast<sal_uInt16>(pVar->GetUserData());
1047 if( nCallId )
1049 const SfxHintId t = pHint->GetId();
1050 if( t == SfxHintId::BasicInfoWanted )
1051 pVar->SetInfo( GetInfo( static_cast<short>(pVar->GetUserData()) ) );
1052 else
1054 bool bWrite = false;
1055 if( t == SfxHintId::BasicDataChanged )
1056 bWrite = true;
1057 if( t == SfxHintId::BasicDataWanted || bWrite )
1059 RtlCall p = aMethods[ nCallId-1 ].pFunc;
1060 SbxArrayRef rPar( pPar_ );
1061 if( !pPar_ )
1063 rPar = pPar_ = new SbxArray;
1064 pPar_->Put(pVar, 0);
1066 p( static_cast<StarBASIC*>(GetParent()), *pPar_, bWrite );
1067 return;
1071 SbxObject::Notify( rBC, rHint );
1074 // building the info-structure for single elements
1075 // if nIdx = 0, don't create anything (Std-Props!)
1077 SbxInfo* SbiStdObject::GetInfo( short nIdx )
1079 if( !nIdx )
1080 return nullptr;
1081 const Method* p = &aMethods[ --nIdx ];
1082 SbxInfo* pInfo_ = new SbxInfo;
1083 short nPar = p->nArgs & ARGSMASK_;
1084 for( short i = 0; i < nPar; i++ )
1086 p++;
1087 SbxFlagBits nFlags_ = static_cast<SbxFlagBits>(( p->nArgs >> 8 ) & 0x03);
1088 if( p->nArgs & OPT_ )
1090 nFlags_ |= SbxFlagBits::Optional;
1092 pInfo_->AddParam(OUString(p->sName), p->eType, nFlags_);
1094 return pInfo_;
1097 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */