/src/libreoffice/include/basic/sbmeth.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #pragma once |
21 | | |
22 | | #include <basic/sbxmeth.hxx> |
23 | | #include <basic/sbdef.hxx> |
24 | | #include <basic/basicdllapi.h> |
25 | | |
26 | | class ErrCode; |
27 | | class SbModule; |
28 | | |
29 | | class BASIC_DLLPUBLIC SbMethod : public SbxMethod |
30 | | { |
31 | | friend class SbiRuntime; |
32 | | friend class SbiFactory; |
33 | | friend class SbModule; |
34 | | friend class SbClassModuleObject; |
35 | | friend class SbiCodeGen; |
36 | | friend class SbJScriptMethod; |
37 | | friend class SbIfaceMapperMethod; |
38 | | |
39 | | SbxVariable* mCaller; // caller |
40 | | SbModule* pMod; |
41 | | BasicDebugFlags nDebugFlags; |
42 | | sal_uInt16 nLine1, nLine2; |
43 | | sal_uInt32 nStart; |
44 | | bool bInvalid; |
45 | | SbxArrayRef refStatics; |
46 | | BASIC_DLLPRIVATE SbMethod( const OUString&, SbxDataType, SbModule* ); |
47 | | BASIC_DLLPRIVATE SbMethod( const SbMethod& ); |
48 | | virtual bool LoadData( SvStream&, sal_uInt16 ) override; |
49 | | virtual std::pair<bool, sal_uInt32> StoreData( SvStream& ) const override; |
50 | | virtual ~SbMethod() override; |
51 | | |
52 | | public: |
53 | | SBX_DECL_PERSIST_NODATA(SBXID_BASICMETHOD,2); |
54 | | virtual SbxInfo* GetInfo() override; |
55 | | SbxArray* GetStatics(); |
56 | | void ClearStatics(); |
57 | 0 | SbModule* GetModule() { return pMod; } |
58 | 0 | BasicDebugFlags GetDebugFlags() const { return nDebugFlags; } |
59 | 0 | void SetDebugFlags( BasicDebugFlags n ) { nDebugFlags = n; } |
60 | | void GetLineRange( sal_uInt16&, sal_uInt16& ); |
61 | | |
62 | | // Interface to execute a method from the applications |
63 | | ErrCode Call( SbxValue* pRet, SbxVariable* pCaller = nullptr ); |
64 | | virtual void Broadcast( SfxHintId nHintId ) override; |
65 | | }; |
66 | | |
67 | | typedef tools::SvRef<SbMethod> SbMethodRef; |
68 | | |
69 | | class SbIfaceMapperMethod final : public SbMethod |
70 | | { |
71 | | friend class SbiRuntime; |
72 | | |
73 | | SbMethodRef mxImplMeth; |
74 | | |
75 | | public: |
76 | | SbIfaceMapperMethod( const OUString& rName, SbMethod* pImplMeth ) |
77 | | : SbMethod( rName, pImplMeth->GetType(), nullptr ) |
78 | | , mxImplMeth( pImplMeth ) |
79 | 0 | {} |
80 | | virtual ~SbIfaceMapperMethod() override; |
81 | | SbMethod* getImplMethod() |
82 | 0 | { return mxImplMeth.get(); } |
83 | | }; |
84 | | |
85 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |