xref: /trunk/main/basic/source/inc/sbintern.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _SB_INTERN_HXX
29*cdf0e10cSrcweir #define _SB_INTERN_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <basic/sbxfac.hxx>
32*cdf0e10cSrcweir #include <unotools/transliterationwrapper.hxx>
33*cdf0e10cSrcweir #include "sb.hxx"
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir namespace utl
36*cdf0e10cSrcweir {
37*cdf0e10cSrcweir     class TransliterationWrapper;
38*cdf0e10cSrcweir }
39*cdf0e10cSrcweir class SbUnoFactory;
40*cdf0e10cSrcweir class SbTypeFactory;
41*cdf0e10cSrcweir class SbOLEFactory;
42*cdf0e10cSrcweir class SbFormFactory;
43*cdf0e10cSrcweir class SbiInstance;
44*cdf0e10cSrcweir class SbModule;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir class SbiFactory : public SbxFactory
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir public:
49*cdf0e10cSrcweir     virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX );
50*cdf0e10cSrcweir     virtual SbxObject* CreateObject( const String& );
51*cdf0e10cSrcweir };
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir typedef ::std::vector< String > StringVector;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir struct SbClassData
56*cdf0e10cSrcweir {
57*cdf0e10cSrcweir     SbxArrayRef     mxIfaces;
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir     // types this module depends on because of use in Dim As New <type>
60*cdf0e10cSrcweir     // needed for initialization order of class modules
61*cdf0e10cSrcweir     StringVector    maRequiredTypes;
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir     SbClassData( void );
64*cdf0e10cSrcweir     ~SbClassData( void )
65*cdf0e10cSrcweir         { clear(); }
66*cdf0e10cSrcweir     void clear( void );
67*cdf0e10cSrcweir };
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir // #115824: Factory class to create class objects (type command)
70*cdf0e10cSrcweir // Implementation: sb.cxx
71*cdf0e10cSrcweir class SbClassFactory : public SbxFactory
72*cdf0e10cSrcweir {
73*cdf0e10cSrcweir     SbxObjectRef    xClassModules;
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir public:
76*cdf0e10cSrcweir     SbClassFactory( void );
77*cdf0e10cSrcweir     virtual ~SbClassFactory();
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir     void AddClassModule( SbModule* pClassModule );
80*cdf0e10cSrcweir     void RemoveClassModule( SbModule* pClassModule );
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir     virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX );
83*cdf0e10cSrcweir     virtual SbxObject* CreateObject( const String& );
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir     SbModule* FindClass( const String& rClassName );
86*cdf0e10cSrcweir };
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir // Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette
89*cdf0e10cSrcweir class SbErrorStackEntry
90*cdf0e10cSrcweir {
91*cdf0e10cSrcweir public:
92*cdf0e10cSrcweir     SbErrorStackEntry(SbMethodRef aM, xub_StrLen nL, xub_StrLen nC1, xub_StrLen nC2)
93*cdf0e10cSrcweir         : aMethod(aM), nLine(nL), nCol1(nC1), nCol2(nC2) {}
94*cdf0e10cSrcweir     SbMethodRef aMethod;
95*cdf0e10cSrcweir     xub_StrLen nLine;
96*cdf0e10cSrcweir     xub_StrLen nCol1, nCol2;
97*cdf0e10cSrcweir };
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir SV_DECL_PTRARR_DEL(SbErrorStack, SbErrorStackEntry*, 1, 1)
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir struct SbiGlobals
104*cdf0e10cSrcweir {
105*cdf0e10cSrcweir     SbiInstance*    pInst;          // alle aktiven Runtime-Instanzen
106*cdf0e10cSrcweir     SbiFactory*     pSbFac;         // StarBASIC-Factory
107*cdf0e10cSrcweir     SbUnoFactory*   pUnoFac;        // Factory fuer Uno-Structs bei DIM AS NEW
108*cdf0e10cSrcweir     SbTypeFactory*  pTypeFac;       // Factory for user defined types
109*cdf0e10cSrcweir     SbClassFactory* pClassFac;      // Factory for user defined classes (based on class modules)
110*cdf0e10cSrcweir     SbOLEFactory*   pOLEFac;        // Factory for OLE types
111*cdf0e10cSrcweir     SbFormFactory*  pFormFac;       // Factory for user forms
112*cdf0e10cSrcweir     SbModule*       pMod;           // aktuell aktives Modul
113*cdf0e10cSrcweir     SbModule*       pCompMod;       // aktuell compiliertes Modul
114*cdf0e10cSrcweir     short           nInst;          // Anzahl BASICs
115*cdf0e10cSrcweir     Link            aErrHdl;        // globaler Error-Handler
116*cdf0e10cSrcweir     Link            aBreakHdl;      // globaler Break-Handler
117*cdf0e10cSrcweir     SbError         nCode;          // aktueller Fehlercode
118*cdf0e10cSrcweir     xub_StrLen      nLine;          // aktuelle Zeile
119*cdf0e10cSrcweir     xub_StrLen      nCol1,nCol2;    // aktuelle Spalten (von,bis)
120*cdf0e10cSrcweir     sal_Bool            bCompiler;      // Flag fuer Compiler-Error
121*cdf0e10cSrcweir     sal_Bool            bGlobalInitErr; // Beim GlobalInit trat ein Compiler-Fehler auf
122*cdf0e10cSrcweir     sal_Bool            bRunInit;       // sal_True, wenn RunInit vom Basic aktiv ist
123*cdf0e10cSrcweir     String          aErrMsg;        // Puffer fuer GetErrorText()
124*cdf0e10cSrcweir     SbLanguageMode  eLanguageMode;  // Flag fuer Visual-Basic-Script-Modus
125*cdf0e10cSrcweir     SbErrorStack*   pErrStack;      // Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette
126*cdf0e10cSrcweir     ::utl::TransliterationWrapper* pTransliterationWrapper;    // For StrComp
127*cdf0e10cSrcweir     sal_Bool            bBlockCompilerError;
128*cdf0e10cSrcweir     BasicManager*   pAppBasMgr;
129*cdf0e10cSrcweir     StarBASIC*      pMSOMacroRuntimLib; // Lib containing MSO Macro Runtime API entry symbols
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir     SbiGlobals();
132*cdf0e10cSrcweir     ~SbiGlobals();
133*cdf0e10cSrcweir };
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir // Utility-Makros und -Routinen
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir SbiGlobals* GetSbData();
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir #define pINST       GetSbData()->pInst
140*cdf0e10cSrcweir #define pMOD        GetSbData()->pMod
141*cdf0e10cSrcweir #define pCMOD       GetSbData()->pCompMod
142*cdf0e10cSrcweir #define pSBFAC      GetSbData()->pSbFac
143*cdf0e10cSrcweir #define pUNOFAC     GetSbData()->pUnoFac
144*cdf0e10cSrcweir #define pTYPEFAC    GetSbData()->pTypeFac
145*cdf0e10cSrcweir #define pCLASSFAC   GetSbData()->pClassFac
146*cdf0e10cSrcweir #define pOLEFAC     GetSbData()->pOLEFac
147*cdf0e10cSrcweir #define pFORMFAC    GetSbData()->pFormFac
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir #endif
150*cdf0e10cSrcweir 
151