merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / registry / configregistry.hxx
bloba682c30787b33486ed224ba22e4f2de446425894
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: configregistry.hxx,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 #ifndef _CONFIGMGR_REGISTRY_CONFIGREGISTRY_HXX_
32 #define _CONFIGMGR_REGISTRY_CONFIGREGISTRY_HXX_
34 #include <cppuhelper/implbase2.hxx>
35 #include "confsvccomponent.hxx"
36 #include <com/sun/star/registry/XSimpleRegistry.hpp>
37 #include <com/sun/star/util/XFlushable.hpp>
38 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 #include <com/sun/star/util/XChangesBatch.hpp>
41 //..........................................................................
42 namespace configmgr
44 //..........................................................................
46 //==========================================================================
47 //= OConfigurationRegistry
48 //==========================================================================
49 /** an object implmenting the <service scope="com.sun.star.configuration">ConfigurationRegistry</service>
50 service.
52 class OConfigurationRegistry
53 :public ServiceComponentImpl
54 ,public cppu::ImplHelper2< com::sun::star::registry::XSimpleRegistry, com::sun::star::util::XFlushable >
56 public:
57 static const ServiceImplementationInfo s_aServiceInfo;
59 protected:
60 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
61 m_xORB; /// the service provider used for creating the instance
62 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
63 m_xConfigurationProvider; /// the configuration provider used for creating configuration accesses
65 ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey >
66 m_xRootKey; /// the root key for the registry-like configuration access
67 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
68 m_xSubtreeRoot; /// the root of the sub tree the object wraps
69 ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >
70 m_xUpdateRoot; /// the update access to the root of the sub tree, valid if opened for writing
71 ::rtl::OUString m_sLocation; /// URL of the configuration node we're representing, if any
74 public:
75 OConfigurationRegistry(
76 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rORB)
77 throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
79 // XInterface
80 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
81 virtual void SAL_CALL acquire( ) throw() { ServiceComponentImpl::acquire(); }
82 virtual void SAL_CALL release( ) throw() { ServiceComponentImpl::release(); }
84 // XTypeProvider
85 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
86 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
88 // XSimpleRegistry
89 virtual ::rtl::OUString SAL_CALL getURL() throw(::com::sun::star::uno::RuntimeException);
90 virtual void SAL_CALL open( const ::rtl::OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException);
91 virtual sal_Bool SAL_CALL isValid( ) throw(::com::sun::star::uno::RuntimeException);
92 virtual void SAL_CALL close( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException);
93 virtual void SAL_CALL destroy( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException);
94 virtual ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > SAL_CALL getRootKey( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException);
95 virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException);
96 virtual void SAL_CALL mergeKey( const ::rtl::OUString& aKeyName, const ::rtl::OUString& aUrl ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::MergeConflictException, ::com::sun::star::uno::RuntimeException);
98 // XFlushable
99 virtual void SAL_CALL flush( ) throw(::com::sun::star::uno::RuntimeException);
100 virtual void SAL_CALL addFlushListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushListener >& l ) throw(::com::sun::star::uno::RuntimeException);
101 virtual void SAL_CALL removeFlushListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushListener >& l ) throw(::com::sun::star::uno::RuntimeException);
103 protected:
104 virtual void SAL_CALL disposing();
105 /// translates the given URL into a nodepath which may be used with the configuration provider
106 ::rtl::OUString getNodePathFromURL(const ::rtl::OUString& _rURL);
108 void implCheckOpen() throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException);
110 sal_Bool implIsOpen()
111 throw (::com::sun::star::uno::RuntimeException);
115 //..........................................................................
116 } // namespace configmgr
117 //..........................................................................
119 #endif // _CONFIGMGR_REGISTRY_CONFIGREGISTRY_HXX_