Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/basic/source/inc/runtime.hxx
Line
Count
Source
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
#pragma once
21
22
#include <basic/sberrors.hxx>
23
#include <basic/sbmeth.hxx>
24
#include <basic/sbstar.hxx>
25
#include <basic/sbx.hxx>
26
27
#include <rtl/ustring.hxx>
28
#include <com/sun/star/uno/Sequence.hxx>
29
#include <osl/file.hxx>
30
#include <i18nlangtag/lang.h>
31
32
#include <cmath>
33
#include <vector>
34
#include <memory>
35
#include <optional>
36
#include <com/sun/star/lang/XComponent.hpp>
37
#include <com/sun/star/container/XEnumeration.hpp>
38
#include <com/sun/star/container/XIndexAccess.hpp>
39
#include <unotools/localedatawrapper.hxx>
40
#include <o3tl/deleter.hxx>
41
#include <tools/wldcrd.hxx>
42
43
class SbiRuntime;                   // active StarBASIC procedure instance
44
45
struct SbiArgv;                     // Argv stack element
46
struct SbiGosub;                    // GOSUB stack element
47
class  SbiImage;                    // Code-Image
48
class  SbiIoSystem;
49
class  SbiDdeControl;
50
class  SbiDllMgr;
51
class  SvNumberFormatter;           // time/date functions
52
enum class SbiImageFlags;
53
54
enum class ForType {
55
    To,
56
    EachArray,
57
    EachCollection,
58
    EachXEnumeration,
59
    EachXIndexAccess,
60
    Error,
61
};
62
63
struct SbiForStack {                // for/next stack:
64
    SbiForStack*    pNext;          // Chain
65
    SbxVariableRef  refVar;         // loop variable
66
    SbxVariableRef  refEnd;         // end expression / for each: Array/BasicCollection object
67
    SbxVariableRef  refInc;         // increment expression
68
69
    // For each support
70
    ForType             eForType;
71
    sal_Int32           nCurCollectionIndex;
72
    std::unique_ptr<sal_Int32[]>
73
                        pArrayCurIndices;
74
    std::unique_ptr<sal_Int32[]>
75
                        pArrayLowerBounds;
76
    std::unique_ptr<sal_Int32[]>
77
                        pArrayUpperBounds;
78
    css::uno::Reference< css::container::XEnumeration > xEnumeration;
79
    css::uno::Reference<css::container::XIndexAccess> xIndexAccess;
80
81
    SbiForStack()
82
        : pNext(nullptr)
83
        , eForType(ForType::To)
84
        , nCurCollectionIndex(0)
85
0
    {}
86
};
87
88
constexpr size_t MAXRECURSION = 500; //to prevent dead-recursions
89
90
// Related to: Dir, GetAttr, SetAttr
91
namespace SbAttributes
92
{
93
constexpr sal_Int16 NORMAL    = 0x0000;
94
constexpr sal_Int16 READONLY  = 0x0001;
95
constexpr sal_Int16 HIDDEN    = 0x0002;
96
constexpr sal_Int16 SYSTEM    = 0x0004;
97
constexpr sal_Int16 VOLUME    = 0x0008;
98
constexpr sal_Int16 DIRECTORY = 0x0010;
99
constexpr sal_Int16 ARCHIVE   = 0x0020;
100
}
101
102
// Related to: MsgBox (Buttons argument)
103
namespace SbMB
104
{
105
constexpr sal_Int16 OK = 0;
106
constexpr sal_Int16 OKCANCEL = 1;
107
constexpr sal_Int16 ABORTRETRYIGNORE = 2;
108
constexpr sal_Int16 YESNOCANCEL = 3;
109
constexpr sal_Int16 YESNO = 4;
110
constexpr sal_Int16 RETRYCANCEL = 5;
111
constexpr sal_Int16 ICONSTOP = 16;
112
constexpr sal_Int16 ICONQUESTION = 32;
113
constexpr sal_Int16 ICONEXCLAMATION = 48;
114
constexpr sal_Int16 ICONINFORMATION = 64;
115
constexpr sal_Int16 DEFBUTTON1 = 0;
116
constexpr sal_Int16 DEFBUTTON2 = 256;
117
constexpr sal_Int16 DEFBUTTON3 = 512;
118
constexpr sal_Int16 APPLMODAL = 0;
119
constexpr sal_Int16 SYSTEMMODAL = 4096;
120
121
// Related to: MsgBox (return value)
122
namespace Response
123
{
124
constexpr sal_Int16 OK = 1;
125
constexpr sal_Int16 CANCEL = 2;
126
constexpr sal_Int16 ABORT = 3;
127
constexpr sal_Int16 RETRY = 4;
128
constexpr sal_Int16 IGNORE = 5;
129
constexpr sal_Int16 YES = 6;
130
constexpr sal_Int16 NO = 7;
131
}
132
}
133
134
// Related to: SwFieldTypesEnum in sw/inc/fldbas.hxx
135
namespace SbTYP
136
{
137
constexpr sal_Int16 DATE = 0;
138
constexpr sal_Int16 TIME = 1;
139
constexpr sal_Int16 FILENAME = 2;
140
constexpr sal_Int16 DATABASENAME = 3;
141
constexpr sal_Int16 CHAPTER = 4;
142
constexpr sal_Int16 PAGENUMBER = 5;
143
constexpr sal_Int16 DOCUMENTSTATISTICS = 6;
144
constexpr sal_Int16 AUTHOR = 7;
145
constexpr sal_Int16 SET = 8;
146
constexpr sal_Int16 GET = 9;
147
constexpr sal_Int16 FORMEL = 10;
148
constexpr sal_Int16 HIDDENTEXT = 11;
149
constexpr sal_Int16 SETREF = 12;
150
constexpr sal_Int16 GETREF = 13;
151
constexpr sal_Int16 DDE = 14;
152
constexpr sal_Int16 MACRO = 15;
153
constexpr sal_Int16 INPUT = 16;
154
constexpr sal_Int16 HIDDENPARAGRAPH = 17;
155
constexpr sal_Int16 DOCUMENTINFO = 18;
156
constexpr sal_Int16 DATABASE = 19;
157
constexpr sal_Int16 USER = 20;
158
constexpr sal_Int16 POSTIT = 21;
159
constexpr sal_Int16 TEMPLATENAME = 22;
160
constexpr sal_Int16 SEQUENCE = 23;
161
constexpr sal_Int16 DATABASENEXTSET = 24;
162
constexpr sal_Int16 DATABASENUMBERSET = 25;
163
constexpr sal_Int16 DATABASESETNUMBER = 26;
164
constexpr sal_Int16 CONDITIONALTEXT = 27;
165
constexpr sal_Int16 NEXTPAGE = 28;
166
constexpr sal_Int16 PREVIOUSPAGE = 29;
167
constexpr sal_Int16 EXTENDEDUSER = 30;
168
constexpr sal_Int16 FIXEDDATE = 31;
169
constexpr sal_Int16 FIXEDTIME = 32;
170
constexpr sal_Int16 SETINPUT = 33;
171
constexpr sal_Int16 USERINPUT = 34;
172
constexpr sal_Int16 SETREFPAGE = 35;
173
constexpr sal_Int16 GETREFPAGE = 36;
174
constexpr sal_Int16 INTERNET = 37;
175
constexpr sal_Int16 JUMPEDIT = 38;
176
}
177
178
class SbiRTLData
179
{
180
public:
181
182
    std::unique_ptr<osl::Directory> pDir;
183
    sal_Int16 nDirFlags;
184
    short   nCurDirPos;
185
186
    OUString sFullNameToBeChecked;
187
    std::optional<WildCard> moWildCard;
188
189
    css::uno::Sequence< OUString > aDirSeq;
190
191
    SbiRTLData();
192
    ~SbiRTLData();
193
};
194
195
// The instance matches a running StarBASIC. Many basics running at the same
196
// time are managed by chained instances. There is all the data that only lives
197
// when the BASIC is living too, like the I/O-system.
198
199
typedef std::vector< css::uno::Reference< css::lang::XComponent > > ComponentVector_t;
200
201
202
class SbiInstance
203
{
204
    friend class SbiRuntime;
205
206
    SbiRTLData      aRTLData;
207
208
    // file system
209
    std::unique_ptr<SbiIoSystem, o3tl::default_delete<SbiIoSystem>> pIosys;
210
    // DDE
211
    std::unique_ptr<SbiDdeControl>    pDdeCtrl;
212
    // DLL-Calls (DECLARE)
213
    std::unique_ptr<SbiDllMgr>        pDllMgr;
214
    std::shared_ptr<SvNumberFormatter> pNumberFormatter;
215
    StarBASIC*      pBasic;
216
    LanguageType    meFormatterLangType;
217
    DateOrder       meFormatterDateOrder;
218
    sal_uInt32      nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx;
219
220
    ErrCode         nErr;
221
    OUString        aErrorMsg;      // last error message for $ARG
222
    sal_Int32       nErl;           // current error line
223
    bool        bReschedule;    // Flag: sal_True = Reschedule in main loop
224
    bool        bCompatibility; // Flag: sal_True = VBA runtime compatibility mode
225
226
    ComponentVector_t ComponentVector;
227
public:
228
    SbiRuntime*  pRun;              // Call-Stack
229
230
    // #31460 new concept for StepInto/Over/Out,
231
    // explanation see runtime.cxx at SbiInstance::CalcBreakCallLevel()
232
    sal_uInt16  nCallLvl;
233
    sal_uInt16  nBreakCallLvl;
234
    void    CalcBreakCallLevel( BasicDebugFlags nFlags );
235
236
    SbiInstance( StarBASIC* );
237
   ~SbiInstance();
238
239
    void Error( ErrCode );                      // trappable Error
240
    void Error( ErrCode, const OUString& rMsg );  // trappable Error with message
241
    void ErrorVB( sal_Int32 nVBNumber, const OUString& rMsg );
242
    void setErrorVB( sal_Int32 nVBNumber );
243
    void FatalError( ErrCode );                 // non-trappable Error
244
    void FatalError( ErrCode, const OUString& );  // non-trappable Error
245
    void Abort();                               // with current error code
246
247
    void    Stop();
248
0
    ErrCode const & GetErr() const       { return nErr; }
249
0
    const OUString& GetErrorMsg() const  { return aErrorMsg; }
250
0
    sal_Int32 GetErl() const             { return nErl; }
251
0
    void    EnableReschedule( bool bEnable ) { bReschedule = bEnable; }
252
0
    bool    IsReschedule() const { return bReschedule; }
253
0
    void    EnableCompatibility( bool bEnable ) { bCompatibility = bEnable; }
254
0
    bool    IsCompatibility() const { return bCompatibility; }
255
256
0
    ComponentVector_t& getComponentVector()  { return ComponentVector; }
257
258
    SbMethod* GetCaller( sal_uInt16 );
259
    SbModule* GetActiveModule();
260
261
0
    SbiIoSystem* GetIoSystem() { return pIosys.get(); }
262
0
    SbiDdeControl* GetDdeControl() { return pDdeCtrl.get(); }
263
0
    StarBASIC* GetBasic() { return pBasic; }
264
    SbiDllMgr* GetDllMgr();
265
0
    SbiRTLData& GetRTLData() { return aRTLData; }
266
267
    std::shared_ptr<SvNumberFormatter> const & GetNumberFormatter();
268
0
    sal_uInt32 GetStdDateIdx() const { return nStdDateIdx; }
269
0
    sal_uInt32 GetStdTimeIdx() const { return nStdTimeIdx; }
270
0
    sal_uInt32 GetStdDateTimeIdx() const { return nStdDateTimeIdx; }
271
272
    // offer NumberFormatter also static
273
    static std::shared_ptr<SvNumberFormatter> PrepareNumberFormatter( sal_uInt32 &rnStdDateIdx,
274
        sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx,
275
        LanguageType const * peFormatterLangType=nullptr, DateOrder const * peFormatterDateOrder=nullptr );
276
};
277
278
// There's one instance of this class for every executed sub-program.
279
// This instance is the heart of the BASIC-machine and contains only local data.
280
281
class SbiRuntime
282
{
283
    friend void SbRtl_CallByName( StarBASIC* pBasic, SbxArray& rPar, bool bWrite );
284
285
    typedef void( SbiRuntime::*pStep0 )();
286
    typedef void( SbiRuntime::*pStep1 )( sal_uInt32 nOp1 );
287
    typedef void( SbiRuntime::*pStep2 )( sal_uInt32 nOp1, sal_uInt32 nOp2 );
288
    static const pStep0 aStep0[];         // opcode-table group 0
289
    static const pStep1 aStep1[];
290
    static const pStep2 aStep2[];
291
292
    StarBASIC&         rBasic;           // StarBASIC instance
293
    SbiInstance*       pInst;            // current thread
294
    SbModule*          pMod;             // current module
295
    SbMethod*          pMeth;            // method instance
296
    SbiIoSystem*       pIosys;           // I/O-System
297
    const SbiImage*    pImg;             // Code-Image
298
    SbxArrayRef        refExprStk;       // expression stack
299
    SbxArrayRef        refCaseStk;       // CASE expression stack
300
    SbxArrayRef        refRedimpArray;   // Array saved to use for REDIM PRESERVE
301
    SbxVariableRef     refRedim;         // Array saved to use for REDIM
302
    SbxVariableRef     xDummyVar;        // substitute for variables that weren't found
303
    SbxVariable*       mpExtCaller = nullptr; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
304
    SbiForStack*       pForStk = nullptr; // FOR/NEXT-Stack
305
    sal_uInt16         nExprLvl = 0;     // depth of the expr-stack
306
    sal_uInt16         nForLvl = 0;      // #118235: Maintain for level
307
    const sal_uInt8*   pCode;            // current Code-Pointer
308
    const sal_uInt8*   pStmnt;           // beginning of the last statement
309
    const sal_uInt8*   pError = nullptr; // address of the current error handler
310
    const sal_uInt8*   pRestart = nullptr; // restart-address
311
    const sal_uInt8*   pErrCode = nullptr; // restart-address RESUME NEXT
312
    const sal_uInt8*   pErrStmnt = nullptr; // restart-address RESUME 0
313
    OUString           aLibName;         // Lib-name for declare-call
314
    SbxArrayRef        refParams;        // current procedure parameters
315
    SbxArrayRef        refLocals;        // local variable
316
    SbxArrayRef        refArgv;
317
    // #74254, one refSaveObj is not enough! new: pRefSaveList (see above)
318
    short              nArgc = 0;
319
    bool               bRun = true;
320
    bool               bError = true;    // true: handle errors
321
    bool               bInError = false; // true: in an error handler
322
    bool               bBlocked = false; // true: blocked by next call level, #i48868
323
    bool               bVBAEnabled;
324
    BasicDebugFlags    nFlags;           // Debugging-Flags
325
    ErrCode            nError = ERRCODE_NONE;
326
    sal_uInt16         nOps = 0;         // opcode counter
327
328
    std::vector<SbxVariableRef>  aRefSaved; // #74254 save temporary references
329
    std::vector<SbiGosub>   pGosubStk;      // GOSUB stack
330
    std::vector<SbiArgv>    pArgvStk;       // ARGV-Stack
331
332
333
    SbxVariable* FindElement
334
    ( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, ErrCode, bool bLocal, bool bStatic = false );
335
    void SetupArgs( SbxVariable*, sal_uInt32 );
336
    SbxVariable* CheckArray( SbxVariable* );
337
338
    void PushVar( SbxVariable* );
339
    SbxVariableRef PopVar();
340
    SbxVariable* GetTOS();
341
    void TOSMakeTemp();
342
    void ClearExprStack();
343
344
    void PushGosub( const sal_uInt8* );
345
    void PopGosub();
346
347
    void PushArgv();
348
    void PopArgv();
349
    void ClearArgvStack();
350
351
    void PushFor();
352
    void PushForEach();
353
    void PopFor();
354
    void ClearForStack();
355
356
    void StepArith( SbxOperator );
357
    void StepUnary( SbxOperator );
358
    void StepCompare( SbxOperator );
359
360
    void SetParameters( SbxArray* );
361
362
    // HAS TO BE IMPLEMENTED SOME TIME
363
    void DllCall( std::u16string_view, std::u16string_view, SbxArray*, SbxDataType, bool );
364
365
    // #56204 swap out DIM-functionality into help method (step0.cxx)
366
    void DimImpl(const SbxVariableRef& refVar);
367
    bool EvaluateTopOfStackAsBool();
368
369
    static bool implIsClass( SbxObject const * pObj, const OUString& aClass );
370
371
    void StepSETCLASS_impl( sal_uInt32 nOp1, bool bHandleDflt );
372
373
    // the following routines are called by the single
374
    // stepper and implement the single opcodes
375
    void StepNOP(),     StepEXP(),      StepMUL(),      StepDIV();
376
    void StepMOD(),     StepPLUS(),     StepMINUS(),    StepNEG();
377
    void StepEQ(),      StepNE(),       StepLT(),       StepGT();
378
    void StepLE(),      StepGE(),       StepIDIV(),     StepAND();
379
    void StepOR(),      StepXOR(),      StepEQV(),      StepIMP();
380
    void StepNOT(),     StepCAT(),      StepLIKE(),     StepIS();
381
    void StepARGC();
382
    void StepARGV(),    StepINPUT(),    StepLINPUT(),   StepSTOP();
383
    void StepGET(),     StepSET(),  StepVBASET(),   StepPUT(),      StepPUTC();
384
    void StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bDefaultHandling = false );
385
    void StepDIM(),     StepREDIM(),    StepREDIMP(),   StepERASE();
386
    void StepINITFOR(), StepNEXT(),     StepERROR(),    StepINITFOREACH();
387
    void StepCASE(),    StepENDCASE(),  StepSTDERROR();
388
    void StepNOERROR(), StepCHANNEL(),  StepCHANNEL0(), StepPRINT();
389
    void StepPRINTF(),  StepWRITE(),    StepRENAME(),   StepPROMPT();
390
    void StepRESTART(), StepEMPTY(),    StepLEAVE();
391
    void StepLSET(),    StepRSET(),     StepREDIMP_ERASE(),     StepERASE_CLEAR();
392
    void StepARRAYACCESS(), StepBYVAL();
393
    // all opcodes with one operand
394
    void StepLOADNC( sal_uInt32 ),  StepLOADSC( sal_uInt32 ),   StepLOADI( sal_uInt32 );
395
    void StepARGN( sal_uInt32 ),    StepBASED( sal_uInt32 ),    StepPAD( sal_uInt32 );
396
    void StepJUMP( sal_uInt32 ),    StepJUMPT( sal_uInt32 );
397
    void StepJUMPF( sal_uInt32 ),   StepONJUMP( sal_uInt32 );
398
    void StepGOSUB( sal_uInt32 ),   StepRETURN( sal_uInt32 );
399
    void StepTESTFOR( sal_uInt32 ), StepCASETO( sal_uInt32 ),   StepERRHDL( sal_uInt32 );
400
    void StepRESUME( sal_uInt32 ),  StepSETCLASS( sal_uInt32 ), StepVBASETCLASS( sal_uInt32 ),  StepTESTCLASS( sal_uInt32 ), StepLIB( sal_uInt32 );
401
    bool checkClass_Impl( const SbxVariableRef& refVal, const OUString& aClass, bool bRaiseErrors, bool bDefault );
402
    void StepCLOSE( sal_uInt32 ),   StepPRCHAR( sal_uInt32 ),   StepARGTYP( sal_uInt32 );
403
    // all opcodes with two operands
404
    void StepRTL( sal_uInt32, sal_uInt32 ),     StepPUBLIC( sal_uInt32, sal_uInt32 ),   StepPUBLIC_P( sal_uInt32, sal_uInt32 );
405
    void StepPUBLIC_Impl( sal_uInt32, sal_uInt32, bool bUsedForClassModule );
406
    void StepFIND_Impl( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, ErrCode, bool bStatic = false );
407
    void StepFIND( sal_uInt32, sal_uInt32 ),    StepELEM( sal_uInt32, sal_uInt32 );
408
    void StepGLOBAL( sal_uInt32, sal_uInt32 ),  StepLOCAL( sal_uInt32, sal_uInt32 );
409
    void StepPARAM( sal_uInt32, sal_uInt32),    StepCREATE( sal_uInt32, sal_uInt32 );
410
    void StepCALL( sal_uInt32, sal_uInt32 ),    StepCALLC( sal_uInt32, sal_uInt32 );
411
    void StepCASEIS( sal_uInt32, sal_uInt32 ),  StepSTMNT( sal_uInt32, sal_uInt32 );
412
    SbxVariable* StepSTATIC_Impl(
413
        OUString const & aName, SbxDataType t, sal_uInt32 nOp2 );
414
    void StepOPEN( sal_uInt32, sal_uInt32 ),    StepSTATIC( sal_uInt32, sal_uInt32 );
415
    void StepTCREATE(sal_uInt32,sal_uInt32),    StepDCREATE(sal_uInt32,sal_uInt32);
416
    void StepGLOBAL_P( sal_uInt32, sal_uInt32 ),StepFIND_G( sal_uInt32, sal_uInt32 );
417
    void StepDCREATE_REDIMP(sal_uInt32,sal_uInt32), StepDCREATE_IMPL(sal_uInt32,sal_uInt32);
418
    void StepFIND_CM( sal_uInt32, sal_uInt32 );
419
    void StepFIND_STATIC( sal_uInt32, sal_uInt32 );
