1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SCRIPTING_BASSCRIPT_HXX
25 #define SCRIPTING_BASSCRIPT_HXX
26 
27 #include <com/sun/star/script/provider/XScript.hpp>
28 #include <com/sun/star/document/XScriptInvocationContext.hpp>
29 #include <cppuhelper/implbase1.hxx>
30 #include <basic/sbmeth.hxx>
31 #include <svl/lstner.hxx>
32 
33 
34 class BasicManager;
35 
36 //.........................................................................
37 namespace basprov
38 {
39 //.........................................................................
40 
41     //	----------------------------------------------------
42     //	class BasicScriptImpl
43     //	----------------------------------------------------
44 
45     typedef ::cppu::WeakImplHelper1<
46         ::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE;
47 
48 
49     class BasicScriptImpl : public BasicScriptImpl_BASE, public SfxListener
50     {
51     private:
52         SbMethodRef         m_xMethod;
53         ::rtl::OUString     m_funcName;
54         BasicManager*       m_documentBasicManager;
55         ::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext >
56                             m_xDocumentScriptContext;
57 
58     public:
59         BasicScriptImpl(
60             const ::rtl::OUString& funcName,
61             SbMethodRef xMethod
62         );
63         BasicScriptImpl(
64             const ::rtl::OUString& funcName,
65             SbMethodRef xMethod,
66             BasicManager& documentBasicManager,
67             const ::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext >& documentScriptContext
68         );
69         virtual ~BasicScriptImpl();
70 
71         // XScript
72         virtual ::com::sun::star::uno::Any SAL_CALL invoke(
73             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
74             ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
75             ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam )
76             throw (
77                     ::com::sun::star::script::provider::ScriptFrameworkErrorException,
78                     ::com::sun::star::reflection::InvocationTargetException,
79                     ::com::sun::star::uno::RuntimeException );
80 
81         // SfxListener
82         virtual void		Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
83     };
84 
85 //.........................................................................
86 }	// namespace basprov
87 //.........................................................................
88 
89 #endif // SCRIPTING_BASSCRIPT_HXX
90