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