Update ooo320-m1
[ooovba.git] / scripting / source / provider / ScriptImpl.hxx
blob9ffc7e0683f73532c60dc57031df43b3a43cf0cf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ScriptImpl.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _FRAMEWORK_SCRIPT_PROVIDER_FUNCTIONIMPL_HXX_
32 #define _FRAMEWORK_SCRIPT_PROVIDER_FUNCTIONIMPL_HXX_
34 #include <cppuhelper/implbase1.hxx> // helper for XInterface, XTypeProvider etc.
35 #include <osl/mutex.hxx>
37 #include <com/sun/star/lang/IllegalArgumentException.hpp>
38 #include <com/sun/star/uno/RuntimeException.hpp>
39 #include <com/sun/star/script/CannotConvertException.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <com/sun/star/reflection/InvocationTargetException.hpp>
43 #include <drafts/com/sun/star/script/framework/provider/XScript.hpp>
44 #include <drafts/com/sun/star/script/framework/runtime/XScriptInvocation.hpp>
46 namespace func_provider
48 // for simplification
49 #define css ::com::sun::star
50 #define dcsssf ::drafts::com::sun::star::script::framework
53 class ScriptImpl :
54 public ::cppu::WeakImplHelper1 < dcsssf::provider::XScript >
57 public:
58 /*************************************************************
59 ScriptImpl Constructor
60 @param runtimeMgr which is a service that implement a XScriptInvocation
61 @param scriptURI the received ScriptURI that needs to be resolve and invoked
63 ScriptImpl(
64 const css::uno::Reference< css::beans::XPropertySet > & scriptingContext,
65 const css::uno::Reference< dcsssf::runtime::XScriptInvocation > & runtimeMgr,
66 const ::rtl::OUString& scriptURI )
67 throw ( css::uno::RuntimeException );
69 /*************************************************************
70 ScriptImpl Destructor
72 ~ScriptImpl();
74 /*************************************************************
75 Invoke
76 @param aParams all parameters; pure, out params are undefined in sequence,
77 i.e., the value has to be ignored by the callee
78 @param aOutParamIndex out indices
79 @param aOutParam out parameters
81 @returns
82 the value returned from the function being invoked
84 @throws IllegalArgumentException
85 if there is no matching script name
87 @throws CannotConvertException
88 if args do not match or cannot be converted the those
89 of the invokee
91 @throws InvocationTargetException
92 if the running script throws an exception this information is captured and
93 rethrown as this exception type.
96 virtual css::uno::Any SAL_CALL invoke(
97 const css::uno::Sequence< css::uno::Any > & aParams,
98 css::uno::Sequence< sal_Int16 > & aOutParamIndex,
99 css::uno::Sequence< css::uno::Any > & aOutParam )
100 throw ( css::lang::IllegalArgumentException,
101 css::script::CannotConvertException,
102 css::reflection::InvocationTargetException,
103 css::uno::RuntimeException );
105 private:
106 css::uno::Reference< css::beans::XPropertySet > m_XScriptingContext;
107 css::uno::Reference < dcsssf::runtime::XScriptInvocation > m_RunTimeManager;
108 ::rtl::OUString m_ScriptURI;
110 /* copy ctor disabled, i.e. not defined */
111 ScriptImpl( const ScriptImpl& );
112 /* assignment disabled, i.e. not defined */
113 ScriptImpl& operator = ( const ScriptImpl& );
115 } // namespace func_provider
116 #endif //_FRAMEWORK_SCRIPT_PROVIDER_FUNCTIONIMPL_HXX_