2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-06 17:28:37 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-16 11:28:29 +00:00
|
|
|
|
2014-01-31 04:53:17 -02:00
|
|
|
#include <cppuhelper/implbase1.hxx>
|
2004-05-19 07:28:34 +00:00
|
|
|
#include <cppuhelper/implementationentry.hxx>
|
|
|
|
#include <cppuhelper/exc_hlp.hxx>
|
2014-01-31 04:53:17 -02:00
|
|
|
#include <cppuhelper/factory.hxx>
|
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
|
|
|
#include <cppuhelper/weakref.hxx>
|
2004-05-19 07:28:34 +00:00
|
|
|
|
2014-04-14 15:51:37 +02:00
|
|
|
#include "MasterScriptProvider.hxx"
|
2004-05-19 07:28:34 +00:00
|
|
|
#include "MasterScriptProviderFactory.hxx"
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
2004-10-22 13:07:27 +00:00
|
|
|
using namespace ::com::sun::star::script;
|
2004-05-19 07:28:34 +00:00
|
|
|
|
|
|
|
namespace func_provider
|
|
|
|
{
|
|
|
|
|
|
|
|
MasterScriptProviderFactory::MasterScriptProviderFactory(
|
|
|
|
Reference< XComponentContext > const & xComponentContext )
|
2005-03-04 08:31:33 +00:00
|
|
|
: m_xComponentContext( xComponentContext )
|
2004-05-19 07:28:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
MasterScriptProviderFactory::~MasterScriptProviderFactory()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference< provider::XScriptProvider > SAL_CALL
|
2014-02-25 21:31:58 +01:00
|
|
|
MasterScriptProviderFactory::createScriptProvider( const Any& context ) throw ( lang::IllegalArgumentException, RuntimeException, std::exception)
|
2004-05-19 07:28:34 +00:00
|
|
|
{
|
2008-03-06 15:29:42 +00:00
|
|
|
Reference< provider::XScriptProvider > xMsp( getActiveMSPList() ->getMSPFromAnyContext( context ), UNO_QUERY_THROW );
|
2004-05-19 07:28:34 +00:00
|
|
|
return xMsp;
|
|
|
|
}
|
|
|
|
|
2005-03-04 08:31:33 +00:00
|
|
|
const rtl::Reference< ActiveMSPList > &
|
|
|
|
MasterScriptProviderFactory::getActiveMSPList() const
|
2004-12-23 10:50:28 +00:00
|
|
|
{
|
2005-03-04 08:31:33 +00:00
|
|
|
if ( !m_MSPList.is() )
|
2004-12-23 10:50:28 +00:00
|
|
|
{
|
|
|
|
::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
|
2005-03-04 08:31:33 +00:00
|
|
|
if ( !m_MSPList.is() )
|
2004-12-23 10:50:28 +00:00
|
|
|
m_MSPList = new ActiveMSPList( m_xComponentContext );
|
|
|
|
}
|
2005-03-04 08:31:33 +00:00
|
|
|
return m_MSPList;
|
2004-12-23 10:50:28 +00:00
|
|
|
}
|
|
|
|
|
2014-01-31 04:53:17 -02:00
|
|
|
Sequence< OUString > SAL_CALL mspf_getSupportedServiceNames( )
|
2004-05-19 07:28:34 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString str_name(
|
2012-06-02 20:19:28 -05:00
|
|
|
"com.sun.star.script.provider.MasterScriptProviderFactory");
|
2004-05-19 07:28:34 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
return Sequence< OUString >( &str_name, 1 );
|
2004-05-19 07:28:34 +00:00
|
|
|
}
|
|
|
|
|
2014-01-31 04:53:17 -02:00
|
|
|
OUString SAL_CALL mspf_getImplementationName( )
|
2004-05-19 07:28:34 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
return OUString(
|
2012-06-02 20:19:28 -05:00
|
|
|
"com.sun.star.script.provider.MasterScriptProviderFactory");
|
2004-05-19 07:28:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Reference< XInterface > SAL_CALL
|
|
|
|
mspf_create( Reference< XComponentContext > const & xComponentContext )
|
|
|
|
{
|
|
|
|
return static_cast< ::cppu::OWeakObject * >(
|
|
|
|
new MasterScriptProviderFactory( xComponentContext ) );
|
|
|
|
}
|
|
|
|
|
2014-01-31 04:53:17 -02:00
|
|
|
OUString SAL_CALL MasterScriptProviderFactory::getImplementationName()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (RuntimeException, std::exception)
|
2004-05-19 07:28:34 +00:00
|
|
|
{
|
|
|
|
return mspf_getImplementationName();
|
|
|
|
}
|
|
|
|
|
2014-01-31 04:53:17 -02:00
|
|
|
Sequence< OUString > SAL_CALL MasterScriptProviderFactory::getSupportedServiceNames()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (RuntimeException, std::exception)
|
2004-05-19 07:28:34 +00:00
|
|
|
{
|
|
|
|
return mspf_getSupportedServiceNames();
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool MasterScriptProviderFactory::supportsService(
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString const & serviceName )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (RuntimeException, std::exception)
|
2004-05-19 07:28:34 +00:00
|
|
|
{
|
2014-01-31 04:53:17 -02:00
|
|
|
return cppu::supportsService(this, serviceName);
|
2004-05-19 07:28:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace browsenodefactory
|
2010-10-12 15:53:47 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|