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>
22 #include <rtlproto.hxx>
23 #include <errobject.hxx>
24 #include <basegfx/numeric/ftools.hxx>
27 // Properties and methods lay the return value down at Get (bWrite = sal_False)
28 // at the element 0 of the Argv; at Put (bWrite = sal_True) the value from
29 // element 0 is stored.
31 void SbRtl_Erl(StarBASIC
*, SbxArray
& rPar
, bool)
33 rPar
.Get( 0 )->PutLong( StarBASIC::GetErl() );
36 void SbRtl_Err(StarBASIC
*, SbxArray
& rPar
, bool bWrite
)
38 if( SbiRuntime::isVBAEnabled() )
40 rPar
.Get( 0 )->PutObject( SbxErrObject::getErrObject().get() );
46 sal_Int32 nVal
= rPar
.Get( 0 )->GetLong();
48 StarBASIC::Error( StarBASIC::GetSfxFromVBError( static_cast<sal_uInt16
>(nVal
) ) );
51 rPar
.Get( 0 )->PutLong( StarBASIC::GetVBErrorCode( StarBASIC::GetErrBasic() ) );
55 void SbRtl_False(StarBASIC
*, SbxArray
& rPar
, bool)
57 rPar
.Get(0)->PutBool( false );
60 void SbRtl_Empty(StarBASIC
*, SbxArray
&, bool) {}
62 void SbRtl_Nothing(StarBASIC
*, SbxArray
& rPar
, bool)
64 // return an empty object
65 rPar
.Get( 0 )->PutObject( nullptr );
68 void SbRtl_Null(StarBASIC
*, SbxArray
& rPar
, bool)
70 // returns an empty object-variable
71 rPar
.Get( 0 )->PutNull();
74 void SbRtl_PI(StarBASIC
*, SbxArray
& rPar
, bool)
76 rPar
.Get( 0 )->PutDouble( F_PI
);
79 void SbRtl_True(StarBASIC
*, SbxArray
& rPar
, bool)
81 rPar
.Get( 0 )->PutBool( true );
84 void SbRtl_ATTR_NORMAL(StarBASIC
*, SbxArray
& rPar
, bool)
86 rPar
.Get(0)->PutInteger(0);
88 void SbRtl_ATTR_READONLY(StarBASIC
*, SbxArray
& rPar
, bool)
90 rPar
.Get(0)->PutInteger(1);
92 void SbRtl_ATTR_HIDDEN(StarBASIC
*, SbxArray
& rPar
, bool)
94 rPar
.Get(0)->PutInteger(2);
96 void SbRtl_ATTR_SYSTEM(StarBASIC
*, SbxArray
& rPar
, bool)
98 rPar
.Get(0)->PutInteger(4);
100 void SbRtl_ATTR_VOLUME(StarBASIC
*, SbxArray
& rPar
, bool)
102 rPar
.Get(0)->PutInteger(8);
104 void SbRtl_ATTR_DIRECTORY(StarBASIC
*, SbxArray
& rPar
, bool)
106 rPar
.Get(0)->PutInteger(16);
108 void SbRtl_ATTR_ARCHIVE(StarBASIC
*, SbxArray
& rPar
, bool)
110 rPar
.Get(0)->PutInteger(32);
113 void SbRtl_V_EMPTY(StarBASIC
*, SbxArray
& rPar
, bool)
115 rPar
.Get(0)->PutInteger(0);
117 void SbRtl_V_NULL(StarBASIC
*, SbxArray
& rPar
, bool)
119 rPar
.Get(0)->PutInteger(1);
121 void SbRtl_V_INTEGER(StarBASIC
*, SbxArray
& rPar
, bool)
123 rPar
.Get(0)->PutInteger(2);
125 void SbRtl_V_LONG(StarBASIC
*, SbxArray
& rPar
, bool)
127 rPar
.Get(0)->PutInteger(3);
129 void SbRtl_V_SINGLE(StarBASIC
*, SbxArray
& rPar
, bool)
131 rPar
.Get(0)->PutInteger(4);
133 void SbRtl_V_DOUBLE(StarBASIC
*, SbxArray
& rPar
, bool)
135 rPar
.Get(0)->PutInteger(5);
137 void SbRtl_V_CURRENCY(StarBASIC
*, SbxArray
& rPar
, bool)
139 rPar
.Get(0)->PutInteger(6);
141 void SbRtl_V_DATE(StarBASIC
*, SbxArray
& rPar
, bool)
143 rPar
.Get(0)->PutInteger(7);
145 void SbRtl_V_STRING(StarBASIC
*, SbxArray
& rPar
, bool)
147 rPar
.Get(0)->PutInteger(8);
150 void SbRtl_MB_OK(StarBASIC
*, SbxArray
& rPar
, bool)
152 rPar
.Get(0)->PutInteger(0);
154 void SbRtl_MB_OKCANCEL(StarBASIC
*, SbxArray
& rPar
, bool)
156 rPar
.Get(0)->PutInteger(1);
158 void SbRtl_MB_ABORTRETRYIGNORE(StarBASIC
*, SbxArray
& rPar
, bool)
160 rPar
.Get(0)->PutInteger(2);
162 void SbRtl_MB_YESNOCANCEL(StarBASIC
*, SbxArray
& rPar
, bool)
164 rPar
.Get(0)->PutInteger(3);
166 void SbRtl_MB_YESNO(StarBASIC
*, SbxArray
& rPar
, bool)
168 rPar
.Get(0)->PutInteger(4);
170 void SbRtl_MB_RETRYCANCEL(StarBASIC
*, SbxArray
& rPar
, bool)
172 rPar
.Get(0)->PutInteger(5);
174 void SbRtl_MB_ICONSTOP(StarBASIC
*, SbxArray
& rPar
, bool)
176 rPar
.Get(0)->PutInteger(16);
178 void SbRtl_MB_ICONQUESTION(StarBASIC
*, SbxArray
& rPar
, bool)
180 rPar
.Get(0)->PutInteger(32);
182 void SbRtl_MB_ICONEXCLAMATION(StarBASIC
*, SbxArray
& rPar
, bool)
184 rPar
.Get(0)->PutInteger(48);
186 void SbRtl_MB_ICONINFORMATION(StarBASIC
*, SbxArray
& rPar
, bool)
188 rPar
.Get(0)->PutInteger(64);
190 void SbRtl_MB_DEFBUTTON1(StarBASIC
*, SbxArray
& rPar
, bool)
192 rPar
.Get(0)->PutInteger(0);
194 void SbRtl_MB_DEFBUTTON2(StarBASIC
*, SbxArray
& rPar
, bool)
196 rPar
.Get(0)->PutInteger(256);
198 void SbRtl_MB_DEFBUTTON3(StarBASIC
*, SbxArray
& rPar
, bool)
200 rPar
.Get(0)->PutInteger(512);
202 void SbRtl_MB_APPLMODAL(StarBASIC
*, SbxArray
& rPar
, bool)
204 rPar
.Get(0)->PutInteger(0);
206 void SbRtl_MB_SYSTEMMODAL(StarBASIC
*, SbxArray
& rPar
, bool)
208 rPar
.Get(0)->PutInteger(4096);
211 void SbRtl_IDOK(StarBASIC
*, SbxArray
& rPar
, bool)
213 rPar
.Get(0)->PutInteger(1);
216 void SbRtl_IDCANCEL(StarBASIC
*, SbxArray
& rPar
, bool)
218 rPar
.Get(0)->PutInteger(2);
220 void SbRtl_IDABORT(StarBASIC
*, SbxArray
& rPar
, bool)
222 rPar
.Get(0)->PutInteger(3);
224 void SbRtl_IDRETRY(StarBASIC
*, SbxArray
& rPar
, bool)
226 rPar
.Get(0)->PutInteger(4);
228 void SbRtl_IDYES(StarBASIC
*, SbxArray
& rPar
, bool)
230 rPar
.Get(0)->PutInteger(6);
232 void SbRtl_IDNO(StarBASIC
*, SbxArray
& rPar
, bool)
234 rPar
.Get(0)->PutInteger(7);
237 void SbRtl_CF_TEXT(StarBASIC
*, SbxArray
& rPar
, bool)
239 rPar
.Get(0)->PutInteger(1);
241 void SbRtl_CF_BITMAP(StarBASIC
*, SbxArray
& rPar
, bool)
243 rPar
.Get(0)->PutInteger(2);
245 void SbRtl_CF_METAFILEPICT(StarBASIC
*, SbxArray
& rPar
, bool)
247 rPar
.Get(0)->PutInteger(3);
250 void SbRtl_TYP_AUTHORFLD(StarBASIC
*, SbxArray
& rPar
, bool)
252 rPar
.Get(0)->PutInteger(7);
254 void SbRtl_TYP_CHAPTERFLD(StarBASIC
*, SbxArray
& rPar
, bool)
256 rPar
.Get(0)->PutInteger(4);
258 void SbRtl_TYP_CONDTXTFLD(StarBASIC
*, SbxArray
& rPar
, bool)
260 rPar
.Get(0)->PutInteger(27);
262 void SbRtl_TYP_DATEFLD(StarBASIC
*, SbxArray
& rPar
, bool)
264 rPar
.Get(0)->PutInteger(0);
266 void SbRtl_TYP_DBFLD(StarBASIC
*, SbxArray
& rPar
, bool)
268 rPar
.Get(0)->PutInteger(19);
270 void SbRtl_TYP_DBNAMEFLD(StarBASIC
*, SbxArray
& rPar
, bool)
272 rPar
.Get(0)->PutInteger(3);
274 void SbRtl_TYP_DBNEXTSETFLD(StarBASIC
*, SbxArray
& rPar
, bool)
276 rPar
.Get(0)->PutInteger(24);
278 void SbRtl_TYP_DBNUMSETFLD(StarBASIC
*, SbxArray
& rPar
, bool)
280 rPar
.Get(0)->PutInteger(25);
282 void SbRtl_TYP_DBSETNUMBERFLD(StarBASIC
*, SbxArray
& rPar
, bool)
284 rPar
.Get(0)->PutInteger(26);
286 void SbRtl_TYP_DDEFLD(StarBASIC
*, SbxArray
& rPar
, bool)
288 rPar
.Get(0)->PutInteger(14);
290 void SbRtl_TYP_DOCINFOFLD(StarBASIC
*, SbxArray
& rPar
, bool)
292 rPar
.Get(0)->PutInteger(18);
294 void SbRtl_TYP_DOCSTATFLD(StarBASIC
*, SbxArray
& rPar
, bool)
296 rPar
.Get(0)->PutInteger(6);
298 void SbRtl_TYP_EXTUSERFLD(StarBASIC
*, SbxArray
& rPar
, bool)
300 rPar
.Get(0)->PutInteger(30);
302 void SbRtl_TYP_FILENAMEFLD(StarBASIC
*, SbxArray
& rPar
, bool)
304 rPar
.Get(0)->PutInteger(2);
306 void SbRtl_TYP_FIXDATEFLD(StarBASIC
*, SbxArray
& rPar
, bool)
308 rPar
.Get(0)->PutInteger(31);
310 void SbRtl_TYP_FIXTIMEFLD(StarBASIC
*, SbxArray
& rPar
, bool)
312 rPar
.Get(0)->PutInteger(32);
314 void SbRtl_TYP_FORMELFLD(StarBASIC
*, SbxArray
& rPar
, bool)
316 rPar
.Get(0)->PutInteger(10);
318 void SbRtl_TYP_GETFLD(StarBASIC
*, SbxArray
& rPar
, bool)
320 rPar
.Get(0)->PutInteger(9);
322 void SbRtl_TYP_GETREFFLD(StarBASIC
*, SbxArray
& rPar
, bool)
324 rPar
.Get(0)->PutInteger(13);
326 void SbRtl_TYP_HIDDENPARAFLD(StarBASIC
*, SbxArray
& rPar
, bool)
328 rPar
.Get(0)->PutInteger(17);
330 void SbRtl_TYP_HIDDENTXTFLD(StarBASIC
*, SbxArray
& rPar
, bool)
332 rPar
.Get(0)->PutInteger(11);
334 void SbRtl_TYP_INPUTFLD(StarBASIC
*, SbxArray
& rPar
, bool)
336 rPar
.Get(0)->PutInteger(16);
338 void SbRtl_TYP_MACROFLD(StarBASIC
*, SbxArray
& rPar
, bool)
340 rPar
.Get(0)->PutInteger(15);
342 void SbRtl_TYP_NEXTPAGEFLD(StarBASIC
*, SbxArray
& rPar
, bool)
344 rPar
.Get(0)->PutInteger(28);
346 void SbRtl_TYP_PAGENUMBERFLD(StarBASIC
*, SbxArray
& rPar
, bool)
348 rPar
.Get(0)->PutInteger(5);
350 void SbRtl_TYP_POSTITFLD(StarBASIC
*, SbxArray
& rPar
, bool)
352 rPar
.Get(0)->PutInteger(21);
354 void SbRtl_TYP_PREVPAGEFLD(StarBASIC
*, SbxArray
& rPar
, bool)
356 rPar
.Get(0)->PutInteger(29);
358 void SbRtl_TYP_SEQFLD(StarBASIC
* , SbxArray
& rPar
, bool)
360 rPar
.Get(0)->PutInteger(23);
362 void SbRtl_TYP_SETFLD(StarBASIC
*, SbxArray
& rPar
, bool)
364 rPar
.Get(0)->PutInteger(8);
366 void SbRtl_TYP_SETINPFLD(StarBASIC
*, SbxArray
& rPar
, bool)
368 rPar
.Get(0)->PutInteger(33);
370 void SbRtl_TYP_SETREFFLD(StarBASIC
*, SbxArray
& rPar
, bool)
372 rPar
.Get(0)->PutInteger(12);
374 void SbRtl_TYP_TEMPLNAMEFLD(StarBASIC
*, SbxArray
& rPar
, bool)
376 rPar
.Get(0)->PutInteger(22);
378 void SbRtl_TYP_TIMEFLD(StarBASIC
*, SbxArray
& rPar
, bool)
380 rPar
.Get(0)->PutInteger(1);
382 void SbRtl_TYP_USERFLD(StarBASIC
*, SbxArray
& rPar
, bool)
384 rPar
.Get(0)->PutInteger(20);
386 void SbRtl_TYP_USRINPFLD(StarBASIC
*, SbxArray
& rPar
, bool)
388 rPar
.Get(0)->PutInteger(34);
390 void SbRtl_TYP_SETREFPAGEFLD(StarBASIC
*, SbxArray
& rPar
, bool)
392 rPar
.Get(0)->PutInteger(35);
394 void SbRtl_TYP_GETREFPAGEFLD(StarBASIC
*, SbxArray
& rPar
, bool)
396 rPar
.Get(0)->PutInteger(36);
398 void SbRtl_TYP_INTERNETFLD(StarBASIC
*, SbxArray
& rPar
, bool)
400 rPar
.Get(0)->PutInteger(37);
403 void SbRtl_SET_ON(StarBASIC
*, SbxArray
& rPar
, bool)
405 rPar
.Get(0)->PutInteger(1);
407 void SbRtl_SET_OFF(StarBASIC
*, SbxArray
& rPar
, bool)
409 rPar
.Get(0)->PutInteger(0);
411 void SbRtl_TOGGLE(StarBASIC
*, SbxArray
& rPar
, bool)
413 rPar
.Get(0)->PutInteger(2);
416 void SbRtl_FRAMEANCHORPAGE(StarBASIC
*, SbxArray
& rPar
, bool)
418 rPar
.Get(0)->PutInteger(1);
420 void SbRtl_FRAMEANCHORPARA(StarBASIC
*, SbxArray
& rPar
, bool)
422 rPar
.Get(0)->PutInteger(14);
424 void SbRtl_FRAMEANCHORCHAR(StarBASIC
*, SbxArray
& rPar
, bool)
426 rPar
.Get(0)->PutInteger(15);
429 void SbRtl_CLEAR_ALLTABS(StarBASIC
*, SbxArray
& rPar
, bool)
431 rPar
.Get(0)->PutInteger(2);
433 void SbRtl_CLEAR_TAB(StarBASIC
*, SbxArray
& rPar
, bool)
435 rPar
.Get(0)->PutInteger(1);
437 void SbRtl_SET_TAB(StarBASIC
*, SbxArray
& rPar
, bool)
439 rPar
.Get(0)->PutInteger(0);
442 void SbRtl_TYP_JUMPEDITFLD(StarBASIC
*, SbxArray
& rPar
, bool)
444 rPar
.Get(0)->PutInteger(38);
448 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */