1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: provider.hxx,v $
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_API_PROVIDER_HXX_
32 #define CONFIGMGR_API_PROVIDER_HXX_
34 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 #include <com/sun/star/lang/XLocalizable.hpp>
36 #include <com/sun/star/util/XRefreshable.hpp>
37 #include <com/sun/star/util/XFlushable.hpp>
38 #include <com/sun/star/uno/XComponentContext.hpp>
39 #ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HDL_
40 #include <com/sun/star/lang/IllegalArgumentException.hdl>
42 #include "confsvccomponent.hxx"
43 #include <rtl/ustring.hxx>
44 #include <vos/ref.hxx>
45 #include <cppuhelper/implbase4.hxx>
46 #include <comphelper/proparrhlp.hxx>
47 #include <comphelper/propertycontainer.hxx>
51 namespace css
= ::com::sun::star
;
52 namespace uno
= css::uno
;
53 namespace lang
= css::lang
;
54 namespace beans
= css::beans
;
55 namespace util
= css::util
;
61 //==========================================================================
63 //==========================================================================
64 /** Base class to receive access to the configuration data. A provider for configuration is
65 a factory for service which allow a readonly or update access to the configuration trees.
68 private ServiceComponentImpl
, private comphelper::OPropertyContainer
,
69 public comphelper::OPropertyArrayUsageHelper
< OProvider
>
70 // don't want to allow our derivees to access the mutex of ServiceComponentImpl
71 // (this helps to prevent deadlocks: The mutex of the base class is used by the OComponentHelper to
72 // protect addEvenetListener calls. Unfortunately these calls are made from within API object we create,
73 // too, which can lead do deadlocks ....)
74 , public cppu::ImplHelper4
< lang::XMultiServiceFactory
, lang::XLocalizable
, util::XRefreshable
, util::XFlushable
>
77 friend class OProviderDisposingListener
;
79 uno::Reference
< uno::XComponentContext
> m_xContext
;
80 uno::Reference
< lang::XEventListener
> m_xDisposeListener
;
81 OProviderImpl
* m_pImpl
;
82 uno::Sequence
< ::rtl::OUString
> m_aPrefetchNodes
;
83 sal_Bool m_bEnableAsync
;
86 // make ServiceComponentImpl allocation functions public
87 static void * SAL_CALL
operator new( size_t nSize
) throw()
88 { return ServiceComponentImpl::operator new( nSize
); }
89 static void SAL_CALL
operator delete( void * pMem
) throw()
90 { ServiceComponentImpl::operator delete( pMem
); }
92 OProvider(uno::Reference
< uno::XComponentContext
> const & xContext
, ServiceImplementationInfo
const* pInfo
);
95 void connect() throw (uno::Exception
);
98 virtual uno::Sequence
< uno::Type
> SAL_CALL
getTypes( ) throw(uno::RuntimeException
);
101 virtual void SAL_CALL
acquire() throw() { ServiceComponentImpl::acquire(); }
102 virtual void SAL_CALL
release() throw() { ServiceComponentImpl::release(); }
103 virtual uno::Any SAL_CALL
queryInterface(uno::Type
const& rType
) throw (uno::RuntimeException
);
106 virtual uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(uno::RuntimeException
);
108 /// XMultiServiceFactory
109 virtual uno::Reference
< uno::XInterface
> SAL_CALL
110 createInstance( const rtl::OUString
& aServiceSpecifier
)
111 throw(uno::Exception
, uno::RuntimeException
);
113 virtual uno::Reference
< uno::XInterface
> SAL_CALL
114 createInstanceWithArguments( const ::rtl::OUString
& ServiceSpecifier
, const uno::Sequence
< uno::Any
>& Arguments
)
115 throw(uno::Exception
, uno::RuntimeException
);
117 virtual uno::Sequence
< rtl::OUString
> SAL_CALL
118 getAvailableServiceNames( )
119 throw(uno::RuntimeException
);
122 virtual void SAL_CALL
123 setLocale( const lang::Locale
& eLocale
)
124 throw (uno::RuntimeException
);
126 virtual lang::Locale SAL_CALL
128 throw (uno::RuntimeException
);
132 virtual void SAL_CALL
134 throw (uno::RuntimeException
);
135 virtual void SAL_CALL
137 const uno::Reference
< util::XRefreshListener
>& aListener
)
138 throw (uno::RuntimeException
);
139 virtual void SAL_CALL
140 removeRefreshListener(
141 const uno::Reference
< util::XRefreshListener
>& aListener
)
142 throw (uno::RuntimeException
);
144 virtual void SAL_CALL
146 throw (uno::RuntimeException
);
147 virtual void SAL_CALL
149 const uno::Reference
< util::XFlushListener
>& aListener
)
150 throw (uno::RuntimeException
);
151 virtual void SAL_CALL
153 const uno::Reference
< util::XFlushListener
>& aListener
)
154 throw (uno::RuntimeException
);
157 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
158 sal_Int32 nHandle
, const uno::Any
& rValue
) throw (uno::Exception
);
160 static sal_Int32
countServices(ServiceRegistrationInfo
const* aInfo
) { return ServiceRegistrationHelper(aInfo
).countServices(); }
163 // creates a new session
164 void implConnect(OProviderImpl
& rFreshProviderImpl
, const ContextReader
& _rSettings
) throw (uno::Exception
);
166 // disambuiguated access
167 cppu::OBroadcastHelper
& getBroadcastHelper()
168 { return ServiceComponentImpl::rBHelper
; }
170 /// Component Helper override
171 virtual void SAL_CALL
disposing();
172 virtual void SAL_CALL
disposing(lang::EventObject
const& rEvt
) throw();
174 // OPropertyArrayUsageHelper
175 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const;
177 // OPropertySetHelper
178 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
180 // OPropertyContainer
181 void registerProperty(const rtl::OUString
& _rName
, sal_Int32 _nHandle
, sal_Int32 _nAttributes
,
182 void* _pPointerToMember
, const uno::Type
& _rMemberType
)
183 { OPropertyContainer::registerProperty(_rName
, _nHandle
, _nAttributes
, _pPointerToMember
, _rMemberType
);}
185 void describeProperties(uno::Sequence
< beans::Property
>& /* [out] */ _rProps
) const
186 { OPropertyContainer::describeProperties(_rProps
);}
189 uno::Any SAL_CALL
queryPropertyInterface(uno::Type
const& rType
) throw (uno::RuntimeException
)
190 { return OPropertyContainer::queryInterface(rType
);}
192 void attachToContext();
193 uno::Reference
< lang::XComponent
> releaseContext();
194 void discardContext(uno::Reference
< lang::XComponent
> const & xContext
);
197 } // namespace configmgr
199 #endif // CONFIGMGR_API_PROVIDER_HXX_