merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / inc / serviceinfohelper.hxx
blob1be7b1e2a2f6526e05e3feee5ff2198297ffe1b2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: serviceinfohelper.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef CONFIGMGR_SERVICEINFOHELPER_HXX_
32 #define CONFIGMGR_SERVICEINFOHELPER_HXX_
34 #include <com/sun/star/lang/XServiceInfo.hpp>
36 namespace configmgr
38 // -----------------------------------------------------------------------------
39 namespace uno = ::com::sun::star::uno;
40 namespace lang = ::com::sun::star::lang;
41 // -----------------------------------------------------------------------------
43 /// POD struct describing the registration information of a service implementation
44 struct ServiceRegistrationInfo
46 /// The implementation name of this service implementation
47 sal_Char const * implementationName;
48 /// The services for which this service implementation is registered
49 sal_Char const * const * registeredServiceNames;
51 // -----------------------------------------------------------------------------
53 /// POD struct describing the implementation information of a service implementation
54 struct ServiceImplementationInfo
56 /// The implementation name of this service implementation
57 sal_Char const * implementationName;
58 /// The services for which this service implementation is registered
59 sal_Char const * const * registeredServiceNames;
60 /// Additional services implemented by this service implementation, for which it is not registered
61 sal_Char const * const * additionalServiceNames;
63 // -----------------------------------------------------------------------------
65 // ServiceImplementationInfo has a compatible initial sequence with struct ServiceRegistrationInfo
67 inline
68 ServiceRegistrationInfo const *
69 getRegistrationInfo(ServiceImplementationInfo const * _info)
71 return reinterpret_cast<ServiceRegistrationInfo const *>(_info);
73 // -----------------------------------------------------------------------------
75 /// POD struct describing the registration information of a singleton
76 struct SingletonRegistrationInfo
78 /// The name of this singleton
79 sal_Char const * singletonName;
80 /// The implementation, which owns this singleton
81 sal_Char const * implementationName;
82 /// The service, which should be instatiated for this singleton
83 sal_Char const * instantiatedServiceName;
84 /// A name for a pseudo-implementation, which is mapped to this singleton
85 ServiceRegistrationInfo const * mappedImplementation;
87 // -----------------------------------------------------------------------------
89 class ServiceRegistrationHelper
91 ServiceRegistrationInfo const*const m_info;
93 public:
94 ServiceRegistrationHelper(ServiceRegistrationInfo const* _info)
95 : m_info(_info)
98 ServiceRegistrationHelper(ServiceImplementationInfo const* _info)
99 : m_info(getRegistrationInfo(_info))
102 sal_Int32 countServices() const;
104 rtl::OUString getImplementationName( ) const
105 throw(uno::RuntimeException);
107 uno::Sequence< rtl::OUString > getRegisteredServiceNames( ) const
108 throw(uno::RuntimeException);
110 // -----------------------------------------------------------------------------
112 class ServiceInfoHelper
114 ServiceImplementationInfo const*const m_info;
116 public:
117 ServiceInfoHelper(ServiceImplementationInfo const* _info)
118 : m_info(_info)
121 sal_Int32 countServices() const;
123 rtl::OUString getImplementationName( ) const
124 throw(uno::RuntimeException);
126 sal_Bool supportsService( rtl::OUString const & ServiceName ) const
127 throw(uno::RuntimeException);
129 uno::Sequence< rtl::OUString > getSupportedServiceNames( ) const
130 throw(uno::RuntimeException);
132 // -----------------------------------------------------------------------------
134 } // namespace configmgr
136 #endif