Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / scripting / source / basprov / basscript.hxx
blob62a2d61e66da3179e8e2b8c19d305177c6c6e125
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_SCRIPTING_SOURCE_BASPROV_BASSCRIPT_HXX
21 #define INCLUDED_SCRIPTING_SOURCE_BASPROV_BASSCRIPT_HXX
23 #include <bcholder.hxx>
24 #include <com/sun/star/script/provider/XScript.hpp>
25 #include <com/sun/star/document/XScriptInvocationContext.hpp>
26 #include <cppuhelper/implbase.hxx>
27 #include <comphelper/proparrhlp.hxx>
28 #include <comphelper/propertycontainer.hxx>
29 #include <basic/sbmeth.hxx>
30 #include <svl/lstner.hxx>
32 class BasicManager;
35 namespace basprov
39 // class BasicScriptImpl
42 typedef ::cppu::WeakImplHelper<
43 css::script::provider::XScript > BasicScriptImpl_BASE;
46 class BasicScriptImpl : public BasicScriptImpl_BASE, public SfxListener,
47 public ::scripting_helper::OMutexHolder,
48 public ::scripting_helper::OBroadcastHelperHolder,
49 public ::comphelper::OPropertyContainer,
50 public ::comphelper::OPropertyArrayUsageHelper< BasicScriptImpl >
52 private:
53 SbMethodRef m_xMethod;
54 OUString const m_funcName;
55 BasicManager* m_documentBasicManager;
56 css::uno::Reference< css::document::XScriptInvocationContext >
57 m_xDocumentScriptContext;
58 // hack, OPropertyContainer doesn't allow you to define a property of unknown
59 // type ( I guess because an Any can't contain an Any... I've always wondered why?
60 // as it's not unusual to do that in corba )
61 css::uno::Sequence< css::uno::Any > m_caller;
62 protected:
63 // OPropertySetHelper
64 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( ) override;
66 // OPropertyArrayUsageHelper
67 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
69 public:
70 BasicScriptImpl(
71 const OUString& funcName,
72 SbMethodRef const & xMethod
74 BasicScriptImpl(
75 const OUString& funcName,
76 SbMethodRef const & xMethod,
77 BasicManager& documentBasicManager,
78 const css::uno::Reference< css::document::XScriptInvocationContext >& documentScriptContext
80 virtual ~BasicScriptImpl() override;
82 // XInterface
83 DECLARE_XINTERFACE()
85 // XTypeProvider
86 DECLARE_XTYPEPROVIDER()
88 // XScript
89 virtual css::uno::Any SAL_CALL invoke(
90 const css::uno::Sequence< css::uno::Any >& aParams,
91 css::uno::Sequence< sal_Int16 >& aOutParamIndex,
92 css::uno::Sequence< css::uno::Any >& aOutParam ) override;
93 // XPropertySet
94 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
96 // SfxListener
97 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
101 } // namespace basprov
104 #endif // INCLUDED_SCRIPTING_SOURCE_BASPROV_BASSCRIPT_HXX
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */