2010-10-12 15:53:47 +02:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2002-09-20 13:37:46 +00:00
/*************************************************************************
*
2008-04-11 09:40:23 +00:00
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER .
2002-09-20 13:37:46 +00:00
*
2010-02-12 15:01:35 +01:00
* Copyright 2000 , 2010 Oracle and / or its affiliates .
2002-09-20 13:37:46 +00:00
*
2008-04-11 09:40:23 +00:00
* OpenOffice . org - a multi - platform office productivity suite
2002-09-20 13:37:46 +00:00
*
2008-04-11 09:40:23 +00:00
* This file is part of OpenOffice . org .
2002-09-20 13:37:46 +00:00
*
2008-04-11 09:40:23 +00:00
* OpenOffice . org is free software : you can redistribute it and / or modify
* it under the terms of the GNU Lesser General Public License version 3
* only , as published by the Free Software Foundation .
2002-09-20 13:37:46 +00:00
*
2008-04-11 09:40:23 +00:00
* OpenOffice . org is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU Lesser General Public License version 3 for more details
* ( a copy is included in the LICENSE file that accompanied this code ) .
2002-09-20 13:37:46 +00:00
*
2008-04-11 09:40:23 +00:00
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice . org . If not , see
* < http : //www.openoffice.org/license.html>
* for a copy of the LGPLv3 License .
2002-09-20 13:37:46 +00:00
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2006-09-16 11:29:59 +00:00
2002-10-29 15:52:34 +00:00
# include <vcl/msgbox.hxx>
# include "ScriptExecDialog.hrc"
2002-10-30 13:26:24 +00:00
# include <util/scriptingconstants.hxx>
2002-09-20 13:37:46 +00:00
# include <cppuhelper/implementationentry.hxx>
2010-11-04 10:36:15 +01:00
# include <tools/diagnose_ex.h>
2002-09-20 13:37:46 +00:00
2002-10-23 13:13:25 +00:00
# include <com/sun/star/beans/XPropertySet.hpp>
2003-05-16 09:14:24 +00:00
# include <com/sun/star/lang/XEventListener.hpp>
2003-05-21 08:04:36 +00:00
# include <com/sun/star/lang/EventObject.hpp>
2002-10-23 13:13:25 +00:00
2002-09-20 13:37:46 +00:00
# include "ScriptNameResolverImpl.hxx"
2002-09-27 11:16:30 +00:00
# include "ScriptRuntimeManager.hxx"
2002-09-20 13:37:46 +00:00
# include <util/util.hxx>
2002-10-23 13:13:25 +00:00
# include <util/scriptingconstants.hxx>
2002-09-20 13:37:46 +00:00
using namespace : : rtl ;
using namespace : : osl ;
using namespace : : com : : sun : : star ;
using namespace : : com : : sun : : star : : uno ;
using namespace : : drafts : : com : : sun : : star : : script : : framework ;
namespace scripting_runtimemgr
{
2010-11-19 19:43:57 +01:00
static OUString s_implName ( RTL_CONSTASCII_USTRINGPARAM (
" drafts.com.sun.star.script.framework.runtime.ScriptRuntimeManager " ) ) ;
static OUString s_serviceName ( RTL_CONSTASCII_USTRINGPARAM (
" drafts.com.sun.star.script.framework.runtime.ScriptRuntimeManager " ) ) ;
2002-09-20 13:37:46 +00:00
static Sequence < OUString > s_serviceNames = Sequence < OUString > ( & s_serviceName , 1 ) ;
: : rtl_StandardModuleCount s_moduleCount = MODULE_COUNT_INIT ;
//*************************************************************************
// ScriptRuntimeManager Constructor
2002-09-27 11:16:30 +00:00
ScriptRuntimeManager : : ScriptRuntimeManager (
const Reference < XComponentContext > & xContext ) :
2010-11-04 10:36:15 +01:00
m_xContext ( xContext , UNO_SET_THROW )
2002-09-20 13:37:46 +00:00
{
2011-09-20 10:18:12 +02:00
OSL_TRACE ( " < ScriptRuntimeManager ctor called > " ) ;
2010-11-04 10:36:15 +01:00
m_xMgr . set ( m_xContext - > getServiceManager ( ) , UNO_SET_THROW ) ;
2002-09-20 13:37:46 +00:00
s_moduleCount . modCnt . acquire ( & s_moduleCount . modCnt ) ;
2003-01-27 16:18:27 +00:00
// test
//scripting_securitymgr::ScriptSecurityManager ssm(xContext);
2002-09-20 13:37:46 +00:00
}
//*************************************************************************
// ScriptRuntimeManager Destructor
ScriptRuntimeManager : : ~ ScriptRuntimeManager ( )
{
2011-09-20 10:18:12 +02:00
OSL_TRACE ( " < ScriptRuntimeManager dtor called > " ) ;
2002-09-20 13:37:46 +00:00
s_moduleCount . modCnt . release ( & s_moduleCount . modCnt ) ;
}
//*************************************************************************
// Get the proper XScriptInvocation
2003-03-03 17:39:42 +00:00
Reference < runtime : : XScriptInvocation > SAL_CALL ScriptRuntimeManager : : getScriptRuntime (
2002-10-23 13:13:25 +00:00
const Reference < XInterface > & scriptInfo )
2002-09-27 11:16:30 +00:00
throw ( RuntimeException )
2002-09-20 13:37:46 +00:00
{
2011-09-20 10:18:12 +02:00
OSL_TRACE ( " ** ==> ScriptRuntimeManager in getScriptRuntime " ) ;
2002-09-20 13:37:46 +00:00
2003-03-03 17:39:42 +00:00
Reference < runtime : : XScriptInvocation > xScriptInvocation ;
2002-09-20 13:37:46 +00:00
try
{
2002-11-06 15:26:40 +00:00
Reference < XInterface > xInterface ;
2003-01-21 14:40:49 +00:00
Reference < storage : : XScriptInfo > sinfo =
Reference < storage : : XScriptInfo > ( scriptInfo , UNO_QUERY_THROW ) ;
2010-11-04 10:36:15 +01:00
OUStringBuffer * buf ( 80 ) ;
buf . appendAscii ( " /singletons/drafts.com.sun.star.script.framework.runtime.theScriptRuntimeFor " ) ;
buf . append ( sinfo - > getLanguage ( ) ) ;
2003-01-21 14:40:49 +00:00
2010-11-04 10:36:15 +01:00
xInterface . set ( m_xContext - > getValueByName ( buf . makeStringAndClear ( ) ) , UNO_QUERY_THROW ) ;
xScriptInvocation . set ( xInterface , UNO_QUERY_THROW ) ;
2002-09-20 13:37:46 +00:00
}
2011-12-25 15:08:11 +09:00
catch ( const Exception & e )
2002-09-20 13:37:46 +00:00
{
2002-09-27 11:16:30 +00:00
OUString temp = OUSTR ( " ScriptRuntimeManager::GetScriptRuntime: " ) ;
throw RuntimeException ( temp . concat ( e . Message ) , Reference < XInterface > ( ) ) ;
2002-09-20 13:37:46 +00:00
}
return xScriptInvocation ;
}
//*************************************************************************
// Get the proper XScriptNameResolver
2003-03-03 17:39:42 +00:00
Reference < runtime : : XScriptNameResolver > SAL_CALL
2002-09-20 13:37:46 +00:00
ScriptRuntimeManager : : getScriptNameResolver ( )
2002-09-27 11:16:30 +00:00
throw ( RuntimeException )
2002-09-20 13:37:46 +00:00
{
2011-09-20 10:18:12 +02:00
OSL_TRACE ( " ** ==> ScriptRuntimeManager in getScriptNameResolver " ) ;
2003-03-03 17:39:42 +00:00
Reference < runtime : : XScriptNameResolver > xScriptNameResolver ;
2002-09-20 13:37:46 +00:00
try
{
2010-11-04 10:36:15 +01:00
Reference < XInterface > xInterface (
m_xMgr - > createInstanceWithContext (
2011-03-12 02:42:58 +01:00
OUString ( RTL_CONSTASCII_USTRINGPARAM (
" drafts.com.sun.star.script.framework.runtime.DefaultScriptNameResolver " ) ) ,
2010-11-04 10:36:15 +01:00
m_xContext
) ,
UNO_SET_THROW
) ;
xScriptNameResolver . set ( xInterface , UNO_QUERY_THROW ) ;
2002-09-20 13:37:46 +00:00
}
2011-12-25 15:08:11 +09:00
catch ( const Exception & e )
2002-09-20 13:37:46 +00:00
{
2002-09-27 11:16:30 +00:00
OUString temp = OUSTR ( " ScriptRuntimeManager::GetScriptNameResolver: " ) ;
throw RuntimeException ( temp . concat ( e . Message ) , Reference < XInterface > ( ) ) ;
2002-09-20 13:37:46 +00:00
}
return xScriptNameResolver ;
}
//*************************************************************************
// XScriptInvocation implementation
Any SAL_CALL ScriptRuntimeManager : : invoke (
2002-10-23 13:13:25 +00:00
const : : rtl : : OUString & scriptURI ,
2002-09-27 11:16:30 +00:00
const Any & invocationCtx , const Sequence < Any > & aParams ,
Sequence < sal_Int16 > & aOutParamIndex , Sequence < Any > & aOutParam )
throw ( lang : : IllegalArgumentException , script : : CannotConvertException ,
reflection : : InvocationTargetException , RuntimeException )
2002-09-20 13:37:46 +00:00
{
2011-09-20 10:18:12 +02:00
OSL_TRACE ( " ** ==> ScriptRuntimeManager in runtimemgr invoke " ) ;
2002-10-30 13:26:24 +00:00
2002-09-20 13:37:46 +00:00
Any results ;
2002-10-30 13:26:24 +00:00
scripting_constants : : ScriptingConstantsPool & scriptingConstantsPool =
scripting_constants : : ScriptingConstantsPool : : instance ( ) ;
2002-09-20 13:37:46 +00:00
// Initialise resolved context with invocation context,
// the resolved context (resolvedCtx will be modified by the
// resolve method to contain the storage where the script code is
// stored
Any resolvedCtx = invocationCtx ;
2002-10-29 15:52:34 +00:00
2002-09-20 13:37:46 +00:00
try
{
2010-11-04 10:36:15 +01:00
Reference < storage : : XScriptInfo > resolvedScript = resolve ( scriptURI , resolvedCtx ) ;
ENSURE_OR_THROW ( resolvedScript . is ( ) , " ScriptRuntimeManager::invoke: No resolvedURI " ) ;
2002-10-30 13:26:24 +00:00
2002-11-06 15:26:40 +00:00
Reference < beans : : XPropertySet > xPropSetResolvedCtx ;
if ( sal_False = = ( resolvedCtx > > = xPropSetResolvedCtx ) )
2002-10-30 13:26:24 +00:00
{
throw RuntimeException ( OUSTR (
" ScriptRuntimeManager::invoke : unable to get XPropSetScriptingContext from param " ) ,
Reference < XInterface > ( ) ) ;
}
2002-11-06 15:26:40 +00:00
Any any = xPropSetResolvedCtx - > getPropertyValue (
2002-10-30 13:26:24 +00:00
scriptingConstantsPool . RESOLVED_STORAGE_ID ) ;
2003-05-16 09:14:24 +00:00
sal_Int32 resolvedSid ;
if ( sal_False = = ( any > > = resolvedSid ) )
2002-10-30 13:26:24 +00:00
{
throw RuntimeException ( OUSTR (
2003-05-16 09:14:24 +00:00
" ScriptRuntimeManager::invoke : unable to get resolved storage id from xPropSetResolvedCtx " ) ,
2002-10-30 13:26:24 +00:00
Reference < XInterface > ( ) ) ;
}
2011-09-20 10:18:12 +02:00
OSL_TRACE ( " Storage sid is: %d " , resolvedSid ) ;
2002-10-30 13:26:24 +00:00
2002-11-06 15:26:40 +00:00
// modifying the XPropertySet on the resolved Context to contain the
// full script info
2002-10-23 13:13:25 +00:00
Any aResolvedScript ;
aResolvedScript < < = resolvedScript ;
2002-11-06 15:26:40 +00:00
xPropSetResolvedCtx - > setPropertyValue ( scriptingConstantsPool . SCRIPT_INFO ,
2002-10-23 13:13:25 +00:00
aResolvedScript ) ;
2002-09-20 13:37:46 +00:00
2003-03-03 17:39:42 +00:00
Reference < runtime : : XScriptInvocation > xScriptInvocation =
2002-10-23 13:13:25 +00:00
getScriptRuntime ( resolvedScript ) ;
2010-11-04 10:36:15 +01:00
ENSURE_OR_THROW ( xScriptInvocation . is ( ) ,
2002-09-27 11:16:30 +00:00
" ScriptRuntimeManager::invoke: cannot get instance of language specific runtime. " ) ;
2002-09-20 13:37:46 +00:00
2002-11-06 15:26:40 +00:00
// the scriptURI is currently passed to the language-dept runtime but
// is not used (may be useful in the future?). All of the script info
// is contained as a property(SCRIPT_INFO) within the resolvedCtx
2002-10-23 13:13:25 +00:00
results = xScriptInvocation - > invoke ( scriptURI , resolvedCtx , aParams ,
2002-09-27 11:16:30 +00:00
aOutParamIndex , aOutParam ) ;
2003-05-16 09:14:24 +00:00
// need to dispose of filesystem storage
2010-11-19 19:43:57 +01:00
OUString filesysString ( RTL_CONSTASCII_USTRINGPARAM (
" location=filesystem " ) ) ;
2003-05-16 09:14:24 +00:00
if ( scriptURI . indexOf ( filesysString ) ! = - 1 )
{
Any a = m_xContext - > getValueByName (
scriptingConstantsPool . SCRIPTSTORAGEMANAGER_SERVICE ) ;
2010-11-04 10:36:15 +01:00
Reference < lang : : XEventListener > xEL_ScriptStorageManager ( a , UNO_QUERY_THROW ) ;
2003-05-21 08:04:36 +00:00
lang : : EventObject event ( resolvedScript ) ;
xEL_ScriptStorageManager - > disposing ( event ) ;
2003-05-16 09:14:24 +00:00
}
2002-09-20 13:37:46 +00:00
}
2011-12-25 15:08:11 +09:00
catch ( const lang : : IllegalArgumentException & iae )
2002-09-20 13:37:46 +00:00
{
2002-09-27 11:16:30 +00:00
OUString temp = OUSTR ( " ScriptRuntimeManager::invoke IllegalArgumentException: " ) ;
throw lang : : IllegalArgumentException ( temp . concat ( iae . Message ) ,
Reference < XInterface > ( ) ,
iae . ArgumentPosition ) ;
2002-09-20 13:37:46 +00:00
}
2011-12-25 15:08:11 +09:00
catch ( const script : : CannotConvertException & cce )
2002-09-20 13:37:46 +00:00
{
2002-09-27 11:16:30 +00:00
OUString temp = OUSTR ( " ScriptRuntimeManager::invoke CannotConvertException: " ) ;
throw script : : CannotConvertException ( temp . concat ( cce . Message ) ,
Reference < XInterface > ( ) ,
cce . DestinationTypeClass , cce . Reason ,
cce . ArgumentIndex ) ;
2002-09-20 13:37:46 +00:00
}
2011-12-25 15:08:11 +09:00
catch ( const reflection : : InvocationTargetException & ite )
2002-09-20 13:37:46 +00:00
{
2002-09-27 11:16:30 +00:00
OUString temp = OUSTR ( " ScriptRuntimeManager::invoke InvocationTargetException: " ) ;
throw reflection : : InvocationTargetException ( temp . concat ( ite . Message ) ,
Reference < XInterface > ( ) , ite . TargetException ) ;
2002-09-20 13:37:46 +00:00
}
2011-12-25 15:08:11 +09:00
catch ( const beans : : UnknownPropertyException & e )
2002-10-30 13:26:24 +00:00
{
OUString temp = OUSTR ( " ScriptRuntimeManager::invoke UnknownPropertyException: " ) ;
throw RuntimeException ( temp . concat ( e . Message ) ,
Reference < XInterface > ( ) ) ;
}
2011-12-25 15:08:11 +09:00
catch ( const lang : : WrappedTargetException & e )
2002-10-30 13:26:24 +00:00
{
OUString temp = OUSTR ( " ScriptRuntimeManager::invoke WrappedTargetException : " ) ;
throw RuntimeException ( temp . concat ( e . Message ) ,
Reference < XInterface > ( ) ) ;
}
2011-12-25 15:08:11 +09:00
catch ( const RuntimeException & re )
2002-09-20 13:37:46 +00:00
{
2002-09-27 11:16:30 +00:00
OUString temp = OUSTR ( " ScriptRuntimeManager::invoke RuntimeException: " ) ;
throw RuntimeException ( temp . concat ( re . Message ) ,
Reference < XInterface > ( ) ) ;
2002-09-20 13:37:46 +00:00
}
2011-12-25 15:08:11 +09:00
catch ( const Exception & e )
2002-11-06 15:26:40 +00:00
{
OUString temp = OUSTR ( " ScriptRuntimeManager::invoke Exception: " ) ;
throw RuntimeException ( temp . concat ( e . Message ) ,
Reference < XInterface > ( ) ) ;
}
2002-09-20 13:37:46 +00:00
# ifdef _DEBUG
catch ( . . . )
{
2002-09-27 11:16:30 +00:00
throw RuntimeException ( OUSTR ( " ScriptRuntimeManager::invoke UnknownException: " ) ,
Reference < XInterface > ( ) ) ;
2002-09-20 13:37:46 +00:00
}
# endif
2011-09-20 10:18:12 +02:00
OSL_TRACE ( " ** ==> ScriptRuntimeManager returned from invoke: %s " , : : rtl : : OUStringToOString ( results . getValueTypeName ( ) , RTL_TEXTENCODING_ASCII_US ) . pData - > buffer ) ;
2002-09-20 13:37:46 +00:00
return results ;
}
//*************************************************************************
// XScriptNameResolver implementation
2003-01-28 10:52:17 +00:00
Reference < storage : : XScriptInfo > SAL_CALL
2002-10-23 13:13:25 +00:00
ScriptRuntimeManager : : resolve ( const : : rtl : : OUString & scriptURI ,
2002-09-27 11:16:30 +00:00
Any & invocationCtx )
throw ( lang : : IllegalArgumentException , script : : CannotConvertException , RuntimeException )
2002-09-20 13:37:46 +00:00
{
2011-09-20 10:18:12 +02:00
OSL_TRACE ( " ** ==> ScriptRuntimeManager in resolve " ) ;
2003-01-28 10:52:17 +00:00
Reference < storage : : XScriptInfo > resolvedURI ;
2002-09-20 13:37:46 +00:00
2003-03-03 17:39:42 +00:00
Reference < runtime : : XScriptNameResolver > xScriptNameResolver = getScriptNameResolver ( ) ;
2010-11-04 10:36:15 +01:00
ENSURE_OR_THROW ( xScriptNameResolver . is ( ) ,
2002-09-27 11:16:30 +00:00
" ScriptRuntimeManager::resolve: No ScriptNameResolver " ) ;
2002-09-20 13:37:46 +00:00
try
{
2002-09-27 11:16:30 +00:00
resolvedURI = xScriptNameResolver - > resolve ( scriptURI , invocationCtx ) ;
2002-09-20 13:37:46 +00:00
}
2011-12-25 15:08:11 +09:00
catch ( const lang : : IllegalArgumentException & iae )
2002-09-20 13:37:46 +00:00
{
2002-09-27 11:16:30 +00:00
OUString temp =
OUSTR ( " ScriptRuntimeManager::resolve IllegalArgumentException: " ) ;
throw lang : : IllegalArgumentException ( temp . concat ( iae . Message ) ,
Reference < XInterface > ( ) ,
iae . ArgumentPosition ) ;
2002-09-20 13:37:46 +00:00
}
2011-12-25 15:08:11 +09:00
catch ( const script : : CannotConvertException & cce )
2002-09-20 13:37:46 +00:00
{
2002-09-27 11:16:30 +00:00
OUString temp = OUSTR ( " ScriptRuntimeManager::resolve CannotConvertException: " ) ;
throw script : : CannotConvertException ( temp . concat ( cce . Message ) ,
Reference < XInterface > ( ) ,
cce . DestinationTypeClass , cce . Reason ,
cce . ArgumentIndex ) ;
2002-09-20 13:37:46 +00:00
}
2011-12-25 15:08:11 +09:00
catch ( const RuntimeException & re )
2002-09-20 13:37:46 +00:00
{
2002-09-27 11:16:30 +00:00
OUString temp = OUSTR ( " ScriptRuntimeManager::resolve RuntimeException: " ) ;
throw RuntimeException ( temp . concat ( re . Message ) ,
Reference < XInterface > ( ) ) ;
2002-09-20 13:37:46 +00:00
}
# ifdef _DEBUG
catch ( . . . )
{
2002-09-27 11:16:30 +00:00
throw RuntimeException (
OUSTR ( " ScriptRuntimeManager::resolve UnknownException: " ) ,
Reference < XInterface > ( ) ) ;
2002-09-20 13:37:46 +00:00
}
# endif
return resolvedURI ;
}
//*************************************************************************
2002-09-27 11:16:30 +00:00
OUString SAL_CALL ScriptRuntimeManager : : getImplementationName ( )
throw ( RuntimeException )
2002-09-20 13:37:46 +00:00
{
return s_implName ;
}
//*************************************************************************
sal_Bool SAL_CALL ScriptRuntimeManager : : supportsService ( const OUString & serviceName )
2002-09-27 11:16:30 +00:00
throw ( RuntimeException )
2002-09-20 13:37:46 +00:00
{
OUString const * pNames = s_serviceNames . getConstArray ( ) ;
for ( sal_Int32 nPos = s_serviceNames . getLength ( ) ; nPos - - ; )
{
2002-09-27 11:16:30 +00:00
if ( serviceName . equals ( pNames [ nPos ] ) )
2002-09-20 13:37:46 +00:00
{
return sal_True ;
}
}
return sal_False ;
}
//*************************************************************************
2002-09-27 11:16:30 +00:00
Sequence < OUString > SAL_CALL ScriptRuntimeManager : : getSupportedServiceNames ( )
throw ( RuntimeException )
2002-09-20 13:37:46 +00:00
{
return s_serviceNames ;
}
//*************************************************************************
2002-09-27 11:16:30 +00:00
static Reference < XInterface > SAL_CALL srm_create (
2002-09-20 13:37:46 +00:00
const Reference < XComponentContext > & xCompC )
{
2002-09-27 11:16:30 +00:00
return ( cppu : : OWeakObject * ) new ScriptRuntimeManager ( xCompC ) ;
2002-09-20 13:37:46 +00:00
}
//*************************************************************************
2002-09-27 11:16:30 +00:00
static Sequence < OUString > srm_getSupportedServiceNames ( )
2002-09-20 13:37:46 +00:00
SAL_THROW ( ( ) )
{
return s_serviceNames ;
}
//*************************************************************************
2002-09-27 11:16:30 +00:00
static OUString srm_getImplementationName ( )
2002-09-20 13:37:46 +00:00
SAL_THROW ( ( ) )
{
return s_implName ;
}
//*************************************************************************
Reference < XInterface > SAL_CALL scriptnri_create (
Reference < XComponentContext > const & xComponentContext )
2002-09-27 11:16:30 +00:00
SAL_THROW ( ( Exception ) ) ;
2002-09-20 13:37:46 +00:00
//*************************************************************************
Sequence < OUString > scriptnri_getSupportedServiceNames ( ) SAL_THROW ( ( ) ) ;
//*************************************************************************
OUString scriptnri_getImplementationName ( ) SAL_THROW ( ( ) ) ;
2003-07-07 13:25:54 +00:00
//******************** ScriptStorageMangaer defines ***********************
Reference < XInterface > SAL_CALL ssm_create (
Reference < XComponentContext > const & xComponentContext )
SAL_THROW ( ( Exception ) ) ;
//*************************************************************************
Sequence < OUString > ssm_getSupportedServiceNames ( ) SAL_THROW ( ( ) ) ;
//*************************************************************************
OUString ssm_getImplementationName ( ) SAL_THROW ( ( ) ) ;
//*************************************************************************
//************ Script Provider defines ************************************
2003-07-23 13:05:13 +00:00
Reference < XInterface > SAL_CALL sp_create ( const Reference < XComponentContext > & xCompC ) ;
//******************** ScriptProvider defines ***************************
Sequence < OUString > sp_getSupportedServiceNames ( ) SAL_THROW ( ( ) ) ;
2003-07-07 13:25:54 +00:00
//*************************************************************************
2003-07-23 13:05:13 +00:00
OUString sp_getImplementationName ( ) SAL_THROW ( ( ) ) ;
2002-09-20 13:37:46 +00:00
//*************************************************************************
2003-07-07 13:25:54 +00:00
//************ ScriptStorage defines **************************************
Reference < XInterface > SAL_CALL ss_create ( const Reference < XComponentContext > & xCompC ) ;
2003-07-23 13:05:13 +00:00
//******************** ScriptProvider defines ***************************
2003-07-07 13:25:54 +00:00
Sequence < OUString > ss_getSupportedServiceNames ( ) SAL_THROW ( ( ) ) ;
//*************************************************************************
OUString ss_getImplementationName ( ) SAL_THROW ( ( ) ) ;
//*************************************************************************
2002-09-20 13:37:46 +00:00
static struct cppu : : ImplementationEntry s_entries [ ] =
{
{
srm_create , srm_getImplementationName ,
srm_getSupportedServiceNames , cppu : : createSingleComponentFactory ,
& s_moduleCount . modCnt , 0
} ,
{
scriptnri_create , scriptnri_getImplementationName ,
scriptnri_getSupportedServiceNames , cppu : : createSingleComponentFactory ,
& s_moduleCount . modCnt , 0
} ,
2003-07-07 13:25:54 +00:00
{
ssm_create , ssm_getImplementationName ,
ssm_getSupportedServiceNames , cppu : : createSingleComponentFactory ,
0 , 0
} ,
{
ss_create , ss_getImplementationName ,
ss_getSupportedServiceNames , cppu : : createSingleComponentFactory ,
0 , 0
} ,
{
2003-07-23 13:05:13 +00:00
sp_create , sp_getImplementationName ,
sp_getSupportedServiceNames , cppu : : createSingleComponentFactory ,
2003-07-07 13:25:54 +00:00
0 , 0
} ,
2002-09-20 13:37:46 +00:00
{ 0 , 0 , 0 , 0 , 0 , 0 }
} ;
} // Namespace
2002-09-27 11:16:30 +00:00
//#######################################################################################
//#### EXPORTED #########################################################################
//#######################################################################################
2002-09-20 13:37:46 +00:00
extern " C "
{
/**
* This function is called to get service factories for an implementation .
*
* @ param pImplName name of implementation
* @ param pServiceManager a service manager , need for component creation
2002-09-27 11:16:30 +00:00
* @ param pRegistryKey the registry key for this component , need for persistent
* data
2002-09-20 13:37:46 +00:00
* @ return a component factory
*/
2011-04-21 00:27:41 +02:00
SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( const sal_Char * pImplName ,
2002-09-27 11:16:30 +00:00
lang : : XMultiServiceFactory * pServiceManager ,
registry : : XRegistryKey * pRegistryKey )
2002-09-20 13:37:46 +00:00
{
2002-09-27 11:16:30 +00:00
return : : cppu : : component_getFactoryHelper ( pImplName , pServiceManager ,
pRegistryKey , : : scripting_runtimemgr : : s_entries ) ;
2002-09-20 13:37:46 +00:00
}
}
2010-10-12 15:53:47 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */