merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / misc / providerwrapper.hxx
blobf402552a09bcc1985f096ee644b4574a09b64cdc
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: providerwrapper.hxx,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
30 #ifndef CONFIGMGR_API_PROVIDERWRAPPER_HXX_
31 #define CONFIGMGR_API_PROVIDERWRAPPER_HXX_
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/beans/NamedValue.hpp>
36 #include <com/sun/star/uno/Sequence.hxx>
37 #include <cppuhelper/compbase2.hxx>
38 #include <osl/mutex.hxx>
40 namespace configmgr
42 //==========================================================================
43 namespace uno = com::sun::star::uno;
44 namespace lang = com::sun::star::lang;
45 //==========================================================================
46 //= ProviderWrapper
47 //==========================================================================
48 struct PWMutexHolder { osl::Mutex mutex; }; // ad hoc ...
50 class ProviderWrapper : private PWMutexHolder, public cppu::WeakComponentImplHelper2< lang::XMultiServiceFactory, lang::XServiceInfo >
52 private:
53 uno::Reference< lang::XMultiServiceFactory > m_xDelegate;
54 uno::Sequence< uno::Any > m_aDefaults;
55 private:
56 ProviderWrapper(uno::Reference< lang::XMultiServiceFactory > const & xDelegate, uno::Sequence< com::sun::star::beans::NamedValue > const & aPresets);
58 public:
59 static uno::Reference< uno::XInterface > create( uno::Reference< uno::XInterface > xDelegate, uno::Sequence< com::sun::star::beans::NamedValue > const & aPresets);
60 ~ProviderWrapper();
62 /// XMultiServiceFactory
63 virtual uno::Reference< uno::XInterface > SAL_CALL
64 createInstance( const rtl::OUString& aServiceSpecifier )
65 throw(uno::Exception, uno::RuntimeException);
67 virtual uno::Reference< uno::XInterface > SAL_CALL
68 createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments )
69 throw(uno::Exception, uno::RuntimeException);
71 virtual uno::Sequence< rtl::OUString > SAL_CALL
72 getAvailableServiceNames( )
73 throw(uno::RuntimeException);
75 /// XServiceInfo
76 virtual rtl::OUString SAL_CALL
77 getImplementationName( )
78 throw(uno::RuntimeException);
80 virtual sal_Bool SAL_CALL
81 supportsService( const ::rtl::OUString& ServiceName )
82 throw(uno::RuntimeException);
84 virtual uno::Sequence< rtl::OUString > SAL_CALL
85 getSupportedServiceNames( )
86 throw(uno::RuntimeException);
88 protected:
89 virtual void SAL_CALL disposing();
90 private:
91 uno::Reference< lang::XMultiServiceFactory > getDelegate();
92 uno::Reference<lang::XServiceInfo> getDelegateInfo();
93 uno::Sequence< uno::Any > patchArguments(uno::Sequence< uno::Any > const & aArgs) const;
97 } // namespace configmgr
99 #endif // CONFIGMGR_API_CONFPROVIDER2_HXX_