1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SCRIPTING_BASSCRIPT_HXX
29 #define SCRIPTING_BASSCRIPT_HXX
30 
31 #include <com/sun/star/script/provider/XScript.hpp>
32 #include <com/sun/star/document/XScriptInvocationContext.hpp>
33 #include <cppuhelper/implbase1.hxx>
34 #include <basic/sbmeth.hxx>
35 #include <svl/lstner.hxx>
36 
37 
38 class BasicManager;
39 
40 //.........................................................................
41 namespace basprov
42 {
43 //.........................................................................
44 
45     //	----------------------------------------------------
46     //	class BasicScriptImpl
47     //	----------------------------------------------------
48 
49     typedef ::cppu::WeakImplHelper1<
50         ::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE;
51 
52 
53     class BasicScriptImpl : public BasicScriptImpl_BASE, public SfxListener
54     {
55     private:
56         SbMethodRef         m_xMethod;
57         ::rtl::OUString     m_funcName;
58         BasicManager*       m_documentBasicManager;
59         ::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext >
60                             m_xDocumentScriptContext;
61 
62     public:
63         BasicScriptImpl(
64             const ::rtl::OUString& funcName,
65             SbMethodRef xMethod
66         );
67         BasicScriptImpl(
68             const ::rtl::OUString& funcName,
69             SbMethodRef xMethod,
70             BasicManager& documentBasicManager,
71             const ::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext >& documentScriptContext
72         );
73         virtual ~BasicScriptImpl();
74 
75         // XScript
76         virtual ::com::sun::star::uno::Any SAL_CALL invoke(
77             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
78             ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
79             ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam )
80             throw (
81                     ::com::sun::star::script::provider::ScriptFrameworkErrorException,
82                     ::com::sun::star::reflection::InvocationTargetException,
83                     ::com::sun::star::uno::RuntimeException );
84 
85         // SfxListener
86         virtual void		Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
87     };
88 
89 //.........................................................................
90 }	// namespace basprov
91 //.........................................................................
92 
93 #endif // SCRIPTING_BASSCRIPT_HXX
94