2002-05-22 03:21:01 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-07 21:55:54 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 21:55:54 -05:00
|
|
|
* $RCSfile: serviceinfohelper.hxx,v $
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 21:55:54 -05:00
|
|
|
* $Revision: 1.4 $
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 21:55:54 -05:00
|
|
|
* last change: $Author: rt $ $Date: 2005-09-08 03:55:54 $
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 21:55:54 -05:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
|
|
|
*
|
2005-09-07 21:55:54 -05:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 21:55:54 -05:00
|
|
|
* 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.
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 21:55:54 -05:00
|
|
|
* 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.
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
2005-09-07 21:55:54 -05:00
|
|
|
* 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
|
2002-05-22 03:21:01 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef CONFIGMGR_SERVICEINFOHELPER_HXX_
|
|
|
|
#define CONFIGMGR_SERVICEINFOHELPER_HXX_
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
|
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace configmgr
|
|
|
|
{
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
namespace uno = ::com::sun::star::uno;
|
|
|
|
namespace lang = ::com::sun::star::lang;
|
|
|
|
using ::rtl::OUString;
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
typedef sal_Char const * AsciiServiceName;
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2002-12-06 06:07:49 -06:00
|
|
|
/// POD struct describing the registration information of a service implementation
|
|
|
|
struct ServiceRegistrationInfo
|
2002-05-22 03:21:01 -05:00
|
|
|
{
|
2002-12-06 06:07:49 -06:00
|
|
|
/// The implementation name of this service implementation
|
2002-05-22 03:21:01 -05:00
|
|
|
AsciiServiceName implementationName;
|
2002-12-06 06:07:49 -06:00
|
|
|
/// The services for which this service implementation is registered
|
|
|
|
AsciiServiceName const * registeredServiceNames;
|
|
|
|
};
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/// POD struct describing the implementation information of a service implementation
|
|
|
|
struct ServiceImplementationInfo
|
|
|
|
{
|
|
|
|
/// The implementation name of this service implementation
|
|
|
|
AsciiServiceName implementationName;
|
|
|
|
/// The services for which this service implementation is registered
|
|
|
|
AsciiServiceName const * registeredServiceNames;
|
|
|
|
/// Additional services implemented by this service implementation, for which it is not registered
|
|
|
|
AsciiServiceName const * additionalServiceNames;
|
|
|
|
};
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// ServiceImplementationInfo has a compatible initial sequence with struct ServiceRegistrationInfo
|
|
|
|
|
|
|
|
inline
|
|
|
|
ServiceRegistrationInfo const *
|
|
|
|
getRegistrationInfo(ServiceImplementationInfo const * _info)
|
|
|
|
{
|
|
|
|
return reinterpret_cast<ServiceRegistrationInfo const *>(_info);
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/// POD struct describing the registration information of a singleton
|
|
|
|
struct SingletonRegistrationInfo
|
|
|
|
{
|
|
|
|
/// The name of this singleton
|
|
|
|
AsciiServiceName singletonName;
|
2003-03-19 09:20:19 -06:00
|
|
|
/// The implementation, which owns this singleton
|
|
|
|
AsciiServiceName implementationName;
|
|
|
|
/// The service, which should be instatiated for this singleton
|
2002-12-06 06:07:49 -06:00
|
|
|
AsciiServiceName instantiatedServiceName;
|
|
|
|
/// A name for a pseudo-implementation, which is mapped to this singleton
|
|
|
|
ServiceRegistrationInfo const * mappedImplementation;
|
|
|
|
};
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class ServiceRegistrationHelper
|
|
|
|
{
|
|
|
|
ServiceRegistrationInfo const*const m_info;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ServiceRegistrationHelper(ServiceRegistrationInfo const* _info)
|
|
|
|
: m_info(_info)
|
|
|
|
{}
|
|
|
|
|
|
|
|
ServiceRegistrationHelper(ServiceImplementationInfo const* _info)
|
|
|
|
: m_info(getRegistrationInfo(_info))
|
|
|
|
{}
|
|
|
|
|
|
|
|
sal_Int32 countServices() const;
|
|
|
|
|
|
|
|
OUString getImplementationName( ) const
|
|
|
|
throw(uno::RuntimeException);
|
|
|
|
|
|
|
|
uno::Sequence< OUString > getRegisteredServiceNames( ) const
|
|
|
|
throw(uno::RuntimeException);
|
2002-05-22 03:21:01 -05:00
|
|
|
};
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class ServiceInfoHelper
|
|
|
|
{
|
2002-12-06 06:07:49 -06:00
|
|
|
ServiceImplementationInfo const*const m_info;
|
2002-05-22 03:21:01 -05:00
|
|
|
|
|
|
|
public:
|
2002-12-06 06:07:49 -06:00
|
|
|
ServiceInfoHelper(ServiceImplementationInfo const* _info)
|
2002-05-22 03:21:01 -05:00
|
|
|
: m_info(_info)
|
|
|
|
{}
|
|
|
|
|
|
|
|
sal_Int32 countServices() const;
|
|
|
|
|
|
|
|
OUString getImplementationName( ) const
|
|
|
|
throw(uno::RuntimeException);
|
|
|
|
|
|
|
|
sal_Bool supportsService( OUString const & ServiceName ) const
|
|
|
|
throw(uno::RuntimeException);
|
|
|
|
|
|
|
|
uno::Sequence< OUString > getSupportedServiceNames( ) const
|
|
|
|
throw(uno::RuntimeException);
|
|
|
|
};
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
} // namespace configmgr
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|