420
    static void implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt32 nOp2 );
421
public:
422
    void          SetVBAEnabled( bool bEnabled );
423
    bool          IsImageFlag( SbiImageFlags n ) const;
424
    sal_uInt16      GetBase() const;
425
    sal_Int32  nLine = 0, nCol1 = 0, nCol2 = 0;
426
    SbiRuntime* pNext = nullptr; // Stack-Chain
427
428
    // tdf#79426, tdf#125180 - adds the information about a missing parameter
429
    static void SetIsMissing( SbxVariable* );
430
    // tdf#79426, tdf#125180 - checks if a variable contains the information about a missing parameter
431
    static bool IsMissing( SbxVariable*, sal_uInt16 );
432
433
    SbiRuntime( SbModule*, SbMethod*, sal_uInt32 );
434
   ~SbiRuntime();
435
    void Error( ErrCode, bool bVBATranslationAlreadyDone = false );     // set error if != 0
436
    void Error( ErrCode, const OUString& );       // set error if != 0
437
    void FatalError( ErrCode );                 // error handling = standard, set error
438
    void FatalError( ErrCode, const OUString& );  // error handling = standard, set error
439
    static sal_Int32 translateErrorToVba( ErrCode nError, OUString& rMsg );
440
    bool Step();                    // single step (one opcode)
441
0
    void Stop()            { bRun = false;   }
442
0
    void block()     { bBlocked = true; }
443
0
    void unblock()   { bBlocked = false; }
444
0
    SbModule* GetModule()  { return pMod;    }
445
0
    BasicDebugFlags GetDebugFlags() const { return nFlags;  }
446
0
    void SetDebugFlags( BasicDebugFlags nFl ) { nFlags = nFl;  }
447
0
    SbMethod* GetCaller() { return pMeth;}
448
0
    SbxVariable* GetExternalCaller(){ return mpExtCaller; }
449
450
    SbiForStack* FindForStackItemForCollection( class BasicCollection const * pCollection );
451
452
    SbxBase* FindElementExtern( const OUString& rName );
453
    static bool isVBAEnabled();
454
455
};
456
457
inline void checkArithmeticOverflow( double d )
458
0
{
459
0
    if( !std::isfinite( d ) )
460
0
        StarBASIC::Error( ERRCODE_BASIC_MATH_OVERFLOW );
461
0
}
462
463
inline void checkArithmeticOverflow( SbxVariable const * pVar )
464
0
{
465
0
    if( pVar->GetType() == SbxDOUBLE )
466
0
    {
467
0
        double d = pVar->GetDouble();
468
0
        checkArithmeticOverflow( d );
469
0
    }
470
0
}
471
472
473
StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic );
474
475
// Returns true if UNO is available, otherwise the old
476
// file system implementation has to be used
477
// (Implemented in iosys.cxx)
478
bool hasUno();
479
480
// Converts possibly relative paths to absolute paths
481
// according to the setting done by ChDir/ChDrive
482
// (Implemented in methods.cxx)
483
OUString getFullPath( const OUString& aRelPath );
484
485
// Implementation of StepRENAME with UCB
486
// (Implemented in methods.cxx, so step0.cxx
487
// has not to be infected with UNO)
488
void implStepRenameUCB( const OUString& aSource, const OUString& aDest );
489
490
void implStepRenameOSL( const OUString& aSource, const OUString& aDest );
491
bool IsBaseIndexOne();
492
493
void removeDimAsNewRecoverItem( SbxVariable* pVar );
494
495
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */