xref: /aoo4110/main/basic/inc/basic/sbmeth.hxx (revision b1cdbd2c)
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_SBMETH_HXX
25 #define _SB_SBMETH_HXX
26 
27 #include <tools/errcode.hxx>
28 #include <basic/sbxmeth.hxx>
29 #include <basic/sbdef.hxx>
30 
31 class SbModule;
32 class SbMethodImpl;
33 
34 class SbMethod : public SbxMethod
35 {
36 	friend class SbiRuntime;
37 	friend class SbiFactory;
38 	friend class SbModule;
39 	friend class SbClassModuleObject;
40 	friend class SbiCodeGen;
41 	friend class SbJScriptMethod;
42 	friend class SbIfaceMapperMethod;
43 
44 	SbMethodImpl* mpSbMethodImpl;			// Impl data
45 	SbModule* pMod;
46 	sal_uInt16    nDebugFlags;
47 	sal_uInt16	  nLine1, nLine2;
48 	sal_uInt32	  nStart;
49 	sal_Bool	  bInvalid;
50 	SbxArrayRef refStatics;
51 	SbMethod( const String&, SbxDataType, SbModule* );
52 	SbMethod( const SbMethod& );
53 	virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
54 	virtual sal_Bool StoreData( SvStream& ) const;
55 	virtual ~SbMethod();
56 
57 public:
58 	SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMETHOD,2);
59 	TYPEINFO();
60 	virtual SbxInfo* GetInfo();
61 	SbxArray* GetLocals();
62 	SbxArray* GetStatics();
63 	void      ClearStatics();
GetModule()64 	SbModule* GetModule() 				 { return pMod; 	   }
GetId() const65 	sal_uInt32	  GetId() const				 { return nStart;	   }
GetDebugFlags()66 	sal_uInt16    GetDebugFlags()			 { return nDebugFlags; }
SetDebugFlags(sal_uInt16 n)67 	void 	  SetDebugFlags( sal_uInt16 n )  { nDebugFlags = n;    }
68 	void 	  GetLineRange( sal_uInt16&, sal_uInt16& );
69 
70 	// Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
71 	virtual ErrCode Call( SbxValue* pRet = NULL );
72 	virtual void Broadcast( sal_uIntPtr nHintId );
73 };
74 
75 #ifndef __SB_SBMETHODREF_HXX
76 #define __SB_SBMETHODREF_HXX
77 SV_DECL_IMPL_REF(SbMethod)
78 #endif
79 
80 class SbIfaceMapperMethod : public SbMethod
81 {
82 	friend class SbiRuntime;
83 
84 	SbMethodRef mxImplMeth;
85 
86 public:
87 	TYPEINFO();
SbIfaceMapperMethod(const String & rName,SbMethod * pImplMeth)88 	SbIfaceMapperMethod( const String& rName, SbMethod* pImplMeth )
89 		: SbMethod( rName, pImplMeth->GetType(), NULL )
90 		, mxImplMeth( pImplMeth )
91 	{}
92 	virtual ~SbIfaceMapperMethod();
getImplMethod(void)93 	SbMethod* getImplMethod( void )
94 		{ return mxImplMeth; }
95 };
96 
97 #endif
98