1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include "ScriptImpl.hxx"
22 #include "sal/log.hxx"
24 using namespace ::com::sun::star
;
25 using namespace ::com::sun::star::uno
;
26 using namespace ::com::sun::star::script::framework
;
28 namespace func_provider
32 ScriptImpl::ScriptImpl(
33 const Reference
< beans::XPropertySet
> & scriptingContext
,
34 const Reference
< runtime::XScriptInvocation
> & runtimeMgr
,
35 const OUString
& scriptURI
)
36 throw ( RuntimeException
) :
37 m_XScriptingContext( scriptingContext
, UNO_SET_THROW
),
38 m_RunTimeManager( runtimeMgr
, UNO_SET_THROW
),
39 m_ScriptURI( scriptURI
)
41 SAL_INFO("scripting.provider", "<!constucting a ScriptImpl>" );
45 ScriptImpl::~ScriptImpl()
47 SAL_INFO("scripting.provider", "<Destructing a ScriptImpl>" );
52 ScriptImpl::invoke( const Sequence
< Any
>& aParams
,
53 Sequence
< sal_Int16
>& aOutParamIndex
, Sequence
< Any
>& aOutParam
)
54 throw ( lang::IllegalArgumentException
, script::CannotConvertException
,
55 reflection::InvocationTargetException
, RuntimeException
)
57 SAL_INFO("scripting.provider", "<ScriptImpl::invoke>" );
59 Any anyScriptingContext
;
61 anyScriptingContext
<<= m_XScriptingContext
;
64 result
= m_RunTimeManager
->invoke( m_ScriptURI
, anyScriptingContext
, aParams
,
65 aOutParamIndex
, aOutParam
);
67 catch ( const lang::IllegalArgumentException
& iae
)
69 OUString temp
= "ScriptImpl::invoke IllegalArgumentException : ";
70 throw lang::IllegalArgumentException( temp
.concat( iae
.Message
),
71 Reference
< XInterface
> (),
72 iae
.ArgumentPosition
);
74 catch ( const script::CannotConvertException
& cce
)
76 OUString temp
= "ScriptImpl::invoke CannotConvertException : ";
77 throw script::CannotConvertException( temp
.concat( cce
.Message
),
78 Reference
< XInterface
> (),
79 cce
.DestinationTypeClass
,
83 catch ( const reflection::InvocationTargetException
& ite
)
85 OUString temp
= "ScriptImpl::invoke InvocationTargetException : ";
86 throw reflection::InvocationTargetException( temp
.concat( ite
.Message
),
87 Reference
< XInterface
> (),
88 ite
.TargetException
);
90 catch ( const RuntimeException
& re
)
92 OUString temp
= "ScriptImpl::invoke RuntimeException : ";
93 throw RuntimeException( temp
.concat( re
.Message
) );
98 throw RuntimeException(
99 "ScriptImpl::invoke Unknown Exception caught - RuntimeException rethrown" );
104 } // namespace func_provider
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */