update dev300-m58
[ooovba.git] / ucb / source / core / ucbstore.hxx
blob3d9d0978d9c801e36010769ea7426c97c9ed6dee
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: ucbstore.hxx,v $
10 * $Revision: 1.7 $
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 _UCBSTORE_HXX
32 #define _UCBSTORE_HXX
34 #include <com/sun/star/lang/XTypeProvider.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37 #include <com/sun/star/container/XNamed.hpp>
38 #include <com/sun/star/container/XNameAccess.hpp>
39 #include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp>
40 #include <com/sun/star/ucb/XPropertySetRegistry.hpp>
41 #include <com/sun/star/ucb/XPersistentPropertySet.hpp>
42 #include <com/sun/star/beans/XPropertyContainer.hpp>
43 #include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp>
44 #include <com/sun/star/beans/XPropertyAccess.hpp>
45 #include <com/sun/star/lang/XComponent.hpp>
46 #include <com/sun/star/lang/XInitialization.hpp>
47 #include <cppuhelper/weak.hxx>
48 #include <ucbhelper/macros.hxx>
50 //=========================================================================
52 #define STORE_SERVICE_NAME "com.sun.star.ucb.Store"
53 #define PROPSET_REG_SERVICE_NAME "com.sun.star.ucb.PropertySetRegistry"
54 #define PERS_PROPSET_SERVICE_NAME "com.sun.star.ucb.PersistentPropertySet"
56 //=========================================================================
58 struct UcbStore_Impl;
60 class UcbStore :
61 public cppu::OWeakObject,
62 public com::sun::star::lang::XTypeProvider,
63 public com::sun::star::lang::XServiceInfo,
64 public com::sun::star::ucb::XPropertySetRegistryFactory,
65 public com::sun::star::lang::XInitialization
67 com::sun::star::uno::Reference<
68 com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
69 UcbStore_Impl* m_pImpl;
71 public:
72 UcbStore(
73 const com::sun::star::uno::Reference<
74 com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
75 virtual ~UcbStore();
77 // XInterface
78 XINTERFACE_DECL()
80 // XTypeProvider
81 XTYPEPROVIDER_DECL()
83 // XServiceInfo
84 XSERVICEINFO_DECL()
86 // XPropertySetRegistryFactory
87 virtual com::sun::star::uno::Reference<
88 com::sun::star::ucb::XPropertySetRegistry > SAL_CALL
89 createPropertySetRegistry( const rtl::OUString& URL )
90 throw( com::sun::star::uno::RuntimeException );
92 // XInitialization
93 virtual void SAL_CALL
94 initialize( const ::com::sun::star::uno::Sequence<
95 ::com::sun::star::uno::Any >& aArguments )
96 throw( ::com::sun::star::uno::Exception,
97 ::com::sun::star::uno::RuntimeException );
99 // New
100 void removeRegistry();
102 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
103 getInitArgs() const;
106 //=========================================================================
108 struct PropertySetRegistry_Impl;
109 class PersistentPropertySet;
111 class PropertySetRegistry :
112 public cppu::OWeakObject,
113 public com::sun::star::lang::XTypeProvider,
114 public com::sun::star::lang::XServiceInfo,
115 public com::sun::star::ucb::XPropertySetRegistry,
116 public com::sun::star::container::XNameAccess
118 friend class PersistentPropertySet;
120 com::sun::star::uno::Reference<
121 com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
122 PropertySetRegistry_Impl* m_pImpl;
124 private:
125 com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
126 getConfigProvider();
128 void add ( PersistentPropertySet* pSet );
129 void remove( PersistentPropertySet* pSet );
131 void renamePropertySet( const rtl::OUString& rOldKey,
132 const rtl::OUString& rNewKey );
134 public:
135 PropertySetRegistry(
136 const com::sun::star::uno::Reference<
137 com::sun::star::lang::XMultiServiceFactory >& rXSMgr,
138 UcbStore& rCreator );
139 virtual ~PropertySetRegistry();
141 // XInterface
142 XINTERFACE_DECL()
144 // XTypeProvider
145 XTYPEPROVIDER_DECL()
147 // XServiceInfo
148 XSERVICEINFO_NOFACTORY_DECL()
150 // XPropertySetRegistry
151 virtual com::sun::star::uno::Reference<
152 com::sun::star::ucb::XPersistentPropertySet > SAL_CALL
153 openPropertySet( const rtl::OUString& key, sal_Bool create )
154 throw( com::sun::star::uno::RuntimeException );
155 virtual void SAL_CALL
156 removePropertySet( const rtl::OUString& key )
157 throw( com::sun::star::uno::RuntimeException );
159 // XElementAccess ( XNameAccess is derived from it )
160 virtual com::sun::star::uno::Type SAL_CALL
161 getElementType()
162 throw( com::sun::star::uno::RuntimeException );
163 virtual sal_Bool SAL_CALL
164 hasElements()
165 throw( com::sun::star::uno::RuntimeException );
167 // XNameAccess
168 virtual com::sun::star::uno::Any SAL_CALL
169 getByName( const rtl::OUString& aName )
170 throw( com::sun::star::container::NoSuchElementException,
171 com::sun::star::lang::WrappedTargetException,
172 com::sun::star::uno::RuntimeException );
173 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
174 getElementNames()
175 throw( com::sun::star::uno::RuntimeException );
176 virtual sal_Bool SAL_CALL
177 hasByName( const rtl::OUString& aName )
178 throw( com::sun::star::uno::RuntimeException );
180 // Non-interface methods
181 com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
182 getRootConfigReadAccess();
183 com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
184 getConfigWriteAccess( const rtl::OUString& rPath );
187 //=========================================================================
189 struct PersistentPropertySet_Impl;
191 class PersistentPropertySet :
192 public cppu::OWeakObject,
193 public com::sun::star::lang::XTypeProvider,
194 public com::sun::star::lang::XServiceInfo,
195 public com::sun::star::lang::XComponent,
196 public com::sun::star::ucb::XPersistentPropertySet,
197 public com::sun::star::container::XNamed,
198 public com::sun::star::beans::XPropertyContainer,
199 public com::sun::star::beans::XPropertySetInfoChangeNotifier,
200 public com::sun::star::beans::XPropertyAccess
202 com::sun::star::uno::Reference<
203 com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
204 PersistentPropertySet_Impl* m_pImpl;
206 private:
207 void notifyPropertyChangeEvent(
208 const com::sun::star::beans::PropertyChangeEvent& rEvent ) const;
209 void notifyPropertySetInfoChange(
210 const com::sun::star::beans::PropertySetInfoChangeEvent& evt ) const;
212 public:
213 PersistentPropertySet(
214 const com::sun::star::uno::Reference<
215 com::sun::star::lang::XMultiServiceFactory >& rXSMgr,
216 PropertySetRegistry& rCreator,
217 const rtl::OUString& rKey );
218 virtual ~PersistentPropertySet();
220 // XInterface
221 XINTERFACE_DECL()
223 // XTypeProvider
224 XTYPEPROVIDER_DECL()
226 // XServiceInfo
227 XSERVICEINFO_NOFACTORY_DECL()
229 // XComponent
230 virtual void SAL_CALL
231 dispose()
232 throw( com::sun::star::uno::RuntimeException );
233 virtual void SAL_CALL
234 addEventListener( const com::sun::star::uno::Reference<
235 com::sun::star::lang::XEventListener >& Listener )
236 throw( com::sun::star::uno::RuntimeException );
237 virtual void SAL_CALL
238 removeEventListener( const com::sun::star::uno::Reference<
239 com::sun::star::lang::XEventListener >& Listener )
240 throw( com::sun::star::uno::RuntimeException );
242 // XPropertySet
243 virtual com::sun::star::uno::Reference<
244 com::sun::star::beans::XPropertySetInfo > SAL_CALL
245 getPropertySetInfo()
246 throw( com::sun::star::uno::RuntimeException );
247 virtual void SAL_CALL
248 setPropertyValue( const rtl::OUString& aPropertyName,
249 const com::sun::star::uno::Any& aValue )
250 throw( com::sun::star::beans::UnknownPropertyException,
251 com::sun::star::beans::PropertyVetoException,
252 com::sun::star::lang::IllegalArgumentException,
253 com::sun::star::lang::WrappedTargetException,
254 com::sun::star::uno::RuntimeException );
255 virtual com::sun::star::uno::Any SAL_CALL
256 getPropertyValue( const rtl::OUString& PropertyName )
257 throw( com::sun::star::beans::UnknownPropertyException,
258 com::sun::star::lang::WrappedTargetException,
259 com::sun::star::uno::RuntimeException );
260 virtual void SAL_CALL
261 addPropertyChangeListener( const rtl::OUString& aPropertyName,
262 const com::sun::star::uno::Reference<
263 com::sun::star::beans::XPropertyChangeListener >& xListener )
264 throw( com::sun::star::beans::UnknownPropertyException,
265 com::sun::star::lang::WrappedTargetException,
266 com::sun::star::uno::RuntimeException );
267 virtual void SAL_CALL
268 removePropertyChangeListener( const rtl::OUString& aPropertyName,
269 const com::sun::star::uno::Reference<
270 com::sun::star::beans::XPropertyChangeListener >& aListener )
271 throw( com::sun::star::beans::UnknownPropertyException,
272 com::sun::star::lang::WrappedTargetException,
273 com::sun::star::uno::RuntimeException );
274 virtual void SAL_CALL
275 addVetoableChangeListener( const rtl::OUString& PropertyName,
276 const com::sun::star::uno::Reference<
277 com::sun::star::beans::XVetoableChangeListener >& aListener )
278 throw( com::sun::star::beans::UnknownPropertyException,
279 com::sun::star::lang::WrappedTargetException,
280 com::sun::star::uno::RuntimeException );
281 virtual void SAL_CALL
282 removeVetoableChangeListener( const rtl::OUString& PropertyName,
283 const com::sun::star::uno::Reference<
284 com::sun::star::beans::XVetoableChangeListener >& aListener )
285 throw( com::sun::star::beans::UnknownPropertyException,
286 com::sun::star::lang::WrappedTargetException,
287 com::sun::star::uno::RuntimeException );
289 // XPersistentPropertySet
290 virtual com::sun::star::uno::Reference<
291 com::sun::star::ucb::XPropertySetRegistry > SAL_CALL
292 getRegistry()
293 throw( com::sun::star::uno::RuntimeException );
294 virtual rtl::OUString SAL_CALL
295 getKey()
296 throw( com::sun::star::uno::RuntimeException );
298 // XNamed
299 virtual rtl::OUString SAL_CALL
300 getName()
301 throw( ::com::sun::star::uno::RuntimeException );
302 virtual void SAL_CALL
303 setName( const ::rtl::OUString& aName )
304 throw( ::com::sun::star::uno::RuntimeException );
306 // XPropertyContainer
307 virtual void SAL_CALL
308 addProperty( const rtl::OUString& Name,
309 sal_Int16 Attributes,
310 const com::sun::star::uno::Any& DefaultValue )
311 throw( com::sun::star::beans::PropertyExistException,
312 com::sun::star::beans::IllegalTypeException,
313 com::sun::star::lang::IllegalArgumentException,
314 com::sun::star::uno::RuntimeException );
315 virtual void SAL_CALL
316 removeProperty( const rtl::OUString& Name )
317 throw( com::sun::star::beans::UnknownPropertyException,
318 com::sun::star::beans::NotRemoveableException,
319 com::sun::star::uno::RuntimeException );
321 // XPropertySetInfoChangeNotifier
322 virtual void SAL_CALL
323 addPropertySetInfoChangeListener( const com::sun::star::uno::Reference<
324 com::sun::star::beans::XPropertySetInfoChangeListener >& Listener )
325 throw( com::sun::star::uno::RuntimeException );
326 virtual void SAL_CALL
327 removePropertySetInfoChangeListener( const com::sun::star::uno::Reference<
328 com::sun::star::beans::XPropertySetInfoChangeListener >& Listener )
329 throw( com::sun::star::uno::RuntimeException );
331 // XPropertyAccess
332 virtual com::sun::star::uno::Sequence<
333 com::sun::star::beans::PropertyValue > SAL_CALL
334 getPropertyValues()
335 throw( com::sun::star::uno::RuntimeException );
336 virtual void SAL_CALL
337 setPropertyValues( const com::sun::star::uno::Sequence<
338 com::sun::star::beans::PropertyValue >& aProps )
339 throw( com::sun::star::beans::UnknownPropertyException,
340 com::sun::star::beans::PropertyVetoException,
341 com::sun::star::lang::IllegalArgumentException,
342 com::sun::star::lang::WrappedTargetException,
343 com::sun::star::uno::RuntimeException );
345 // Non-interface methods.
346 PropertySetRegistry& getPropertySetRegistry();
347 const rtl::OUString& getFullKey();
350 #endif /* !_UCBSTORE_HXX */