merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / api / confsvccomponent.cxx
bloba47cf2a7c129c352040185c0177ffc13cb1ad2fa
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: confsvccomponent.cxx,v $
10 * $Revision: 1.8 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_configmgr.hxx"
34 #include "confsvccomponent.hxx"
35 #include "datalock.hxx"
36 #include <com/sun/star/lang/DisposedException.hpp>
37 #include <cppuhelper/typeprovider.hxx>
38 #include <osl/mutex.hxx>
39 #include "utility.hxx"
41 #include <map>
43 namespace configmgr {
46 ServiceComponentImpl::ServiceComponentImpl(ServiceImplementationInfo const* aInfo)
47 : ::cppu::WeakComponentImplHelper1< lang::XServiceInfo >(UnoApiLock::getLock())
48 , m_info(aInfo)
52 void ServiceComponentImpl::disposing()
54 ::cppu::WeakComponentImplHelper1< lang::XServiceInfo >::disposing();
56 void ServiceComponentImpl::checkAlive() throw (uno::RuntimeException)
58 checkAlive("Object was disposed");
60 void ServiceComponentImpl::checkAlive(rtl::OUString const& sMessage) throw (uno::RuntimeException)
62 if (rBHelper.bDisposed)
63 throw lang::DisposedException(sMessage, *this);
66 // XTypeProvider
67 uno::Sequence<sal_Int8> ServiceComponentImpl::getStaticImplementationId(ServiceImplementationInfo const* pServiceInfo)
68 throw(uno::RuntimeException)
70 static osl::Mutex aMapMutex;
71 static std::map<ServiceImplementationInfo const*, ::cppu::OImplementationId> aIdMap;
73 osl::MutexGuard aMapGuard(aMapMutex);
74 return aIdMap[pServiceInfo].getImplementationId();
77 uno::Sequence<sal_Int8> SAL_CALL ServiceComponentImpl::getImplementationId()
78 throw(uno::RuntimeException)
80 return getStaticImplementationId(m_info);
83 // XServiceInfo
84 rtl::OUString SAL_CALL ServiceComponentImpl::getImplementationName( ) throw(uno::RuntimeException)
86 return ServiceInfoHelper(m_info).getImplementationName();
89 sal_Bool SAL_CALL ServiceComponentImpl::supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException)
91 return ServiceInfoHelper(m_info).supportsService( ServiceName );
94 uno::Sequence< rtl::OUString > SAL_CALL ServiceComponentImpl::getSupportedServiceNames( ) throw(uno::RuntimeException)
96 return ServiceInfoHelper(m_info).getSupportedServiceNames( );
99 //ServiceComponentImpl::
101 } // namespace configmgr