1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SB_SBMETH_HXX 29 #define _SB_SBMETH_HXX 30 31 #include <tools/errcode.hxx> 32 #include <basic/sbxmeth.hxx> 33 #include <basic/sbdef.hxx> 34 35 class SbModule; 36 class SbMethodImpl; 37 38 class SbMethod : public SbxMethod 39 { 40 friend class SbiRuntime; 41 friend class SbiFactory; 42 friend class SbModule; 43 friend class SbClassModuleObject; 44 friend class SbiCodeGen; 45 friend class SbJScriptMethod; 46 friend class SbIfaceMapperMethod; 47 48 SbMethodImpl* mpSbMethodImpl; // Impl data 49 SbModule* pMod; 50 sal_uInt16 nDebugFlags; 51 sal_uInt16 nLine1, nLine2; 52 sal_uInt32 nStart; 53 sal_Bool bInvalid; 54 SbxArrayRef refStatics; 55 SbMethod( const String&, SbxDataType, SbModule* ); 56 SbMethod( const SbMethod& ); 57 virtual sal_Bool LoadData( SvStream&, sal_uInt16 ); 58 virtual sal_Bool StoreData( SvStream& ) const; 59 virtual ~SbMethod(); 60 61 public: 62 SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMETHOD,2); 63 TYPEINFO(); 64 virtual SbxInfo* GetInfo(); 65 SbxArray* GetLocals(); 66 SbxArray* GetStatics(); 67 void ClearStatics(); 68 SbModule* GetModule() { return pMod; } 69 sal_uInt32 GetId() const { return nStart; } 70 sal_uInt16 GetDebugFlags() { return nDebugFlags; } 71 void SetDebugFlags( sal_uInt16 n ) { nDebugFlags = n; } 72 void GetLineRange( sal_uInt16&, sal_uInt16& ); 73 74 // Schnittstelle zum Ausfuehren einer Methode aus den Applikationen 75 virtual ErrCode Call( SbxValue* pRet = NULL ); 76 virtual void Broadcast( sal_uIntPtr nHintId ); 77 }; 78 79 #ifndef __SB_SBMETHODREF_HXX 80 #define __SB_SBMETHODREF_HXX 81 SV_DECL_IMPL_REF(SbMethod) 82 #endif 83 84 class SbIfaceMapperMethod : public SbMethod 85 { 86 friend class SbiRuntime; 87 88 SbMethodRef mxImplMeth; 89 90 public: 91 TYPEINFO(); 92 SbIfaceMapperMethod( const String& rName, SbMethod* pImplMeth ) 93 : SbMethod( rName, pImplMeth->GetType(), NULL ) 94 , mxImplMeth( pImplMeth ) 95 {} 96 virtual ~SbIfaceMapperMethod(); 97 SbMethod* getImplMethod( void ) 98 { return mxImplMeth; } 99 }; 100 101 #endif 102