1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_BASIC_SBMETH_HXX
21 #define INCLUDED_BASIC_SBMETH_HXX
23 #include <vcl/errcode.hxx>
24 #include <basic/sbxmeth.hxx>
25 #include <basic/sbdef.hxx>
26 #include <basic/basicdllapi.h>
30 class BASIC_DLLPUBLIC SbMethod
: public SbxMethod
32 friend class SbiRuntime
;
33 friend class SbiFactory
;
34 friend class SbModule
;
35 friend class SbClassModuleObject
;
36 friend class SbiCodeGen
;
37 friend class SbJScriptMethod
;
38 friend class SbIfaceMapperMethod
;
40 SbxVariable
* mCaller
; // caller
42 BasicDebugFlags nDebugFlags
;
43 sal_uInt16 nLine1
, nLine2
;
46 SbxArrayRef refStatics
;
47 BASIC_DLLPRIVATE
SbMethod( const OUString
&, SbxDataType
, SbModule
* );
48 BASIC_DLLPRIVATE
SbMethod( const SbMethod
& );
49 virtual bool LoadData( SvStream
&, sal_uInt16
) override
;
50 virtual bool StoreData( SvStream
& ) const override
;
51 virtual ~SbMethod() override
;
54 SBX_DECL_PERSIST_NODATA(SBXID_BASICMETHOD
,2);
55 virtual SbxInfo
* GetInfo() override
;
56 SbxArray
* GetStatics();
58 SbModule
* GetModule() { return pMod
; }
59 BasicDebugFlags
GetDebugFlags() const { return nDebugFlags
; }
60 void SetDebugFlags( BasicDebugFlags n
) { nDebugFlags
= n
; }
61 void GetLineRange( sal_uInt16
&, sal_uInt16
& );
63 // Interface to execute a method from the applications
64 ErrCode
Call( SbxValue
* pRet
, SbxVariable
* pCaller
= nullptr );
65 virtual void Broadcast( SfxHintId nHintId
) override
;
68 typedef tools::SvRef
<SbMethod
> SbMethodRef
;
70 class SbIfaceMapperMethod
: public SbMethod
72 friend class SbiRuntime
;
74 SbMethodRef mxImplMeth
;
77 SbIfaceMapperMethod( const OUString
& rName
, SbMethod
* pImplMeth
)
78 : SbMethod( rName
, pImplMeth
->GetType(), nullptr )
79 , mxImplMeth( pImplMeth
)
81 virtual ~SbIfaceMapperMethod() override
;
82 SbMethod
* getImplMethod()
83 { return mxImplMeth
.get(); }
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */