1*234bd5c5SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*234bd5c5SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*234bd5c5SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*234bd5c5SAndrew Rist * distributed with this work for additional information 6*234bd5c5SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*234bd5c5SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*234bd5c5SAndrew Rist * "License"); you may not use this file except in compliance 9*234bd5c5SAndrew Rist * with the License. You may obtain a copy of the License at 10*234bd5c5SAndrew Rist * 11*234bd5c5SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*234bd5c5SAndrew Rist * 13*234bd5c5SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*234bd5c5SAndrew Rist * software distributed under the License is distributed on an 15*234bd5c5SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*234bd5c5SAndrew Rist * KIND, either express or implied. See the License for the 17*234bd5c5SAndrew Rist * specific language governing permissions and limitations 18*234bd5c5SAndrew Rist * under the License. 19*234bd5c5SAndrew Rist * 20*234bd5c5SAndrew Rist *************************************************************/ 21*234bd5c5SAndrew Rist 22*234bd5c5SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SB_INTERN_HXX 25cdf0e10cSrcweir #define _SB_INTERN_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <basic/sbxfac.hxx> 28cdf0e10cSrcweir #include <unotools/transliterationwrapper.hxx> 29cdf0e10cSrcweir #include "sb.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir namespace utl 32cdf0e10cSrcweir { 33cdf0e10cSrcweir class TransliterationWrapper; 34cdf0e10cSrcweir } 35cdf0e10cSrcweir class SbUnoFactory; 36cdf0e10cSrcweir class SbTypeFactory; 37cdf0e10cSrcweir class SbOLEFactory; 38cdf0e10cSrcweir class SbFormFactory; 39cdf0e10cSrcweir class SbiInstance; 40cdf0e10cSrcweir class SbModule; 41cdf0e10cSrcweir 42cdf0e10cSrcweir class SbiFactory : public SbxFactory 43cdf0e10cSrcweir { 44cdf0e10cSrcweir public: 45cdf0e10cSrcweir virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); 46cdf0e10cSrcweir virtual SbxObject* CreateObject( const String& ); 47cdf0e10cSrcweir }; 48cdf0e10cSrcweir 49cdf0e10cSrcweir typedef ::std::vector< String > StringVector; 50cdf0e10cSrcweir 51cdf0e10cSrcweir struct SbClassData 52cdf0e10cSrcweir { 53cdf0e10cSrcweir SbxArrayRef mxIfaces; 54cdf0e10cSrcweir 55cdf0e10cSrcweir // types this module depends on because of use in Dim As New <type> 56cdf0e10cSrcweir // needed for initialization order of class modules 57cdf0e10cSrcweir StringVector maRequiredTypes; 58cdf0e10cSrcweir 59cdf0e10cSrcweir SbClassData( void ); ~SbClassDataSbClassData60cdf0e10cSrcweir ~SbClassData( void ) 61cdf0e10cSrcweir { clear(); } 62cdf0e10cSrcweir void clear( void ); 63cdf0e10cSrcweir }; 64cdf0e10cSrcweir 65cdf0e10cSrcweir // #115824: Factory class to create class objects (type command) 66cdf0e10cSrcweir // Implementation: sb.cxx 67cdf0e10cSrcweir class SbClassFactory : public SbxFactory 68cdf0e10cSrcweir { 69cdf0e10cSrcweir SbxObjectRef xClassModules; 70cdf0e10cSrcweir 71cdf0e10cSrcweir public: 72cdf0e10cSrcweir SbClassFactory( void ); 73cdf0e10cSrcweir virtual ~SbClassFactory(); 74cdf0e10cSrcweir 75cdf0e10cSrcweir void AddClassModule( SbModule* pClassModule ); 76cdf0e10cSrcweir void RemoveClassModule( SbModule* pClassModule ); 77cdf0e10cSrcweir 78cdf0e10cSrcweir virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); 79cdf0e10cSrcweir virtual SbxObject* CreateObject( const String& ); 80cdf0e10cSrcweir 81cdf0e10cSrcweir SbModule* FindClass( const String& rClassName ); 82cdf0e10cSrcweir }; 83cdf0e10cSrcweir 84cdf0e10cSrcweir // Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette 85cdf0e10cSrcweir class SbErrorStackEntry 86cdf0e10cSrcweir { 87cdf0e10cSrcweir public: SbErrorStackEntry(SbMethodRef aM,xub_StrLen nL,xub_StrLen nC1,xub_StrLen nC2)88cdf0e10cSrcweir SbErrorStackEntry(SbMethodRef aM, xub_StrLen nL, xub_StrLen nC1, xub_StrLen nC2) 89cdf0e10cSrcweir : aMethod(aM), nLine(nL), nCol1(nC1), nCol2(nC2) {} 90cdf0e10cSrcweir SbMethodRef aMethod; 91cdf0e10cSrcweir xub_StrLen nLine; 92cdf0e10cSrcweir xub_StrLen nCol1, nCol2; 93cdf0e10cSrcweir }; 94cdf0e10cSrcweir 95cdf0e10cSrcweir SV_DECL_PTRARR_DEL(SbErrorStack, SbErrorStackEntry*, 1, 1) 96cdf0e10cSrcweir 97cdf0e10cSrcweir 98cdf0e10cSrcweir 99cdf0e10cSrcweir struct SbiGlobals 100cdf0e10cSrcweir { 101cdf0e10cSrcweir SbiInstance* pInst; // alle aktiven Runtime-Instanzen 102cdf0e10cSrcweir SbiFactory* pSbFac; // StarBASIC-Factory 103cdf0e10cSrcweir SbUnoFactory* pUnoFac; // Factory fuer Uno-Structs bei DIM AS NEW 104cdf0e10cSrcweir SbTypeFactory* pTypeFac; // Factory for user defined types 105cdf0e10cSrcweir SbClassFactory* pClassFac; // Factory for user defined classes (based on class modules) 106cdf0e10cSrcweir SbOLEFactory* pOLEFac; // Factory for OLE types 107cdf0e10cSrcweir SbFormFactory* pFormFac; // Factory for user forms 108cdf0e10cSrcweir SbModule* pMod; // aktuell aktives Modul 109cdf0e10cSrcweir SbModule* pCompMod; // aktuell compiliertes Modul 110cdf0e10cSrcweir short nInst; // Anzahl BASICs 111cdf0e10cSrcweir Link aErrHdl; // globaler Error-Handler 112cdf0e10cSrcweir Link aBreakHdl; // globaler Break-Handler 113cdf0e10cSrcweir SbError nCode; // aktueller Fehlercode 114cdf0e10cSrcweir xub_StrLen nLine; // aktuelle Zeile 115cdf0e10cSrcweir xub_StrLen nCol1,nCol2; // aktuelle Spalten (von,bis) 116cdf0e10cSrcweir sal_Bool bCompiler; // Flag fuer Compiler-Error 117cdf0e10cSrcweir sal_Bool bGlobalInitErr; // Beim GlobalInit trat ein Compiler-Fehler auf 118cdf0e10cSrcweir sal_Bool bRunInit; // sal_True, wenn RunInit vom Basic aktiv ist 119cdf0e10cSrcweir String aErrMsg; // Puffer fuer GetErrorText() 120cdf0e10cSrcweir SbLanguageMode eLanguageMode; // Flag fuer Visual-Basic-Script-Modus 121cdf0e10cSrcweir SbErrorStack* pErrStack; // Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette 122cdf0e10cSrcweir ::utl::TransliterationWrapper* pTransliterationWrapper; // For StrComp 123cdf0e10cSrcweir sal_Bool bBlockCompilerError; 124cdf0e10cSrcweir BasicManager* pAppBasMgr; 125cdf0e10cSrcweir StarBASIC* pMSOMacroRuntimLib; // Lib containing MSO Macro Runtime API entry symbols 126cdf0e10cSrcweir 127cdf0e10cSrcweir SbiGlobals(); 128cdf0e10cSrcweir ~SbiGlobals(); 129cdf0e10cSrcweir }; 130cdf0e10cSrcweir 131cdf0e10cSrcweir // Utility-Makros und -Routinen 132cdf0e10cSrcweir 133cdf0e10cSrcweir SbiGlobals* GetSbData(); 134cdf0e10cSrcweir 135cdf0e10cSrcweir #define pINST GetSbData()->pInst 136cdf0e10cSrcweir #define pMOD GetSbData()->pMod 137cdf0e10cSrcweir #define pCMOD GetSbData()->pCompMod 138cdf0e10cSrcweir #define pSBFAC GetSbData()->pSbFac 139cdf0e10cSrcweir #define pUNOFAC GetSbData()->pUnoFac 140cdf0e10cSrcweir #define pTYPEFAC GetSbData()->pTypeFac 141cdf0e10cSrcweir #define pCLASSFAC GetSbData()->pClassFac 142cdf0e10cSrcweir #define pOLEFAC GetSbData()->pOLEFac 143cdf0e10cSrcweir #define pFORMFAC GetSbData()->pFormFac 144cdf0e10cSrcweir 145cdf0e10cSrcweir #endif 146cdf0e10cSrcweir 147