Branch libreoffice-5-0-4
[LibreOffice.git] / scripting / source / basprov / basscript.hxx
blob203a3f691e2eec5265a988fe67ba6eb1e218e7e3
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/implbase1.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
40 // class BasicScriptImpl
43 typedef ::cppu::WeakImplHelper1<
44 ::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE;
47 class BasicScriptImpl : public BasicScriptImpl_BASE, public SfxListener,
48 public ::scripting_helper::OMutexHolder,
49 public ::scripting_helper::OBroadcastHelperHolder,
50 public ::comphelper::OPropertyContainer,
51 public ::comphelper::OPropertyArrayUsageHelper< BasicScriptImpl >
53 private:
54 SbMethodRef m_xMethod;
55 OUString m_funcName;
56 BasicManager* m_documentBasicManager;
57 ::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext >
58 m_xDocumentScriptContext;
59 // hack, OPropertyContainer doesn't allow you to define a property of unknown
60 // type ( I guess because an Any can't contain an Any... I've always wondered why?
61 // as its not unusual to do that in corba )
62 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_caller;
63 protected:
64 // OPropertySetHelper
65 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( ) SAL_OVERRIDE;
67 // OPropertyArrayUsageHelper
68 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
70 public:
71 BasicScriptImpl(
72 const OUString& funcName,
73 SbMethodRef xMethod
75 BasicScriptImpl(
76 const OUString& funcName,
77 SbMethodRef xMethod,
78 BasicManager& documentBasicManager,
79 const ::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext >& documentScriptContext
81 virtual ~BasicScriptImpl();
83 // XInterface
84 DECLARE_XINTERFACE()
86 // XTypeProvider
87 DECLARE_XTYPEPROVIDER()
89 // XScript
90 virtual ::com::sun::star::uno::Any SAL_CALL invoke(
91 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
92 ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
93 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam )
94 throw (
95 ::com::sun::star::script::provider::ScriptFrameworkErrorException,
96 ::com::sun::star::reflection::InvocationTargetException,
97 ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
98 // XPropertySet
99 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
100 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 // SfxListener
103 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
107 } // namespace basprov
110 #endif // INCLUDED_SCRIPTING_SOURCE_BASPROV_BASSCRIPT_HXX
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */