summaryrefslogtreecommitdiff
path: root/basic/inc/basic/sbstar.hxx
blob: b9b52773f023974b10543975c9378ceac7f907b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

#ifndef _SB_SBSTAR_HXX
#define _SB_SBSTAR_HXX

#include <basic/sbx.hxx>
#include <basic/sbxobj.hxx>
#include <rtl/ustring.hxx>
#include <osl/mutex.hxx>

#include <basic/sbdef.hxx>
#include <basic/sberrors.hxx>
#include <com/sun/star/script/ModuleInfo.hpp>
#include <com/sun/star/frame/XModel.hpp>

class SbModule;                     // completed module
class SbiInstance;                  // runtime instance
class SbiRuntime;                   // currently running procedure
class SbiImage;                     // compiled image
class BasicLibInfo;                 // info block for basic manager
class SbTextPortions;
class SbMethod;
class BasicManager;

class StarBASICImpl;

class StarBASIC : public SbxObject
{
    friend class SbiScanner;
    friend class SbiExpression; // Access to RTL
    friend class SbiInstance;
    friend class SbiRuntime;

    StarBASICImpl*	mpStarBASICImpl;

    SbxArrayRef		pModules;               // List of all modules
    SbxObjectRef	pRtl;				// Runtime Library
    SbxArrayRef		xUnoListeners;          // Listener handled by CreateUnoListener
    
   // Handler-Support:
    Link			aErrorHdl;              // Error handler
    Link			aBreakHdl;              // Breakpoint handler
    BOOL			bNoRtl;                 // if TRUE: do not search RTL
    BOOL			bBreak;                 // if TRUE: Break, otherwise Step
    BOOL			bDocBasic;
    BOOL			bVBAEnabled;
    BasicLibInfo*	pLibInfo;			// Info block for basic manager
    SbLanguageMode	eLanguageMode;		// LanguageMode of the basic object
    BOOL			bQuit;

    SbxObjectRef pVBAGlobals; 
    SbxObject* getVBAGlobals( );

    void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic );

protected:
    BOOL 			CError( SbError, const String&, xub_StrLen, xub_StrLen, xub_StrLen );
private:
    BOOL 			RTError( SbError, xub_StrLen, xub_StrLen, xub_StrLen );
    BOOL 			RTError( SbError, const String& rMsg, xub_StrLen, xub_StrLen, xub_StrLen );
    USHORT 			BreakPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 );
    USHORT 			StepPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 );
    virtual BOOL LoadData( SvStream&, USHORT );
    virtual BOOL StoreData( SvStream& ) const;

protected:

    virtual	BOOL  	ErrorHdl();
    virtual	USHORT	BreakHdl();
    virtual ~StarBASIC();

public:

    SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASIC,1);
    TYPEINFO();

    StarBASIC( StarBASIC* pParent = NULL, BOOL bIsDocBasic = FALSE );

    // #51727 SetModified overridden so that the Modfied-State is
        // not delivered to Parent.
    virtual void SetModified( BOOL );

    void* operator 	new( size_t );
    void operator 	delete( void* );

    virtual void    Insert( SbxVariable* );
    using SbxObject::Remove;
    virtual void    Remove( SbxVariable* );
    virtual void	Clear();

    BasicLibInfo*	GetLibInfo()					{ return pLibInfo;	}
    void			SetLibInfo( BasicLibInfo* p )   { pLibInfo = p;		}

    // Compiler-Interface
    SbModule*   	MakeModule( const String& rName, const String& rSrc );
    SbModule*   	MakeModule32( const String& rName, const ::rtl::OUString& rSrc );
    SbModule*       MakeModule32( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, const ::rtl::OUString& rSrc );
    BOOL			Compile( SbModule* );
    BOOL 			Disassemble( SbModule*, String& rText );
    static void 	Stop();
    static void 	Error( SbError );
    static void 	Error( SbError, const String& rMsg );
    static void 	FatalError( SbError );
    static void 	FatalError( SbError, const String& rMsg );
    static BOOL 	IsRunning();
    static SbError 	GetErrBasic();
    // #66536 make additional message accessible by RTL function Error
    static String	GetErrorMsg();
    static xub_StrLen GetErl();
    // Highlighting
    void 			Highlight( const String& rSrc, SbTextPortions& rList );

    virtual SbxVariable* Find( const String&, SbxClassType );
    virtual BOOL Call( const String&, SbxArray* = NULL );

    SbxArray*		GetModules() { return pModules; }
    SbxObject*		GetRtl()	 { return pRtl;		}
    SbModule*		FindModule( const String& );
    // Run init code of all modules (including the inserted Doc-Basics)
    void			InitAllModules( StarBASIC* pBasicNotToInit = NULL );
    void			DeInitAllModules( void );
    void			ClearAllModuleVars( void );
    void			ActivateObject( const String*, BOOL );
    BOOL 			LoadOldModules( SvStream& );

    // #43011 For TestTool; deletes global vars
    void			ClearGlobalVars( void );

    // Calls for error and break handler
    static USHORT	GetLine();
    static USHORT	GetCol1();
    static USHORT	GetCol2();
    static void		SetErrorData( SbError nCode, USHORT nLine,
                                  USHORT nCol1, USHORT nCol2 );

    // Specific to error handler
    static void		MakeErrorText( SbError, const String& aMsg );
    static const	String&	GetErrorText();
    static SbError	GetErrorCode();
    static BOOL		IsCompilerError();
    static USHORT	GetVBErrorCode( SbError nError );
    static SbError	GetSfxFromVBError( USHORT nError );
    static void		SetGlobalLanguageMode( SbLanguageMode eLangMode );
    static SbLanguageMode GetGlobalLanguageMode();
    // Local settings
    void SetLanguageMode( SbLanguageMode eLangMode )
        { eLanguageMode = eLangMode; }
    SbLanguageMode GetLanguageMode();

    // Specific for break handler
    BOOL   			IsBreak() const				{ return bBreak; }

    static Link 	GetGlobalErrorHdl();
    static void 	SetGlobalErrorHdl( const Link& rNewHdl );
    Link 			GetErrorHdl() const { return aErrorHdl; }
    void 			SetErrorHdl( const Link& r ) { aErrorHdl = r; }

    static Link 	GetGlobalBreakHdl();
    static void 	SetGlobalBreakHdl( const Link& rNewHdl );
    Link 			GetBreakHdl() const { return aBreakHdl; }
    void 			SetBreakHdl( const Link& r ) { aBreakHdl = r; }

    SbxArrayRef		getUnoListeners( void );

    static SbxBase*	FindSBXInCurrentScope( const String& rName );
    static SbxVariable*	FindVarInCurrentScopy
                    ( const String& rName, USHORT& rStatus );
    static SbMethod* GetActiveMethod( USHORT nLevel = 0 );
    static SbModule* GetActiveModule();
    void SetVBAEnabled( BOOL bEnabled );
    BOOL isVBAEnabled();

    // #60175 TRUE: SFX-Resource is not displayed on basic errors
    static void StaticSuppressSfxResource( BOOL bSuppress );

    // #91147 TRUE: Reschedule is enabled (default>, FALSE: No reschedule
    static void StaticEnableReschedule( BOOL bReschedule );

    SbxObjectRef getRTL( void ) { return pRtl; }
    BOOL IsDocBasic() { return bDocBasic; }
    SbxVariable* VBAFind( const String& rName, SbxClassType t );
    bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
    void QuitAndExitApplication();
    BOOL IsQuitApplication() { return bQuit; };

    static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
        GetModelFromBasic( SbxObject* pBasic );
};

#ifndef __SB_SBSTARBASICREF_HXX
#define __SB_SBSTARBASICREF_HXX

SV_DECL_IMPL_REF(StarBASIC)

#endif

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
t'>feature/sgexperiment main, development code repositoryroot
summaryrefslogtreecommitdiff
path: root/swext
AgeCommit message (Expand)AuthorFilesLines
2014-12-10java: unused importsNoel Grandin1-1/+0
2014-12-05java: remove some unused local variablesNoel Grandin2-9/+1
2014-12-05java: remove some unused fieldsNoel Grandin1-3/+0
2014-11-18java: make fields final where possibleNoel Grandin6-13/+13
2014-11-12java: reduce excessive code indentation levelsNoel Grandin3-86/+86
2014-10-17java: final fields that can be staticNoel Grandin2-5/+5
2014-10-16java: when rethrowing, store the original exceptionNoel Grandin1-1/+1
2014-10-16java: reduce the depth of some deeply nested if blocksNoel Grandin1-25/+25
2014-09-11mediawiki: use String.length()==0 instead of String.equals(empty string)rbuj1-2/+2
2014-09-10mediawiki: use a character literalrbuj2-2/+2
2014-09-08swext: use proper syntax for accessing outer class thisMichael Stahl2-7/+7
2014-09-08missing importsCaolán McNamara1-0/+2
2014-09-08mediawiki options went missingCaolán McNamara1-0/+11
2014-09-08mediawiki: improve storeConfiguration & loadConfiguration methodsrbuj1-53/+48
2014-09-06mediawiki: if...else if...else Statementrbuj1-1/+1
2014-09-06mediawiki: use contains to check if a string contains a substringrbuj1-1/+1
2014-09-06mediawiki: the assigned value is never usedrbuj1-5/+3
2014-08-20Use COMMONS_LOGGING_VERSION vblerbuj1-1/+1
2014-08-20java: remove unnecessary constructor declarationsNoel Grandin2-10/+0
2014-08-20java: don't catch and then just rethrow an exceptionNoel Grandin1-25/+18
2014-08-19java: use 'Short.valueOf' instead of 'new Short'Noel Grandin2-2/+2
2014-08-19java: use 'Integer.valueOf' instead of 'new Integer'Noel Grandin1-4/+4
2014-08-19java: use Boolean.valueOf instead of instantiating Boolean objectsNoel Grandin5-14/+14
2014-08-19java: remove unused methodsNoel Grandin1-26/+0
2014-08-16upgrade to apache-commons-1.2Thomas Arnhold1-1/+1
2014-08-14java: remove unused importsNoel Grandin2-6/+0
2014-08-14java: remove commented out codeNoel Grandin2-5/+0
2014-08-13java: remove dead methodsNoel Grandin5-135/+4
2014-08-13java: remove unused fieldsNoel Grandin2-6/+5
2014-08-13java: reduce scope, make some methods privateNoel Grandin9-22/+22
2014-08-13java: reduce scope, make fields privateNoel Grandin1-1/+1