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