Debian Codegraph @

basic/source/runtime/stdobj.cxx

raw
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20
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!
29
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
36
37 namespace {
38
39 enum Flags
40 {
41 ARGSMASK_ = 0x003F, // 63 Arguments
42
43 NORMONLY_ = 0x0040, // procedure is visible in normal mode only
44 COMPATONLY_ = 0x0080, // procedure is visible in vba mode only
45 COMPTMASK_ = (COMPATONLY_ | NORMONLY_), // COMPATIBILITY mask
46
47 READ_ = 0x0100, // parameter allows read
48 WRITE_ = 0x0200, // parameter allows write
49 OPT_ = 0x0400, // parameter is optional
50 CONST_ = 0x0800, // property is const
51 RWMASK_ = (READ_ | WRITE_ | OPT_ | CONST_), // mask for R/W-bits
52
53 FUNC_TYPE_ = 0x1000, // functional type
54 SUB_TYPE_ = 0x2000, // sub type
55 METHOD_ = (FUNC_TYPE_ | SUB_TYPE_),
56 PROPERTY_ = 0x4000,
57 OBJECT_ = 0x8000,
58 TYPEMASK_ = (METHOD_ | PROPERTY_ | OBJECT_), // mask for the entry's type
59
60 // combination of bits above
61 FUNCTION_ = (FUNC_TYPE_ | READ_),
62 LFUNCTION_ = (FUNC_TYPE_ | READ_ | WRITE_), // mask for function which also works as Lvalue (statement)
63 SUB_ = SUB_TYPE_,
64 ROPROP_ = (PROPERTY_ | READ_), // mask Read Only-Property
65 RWPROP_ = (PROPERTY_ | READ_ | WRITE_), // mask Read/Write-Property
66 CPROP_ = (PROPERTY_ | READ_ | CONST_) // mask for constant
67 };
68
69 struct Method {
70 RtlCall pFunc;
71 std::u16string_view sName;
72 SbxDataType eType;
73 short nArgs;
74 sal_uInt16 nHash;
75 constexpr Method(std::u16string_view name, SbxDataType type, short args, RtlCall func)
76 : pFunc(func)
77 , sName(name)
78 , eType(type)
79 , nArgs(args)
80 , nHash(SbxVariable::MakeHashCode(name))
81 {
82 }
83 };
84
85 constexpr Method arg(std::u16string_view name, SbxDataType type, short args = 0)
86 {
87 return Method(name, type, args, nullptr);
88 }
89
90 template <int N> constexpr bool MethodsTableValid(const Method (&rMethods)[N])
91 {
92 int nCurMethArgs = 0;
93 int nArgsChecked = 0;
94 for (const auto& m : rMethods)
95 {
96 if (m.pFunc) // main (function/sub/etc) entry
97 {
98 assert(nCurMethArgs == nArgsChecked); // previous method had correct # of arguments
99 if (nCurMethArgs != nArgsChecked)
100 return false;
101 nCurMethArgs = m.nArgs & ARGSMASK_;
102 nArgsChecked = 0;
103 }
104 else // subordinate (argument) entry
105 ++nArgsChecked;
106 }
107 assert(nCurMethArgs == nArgsChecked); // last method had correct # of arguments
108 return nCurMethArgs == nArgsChecked;
109 }
110
111 template <bool N> void ConstBool(StarBASIC*, SbxArray& par, bool) { par.Get(0)->PutBool(N); }
112 template <sal_Int16 N> void ConstInt(StarBASIC*, SbxArray& par, bool) { par.Get(0)->PutInteger(N); }
113
114 constexpr Method aMethods[] = {
115
116 { u"Abs", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Abs },
117 arg(u"number", SbxDOUBLE),
118
119 { u"Array", SbxOBJECT, FUNCTION_, SbRtl_Array },
120 { u"Asc", SbxLONG, 1 | FUNCTION_, SbRtl_Asc },
121 arg(u"string", SbxSTRING),
122
123 { u"AscW", SbxLONG, 1 | FUNCTION_ | COMPATONLY_, SbRtl_Asc },
124 arg(u"string", SbxSTRING),
125
126 { u"Atn", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Atn },
127 arg(u"number", SbxDOUBLE),
128
129 // Related to: Dir, GetAttr, SetAttr
130 { u"ATTR_ARCHIVE", SbxINTEGER, CPROP_, ConstInt<SbAttributes::ARCHIVE> },
131 { u"ATTR_DIRECTORY", SbxINTEGER, CPROP_, ConstInt<SbAttributes::DIRECTORY> },
132 { u"ATTR_HIDDEN", SbxINTEGER, CPROP_, ConstInt<SbAttributes::HIDDEN> },
133 { u"ATTR_NORMAL", SbxINTEGER, CPROP_, ConstInt<SbAttributes::NORMAL> },
134 { u"ATTR_READONLY", SbxINTEGER, CPROP_, ConstInt<SbAttributes::READONLY> },
135 { u"ATTR_SYSTEM", SbxINTEGER, CPROP_, ConstInt<SbAttributes::SYSTEM> },
136 { u"ATTR_VOLUME", SbxINTEGER, CPROP_, ConstInt<SbAttributes::VOLUME> },
137
138 { u"Beep", SbxNULL, FUNCTION_, SbRtl_Beep },
139 { u"Blue", SbxINTEGER, 1 | FUNCTION_ | NORMONLY_, SbRtl_Blue },
140 arg(u"RGB-Value", SbxLONG),
141
142 { u"CallByName", SbxVARIANT, 3 | FUNCTION_, SbRtl_CallByName },
143 arg(u"Object", SbxOBJECT),
144 arg(u"ProcName", SbxSTRING),
145 arg(u"CallType", SbxINTEGER),
146
147 { u"CBool", SbxBOOL, 1 | FUNCTION_, SbRtl_CBool },
148 arg(u"expression", SbxVARIANT),
149
150 { u"CByte", SbxBYTE, 1 | FUNCTION_, SbRtl_CByte },
151 arg(u"expression", SbxVARIANT),
152
153 { u"CCur", SbxCURRENCY, 1 | FUNCTION_, SbRtl_CCur },
154 arg(u"expression", SbxVARIANT),
155
156 { u"CDate", SbxDATE, 1 | FUNCTION_, SbRtl_CDate },
157 arg(u"expression", SbxVARIANT),
158
159 { u"CDateFromUnoDate", SbxDATE, 1 | FUNCTION_, SbRtl_CDateFromUnoDate },
160 arg(u"UnoDate", SbxOBJECT),
161
162 { u"CDateToUnoDate", SbxOBJECT, 1 | FUNCTION_, SbRtl_CDateToUnoDate },
163 arg(u"Date", SbxDATE),
164
165 { u"CDateFromUnoTime", SbxDATE, 1 | FUNCTION_, SbRtl_CDateFromUnoTime },
166 arg(u"UnoTime", SbxOBJECT),
167
168 { u"CDateToUnoTime", SbxOBJECT, 1 | FUNCTION_, SbRtl_CDateToUnoTime },
169 arg(u"Time", SbxDATE),
170
171 { u"CDateFromUnoDateTime", SbxDATE, 1 | FUNCTION_, SbRtl_CDateFromUnoDateTime },
172 arg(u"UnoDateTime", SbxOBJECT),
173
174 { u"CDateToUnoDateTime", SbxOBJECT, 1 | FUNCTION_, SbRtl_CDateToUnoDateTime },
175 arg(u"DateTime", SbxDATE),
176
177 { u"CDateFromIso", SbxDATE, 1 | FUNCTION_, SbRtl_CDateFromIso },
178 arg(u"IsoDate", SbxSTRING),
179
180 { u"CDateToIso", SbxSTRING, 1 | FUNCTION_, SbRtl_CDateToIso },
181 arg(u"Date", SbxDATE),
182
183 { u"CDec", SbxDECIMAL, 1 | FUNCTION_, SbRtl_CDec },
184 arg(u"expression", SbxVARIANT),
185
186 { u"CDbl", SbxDOUBLE, 1 | FUNCTION_, SbRtl_CDbl },
187 arg(u"expression", SbxVARIANT),
188
189 // FIXME: CF_* are for what??? They duplicate WinAPI clipboard constants, but why?
190 { u"CF_BITMAP", SbxINTEGER, CPROP_, ConstInt<1> },
191 { u"CF_METAFILEPICT", SbxINTEGER, CPROP_, ConstInt<2> },
192 { u"CF_TEXT", SbxINTEGER, CPROP_, ConstInt<3> },
193
194 { u"ChDir", SbxNULL, 1 | FUNCTION_, SbRtl_ChDir },
195 arg(u"string", SbxSTRING),
196
197 { u"ChDrive", SbxNULL, 1 | FUNCTION_, SbRtl_ChDrive },
198 arg(u"string", SbxSTRING),
199
200 { u"Choose", SbxVARIANT, 2 | FUNCTION_, SbRtl_Choose },
201 arg(u"Index", SbxINTEGER),
202 arg(u"Expression", SbxVARIANT),
203
204 { u"Chr", SbxSTRING, 1 | FUNCTION_, SbRtl_Chr },
205 arg(u"charcode", SbxLONG),
206
207 { u"ChrW", SbxSTRING, 1 | FUNCTION_ | COMPATONLY_, SbRtl_ChrW },
208 arg(u"charcode", SbxLONG),
209
210 { u"CInt", SbxINTEGER, 1 | FUNCTION_, SbRtl_CInt },
211 arg(u"expression", SbxVARIANT),
212
213 // FIXME: what for are these???
214 { u"SET_TAB", SbxINTEGER, CPROP_, ConstInt<0> },
215 { u"CLEAR_TAB", SbxINTEGER, CPROP_, ConstInt<1> },
216 { u"CLEAR_ALLTABS", SbxINTEGER, CPROP_, ConstInt<2> },
217
218 { u"CLng", SbxLONG, 1 | FUNCTION_, SbRtl_CLng },
219 arg(u"expression", SbxVARIANT),
220
221 { u"CompatibilityMode", SbxBOOL, 1 | FUNCTION_, SbRtl_CompatibilityMode },
222 arg(u"bEnable", SbxBOOL),
223
224 { u"ConvertFromUrl", SbxSTRING, 1 | FUNCTION_, SbRtl_ConvertFromUrl },
225 arg(u"Url", SbxSTRING),
226
227 { u"ConvertToUrl", SbxSTRING, 1 | FUNCTION_, SbRtl_ConvertToUrl },
228 arg(u"SystemPath", SbxSTRING),
229
230 { u"Cos", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Cos },
231 arg(u"number", SbxDOUBLE),
232
233 { u"CreateObject", SbxOBJECT, 1 | FUNCTION_, SbRtl_CreateObject },
234 arg(u"class", SbxSTRING),
235
236 { u"CreateUnoListener", SbxOBJECT, 2 | FUNCTION_, SbRtl_CreateUnoListener },
237 arg(u"prefix", SbxSTRING),
238 arg(u"typename", SbxSTRING),
239
240 { u"CreateUnoDialog", SbxOBJECT, 2 | FUNCTION_, SbRtl_CreateUnoDialog },
241 arg(u"dialoglibrary", SbxOBJECT),
242 arg(u"dialogname", SbxSTRING),
243
244 { u"CreateUnoService", SbxOBJECT, 1 | FUNCTION_, SbRtl_CreateUnoService },
245 arg(u"servicename", SbxSTRING),
246
247 { u"CreateUnoServiceWithArguments", SbxOBJECT, 2 | FUNCTION_, SbRtl_CreateUnoServiceWithArguments },
248 arg(u"servicename", SbxSTRING),
249 arg(u"arguments", SbxARRAY),
250
251 { u"CreateUnoStruct", SbxOBJECT, 1 | FUNCTION_, SbRtl_CreateUnoStruct },
252 arg(u"classname", SbxSTRING),
253
254 { u"CreateUnoValue", SbxOBJECT, 2 | FUNCTION_, SbRtl_CreateUnoValue },
255 arg(u"type", SbxSTRING),
256 arg(u"value", SbxVARIANT),
257
258 { u"CreatePropertySet", SbxOBJECT, 1 | FUNCTION_, SbRtl_CreatePropertySet },
259 arg(u"values", SbxARRAY),
260
261 { u"CSng", SbxSINGLE, 1 | FUNCTION_, SbRtl_CSng },
262 arg(u"expression", SbxVARIANT),
263
264 { u"CStr", SbxSTRING, 1 | FUNCTION_, SbRtl_CStr },
265 arg(u"expression", SbxVARIANT),
266
267 { u"CurDir", SbxSTRING, 1 | FUNCTION_, SbRtl_CurDir },
268 arg(u"string", SbxSTRING),
269
270 { u"CVar", SbxVARIANT, 1 | FUNCTION_, SbRtl_CVar },
271 arg(u"expression", SbxVARIANT),
272
273 { u"CVErr", SbxVARIANT, 1 | FUNCTION_, SbRtl_CVErr },
274 arg(u"expression", SbxVARIANT),
275
276 { u"DDB", SbxDOUBLE, 5 | FUNCTION_ | COMPATONLY_, SbRtl_DDB },
277 arg(u"Cost", SbxDOUBLE),
278 arg(u"Salvage", SbxDOUBLE),
279 arg(u"Life", SbxDOUBLE),
280 arg(u"Period", SbxDOUBLE),
281 arg(u"Factor", SbxVARIANT, OPT_),
282
283 { u"Date", SbxDATE, LFUNCTION_, SbRtl_Date },
284 { u"DateAdd", SbxDATE, 3 | FUNCTION_, SbRtl_DateAdd },
285 arg(u"Interval", SbxSTRING),
286 arg(u"Number", SbxLONG),
287 arg(u"Date", SbxDATE),
288
289 { u"DateDiff", SbxDOUBLE, 5 | FUNCTION_, SbRtl_DateDiff },
290 arg(u"Interval", SbxSTRING),
291 arg(u"Date1", SbxDATE),
292 arg(u"Date2", SbxDATE),
293 arg(u"Firstdayofweek", SbxINTEGER, OPT_),
294 arg(u"Firstweekofyear", SbxINTEGER, OPT_),
295
296 { u"DatePart", SbxLONG, 4 | FUNCTION_, SbRtl_DatePart },
297 arg(u"Interval", SbxSTRING),
298 arg(u"Date", SbxDATE),
299 arg(u"Firstdayofweek", SbxINTEGER, OPT_),
300 arg(u"Firstweekofyear", SbxINTEGER, OPT_),
301
302 { u"DateSerial", SbxDATE, 3 | FUNCTION_, SbRtl_DateSerial },
303 arg(u"Year", SbxINTEGER),
304 arg(u"Month", SbxINTEGER),
305 arg(u"Day", SbxINTEGER),
306
307 { u"DateValue", SbxDATE, 1 | FUNCTION_, SbRtl_DateValue },
308 arg(u"String", SbxSTRING),
309
310 { u"Day", SbxINTEGER, 1 | FUNCTION_, SbRtl_Day },
311 arg(u"Date", SbxDATE),
312
313 { u"Ddeexecute", SbxNULL, 2 | FUNCTION_, SbRtl_DDEExecute },
314 arg(u"Channel", SbxLONG),
315 arg(u"Command", SbxSTRING),
316
317 { u"Ddeinitiate", SbxINTEGER, 2 | FUNCTION_, SbRtl_DDEInitiate },
318 arg(u"Application", SbxSTRING),
319 arg(u"Topic", SbxSTRING),
320
321 { u"Ddepoke", SbxNULL, 3 | FUNCTION_, SbRtl_DDEPoke },
322 arg(u"Channel", SbxLONG),
323 arg(u"Item", SbxSTRING),
324 arg(u"Data", SbxSTRING),
325
326 { u"Dderequest", SbxSTRING, 2 | FUNCTION_, SbRtl_DDERequest },
327 arg(u"Channel", SbxLONG),
328 arg(u"Item", SbxSTRING),
329
330 { u"Ddeterminate", SbxNULL, 1 | FUNCTION_, SbRtl_DDETerminate },
331 arg(u"Channel", SbxLONG),
332
333 { u"Ddeterminateall", SbxNULL, FUNCTION_, SbRtl_DDETerminateAll },
334 { u"DimArray", SbxOBJECT, FUNCTION_, SbRtl_DimArray },
335 { u"Dir", SbxSTRING, 2 | FUNCTION_, SbRtl_Dir },
336 arg(u"Pathname", SbxSTRING, OPT_),
337 arg(u"Attributes", SbxINTEGER, OPT_),
338
339 { u"DoEvents", SbxINTEGER, FUNCTION_, SbRtl_DoEvents },
340 { u"DumpAllObjects", SbxEMPTY, 2 | SUB_, SbRtl_DumpAllObjects },
341 arg(u"FileSpec", SbxSTRING),
342 arg(u"DumpAll", SbxINTEGER, OPT_),
343
344 { u"Empty", SbxVARIANT, CPROP_, SbRtl_Empty },
345 { u"EqualUnoObjects", SbxBOOL, 2 | FUNCTION_, SbRtl_EqualUnoObjects },
346 arg(u"Variant", SbxVARIANT),
347 arg(u"Variant", SbxVARIANT),
348
349 { u"EnableReschedule", SbxNULL, 1 | FUNCTION_, SbRtl_EnableReschedule },
350 arg(u"bEnable", SbxBOOL),
351
352 { u"Environ", SbxSTRING, 1 | FUNCTION_, SbRtl_Environ },
353 arg(u"Environmentstring", SbxSTRING),
354
355 { u"EOF", SbxBOOL, 1 | FUNCTION_, SbRtl_EOF },
356 arg(u"Channel", SbxINTEGER),
357
358 { u"Erl", SbxLONG, ROPROP_, SbRtl_Erl },
359 { u"Err", SbxVARIANT, RWPROP_, SbRtl_Err },
360 { u"Error", SbxSTRING, 1 | FUNCTION_, SbRtl_Error },
361 arg(u"code", SbxLONG),
362
363 { u"Exp", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Exp },
364 arg(u"number", SbxDOUBLE),
365
366 { u"False", SbxBOOL, CPROP_, ConstBool<false> },
367 { u"True", SbxBOOL, CPROP_, ConstBool<true> },
368
369 { u"FileAttr", SbxINTEGER, 2 | FUNCTION_, SbRtl_FileAttr },
370 arg(u"Channel", SbxINTEGER),
371 arg(u"Attributes", SbxINTEGER),
372
373 { u"FileCopy", SbxNULL, 2 | FUNCTION_, SbRtl_FileCopy },
374 arg(u"Source", SbxSTRING),
375 arg(u"Destination", SbxSTRING),
376
377 { u"FileDateTime", SbxSTRING, 1 | FUNCTION_, SbRtl_FileDateTime },
378 arg(u"filename", SbxSTRING),
379
380 { u"FileExists", SbxBOOL, 1 | FUNCTION_, SbRtl_FileExists },
381 arg(u"filename", SbxSTRING),
382
383 { u"FileLen", SbxLONG, 1 | FUNCTION_, SbRtl_FileLen },
384 arg(u"filename", SbxSTRING),
385
386 { u"FindObject", SbxOBJECT, 1 | FUNCTION_, SbRtl_FindObject },
387 arg(u"Name", SbxSTRING),
388
389 { u"FindPropertyObject", SbxOBJECT, 2 | FUNCTION_, SbRtl_FindPropertyObject },
390 arg(u"Object", SbxOBJECT),
391 arg(u"Name", SbxSTRING),
392
393 { u"Fix", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Fix },
394 arg(u"number", SbxDOUBLE),
395
396 { u"Format", SbxSTRING, 2 | FUNCTION_, SbRtl_Format },
397 arg(u"expression", SbxVARIANT),
398 arg(u"format", SbxSTRING, OPT_),
399
400 { u"FormatDateTime", SbxSTRING, 2 | FUNCTION_ | COMPATONLY_, SbRtl_FormatDateTime},
401 arg(u"Date", SbxDATE),
402 arg(u"NamedFormat", SbxINTEGER, OPT_),
403
404 { u"FormatNumber", SbxSTRING, 5 | FUNCTION_ | COMPATONLY_, SbRtl_FormatNumber },
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
410
411 { u"FormatPercent", SbxSTRING, 5 | FUNCTION_ | COMPATONLY_, SbRtl_FormatPercent },
412 arg(u"expression", SbxDOUBLE),
413 arg(u"numDigitsAfterDecimal", SbxINTEGER, OPT_),
414 arg(u"includeLeadingDigit", SbxINTEGER, OPT_), // vbTriState
415 arg(u"useParensForNegativeNumbers", SbxINTEGER, OPT_), // vbTriState
416 arg(u"groupDigits", SbxINTEGER, OPT_), // vbTriState
417
418 { u"Frac", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Frac },
419 arg(u"number", SbxDOUBLE),
420
421 // FIXME: what for are these???
422 { u"FRAMEANCHORPAGE", SbxINTEGER, CPROP_, ConstInt<1> },
423 { u"FRAMEANCHORCHAR", SbxINTEGER, CPROP_, ConstInt<15> },
424 { u"FRAMEANCHORPARA", SbxINTEGER, CPROP_, ConstInt<14> },
425
426 { u"FreeFile", SbxINTEGER, FUNCTION_, SbRtl_FreeFile },
427 { u"FreeLibrary", SbxNULL, 1 | FUNCTION_, SbRtl_FreeLibrary },
428 arg(u"Modulename", SbxSTRING),
429
430 { u"FV", SbxDOUBLE, 5 | FUNCTION_ | COMPATONLY_, SbRtl_FV },
431 arg(u"Rate", SbxDOUBLE),
432 arg(u"NPer", SbxDOUBLE),
433 arg(u"Pmt", SbxDOUBLE),
434 arg(u"PV", SbxVARIANT, OPT_),
435 arg(u"Due", SbxVARIANT, OPT_),
436
437 { u"Get", SbxNULL, 3 | FUNCTION_, SbRtl_Get },
438 arg(u"filenumber", SbxINTEGER),
439 arg(u"recordnumber", SbxLONG),
440 arg(u"variablename", SbxVARIANT),
441
442 { u"GetAttr", SbxINTEGER, 1 | FUNCTION_, SbRtl_GetAttr },
443 arg(u"filename", SbxSTRING),
444
445 { u"GetDefaultContext", SbxOBJECT, 0 | FUNCTION_, SbRtl_GetDefaultContext },
446 { u"GetDialogZoomFactorX", SbxDOUBLE, FUNCTION_, SbRtl_GetDialogZoomFactorX },
447 { u"GetDialogZoomFactorY", SbxDOUBLE, FUNCTION_, SbRtl_GetDialogZoomFactorY },
448 { u"GetGUIType", SbxINTEGER, FUNCTION_, SbRtl_GetGUIType },
449 { u"GetGUIVersion", SbxLONG, FUNCTION_, SbRtl_GetGUIVersion },
450 { u"GetPathSeparator", SbxSTRING, FUNCTION_, SbRtl_GetPathSeparator },
451 { u"GetProcessServiceManager", SbxOBJECT, 0 | FUNCTION_, SbRtl_GetProcessServiceManager },
452 { u"GetSolarVersion", SbxLONG, FUNCTION_, SbRtl_GetSolarVersion },
453 { u"GetSystemTicks", SbxLONG, FUNCTION_, SbRtl_GetSystemTicks },
454 { u"GetSystemType", SbxINTEGER, FUNCTION_, SbRtl_GetSystemType },
455 { u"GlobalScope", SbxOBJECT, FUNCTION_, SbRtl_GlobalScope },
456 { u"Green", SbxINTEGER, 1 | FUNCTION_ | NORMONLY_, SbRtl_Green },
457 arg(u"RGB-Value", SbxLONG),
458
459 { u"HasUnoInterfaces", SbxBOOL, 1 | FUNCTION_, SbRtl_HasUnoInterfaces },
460 arg(u"InterfaceName", SbxSTRING),
461
462 { u"Hex", SbxSTRING, 1 | FUNCTION_, SbRtl_Hex },
463 arg(u"number", SbxLONG),
464
465 { u"Hour", SbxINTEGER, 1 | FUNCTION_, SbRtl_Hour },
466 arg(u"Date", SbxDATE),
467
468 // Related to: MsgBox (return value)
469 { u"IDABORT", SbxINTEGER, CPROP_, ConstInt<SbMB::Response::ABORT> },
470 { u"IDCANCEL", SbxINTEGER, CPROP_, ConstInt<SbMB::Response::CANCEL> },
471 { u"IDIGNORE", SbxINTEGER, CPROP_, ConstInt<SbMB::Response::IGNORE> },
472 { u"IDNO", SbxINTEGER, CPROP_, ConstInt<SbMB::Response::NO> },
473 { u"IDOK", SbxINTEGER, CPROP_, ConstInt<SbMB::Response::OK> },
474 { u"IDRETRY", SbxINTEGER, CPROP_, ConstInt<SbMB::Response::RETRY> },
475 { u"IDYES", SbxINTEGER, CPROP_, ConstInt<SbMB::Response::YES> },
476
477 { u"Iif", SbxVARIANT, 3 | FUNCTION_, SbRtl_Iif },
478 arg(u"Bool", SbxBOOL),
479 arg(u"Variant1", SbxVARIANT),
480 arg(u"Variant2", SbxVARIANT),
481
482 { u"Input", SbxSTRING, 2 | FUNCTION_ | COMPATONLY_, SbRtl_Input },
483 arg(u"Number", SbxLONG),
484 arg(u"FileNumber", SbxLONG),
485
486 { u"InputBox", SbxSTRING, 5 | FUNCTION_, SbRtl_InputBox },
487 arg(u"Prompt", SbxSTRING),
488 arg(u"Title", SbxSTRING, OPT_),
489 arg(u"Default", SbxSTRING, OPT_),
490 arg(u"XPosTwips", SbxLONG, OPT_),
491 arg(u"YPosTwips", SbxLONG, OPT_),
492
493 { u"InStr", SbxLONG, 4 | FUNCTION_, SbRtl_InStr },
494 arg(u"Start", SbxSTRING, OPT_),
495 arg(u"String1", SbxSTRING),
496 arg(u"String2", SbxSTRING),
497 arg(u"Compare", SbxINTEGER, OPT_),
498
499 { u"InStrRev", SbxLONG, 4 | FUNCTION_ | COMPATONLY_, SbRtl_InStrRev },
500 arg(u"StringCheck", SbxSTRING),
501 arg(u"StringMatch", SbxSTRING),
502 arg(u"Start", SbxSTRING, OPT_),
503 arg(u"Compare", SbxINTEGER, OPT_),
504
505 { u"Int", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Int },
506 arg(u"number", SbxDOUBLE),
507
508 { u"IPmt", SbxDOUBLE, 6 | FUNCTION_ | COMPATONLY_, SbRtl_IPmt },
509 arg(u"Rate", SbxDOUBLE),
510 arg(u"Per", SbxDOUBLE),
511 arg(u"NPer", SbxDOUBLE),
512 arg(u"PV", SbxDOUBLE),
513 arg(u"FV", SbxVARIANT, OPT_),
514 arg(u"Due", SbxVARIANT, OPT_),
515
516 { u"IRR", SbxDOUBLE, 2 | FUNCTION_ | COMPATONLY_, SbRtl_IRR },
517 arg(u"ValueArray", SbxARRAY),
518 arg(u"Guess", SbxVARIANT, OPT_),
519
520 { u"IsArray", SbxBOOL, 1 | FUNCTION_, SbRtl_IsArray },
521 arg(u"Variant", SbxVARIANT),
522
523 { u"IsDate", SbxBOOL, 1 | FUNCTION_, SbRtl_IsDate },
524 arg(u"Variant", SbxVARIANT),
525
526 { u"IsEmpty", SbxBOOL, 1 | FUNCTION_, SbRtl_IsEmpty },
527 arg(u"Variant", SbxVARIANT),
528
529 { u"IsError", SbxBOOL, 1 | FUNCTION_, SbRtl_IsError },
530 arg(u"Variant", SbxVARIANT),
531
532 { u"IsMissing", SbxBOOL, 1 | FUNCTION_, SbRtl_IsMissing },
533 arg(u"Variant", SbxVARIANT),
534
535 { u"IsNull", SbxBOOL, 1 | FUNCTION_, SbRtl_IsNull },
536 arg(u"Variant", SbxVARIANT),
537
538 { u"IsNumeric", SbxBOOL, 1 | FUNCTION_, SbRtl_IsNumeric },
539 arg(u"Variant", SbxVARIANT),
540
541 { u"IsObject", SbxBOOL, 1 | FUNCTION_, SbRtl_IsObject },
542 arg(u"Variant", SbxVARIANT),
543
544 { u"IsUnoStruct", SbxBOOL, 1 | FUNCTION_, SbRtl_IsUnoStruct },
545 arg(u"Variant", SbxVARIANT),
546
547 { u"Join", SbxSTRING, 2 | FUNCTION_, SbRtl_Join },
548 arg(u"SourceArray", SbxOBJECT),
549 arg(u"Delimiter", SbxSTRING),
550
551 { u"Kill", SbxNULL, 1 | FUNCTION_, SbRtl_Kill },
552 arg(u"filespec", SbxSTRING),
553
554 { u"LBound", SbxLONG, 1 | FUNCTION_, SbRtl_LBound },
555 arg(u"Variant", SbxVARIANT),
556
557 { u"LCase", SbxSTRING, 1 | FUNCTION_, SbRtl_LCase },
558 arg(u"string", SbxSTRING),
559
560 { u"Left", SbxSTRING, 2 | FUNCTION_, SbRtl_Left },
561 arg(u"String", SbxSTRING),
562 arg(u"Length", SbxLONG),
563
564 { u"Len", SbxLONG, 1 | FUNCTION_, SbRtl_Len },
565 arg(u"StringOrVariant", SbxVARIANT),
566
567 { u"LenB", SbxLONG, 1 | FUNCTION_, SbRtl_Len },
568 arg(u"StringOrVariant", SbxVARIANT),
569
570 { u"Load", SbxNULL, 1 | FUNCTION_, SbRtl_Load },
571 arg(u"object", SbxOBJECT),
572
573 { u"LoadPicture", SbxOBJECT, 1 | FUNCTION_, SbRtl_LoadPicture },
574 arg(u"string", SbxSTRING),
575
576 { u"Loc", SbxLONG, 1 | FUNCTION_, SbRtl_Loc },
577 arg(u"Channel", SbxINTEGER),
578
579 { u"Lof", SbxLONG, 1 | FUNCTION_, SbRtl_Lof },
580 arg(u"Channel", SbxINTEGER),
581
582 { u"Log", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Log },
583 arg(u"number", SbxDOUBLE),
584
585 { u"LTrim", SbxSTRING, 1 | FUNCTION_, SbRtl_LTrim },
586 arg(u"string", SbxSTRING),
587
588 // Related to: MsgBox (Buttons argument)
589 { u"MB_ABORTRETRYIGNORE", SbxINTEGER, CPROP_, ConstInt<SbMB::ABORTRETRYIGNORE> },
590 { u"MB_APPLMODAL", SbxINTEGER, CPROP_, ConstInt<SbMB::APPLMODAL> },
591 { u"MB_DEFBUTTON1", SbxINTEGER, CPROP_, ConstInt<SbMB::DEFBUTTON1> },
592 { u"MB_DEFBUTTON2", SbxINTEGER, CPROP_, ConstInt<SbMB::DEFBUTTON2> },
593 { u"MB_DEFBUTTON3", SbxINTEGER, CPROP_, ConstInt<SbMB::DEFBUTTON3> },
594 { u"MB_ICONEXCLAMATION", SbxINTEGER, CPROP_, ConstInt<SbMB::ICONEXCLAMATION> },
595 { u"MB_ICONINFORMATION", SbxINTEGER, CPROP_, ConstInt<SbMB::ICONINFORMATION> },
596 { u"MB_ICONQUESTION", SbxINTEGER, CPROP_, ConstInt<SbMB::ICONQUESTION> },
597 { u"MB_ICONSTOP", SbxINTEGER, CPROP_, ConstInt<SbMB::ICONSTOP> },
598 { u"MB_OK", SbxINTEGER, CPROP_, ConstInt<SbMB::OK> },
599 { u"MB_OKCANCEL", SbxINTEGER, CPROP_, ConstInt<SbMB::OKCANCEL> },
600 { u"MB_RETRYCANCEL", SbxINTEGER, CPROP_, ConstInt<SbMB::RETRYCANCEL> },
601 { u"MB_SYSTEMMODAL", SbxINTEGER, CPROP_, ConstInt<SbMB::SYSTEMMODAL> },
602 { u"MB_YESNO", SbxINTEGER, CPROP_, ConstInt<SbMB::YESNO> },
603 { u"MB_YESNOCANCEL", SbxINTEGER, CPROP_, ConstInt<SbMB::YESNOCANCEL> },
604
605 { u"Me", SbxOBJECT, 0 | FUNCTION_ | COMPATONLY_, SbRtl_Me },
606 { u"Mid", SbxSTRING, 3 | LFUNCTION_, SbRtl_Mid },
607 arg(u"String", SbxSTRING),
608 arg(u"Start", SbxLONG),
609 arg(u"Length", SbxLONG, OPT_),
610
611 { u"Minute", SbxINTEGER, 1 | FUNCTION_, SbRtl_Minute },
612 arg(u"Date", SbxDATE),
613
614 { u"MIRR", SbxDOUBLE, 3 | FUNCTION_ | COMPATONLY_, SbRtl_MIRR },
615 arg(u"ValueArray", SbxARRAY),
616 arg(u"FinanceRate", SbxDOUBLE),
617 arg(u"ReinvestRate", SbxDOUBLE),
618
619 { u"MkDir", SbxNULL, 1 | FUNCTION_, SbRtl_MkDir },
620 arg(u"pathname", SbxSTRING),
621
622 { u"Month", SbxINTEGER, 1 | FUNCTION_, SbRtl_Month },
623 arg(u"Date", SbxDATE),
624
625 { u"MonthName", SbxSTRING, 2 | FUNCTION_ | COMPATONLY_, SbRtl_MonthName },
626 arg(u"Month", SbxINTEGER),
627 arg(u"Abbreviate", SbxBOOL, OPT_),
628
629 { u"MsgBox", SbxINTEGER, 5 | FUNCTION_, SbRtl_MsgBox },
630 arg(u"Prompt", SbxSTRING),
631 arg(u"Buttons", SbxINTEGER, OPT_),
632 arg(u"Title", SbxSTRING, OPT_),
633 arg(u"Helpfile", SbxSTRING, OPT_),
634 arg(u"Context", SbxINTEGER, OPT_),
635
636 { u"Nothing", SbxOBJECT, CPROP_, SbRtl_Nothing },
637 { u"Now", SbxDATE, FUNCTION_, SbRtl_Now },
638 { u"NPer", SbxDOUBLE, 5 | FUNCTION_ | COMPATONLY_, SbRtl_NPer },
639 arg(u"Rate", SbxDOUBLE),
640 arg(u"Pmt", SbxDOUBLE),
641 arg(u"PV", SbxDOUBLE),
642 arg(u"FV", SbxVARIANT, OPT_),
643 arg(u"Due", SbxVARIANT, OPT_),
644
645 { u"NPV", SbxDOUBLE, 2 | FUNCTION_ | COMPATONLY_, SbRtl_NPV },
646 arg(u"Rate", SbxDOUBLE),
647 arg(u"ValueArray", SbxARRAY),
648
649 { u"Null", SbxNULL, CPROP_, SbRtl_Null },
650
651 { u"Oct", SbxSTRING, 1 | FUNCTION_, SbRtl_Oct },
652 arg(u"number", SbxLONG),
653
654 { u"Partition", SbxSTRING, 4 | FUNCTION_, SbRtl_Partition },
655 arg(u"number", SbxLONG),
656 arg(u"start", SbxLONG),
657 arg(u"stop", SbxLONG),
658 arg(u"interval", SbxLONG),
659
660 { u"Pi", SbxDOUBLE, CPROP_, SbRtl_PI },
661
662 { u"Pmt", SbxDOUBLE, 5 | FUNCTION_ | COMPATONLY_, SbRtl_Pmt },
663 arg(u"Rate", SbxDOUBLE),
664 arg(u"NPer", SbxDOUBLE),
665 arg(u"PV", SbxDOUBLE),
666 arg(u"FV", SbxVARIANT, OPT_),
667 arg(u"Due", SbxVARIANT, OPT_),
668
669 { u"PPmt", SbxDOUBLE, 6 | FUNCTION_ | COMPATONLY_, SbRtl_PPmt },
670 arg(u"Rate", SbxDOUBLE),
671 arg(u"Per", SbxDOUBLE),
672 arg(u"NPer", SbxDOUBLE),
673 arg(u"PV", SbxDOUBLE),
674 arg(u"FV", SbxVARIANT, OPT_),
675 arg(u"Due", SbxVARIANT, OPT_),
676
677 { u"Put", SbxNULL, 3 | FUNCTION_, SbRtl_Put },
678 arg(u"filenumber", SbxINTEGER),
679 arg(u"recordnumber", SbxLONG),
680 arg(u"variablename", SbxVARIANT),
681
682 { u"PV", SbxDOUBLE, 5 | FUNCTION_ | COMPATONLY_, SbRtl_PV },
683 arg(u"Rate", SbxDOUBLE),
684 arg(u"NPer", SbxDOUBLE),
685 arg(u"Pmt", SbxDOUBLE),
686 arg(u"FV", SbxVARIANT, OPT_),
687 arg(u"Due", SbxVARIANT, OPT_),
688
689 { u"QBColor", SbxLONG, 1 | FUNCTION_, SbRtl_QBColor },
690 arg(u"number", SbxINTEGER),
691
692 { u"Randomize", SbxNULL, 1 | FUNCTION_, SbRtl_Randomize },
693 arg(u"Number", SbxDOUBLE, OPT_),
694
695 { u"Rate", SbxDOUBLE, 6 | FUNCTION_ | COMPATONLY_, SbRtl_Rate },
696 arg(u"NPer", SbxDOUBLE),
697 arg(u"Pmt", SbxDOUBLE),
698 arg(u"PV", SbxDOUBLE),
699 arg(u"FV", SbxVARIANT, OPT_),
700 arg(u"Due", SbxVARIANT, OPT_),
701 arg(u"Guess", SbxVARIANT, OPT_),
702
703 { u"Red", SbxINTEGER, 1 | FUNCTION_ | NORMONLY_, SbRtl_Red },
704 arg(u"RGB-Value", SbxLONG),
705
706 { u"Reset", SbxNULL, 0 | FUNCTION_, SbRtl_Reset },
707 { u"ResolvePath", SbxSTRING, 1 | FUNCTION_, SbRtl_ResolvePath },
708 arg(u"Path", SbxSTRING),
709
710 { u"RGB", SbxLONG, 3 | FUNCTION_, SbRtl_RGB },
711 arg(u"Red", SbxINTEGER),
712 arg(u"Green", SbxINTEGER),
713 arg(u"Blue", SbxINTEGER),
714
715 { u"Replace", SbxSTRING, 6 | FUNCTION_, SbRtl_Replace },
716 arg(u"Expression", SbxSTRING),
717 arg(u"Find", SbxSTRING),
718 arg(u"Replace", SbxSTRING),
719 arg(u"Start", SbxINTEGER, OPT_),
720 arg(u"Count", SbxINTEGER, OPT_),
721 arg(u"Compare", SbxINTEGER, OPT_),
722
723 { u"Right", SbxSTRING, 2 | FUNCTION_, SbRtl_Right },
724 arg(u"String", SbxSTRING),
725 arg(u"Length", SbxLONG),
726
727 { u"RmDir", SbxNULL, 1 | FUNCTION_, SbRtl_RmDir },
728 arg(u"pathname", SbxSTRING),
729
730 { u"Round", SbxDOUBLE, 2 | FUNCTION_ | COMPATONLY_, SbRtl_Round },
731 arg(u"Expression", SbxDOUBLE),
732 arg(u"Numdecimalplaces", SbxINTEGER, OPT_),
733
734 { u"Rnd", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Rnd },
735 arg(u"Number", SbxDOUBLE, OPT_),
736
737 { u"RTL", SbxOBJECT, 0 | FUNCTION_ | COMPATONLY_, SbRtl_RTL },
738 { u"RTrim", SbxSTRING, 1 | FUNCTION_, SbRtl_RTrim },
739 arg(u"string", SbxSTRING),
740
741 { u"SavePicture", SbxNULL, 2 | FUNCTION_, SbRtl_SavePicture },
742 arg(u"object", SbxOBJECT),
743 arg(u"string", SbxSTRING),
744
745 { u"Second", SbxINTEGER, 1 | FUNCTION_, SbRtl_Second },
746 arg(u"Date", SbxDATE),
747
748 { u"Seek", SbxLONG, 1 | FUNCTION_, SbRtl_Seek },
749 arg(u"Channel", SbxINTEGER),
750
751 { u"SendKeys", SbxNULL, 2 | FUNCTION_, SbRtl_SendKeys },
752 arg(u"String", SbxSTRING),
753 arg(u"Wait", SbxBOOL, OPT_),
754
755 { u"SetAttr", SbxNULL, 2 | FUNCTION_, SbRtl_SetAttr },
756 arg(u"PathName", SbxSTRING),
757 arg(u"Attributes", SbxINTEGER),
758
759 // FIXME: what for are these???
760 { u"SET_OFF", SbxINTEGER, CPROP_, ConstInt<0> },
761 { u"SET_ON", SbxINTEGER, CPROP_, ConstInt<1> },
762 { u"TOGGLE", SbxINTEGER, CPROP_, ConstInt<2> },
763
764 { u"Sgn", SbxINTEGER, 1 | FUNCTION_, SbRtl_Sgn },
765 arg(u"number", SbxDOUBLE),
766
767 { u"Shell", SbxLONG, 2 | FUNCTION_, SbRtl_Shell },
768 arg(u"PathName", SbxSTRING),
769 arg(u"WindowStyle", SbxINTEGER, OPT_),
770
771 { u"Sin", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Sin },
772 arg(u"number", SbxDOUBLE),
773
774 { u"SLN", SbxDOUBLE, 3 | FUNCTION_ | COMPATONLY_, SbRtl_SLN },
775 arg(u"Cost", SbxDOUBLE),
776 arg(u"Double", SbxDOUBLE),
777 arg(u"Life", SbxDOUBLE),
778
779 { u"SYD", SbxDOUBLE, 4 | FUNCTION_ | COMPATONLY_, SbRtl_SYD },
780 arg(u"Cost", SbxDOUBLE),
781 arg(u"Salvage", SbxDOUBLE),
782 arg(u"Life", SbxDOUBLE),
783 arg(u"Period", SbxDOUBLE),
784
785 { u"Space", SbxSTRING, 1 | FUNCTION_, SbRtl_Space },
786 arg(u"Number", SbxLONG),
787
788 { u"Spc", SbxSTRING, 1 | FUNCTION_, SbRtl_Space },
789 arg(u"Number", SbxLONG),
790
791 { u"Split", SbxOBJECT, 3 | FUNCTION_, SbRtl_Split },
792 arg(u"expression", SbxSTRING),
793 arg(u"delimiter", SbxSTRING),
794 arg(u"Limit", SbxLONG),
795
796 { u"Sqr", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Sqr },
797 arg(u"number", SbxDOUBLE),
798
799 { u"Str", SbxSTRING, 1 | FUNCTION_, SbRtl_Str },
800 arg(u"number", SbxDOUBLE),
801
802 { u"StrComp", SbxINTEGER, 3 | FUNCTION_, SbRtl_StrComp },
803 arg(u"String1", SbxSTRING),
804 arg(u"String2", SbxSTRING),
805 arg(u"Compare", SbxINTEGER, OPT_),
806
807 { u"StrConv", SbxOBJECT, 3 | FUNCTION_, SbRtl_StrConv },
808 arg(u"String", SbxSTRING),
809 arg(u"Conversion", SbxSTRING),
810 arg(u"LCID", SbxINTEGER, OPT_),
811
812 { u"String", SbxSTRING, 2 | FUNCTION_, SbRtl_String },
813 arg(u"Number", SbxLONG),
814 arg(u"Character", SbxVARIANT),
815
816 { u"StrReverse", SbxSTRING, 1 | FUNCTION_ | COMPATONLY_, SbRtl_StrReverse },
817 arg(u"String1", SbxSTRING),
818
819 { u"Switch", SbxVARIANT, 2 | FUNCTION_, SbRtl_Switch },
820 arg(u"Expression", SbxVARIANT),
821 arg(u"Value", SbxVARIANT),
822
823 { u"Tab", SbxSTRING, 1 | FUNCTION_, SbRtl_Tab },
824 arg(u"Count", SbxLONG),
825
826 { u"Tan", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Tan },
827 arg(u"number", SbxDOUBLE),
828
829 { u"Time", SbxVARIANT, LFUNCTION_, SbRtl_Time },
830 { u"Timer", SbxDATE, FUNCTION_, SbRtl_Timer },
831 { u"TimeSerial", SbxDATE, 3 | FUNCTION_, SbRtl_TimeSerial },
832 arg(u"Hour", SbxLONG),
833 arg(u"Minute", SbxLONG),
834 arg(u"Second", SbxLONG),
835
836 { u"TimeValue", SbxDATE, 1 | FUNCTION_, SbRtl_TimeValue },
837 arg(u"String", SbxSTRING),
838
839 { u"Trim", SbxSTRING, 1 | FUNCTION_, SbRtl_Trim },
840 arg(u"String", SbxSTRING),
841
842 { u"TwipsPerPixelX", SbxLONG, FUNCTION_, SbRtl_TwipsPerPixelX },
843 { u"TwipsPerPixelY", SbxLONG, FUNCTION_, SbRtl_TwipsPerPixelY },
844
845 // Related to: SwFieldTypesEnum in sw/inc/fldbas.hxx, .uno:InsertField (Type param), .uno:InsertDBField (Type param)
846 { u"TYP_AUTHORFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::AUTHOR> },
847 { u"TYP_CHAPTERFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::CHAPTER> },
848 { u"TYP_CONDTXTFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::CONDITIONALTEXT> },
849 { u"TYP_DATEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DATE> },
850 { u"TYP_DBFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DATABASE> },
851 { u"TYP_DBNAMEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DATABASENAME> },
852 { u"TYP_DBNEXTSETFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DATABASENEXTSET> },
853 { u"TYP_DBNUMSETFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DATABASENUMBERSET> },
854 { u"TYP_DBSETNUMBERFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DATABASESETNUMBER> },
855 { u"TYP_DDEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DDE> },
856 { u"TYP_DOCINFOFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DOCUMENTINFO> },
857 { u"TYP_DOCSTATFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DOCUMENTSTATISTICS> },
858 { u"TYP_EXTUSERFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::EXTENDEDUSER> },
859 { u"TYP_FILENAMEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::FILENAME> },
860 { u"TYP_FIXDATEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::FIXEDDATE> },
861 { u"TYP_FIXTIMEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::FIXEDTIME> },
862 { u"TYP_FORMELFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::FORMEL> },
863 { u"TYP_GETFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::GET> },
864 { u"TYP_GETREFFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::GETREF> },
865 { u"TYP_GETREFPAGEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::GETREFPAGE> },
866 { u"TYP_HIDDENPARAFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::HIDDENPARAGRAPH> },
867 { u"TYP_HIDDENTXTFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::HIDDENTEXT> },
868 { u"TYP_INPUTFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::INPUT> },
869 { u"TYP_INTERNETFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::INTERNET> },
870 { u"TYP_JUMPEDITFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::JUMPEDIT> },
871 { u"TYP_MACROFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::MACRO> },
872 { u"TYP_NEXTPAGEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::NEXTPAGE> },
873 { u"TYP_PAGENUMBERFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::PAGENUMBER> },
874 { u"TYP_POSTITFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::POSTIT> },
875 { u"TYP_PREVPAGEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::PREVIOUSPAGE> },
876 { u"TYP_SEQFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::SEQUENCE> },
877 { u"TYP_SETFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::SET> },
878 { u"TYP_SETINPFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::SETINPUT> },
879 { u"TYP_SETREFFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::SETREF> },
880 { u"TYP_SETREFPAGEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::SETREFPAGE> },
881 { u"TYP_TEMPLNAMEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::TEMPLATENAME> },
882 { u"TYP_TIMEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::TIME> },
883 { u"TYP_USERFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::USER> },
884 { u"TYP_USRINPFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::USERINPUT> },
885
886 { u"TypeLen", SbxINTEGER, 1 | FUNCTION_, SbRtl_TypeLen },
887 arg(u"Var", SbxVARIANT),
888
889 { u"TypeName", SbxSTRING, 1 | FUNCTION_, SbRtl_TypeName },
890 arg(u"Varname", SbxVARIANT),
891
892 { u"UBound", SbxLONG, 1 | FUNCTION_, SbRtl_UBound },
893 arg(u"Var", SbxVARIANT),
894
895 { u"UCase", SbxSTRING, 1 | FUNCTION_, SbRtl_UCase },
896 arg(u"String", SbxSTRING),
897
898 { u"Unload", SbxNULL, 1 | FUNCTION_, SbRtl_Unload },
899 arg(u"Dialog", SbxOBJECT),
900
901 { u"Val", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Val },
902 arg(u"String", SbxSTRING),
903
904 { u"VarType", SbxINTEGER, 1 | FUNCTION_, SbRtl_VarType },
905 arg(u"Varname", SbxVARIANT),
906
907 // Related to: VarType
908 { u"V_EMPTY", SbxINTEGER, CPROP_, ConstInt<SbxEMPTY> },
909 { u"V_NULL", SbxINTEGER, CPROP_, ConstInt<SbxNULL> },
910 { u"V_INTEGER", SbxINTEGER, CPROP_, ConstInt<SbxINTEGER> },
911 { u"V_LONG", SbxINTEGER, CPROP_, ConstInt<SbxLONG> },
912 { u"V_SINGLE", SbxINTEGER, CPROP_, ConstInt<SbxSINGLE> },
913 { u"V_DOUBLE", SbxINTEGER, CPROP_, ConstInt<SbxDOUBLE> },
914 { u"V_CURRENCY", SbxINTEGER, CPROP_, ConstInt<SbxCURRENCY> },
915 { u"V_DATE", SbxINTEGER, CPROP_, ConstInt<SbxDATE> },
916 { u"V_STRING", SbxINTEGER, CPROP_, ConstInt<SbxSTRING> },
917
918 { u"Wait", SbxNULL, 1 | FUNCTION_, SbRtl_Wait },
919 arg(u"Milliseconds", SbxLONG),
920
921 { u"FuncCaller", SbxVARIANT, FUNCTION_, SbRtl_FuncCaller },
922 //#i64882#
923 { u"WaitUntil", SbxNULL, 1 | FUNCTION_, SbRtl_WaitUntil },
924 arg(u"Date", SbxDOUBLE),
925
926 { u"Weekday", SbxINTEGER, 2 | FUNCTION_, SbRtl_Weekday },
927 arg(u"Date", SbxDATE),
928 arg(u"Firstdayofweek", SbxINTEGER, OPT_),
929
930 { u"WeekdayName", SbxSTRING, 3 | FUNCTION_ | COMPATONLY_, SbRtl_WeekdayName },
931 arg(u"Weekday", SbxINTEGER),
932 arg(u"Abbreviate", SbxBOOL, OPT_),
933 arg(u"Firstdayofweek", SbxINTEGER, OPT_),
934
935 { u"Year", SbxINTEGER, 1 | FUNCTION_, SbRtl_Year },
936 arg(u"Date", SbxDATE),
937 }; // end of the table
938
939 static_assert(MethodsTableValid(aMethods));
940
941 // building the info-structure for single elements
942 // if nIdx = 0, don't create anything (Std-Props!)
943
944 SbxInfo* GetMethodInfo(std::size_t nIdx)
945 {
946 if (!nIdx)
947 return nullptr;
948 assert(nIdx <= std::size(aMethods));
949 const Method* p = &aMethods[nIdx - 1];
950 SbxInfo* pInfo_ = new SbxInfo;
951 short nPar = p->nArgs & ARGSMASK_;
952 for (short i = 0; i < nPar; i++)
953 {
954 p++;
955 SbxFlagBits nFlags_ = static_cast<SbxFlagBits>((p->nArgs >> 8) & 0x03);
956 if (p->nArgs & OPT_)
957 nFlags_ |= SbxFlagBits::Optional;
958 pInfo_->AddParam(OUString(p->sName), p->eType, nFlags_);
959 }
960 return pInfo_;
961 }
962 }
963
964 SbiStdObject::SbiStdObject( const OUString& r, StarBASIC* pb ) : SbxObject( r )
965 {
966 // #i92642: Remove default properties
967 Remove( u"Name"_ustr, SbxClassType::DontCare );
968 Remove( u"Parent"_ustr, SbxClassType::DontCare );
969
970 SetParent( pb );
971
972 pStdFactory.emplace();
973 SbxBase::AddFactory( &*pStdFactory );
974
975 Insert( new SbStdClipboard );
976 }
977
978 SbiStdObject::~SbiStdObject()
979 {
980 SbxBase::RemoveFactory( &*pStdFactory );
981 pStdFactory.reset();
982 }
983
984 // Finding an element:
985 // It runs linearly through the method table here until an
986 // adequate method is has been found. Because of the bits in
987 // the nArgs-field the adequate instance of an SbxObjElement
988 // is created then. If the method/property hasn't been found,
989 // return NULL without error code, so that a whole chain of
990 // objects can be asked for the method/property.
991
992 SbxVariable* SbiStdObject::Find( const OUString& rName, SbxClassType t )
993 {
994 // entered already?
995 SbxVariable* pVar = SbxObject::Find( rName, t );
996 if( !pVar )
997 {
998 // else search one
999 sal_uInt16 nHash_ = SbxVariable::MakeHashCode( rName );
1000 auto p = std::begin(aMethods);
1001 bool bFound = false;
1002 short nIndex = 0;
1003 sal_uInt16 nSrchMask = TYPEMASK_;
1004 switch( t )
1005 {
1006 case SbxClassType::Method: nSrchMask = METHOD_; break;
1007 case SbxClassType::Property: nSrchMask = PROPERTY_; break;
1008 case SbxClassType::Object: nSrchMask = OBJECT_; break;
1009 default: break;
1010 }
1011 while (p != std::end(aMethods))
1012 {
1013 assert(p < std::end(aMethods));
1014 if( ( p->nArgs & nSrchMask )
1015 && ( p->nHash == nHash_ )
1016 && (rName.equalsIgnoreAsciiCase(p->sName)))
1017 {
1018 bFound = true;
1019 if( p->nArgs & COMPTMASK_ )
1020 {
1021 bool bCompatibility = false;
1022 SbiInstance* pInst = GetSbData()->pInst;
1023 if (pInst)
1024 {
1025 bCompatibility = pInst->IsCompatibility();
1026 }
1027 else
1028 {
1029 // No instance running => compiling a source on module level.
1030 const SbModule* pModule = GetSbData()->pCompMod;
1031 if (pModule)
1032 bCompatibility = pModule->IsVBASupport();
1033 }
1034 if ((bCompatibility && (NORMONLY_ & p->nArgs)) || (!bCompatibility && (COMPATONLY_ & p->nArgs)))
1035 bFound = false;
1036 }
1037 break;
1038 }
1039 nIndex += ( p->nArgs & ARGSMASK_ ) + 1;
1040 p = aMethods + nIndex;
1041 }
1042
1043 if( bFound )
1044 {
1045 // isolate Args-fields:
1046 SbxFlagBits nAccess = static_cast<SbxFlagBits>(( p->nArgs & RWMASK_ ) >> 8);
1047 short nType = ( p->nArgs & TYPEMASK_ );
1048 if( p->nArgs & CONST_ )
1049 nAccess |= SbxFlagBits::Const;
1050 SbxClassType eCT = SbxClassType::Object;
1051 if( nType & PROPERTY_ )
1052 {
1053 eCT = SbxClassType::Property;
1054 }
1055 else if( nType & METHOD_ )
1056 {
1057 eCT = SbxClassType::Method;
1058 }
1059 pVar = Make(OUString(p->sName), eCT, p->eType, (p->nArgs & FUNCTION_) == FUNCTION_);
1060 pVar->SetUserData( nIndex + 1 );
1061 pVar->SetFlags( nAccess );
1062 }
1063 }
1064 return pVar;
1065 }
1066
1067 // SetModified must be pinched off at the RTL
1068 void SbiStdObject::SetModified( bool )
1069 {
1070 }
1071
1072
1073 void SbiStdObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
1074
1075 {
1076 const SbxHint* pHint = dynamic_cast<const SbxHint*>(&rHint);
1077 if( !pHint )
1078 return;
1079
1080 SbxVariable* pVar = pHint->GetVar();
1081 SbxArray* pPar_ = pVar->GetParameters();
1082 const std::size_t nCallId = pVar->GetUserData();
1083 if( nCallId )
1084 {
1085 const SfxHintId t = pHint->GetId();
1086 if( t == SfxHintId::BasicInfoWanted )
1087 pVar->SetInfo(GetMethodInfo(nCallId));
1088 else
1089 {
1090 assert(nCallId <= std::size(aMethods));
1091 bool bWrite = false;
1092 if( t == SfxHintId::BasicDataChanged )
1093 bWrite = true;
1094 if( t == SfxHintId::BasicDataWanted || bWrite )
1095 {
1096 RtlCall p = aMethods[ nCallId-1 ].pFunc;
1097 SbxArrayRef rPar( pPar_ );
1098 if( !pPar_ )
1099 {
1100 rPar = pPar_ = new SbxArray;
1101 pPar_->Put(pVar, 0);
1102 }
1103 p( static_cast<StarBASIC*>(GetParent()), *pPar_, bWrite );
1104 return;
1105 }
1106 }
1107 }
1108 SbxObject::Notify( rBC, rHint );
1109 }
1110
1111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */