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