2002-09-20 13:37:46 +00:00
|
|
|
/*************************************************************************
|
2002-09-27 11:16:30 +00:00
|
|
|
*
|
|
|
|
* $RCSfile: ScriptStorageManager.cxx,v $
|
|
|
|
*
|
2002-10-23 13:22:05 +00:00
|
|
|
* $Revision: 1.8 $
|
2002-09-27 11:16:30 +00:00
|
|
|
*
|
2002-10-23 13:22:05 +00:00
|
|
|
* last change: $Author: dfoster $ $Date: 2002-10-23 14:22:03 $
|
2002-09-27 11:16:30 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* either of the following licenses
|
|
|
|
*
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
*
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2000 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library 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 for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
|
|
|
* =================================================
|
|
|
|
* The contents of this file are subject to the Sun Industry Standards
|
|
|
|
* Source License Version 1.1 (the "License"); You may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of the
|
|
|
|
* License at http://www.openoffice.org/license.html.
|
|
|
|
*
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
* obligations concerning the Software.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
2002-09-20 13:37:46 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <cppuhelper/implementationentry.hxx>
|
|
|
|
#include <sal/config.h>
|
|
|
|
|
|
|
|
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
|
|
|
|
#include <com/sun/star/util/XMacroExpander.hpp>
|
|
|
|
#include <com/sun/star/lang/XComponent.hpp>
|
|
|
|
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
|
2002-10-23 13:22:05 +00:00
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
2002-09-20 13:37:46 +00:00
|
|
|
|
|
|
|
#include "ScriptStorageManager.hxx"
|
|
|
|
#include <util/util.hxx>
|
2002-10-23 13:22:05 +00:00
|
|
|
#include <util/scriptingconstants.hxx>
|
2002-09-20 13:37:46 +00:00
|
|
|
|
|
|
|
using namespace ::rtl;
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::drafts::com::sun::star::script::framework;
|
|
|
|
|
|
|
|
namespace scripting_impl
|
|
|
|
{
|
|
|
|
|
2002-09-27 11:16:30 +00:00
|
|
|
static OUString s_implName =
|
|
|
|
::rtl::OUString::createFromAscii(
|
|
|
|
"drafts.com.sun.star.script.framework.storage.ScriptStorageManager" );
|
|
|
|
static OUString s_serviceName =
|
|
|
|
::rtl::OUString::createFromAscii(
|
|
|
|
"drafts.com.sun.star.script.framework.storage.ScriptStorageManager" );
|
2002-09-20 13:37:46 +00:00
|
|
|
static Sequence< OUString > s_serviceNames = Sequence< OUString >( &s_serviceName, 1 );
|
2002-09-27 11:16:30 +00:00
|
|
|
extern ::rtl_StandardModuleCount s_moduleCount = MODULE_COUNT_INIT;
|
2002-09-20 13:37:46 +00:00
|
|
|
|
|
|
|
//*************************************************************************
|
|
|
|
// ScriptStorageManager Constructor
|
2002-09-30 09:59:39 +00:00
|
|
|
ScriptStorageManager::ScriptStorageManager( const Reference<
|
|
|
|
XComponentContext > & xContext ) SAL_THROW ( ( RuntimeException ) )
|
2002-09-27 13:14:14 +00:00
|
|
|
: m_xContext( xContext ), m_count( 0 )
|
2002-09-20 13:37:46 +00:00
|
|
|
{
|
|
|
|
OSL_TRACE( "< ScriptStorageManager ctor called >\n" );
|
|
|
|
s_moduleCount.modCnt.acquire( &s_moduleCount.modCnt );
|
2002-09-27 11:16:30 +00:00
|
|
|
|
|
|
|
validateXRef( m_xContext, "ScriptStorageManager::ScriptStorageManager : cannot get component context" );
|
|
|
|
|
|
|
|
m_xMgr = m_xContext->getServiceManager();
|
|
|
|
validateXRef( m_xMgr, "ScriptStorageManager::ScriptStorageManager : cannot get service manager" );
|
|
|
|
|
2002-09-20 13:37:46 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
// obtain the macro expander singleton to use in determining the
|
|
|
|
// location of the application script storage
|
2002-09-27 11:16:30 +00:00
|
|
|
Any aAny = m_xContext->getValueByName( OUString::createFromAscii(
|
|
|
|
"/singletons/com.sun.star.util.theMacroExpander" ) );
|
2002-09-20 13:37:46 +00:00
|
|
|
Reference<util::XMacroExpander> xME;
|
2002-09-27 11:16:30 +00:00
|
|
|
if ( sal_False == ( aAny >>= xME ) )
|
|
|
|
{
|
|
|
|
throw RuntimeException(
|
|
|
|
OUSTR( "ScriptStorageManager::ScriptStorageManager: can't get XMacroExpander" ),
|
|
|
|
Reference< XInterface >() );
|
|
|
|
}
|
|
|
|
validateXRef( xME, "ScriptStorageManager constructor: can't get MacroExpander" );
|
|
|
|
|
|
|
|
OUString base = OUString::createFromAscii(
|
|
|
|
SAL_CONFIGFILE( "${$SYSBINDIR/bootstrap" ) );
|
|
|
|
|
|
|
|
setupAppStorage( xME,
|
|
|
|
base.concat( OUString::createFromAscii( "::BaseInstallation}/share" ) ) );
|
|
|
|
setupAppStorage( xME,
|
|
|
|
base.concat( OUString::createFromAscii( "::UserInstallation}/user" ) ) );
|
|
|
|
|
|
|
|
}
|
|
|
|
catch ( Exception & e )
|
|
|
|
{
|
|
|
|
throw RuntimeException( OUSTR( "ScriptStorageManager::ScriptStorageManager: " ) + e.Message, Reference< XInterface >() );
|
|
|
|
}
|
|
|
|
OSL_ASSERT( m_count == 2 );
|
|
|
|
}
|
|
|
|
|
|
|
|
//*************************************************************************
|
|
|
|
// ScriptStorageManager setupAppStorage
|
|
|
|
void
|
|
|
|
ScriptStorageManager::setupAppStorage(
|
|
|
|
const Reference<util::XMacroExpander> & xME,
|
|
|
|
const OUString & storageStr )
|
|
|
|
SAL_THROW ( ( RuntimeException ) )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference<XInterface> xInterface =
|
|
|
|
m_xMgr->createInstanceWithContext(
|
|
|
|
OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), m_xContext );
|
|
|
|
validateXRef( xInterface,
|
|
|
|
"ScriptStorageManager constructor: can't get SimpleFileAccess XInterface" );
|
|
|
|
Reference<ucb::XSimpleFileAccess> xSFA( xInterface, UNO_QUERY_THROW );
|
|
|
|
|
|
|
|
setupAnyStorage( xSFA, xME->expandMacros( storageStr ) );
|
|
|
|
}
|
|
|
|
catch ( Exception & e )
|
|
|
|
{
|
|
|
|
throw RuntimeException(
|
|
|
|
OUSTR( "ScriptStorageManager::setupAppStorage: " ).concat( e.Message ),
|
|
|
|
Reference< XInterface >() );
|
|
|
|
}
|
|
|
|
}
|
2002-09-20 13:37:46 +00:00
|
|
|
|
2002-09-27 11:16:30 +00:00
|
|
|
//*************************************************************************
|
|
|
|
// ScriptStorageManager setupAnyStorage
|
2002-10-17 09:04:15 +00:00
|
|
|
sal_Int32
|
2002-09-27 11:16:30 +00:00
|
|
|
ScriptStorageManager::setupAnyStorage(
|
|
|
|
const Reference< ucb::XSimpleFileAccess > & xSFA,
|
|
|
|
const OUString & storageStr )
|
|
|
|
SAL_THROW ( ( RuntimeException ) )
|
|
|
|
{
|
|
|
|
// Required for scope of fnc to protect all access read and writes to m_count
|
|
|
|
::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
|
|
|
|
try
|
|
|
|
{
|
2002-09-20 13:37:46 +00:00
|
|
|
|
|
|
|
// create a ScriptingStorage using the SimpleFileAccess, the storageID // (from the count), and the URL to the application's shared area
|
2002-09-27 11:16:30 +00:00
|
|
|
Sequence <Any> aArgs( 3 );
|
|
|
|
aArgs[ 0 ] <<= xSFA;
|
|
|
|
aArgs[ 1 ] <<= m_count;
|
|
|
|
aArgs[ 2 ] <<= storageStr;
|
|
|
|
|
2002-09-20 13:37:46 +00:00
|
|
|
#ifdef _DEBUG
|
|
|
|
|
2002-09-27 11:16:30 +00:00
|
|
|
fprintf( stderr, "creating storage for: %s\n",
|
|
|
|
::rtl::OUStringToOString(
|
|
|
|
storageStr, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
|
2002-09-20 13:37:46 +00:00
|
|
|
#endif
|
|
|
|
|
2002-09-27 11:16:30 +00:00
|
|
|
Reference<XInterface> xInterface =
|
|
|
|
m_xMgr->createInstanceWithArgumentsAndContext(
|
|
|
|
OUString::createFromAscii(
|
|
|
|
"drafts.com.sun.star.script.framework.storage.ScriptStorage" ),
|
|
|
|
aArgs, m_xContext );
|
2002-09-20 13:37:46 +00:00
|
|
|
|
2002-09-27 11:16:30 +00:00
|
|
|
validateXRef( xInterface, "ScriptStorageManager:: setupAnyStorage: Can't create ScriptStorage for share" );
|
2002-09-20 13:37:46 +00:00
|
|
|
|
2002-09-27 11:16:30 +00:00
|
|
|
// and place it in the hash_map. Increment the counter
|
|
|
|
m_ScriptStorageHash[ m_count++ ] = xInterface;
|
2002-09-20 13:37:46 +00:00
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
2002-09-27 11:16:30 +00:00
|
|
|
fprintf( stderr, "\tcreated with ID=%d\n", m_count - 1 );
|
2002-09-20 13:37:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
2002-09-27 11:16:30 +00:00
|
|
|
catch ( Exception & e )
|
2002-09-20 13:37:46 +00:00
|
|
|
{
|
2002-09-27 11:16:30 +00:00
|
|
|
throw RuntimeException(
|
|
|
|
OUSTR( "ScriptStorageManager::setupAnyStorage: " ).concat( e.Message ),
|
|
|
|
Reference< XInterface >() );
|
2002-09-20 13:37:46 +00:00
|
|
|
}
|
2002-09-27 11:16:30 +00:00
|
|
|
|
|
|
|
return m_count -1;
|
2002-09-20 13:37:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//*************************************************************************
|
|
|
|
// ScriptStorageManager Destructor
|
|
|
|
ScriptStorageManager::~ScriptStorageManager()
|
2002-09-27 11:16:30 +00:00
|
|
|
SAL_THROW ( () )
|
2002-09-20 13:37:46 +00:00
|
|
|
{
|
|
|
|
OSL_TRACE( "< ScriptStorageManager dtor called >\n" );
|
|
|
|
s_moduleCount.modCnt.release( &s_moduleCount.modCnt );
|
|
|
|
}
|
|
|
|
|
|
|
|
//*************************************************************************
|
|
|
|
// This method assumes that the XSimpleFileAccess knows it's on root URL
|
|
|
|
// and can be used with relative URLs
|
2002-10-17 09:04:15 +00:00
|
|
|
sal_Int32 SAL_CALL
|
2002-09-27 11:16:30 +00:00
|
|
|
ScriptStorageManager::createScriptStorage(
|
|
|
|
const Reference< ucb::XSimpleFileAccess >& xSFA )
|
|
|
|
throw ( RuntimeException )
|
2002-09-20 13:37:46 +00:00
|
|
|
{
|
2002-09-27 11:16:30 +00:00
|
|
|
OSL_TRACE( "** ==> ScriptStorageManager in createScriptingStorage\n" );
|
|
|
|
validateXRef( xSFA,
|
|
|
|
"ScriptStorageManager::createScriptStorage: XSimpleFileAccess is not valid" );
|
2002-09-20 13:37:46 +00:00
|
|
|
|
2002-09-27 11:16:30 +00:00
|
|
|
return setupAnyStorage( xSFA, ::rtl::OUString::createFromAscii( "" ) );
|
2002-09-20 13:37:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//*************************************************************************
|
2002-10-17 09:04:15 +00:00
|
|
|
sal_Int32 SAL_CALL
|
2002-09-27 11:16:30 +00:00
|
|
|
ScriptStorageManager::createScriptStorageWithURI(
|
|
|
|
const Reference< ucb::XSimpleFileAccess >& xSFA, const OUString & stringURI )
|
|
|
|
throw ( RuntimeException )
|
2002-09-20 13:37:46 +00:00
|
|
|
{
|
2002-09-27 11:16:30 +00:00
|
|
|
OSL_TRACE( "** ==> ScriptStorageManager in createScriptingStorageWithURI\n" );
|
|
|
|
validateXRef( xSFA, "ScriptStorageManager::createScriptStorage: XSimpleFileAccess is not valid" );
|
2002-09-20 13:37:46 +00:00
|
|
|
|
2002-09-27 11:16:30 +00:00
|
|
|
return setupAnyStorage( xSFA, stringURI );
|
2002-09-20 13:37:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//*************************************************************************
|
2002-09-27 11:16:30 +00:00
|
|
|
Reference <XInterface> SAL_CALL
|
2002-10-17 09:04:15 +00:00
|
|
|
ScriptStorageManager::getScriptStorage( sal_Int32 scriptStorageID )
|
2002-09-27 11:16:30 +00:00
|
|
|
throw( RuntimeException )
|
2002-09-20 13:37:46 +00:00
|
|
|
{
|
2002-09-27 11:16:30 +00:00
|
|
|
OSL_TRACE( "** ==> ScriptStorageManager in getStorageInstance\n" );
|
2002-10-17 09:04:15 +00:00
|
|
|
OSL_TRACE( "** ==> request for id=%d",scriptStorageID );
|
2002-09-27 11:16:30 +00:00
|
|
|
|
|
|
|
ScriptStorage_hash::const_iterator itr =
|
|
|
|
m_ScriptStorageHash.find( scriptStorageID );
|
|
|
|
|
|
|
|
if ( itr == m_ScriptStorageHash.end() )
|
|
|
|
{
|
|
|
|
throw RuntimeException(
|
|
|
|
OUSTR( "ScriptStorageManager::getScriptStorage: invalid storage ID" ),
|
|
|
|
Reference< XInterface >() );
|
|
|
|
}
|
|
|
|
validateXRef( itr->second,
|
|
|
|
"ScriptStorageManager::getScriptStorage: Cannot get ScriptStorage from ScriptStorageHash" );
|
|
|
|
return itr->second;
|
2002-09-20 13:37:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//*************************************************************************
|
2002-09-27 11:16:30 +00:00
|
|
|
OUString SAL_CALL
|
|
|
|
ScriptStorageManager::getImplementationName( )
|
|
|
|
throw( RuntimeException )
|
2002-09-20 13:37:46 +00:00
|
|
|
{
|
|
|
|
return s_implName;
|
|
|
|
}
|
|
|
|
|
|
|
|
//*************************************************************************
|
2002-09-27 11:16:30 +00:00
|
|
|
sal_Bool SAL_CALL
|
|
|
|
ScriptStorageManager::supportsService( const OUString& serviceName )
|
|
|
|
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
|
|
|
|
ScriptStorageManager::getSupportedServiceNames( )
|
|
|
|
throw( RuntimeException )
|
2002-09-20 13:37:46 +00:00
|
|
|
{
|
|
|
|
return s_serviceNames;
|
|
|
|
}
|
|
|
|
|
|
|
|
//*************************************************************************
|
2002-09-27 11:16:30 +00:00
|
|
|
void SAL_CALL
|
|
|
|
ScriptStorageManager::disposing( const ::com::sun::star::lang::EventObject& Source )
|
|
|
|
throw ( ::com::sun::star::uno::RuntimeException )
|
2002-09-20 13:37:46 +00:00
|
|
|
{
|
2002-09-27 11:16:30 +00:00
|
|
|
OSL_TRACE( "ScriptStorageManager::disposing started" );
|
2002-10-23 13:22:05 +00:00
|
|
|
Reference< beans::XPropertySet > xScriptingContext(Source.Source, UNO_QUERY );
|
|
|
|
validateXRef( xScriptingContext, "ScriptStorageManager::disposing can't get script context from EventObject" );
|
|
|
|
scripting_constants::ScriptingConstantsPool& scriptingConstantsPool =
|
|
|
|
scripting_constants::ScriptingConstantsPool::instance();
|
|
|
|
|
|
|
|
// get the scriptStorageID from the script context
|
|
|
|
Any a = xScriptingContext->getPropertyValue( scriptingConstantsPool.DOC_STORAGE_ID );
|
|
|
|
sal_Int32 scriptStorageID;
|
|
|
|
OSL_TRACE( "extracting sid");
|
|
|
|
if( sal_False == (a >>= scriptStorageID ) )
|
|
|
|
{
|
|
|
|
throw RuntimeException(
|
|
|
|
OUSTR( "ScriptStorageManager::disposing: can't get script context" ), Reference< XInterface > ());
|
|
|
|
}
|
|
|
|
if( scriptStorageID == -1 )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
OSL_TRACE( "disposing storageID = %d", scriptStorageID );
|
|
|
|
|
|
|
|
// attempt to get the storage from the hash to ensure that we have a
|
|
|
|
// valid storageID
|
|
|
|
ScriptStorage_hash::const_iterator itr =
|
|
|
|
m_ScriptStorageHash.find( scriptStorageID );
|
|
|
|
|
|
|
|
if ( itr == m_ScriptStorageHash.end() )
|
|
|
|
{
|
|
|
|
throw RuntimeException(
|
|
|
|
OUSTR( "ScriptStorageManager::disposing: attempt to dispose non-existent storage" ),
|
|
|
|
Reference< XInterface >() );
|
|
|
|
}
|
|
|
|
validateXRef( itr->second,
|
|
|
|
"ScriptStorageManager::getScriptStorage: Cannot get ScriptStorage from ScriptStorageHash" );
|
|
|
|
|
|
|
|
// erase the entry from the hash
|
|
|
|
m_ScriptStorageHash.erase( scriptStorageID );
|
2002-09-20 13:37:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//*************************************************************************
|
2002-09-27 11:16:30 +00:00
|
|
|
static Reference<XInterface> SAL_CALL
|
|
|
|
ssm_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 ScriptStorageManager( xCompC );
|
2002-09-20 13:37:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//*************************************************************************
|
2002-09-27 11:16:30 +00:00
|
|
|
static Sequence<OUString>
|
|
|
|
ssm_getSupportedServiceNames( )
|
2002-09-20 13:37:46 +00:00
|
|
|
SAL_THROW( () )
|
|
|
|
{
|
|
|
|
return s_serviceNames;
|
|
|
|
}
|
|
|
|
|
|
|
|
//*************************************************************************
|
2002-09-27 11:16:30 +00:00
|
|
|
static OUString
|
|
|
|
ssm_getImplementationName( )
|
2002-09-20 13:37:46 +00:00
|
|
|
SAL_THROW( () )
|
|
|
|
{
|
|
|
|
return s_implName;
|
|
|
|
}
|
|
|
|
//*************************************************************************
|
|
|
|
Reference<XInterface> SAL_CALL ss_create( const Reference< XComponentContext > & xCompC );
|
|
|
|
//*************************************************************************
|
2002-09-27 11:16:30 +00:00
|
|
|
Sequence<OUString> ss_getSupportedServiceNames( ) SAL_THROW( () );
|
2002-09-20 13:37:46 +00:00
|
|
|
//*************************************************************************
|
2002-09-27 11:16:30 +00:00
|
|
|
OUString ss_getImplementationName( ) SAL_THROW( () );
|
2002-09-20 13:37:46 +00:00
|
|
|
//*************************************************************************
|
|
|
|
Reference<XInterface> SAL_CALL si_create( const Reference< XComponentContext > & xCompC );
|
|
|
|
//*************************************************************************
|
2002-09-27 11:16:30 +00:00
|
|
|
Sequence<OUString> si_getSupportedServiceNames( ) SAL_THROW( () );
|
2002-09-20 13:37:46 +00:00
|
|
|
//*************************************************************************
|
2002-09-27 11:16:30 +00:00
|
|
|
OUString si_getImplementationName( ) SAL_THROW( () );
|
2002-09-20 13:37:46 +00:00
|
|
|
//*************************************************************************
|
|
|
|
static struct cppu::ImplementationEntry s_entries [] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ssm_create, ssm_getImplementationName,
|
|
|
|
ssm_getSupportedServiceNames, cppu::createSingleComponentFactory,
|
|
|
|
&s_moduleCount.modCnt, 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ss_create, ss_getImplementationName,
|
|
|
|
ss_getSupportedServiceNames, cppu::createSingleComponentFactory,
|
|
|
|
&s_moduleCount.modCnt, 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
si_create, si_getImplementationName,
|
|
|
|
si_getSupportedServiceNames, cppu::createSingleComponentFactory,
|
|
|
|
&s_moduleCount.modCnt, 0
|
|
|
|
},
|
|
|
|
{ 0, 0, 0, 0, 0, 0 }
|
|
|
|
};
|
|
|
|
} // Namespace
|
|
|
|
|
|
|
|
//##################################################################################################
|
|
|
|
//#### EXPORTED ####################################################################################
|
|
|
|
//##################################################################################################
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gives the environment this component belongs to.
|
|
|
|
*/
|
|
|
|
extern "C"
|
|
|
|
{
|
2002-09-27 11:16:30 +00:00
|
|
|
void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
|
2002-09-20 13:37:46 +00:00
|
|
|
{
|
|
|
|
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function creates an implementation section in the registry and another subkey
|
|
|
|
*
|
|
|
|
* for each supported service.
|
|
|
|
* @param pServiceManager the service manager
|
|
|
|
* @param pRegistryKey the registry key
|
|
|
|
*/
|
2002-09-27 11:16:30 +00:00
|
|
|
sal_Bool SAL_CALL component_writeInfo( 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_writeInfoHelper( pServiceManager, pRegistryKey, ::scripting_impl::s_entries );
|
2002-09-20 13:37:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
* @param pRegistryKey the registry key for this component, need for persistent data
|
|
|
|
* @return a component factory
|
|
|
|
*/
|
2002-09-27 11:16:30 +00:00
|
|
|
void * SAL_CALL component_getFactory( const sal_Char * pImplName, 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_impl::s_entries );
|
2002-09-20 13:37:46 +00:00
|
|
|
}
|
|
|
|
}
|