1*6df1ea1fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*6df1ea1fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*6df1ea1fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*6df1ea1fSAndrew Rist * distributed with this work for additional information 6*6df1ea1fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*6df1ea1fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*6df1ea1fSAndrew Rist * "License"); you may not use this file except in compliance 9*6df1ea1fSAndrew Rist * with the License. You may obtain a copy of the License at 10*6df1ea1fSAndrew Rist * 11*6df1ea1fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*6df1ea1fSAndrew Rist * 13*6df1ea1fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*6df1ea1fSAndrew Rist * software distributed under the License is distributed on an 15*6df1ea1fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*6df1ea1fSAndrew Rist * KIND, either express or implied. See the License for the 17*6df1ea1fSAndrew Rist * specific language governing permissions and limitations 18*6df1ea1fSAndrew Rist * under the License. 19*6df1ea1fSAndrew Rist * 20*6df1ea1fSAndrew Rist *************************************************************/ 21*6df1ea1fSAndrew Rist 22*6df1ea1fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _UCBSTORE_HXX 25cdf0e10cSrcweir #define _UCBSTORE_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 28cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 29cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 30cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp> 31cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 32cdf0e10cSrcweir #include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp> 33cdf0e10cSrcweir #include <com/sun/star/ucb/XPropertySetRegistry.hpp> 34cdf0e10cSrcweir #include <com/sun/star/ucb/XPersistentPropertySet.hpp> 35cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyContainer.hpp> 36cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp> 37cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyAccess.hpp> 38cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 39cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 40cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 41cdf0e10cSrcweir #include <ucbhelper/macros.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir //========================================================================= 44cdf0e10cSrcweir 45cdf0e10cSrcweir #define STORE_SERVICE_NAME "com.sun.star.ucb.Store" 46cdf0e10cSrcweir #define PROPSET_REG_SERVICE_NAME "com.sun.star.ucb.PropertySetRegistry" 47cdf0e10cSrcweir #define PERS_PROPSET_SERVICE_NAME "com.sun.star.ucb.PersistentPropertySet" 48cdf0e10cSrcweir 49cdf0e10cSrcweir //========================================================================= 50cdf0e10cSrcweir 51cdf0e10cSrcweir struct UcbStore_Impl; 52cdf0e10cSrcweir 53cdf0e10cSrcweir class UcbStore : 54cdf0e10cSrcweir public cppu::OWeakObject, 55cdf0e10cSrcweir public com::sun::star::lang::XTypeProvider, 56cdf0e10cSrcweir public com::sun::star::lang::XServiceInfo, 57cdf0e10cSrcweir public com::sun::star::ucb::XPropertySetRegistryFactory, 58cdf0e10cSrcweir public com::sun::star::lang::XInitialization 59cdf0e10cSrcweir { 60cdf0e10cSrcweir com::sun::star::uno::Reference< 61cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory > m_xSMgr; 62cdf0e10cSrcweir UcbStore_Impl* m_pImpl; 63cdf0e10cSrcweir 64cdf0e10cSrcweir public: 65cdf0e10cSrcweir UcbStore( 66cdf0e10cSrcweir const com::sun::star::uno::Reference< 67cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory >& rXSMgr ); 68cdf0e10cSrcweir virtual ~UcbStore(); 69cdf0e10cSrcweir 70cdf0e10cSrcweir // XInterface 71cdf0e10cSrcweir XINTERFACE_DECL() 72cdf0e10cSrcweir 73cdf0e10cSrcweir // XTypeProvider 74cdf0e10cSrcweir XTYPEPROVIDER_DECL() 75cdf0e10cSrcweir 76cdf0e10cSrcweir // XServiceInfo 77cdf0e10cSrcweir XSERVICEINFO_DECL() 78cdf0e10cSrcweir 79cdf0e10cSrcweir // XPropertySetRegistryFactory 80cdf0e10cSrcweir virtual com::sun::star::uno::Reference< 81cdf0e10cSrcweir com::sun::star::ucb::XPropertySetRegistry > SAL_CALL 82cdf0e10cSrcweir createPropertySetRegistry( const rtl::OUString& URL ) 83cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 84cdf0e10cSrcweir 85cdf0e10cSrcweir // XInitialization 86cdf0e10cSrcweir virtual void SAL_CALL 87cdf0e10cSrcweir initialize( const ::com::sun::star::uno::Sequence< 88cdf0e10cSrcweir ::com::sun::star::uno::Any >& aArguments ) 89cdf0e10cSrcweir throw( ::com::sun::star::uno::Exception, 90cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ); 91cdf0e10cSrcweir 92cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& 93cdf0e10cSrcweir getInitArgs() const; 94cdf0e10cSrcweir }; 95cdf0e10cSrcweir 96cdf0e10cSrcweir //========================================================================= 97cdf0e10cSrcweir 98cdf0e10cSrcweir struct PropertySetRegistry_Impl; 99cdf0e10cSrcweir class PersistentPropertySet; 100cdf0e10cSrcweir 101cdf0e10cSrcweir class PropertySetRegistry : 102cdf0e10cSrcweir public cppu::OWeakObject, 103cdf0e10cSrcweir public com::sun::star::lang::XTypeProvider, 104cdf0e10cSrcweir public com::sun::star::lang::XServiceInfo, 105cdf0e10cSrcweir public com::sun::star::ucb::XPropertySetRegistry, 106cdf0e10cSrcweir public com::sun::star::container::XNameAccess 107cdf0e10cSrcweir { 108cdf0e10cSrcweir friend class PersistentPropertySet; 109cdf0e10cSrcweir 110cdf0e10cSrcweir com::sun::star::uno::Reference< 111cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory > m_xSMgr; 112cdf0e10cSrcweir PropertySetRegistry_Impl* m_pImpl; 113cdf0e10cSrcweir 114cdf0e10cSrcweir private: 115cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > 116cdf0e10cSrcweir getConfigProvider(); 117cdf0e10cSrcweir 118cdf0e10cSrcweir void add ( PersistentPropertySet* pSet ); 119cdf0e10cSrcweir void remove( PersistentPropertySet* pSet ); 120cdf0e10cSrcweir 121cdf0e10cSrcweir void renamePropertySet( const rtl::OUString& rOldKey, 122cdf0e10cSrcweir const rtl::OUString& rNewKey ); 123cdf0e10cSrcweir 124cdf0e10cSrcweir public: 125cdf0e10cSrcweir PropertySetRegistry( 126cdf0e10cSrcweir const com::sun::star::uno::Reference< 127cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory >& rXSMgr, 128cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< 129cdf0e10cSrcweir ::com::sun::star::uno::Any >& rInitArgs); 130cdf0e10cSrcweir virtual ~PropertySetRegistry(); 131cdf0e10cSrcweir 132cdf0e10cSrcweir // XInterface 133cdf0e10cSrcweir XINTERFACE_DECL() 134cdf0e10cSrcweir 135cdf0e10cSrcweir // XTypeProvider 136cdf0e10cSrcweir XTYPEPROVIDER_DECL() 137cdf0e10cSrcweir 138cdf0e10cSrcweir // XServiceInfo 139cdf0e10cSrcweir XSERVICEINFO_NOFACTORY_DECL() 140cdf0e10cSrcweir 141cdf0e10cSrcweir // XPropertySetRegistry 142cdf0e10cSrcweir virtual com::sun::star::uno::Reference< 143cdf0e10cSrcweir com::sun::star::ucb::XPersistentPropertySet > SAL_CALL 144cdf0e10cSrcweir openPropertySet( const rtl::OUString& key, sal_Bool create ) 145cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 146cdf0e10cSrcweir virtual void SAL_CALL 147cdf0e10cSrcweir removePropertySet( const rtl::OUString& key ) 148cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 149cdf0e10cSrcweir 150cdf0e10cSrcweir // XElementAccess ( XNameAccess is derived from it ) 151cdf0e10cSrcweir virtual com::sun::star::uno::Type SAL_CALL 152cdf0e10cSrcweir getElementType() 153cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 154cdf0e10cSrcweir virtual sal_Bool SAL_CALL 155cdf0e10cSrcweir hasElements() 156cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 157cdf0e10cSrcweir 158cdf0e10cSrcweir // XNameAccess 159cdf0e10cSrcweir virtual com::sun::star::uno::Any SAL_CALL 160cdf0e10cSrcweir getByName( const rtl::OUString& aName ) 161cdf0e10cSrcweir throw( com::sun::star::container::NoSuchElementException, 162cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 163cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 164cdf0e10cSrcweir virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL 165cdf0e10cSrcweir getElementNames() 166cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 167cdf0e10cSrcweir virtual sal_Bool SAL_CALL 168cdf0e10cSrcweir hasByName( const rtl::OUString& aName ) 169cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 170cdf0e10cSrcweir 171cdf0e10cSrcweir // Non-interface methods 172cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 173cdf0e10cSrcweir getRootConfigReadAccess(); 174cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 175cdf0e10cSrcweir getConfigWriteAccess( const rtl::OUString& rPath ); 176cdf0e10cSrcweir }; 177cdf0e10cSrcweir 178cdf0e10cSrcweir //========================================================================= 179cdf0e10cSrcweir 180cdf0e10cSrcweir struct PersistentPropertySet_Impl; 181cdf0e10cSrcweir 182cdf0e10cSrcweir class PersistentPropertySet : 183cdf0e10cSrcweir public cppu::OWeakObject, 184cdf0e10cSrcweir public com::sun::star::lang::XTypeProvider, 185cdf0e10cSrcweir public com::sun::star::lang::XServiceInfo, 186cdf0e10cSrcweir public com::sun::star::lang::XComponent, 187cdf0e10cSrcweir public com::sun::star::ucb::XPersistentPropertySet, 188cdf0e10cSrcweir public com::sun::star::container::XNamed, 189cdf0e10cSrcweir public com::sun::star::beans::XPropertyContainer, 190cdf0e10cSrcweir public com::sun::star::beans::XPropertySetInfoChangeNotifier, 191cdf0e10cSrcweir public com::sun::star::beans::XPropertyAccess 192cdf0e10cSrcweir { 193cdf0e10cSrcweir com::sun::star::uno::Reference< 194cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory > m_xSMgr; 195cdf0e10cSrcweir PersistentPropertySet_Impl* m_pImpl; 196cdf0e10cSrcweir 197cdf0e10cSrcweir private: 198cdf0e10cSrcweir void notifyPropertyChangeEvent( 199cdf0e10cSrcweir const com::sun::star::beans::PropertyChangeEvent& rEvent ) const; 200cdf0e10cSrcweir void notifyPropertySetInfoChange( 201cdf0e10cSrcweir const com::sun::star::beans::PropertySetInfoChangeEvent& evt ) const; 202cdf0e10cSrcweir 203cdf0e10cSrcweir public: 204cdf0e10cSrcweir PersistentPropertySet( 205cdf0e10cSrcweir const com::sun::star::uno::Reference< 206cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory >& rXSMgr, 207cdf0e10cSrcweir PropertySetRegistry& rCreator, 208cdf0e10cSrcweir const rtl::OUString& rKey ); 209cdf0e10cSrcweir virtual ~PersistentPropertySet(); 210cdf0e10cSrcweir 211cdf0e10cSrcweir // XInterface 212cdf0e10cSrcweir XINTERFACE_DECL() 213cdf0e10cSrcweir 214cdf0e10cSrcweir // XTypeProvider 215cdf0e10cSrcweir XTYPEPROVIDER_DECL() 216cdf0e10cSrcweir 217cdf0e10cSrcweir // XServiceInfo 218cdf0e10cSrcweir XSERVICEINFO_NOFACTORY_DECL() 219cdf0e10cSrcweir 220cdf0e10cSrcweir // XComponent 221cdf0e10cSrcweir virtual void SAL_CALL 222cdf0e10cSrcweir dispose() 223cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 224cdf0e10cSrcweir virtual void SAL_CALL 225cdf0e10cSrcweir addEventListener( const com::sun::star::uno::Reference< 226cdf0e10cSrcweir com::sun::star::lang::XEventListener >& Listener ) 227cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 228cdf0e10cSrcweir virtual void SAL_CALL 229cdf0e10cSrcweir removeEventListener( const com::sun::star::uno::Reference< 230cdf0e10cSrcweir com::sun::star::lang::XEventListener >& Listener ) 231cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 232cdf0e10cSrcweir 233cdf0e10cSrcweir // XPropertySet 234cdf0e10cSrcweir virtual com::sun::star::uno::Reference< 235cdf0e10cSrcweir com::sun::star::beans::XPropertySetInfo > SAL_CALL 236cdf0e10cSrcweir getPropertySetInfo() 237cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 238cdf0e10cSrcweir virtual void SAL_CALL 239cdf0e10cSrcweir setPropertyValue( const rtl::OUString& aPropertyName, 240cdf0e10cSrcweir const com::sun::star::uno::Any& aValue ) 241cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 242cdf0e10cSrcweir com::sun::star::beans::PropertyVetoException, 243cdf0e10cSrcweir com::sun::star::lang::IllegalArgumentException, 244cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 245cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 246cdf0e10cSrcweir virtual com::sun::star::uno::Any SAL_CALL 247cdf0e10cSrcweir getPropertyValue( const rtl::OUString& PropertyName ) 248cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 249cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 250cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 251cdf0e10cSrcweir virtual void SAL_CALL 252cdf0e10cSrcweir addPropertyChangeListener( const rtl::OUString& aPropertyName, 253cdf0e10cSrcweir const com::sun::star::uno::Reference< 254cdf0e10cSrcweir com::sun::star::beans::XPropertyChangeListener >& xListener ) 255cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 256cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 257cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 258cdf0e10cSrcweir virtual void SAL_CALL 259cdf0e10cSrcweir removePropertyChangeListener( const rtl::OUString& aPropertyName, 260cdf0e10cSrcweir const com::sun::star::uno::Reference< 261cdf0e10cSrcweir com::sun::star::beans::XPropertyChangeListener >& aListener ) 262cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 263cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 264cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 265cdf0e10cSrcweir virtual void SAL_CALL 266cdf0e10cSrcweir addVetoableChangeListener( const rtl::OUString& PropertyName, 267cdf0e10cSrcweir const com::sun::star::uno::Reference< 268cdf0e10cSrcweir com::sun::star::beans::XVetoableChangeListener >& aListener ) 269cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 270cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 271cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 272cdf0e10cSrcweir virtual void SAL_CALL 273cdf0e10cSrcweir removeVetoableChangeListener( const rtl::OUString& PropertyName, 274cdf0e10cSrcweir const com::sun::star::uno::Reference< 275cdf0e10cSrcweir com::sun::star::beans::XVetoableChangeListener >& aListener ) 276cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 277cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 278cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 279cdf0e10cSrcweir 280cdf0e10cSrcweir // XPersistentPropertySet 281cdf0e10cSrcweir virtual com::sun::star::uno::Reference< 282cdf0e10cSrcweir com::sun::star::ucb::XPropertySetRegistry > SAL_CALL 283cdf0e10cSrcweir getRegistry() 284cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 285cdf0e10cSrcweir virtual rtl::OUString SAL_CALL 286cdf0e10cSrcweir getKey() 287cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 288cdf0e10cSrcweir 289cdf0e10cSrcweir // XNamed 290cdf0e10cSrcweir virtual rtl::OUString SAL_CALL 291cdf0e10cSrcweir getName() 292cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 293cdf0e10cSrcweir virtual void SAL_CALL 294cdf0e10cSrcweir setName( const ::rtl::OUString& aName ) 295cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 296cdf0e10cSrcweir 297cdf0e10cSrcweir // XPropertyContainer 298cdf0e10cSrcweir virtual void SAL_CALL 299cdf0e10cSrcweir addProperty( const rtl::OUString& Name, 300cdf0e10cSrcweir sal_Int16 Attributes, 301cdf0e10cSrcweir const com::sun::star::uno::Any& DefaultValue ) 302cdf0e10cSrcweir throw( com::sun::star::beans::PropertyExistException, 303cdf0e10cSrcweir com::sun::star::beans::IllegalTypeException, 304cdf0e10cSrcweir com::sun::star::lang::IllegalArgumentException, 305cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 306cdf0e10cSrcweir virtual void SAL_CALL 307cdf0e10cSrcweir removeProperty( const rtl::OUString& Name ) 308cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 309cdf0e10cSrcweir com::sun::star::beans::NotRemoveableException, 310cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 311cdf0e10cSrcweir 312cdf0e10cSrcweir // XPropertySetInfoChangeNotifier 313cdf0e10cSrcweir virtual void SAL_CALL 314cdf0e10cSrcweir addPropertySetInfoChangeListener( const com::sun::star::uno::Reference< 315cdf0e10cSrcweir com::sun::star::beans::XPropertySetInfoChangeListener >& Listener ) 316cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 317cdf0e10cSrcweir virtual void SAL_CALL 318cdf0e10cSrcweir removePropertySetInfoChangeListener( const com::sun::star::uno::Reference< 319cdf0e10cSrcweir com::sun::star::beans::XPropertySetInfoChangeListener >& Listener ) 320cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 321cdf0e10cSrcweir 322cdf0e10cSrcweir // XPropertyAccess 323cdf0e10cSrcweir virtual com::sun::star::uno::Sequence< 324cdf0e10cSrcweir com::sun::star::beans::PropertyValue > SAL_CALL 325cdf0e10cSrcweir getPropertyValues() 326cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 327cdf0e10cSrcweir virtual void SAL_CALL 328cdf0e10cSrcweir setPropertyValues( const com::sun::star::uno::Sequence< 329cdf0e10cSrcweir com::sun::star::beans::PropertyValue >& aProps ) 330cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 331cdf0e10cSrcweir com::sun::star::beans::PropertyVetoException, 332cdf0e10cSrcweir com::sun::star::lang::IllegalArgumentException, 333cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 334cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 335cdf0e10cSrcweir 336cdf0e10cSrcweir // Non-interface methods. 337cdf0e10cSrcweir PropertySetRegistry& getPropertySetRegistry(); 338cdf0e10cSrcweir const rtl::OUString& getFullKey(); 339cdf0e10cSrcweir }; 340cdf0e10cSrcweir 341cdf0e10cSrcweir #endif /* !_UCBSTORE_HXX */ 342