1*bae3752eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*bae3752eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*bae3752eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*bae3752eSAndrew Rist  * distributed with this work for additional information
6*bae3752eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*bae3752eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*bae3752eSAndrew Rist  * "License"); you may not use this file except in compliance
9*bae3752eSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*bae3752eSAndrew Rist  *
11*bae3752eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*bae3752eSAndrew Rist  *
13*bae3752eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*bae3752eSAndrew Rist  * software distributed under the License is distributed on an
15*bae3752eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*bae3752eSAndrew Rist  * KIND, either express or implied.  See the License for the
17*bae3752eSAndrew Rist  * specific language governing permissions and limitations
18*bae3752eSAndrew Rist  * under the License.
19*bae3752eSAndrew Rist  *
20*bae3752eSAndrew Rist  *************************************************************/
21*bae3752eSAndrew Rist 
22*bae3752eSAndrew Rist 
23cdf0e10cSrcweir #ifndef _UNOTOOLS_CONFIGNODE_HXX_
24cdf0e10cSrcweir #define _UNOTOOLS_CONFIGNODE_HXX_
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "unotools/unotoolsdllapi.h"
27cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
28cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
29cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31cdf0e10cSrcweir #include <com/sun/star/util/XChangesBatch.hpp>
32cdf0e10cSrcweir #include <unotools/eventlisteneradapter.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace comphelper
35cdf0e10cSrcweir {
36cdf0e10cSrcweir     class ComponentContext;
37cdf0e10cSrcweir }
38cdf0e10cSrcweir 
39cdf0e10cSrcweir //........................................................................
40cdf0e10cSrcweir namespace utl
41cdf0e10cSrcweir {
42cdf0e10cSrcweir //........................................................................
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 	//========================================================================
45cdf0e10cSrcweir 	//= OConfigurationNode
46cdf0e10cSrcweir 	//========================================================================
47cdf0e10cSrcweir 	class OConfigurationTreeRoot;
48cdf0e10cSrcweir 	/** a small wrapper around a configuration node.<p/>
49cdf0e10cSrcweir 		Nodes in the terminology used herein are <em>inner</em> nodes of a configuration
50cdf0e10cSrcweir 		tree, which means <em>no leafs</em>.
51cdf0e10cSrcweir 	*/
52cdf0e10cSrcweir 	class UNOTOOLS_DLLPUBLIC OConfigurationNode : public ::utl::OEventListenerAdapter
53cdf0e10cSrcweir 	{
54cdf0e10cSrcweir 	private:
55cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >
56cdf0e10cSrcweir 					m_xHierarchyAccess;		/// accessing children grandchildren (mandatory interface of our UNO object)
57cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
58cdf0e10cSrcweir 					m_xDirectAccess;		/// accessing children  (mandatory interface of our UNO object)
59cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace >
60cdf0e10cSrcweir 					m_xReplaceAccess;		/// replacing child values
61cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
62cdf0e10cSrcweir 					m_xContainerAccess;		/// modifying set nodes  (optional interface of our UNO object)
63cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
64cdf0e10cSrcweir 					m_xDummy;
65cdf0e10cSrcweir 		sal_Bool	m_bEscapeNames;			/// escape names before accessing children ?
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 		::rtl::OUString
68cdf0e10cSrcweir 					m_sCompletePath;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 		OConfigurationNode  insertNode(const ::rtl::OUString& _rName,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xNode) const throw();
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     protected:
73cdf0e10cSrcweir 		/// constructs a node object with an interface representing a node
74cdf0e10cSrcweir 		OConfigurationNode(
75cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxNode
76cdf0e10cSrcweir         );
77cdf0e10cSrcweir 
78cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >&
getUNONode() const79cdf0e10cSrcweir             getUNONode() const { return m_xDirectAccess; }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	public:
82cdf0e10cSrcweir 		/// constructs an empty and invalid node object
OConfigurationNode()83cdf0e10cSrcweir 		OConfigurationNode() :m_bEscapeNames(sal_False) { }
84cdf0e10cSrcweir 		/// copy ctor
85cdf0e10cSrcweir 		OConfigurationNode(const OConfigurationNode& _rSource);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 		/// assigment
88cdf0e10cSrcweir 		const OConfigurationNode& operator=(const OConfigurationNode& _rSource);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 		/// dtor
~OConfigurationNode()91cdf0e10cSrcweir 		~OConfigurationNode() {}
92cdf0e10cSrcweir 
93cdf0e10cSrcweir         /// returns the local name of the node
94cdf0e10cSrcweir         ::rtl::OUString     getLocalName() const;
95cdf0e10cSrcweir 
96cdf0e10cSrcweir         /// returns the fully qualified path of the node
97cdf0e10cSrcweir         ::rtl::OUString     getNodePath() const;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 		/** open a sub node
100cdf0e10cSrcweir 			@param		_rPath		access path of the to-be-opened sub node. May be a hierarchical path.
101cdf0e10cSrcweir 		*/
102cdf0e10cSrcweir 		OConfigurationNode	openNode(const ::rtl::OUString& _rPath) const throw();
103cdf0e10cSrcweir 
openNode(const sal_Char * _pAsciiPath) const104cdf0e10cSrcweir         OConfigurationNode	openNode( const sal_Char* _pAsciiPath ) const
105cdf0e10cSrcweir         {
106cdf0e10cSrcweir             return openNode( ::rtl::OUString::createFromAscii( _pAsciiPath ) );
107cdf0e10cSrcweir         }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 		/** create a new child node
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 			If the object represents a set node, this method may be used to create a new child. For non-set-nodes, the
112cdf0e10cSrcweir 			method will fail.<br/>
113cdf0e10cSrcweir 			Unless the respective operations on the pure configuration API, the to-be-created node immediately
114cdf0e10cSrcweir 			becomes a part of it's hierarchy, no explicit insertion is necessary.
115cdf0e10cSrcweir 			@param		_rName		name for the new child. Must be level-1-depth.
116cdf0e10cSrcweir 		*/
117cdf0e10cSrcweir 		OConfigurationNode	createNode(const ::rtl::OUString& _rName) const throw();
118cdf0e10cSrcweir 
createNode(const sal_Char * _pAsciiName) const119cdf0e10cSrcweir 		OConfigurationNode	createNode( const sal_Char* _pAsciiName ) const
120cdf0e10cSrcweir         {
121cdf0e10cSrcweir             return createNode( ::rtl::OUString::createFromAscii( _pAsciiName ) );
122cdf0e10cSrcweir         }
123cdf0e10cSrcweir 
124cdf0e10cSrcweir         /** appends a node under a new name
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 			If the object represents a set node, this method may be used to create a new child. For non-set-nodes, the
127cdf0e10cSrcweir 			method will fail.<br/>
128cdf0e10cSrcweir 			Unless the respective operations on the pure configuration API, the to-be-created node immediately
129cdf0e10cSrcweir 			becomes a part of it's hierarchy, no explicit insertion is necessary.
130cdf0e10cSrcweir 			@param		_rName		name for the new child. Must be level-1-depth.
131cdf0e10cSrcweir 			@param		_aNewNode	the node which should be appended
132cdf0e10cSrcweir 		*/
133cdf0e10cSrcweir 		OConfigurationNode  appendNode(const ::rtl::OUString& _rName,const OConfigurationNode& _aNewNode) const throw();
134cdf0e10cSrcweir 
appendNode(const sal_Char * _pAsciiName,const OConfigurationNode & _aNewNode) const135cdf0e10cSrcweir 		OConfigurationNode  appendNode( const sal_Char* _pAsciiName, const OConfigurationNode& _aNewNode ) const
136cdf0e10cSrcweir         {
137cdf0e10cSrcweir             return appendNode( ::rtl::OUString::createFromAscii( _pAsciiName ), _aNewNode );
138cdf0e10cSrcweir         }
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 		/** remove an existent child nod
141cdf0e10cSrcweir 
142cdf0e10cSrcweir             If the object represents a set node, this method may be used to delete an existent child. For non-set-nodes,
143cdf0e10cSrcweir 			the method will fail.
144cdf0e10cSrcweir 		*/
145cdf0e10cSrcweir 		sal_Bool			removeNode(const ::rtl::OUString& _rName) const throw();
146cdf0e10cSrcweir 
removeNode(const sal_Char * _pAsciiName) const147cdf0e10cSrcweir 		sal_Bool			removeNode( const sal_Char* _pAsciiName ) const
148cdf0e10cSrcweir         {
149cdf0e10cSrcweir             return removeNode( ::rtl::OUString::createFromAscii( _pAsciiName ) );
150cdf0e10cSrcweir         }
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 		/** retrieves the content of a descendant
153cdf0e10cSrcweir 
154cdf0e10cSrcweir             the returned value may contain anything from an interface (if <arg>_rPath</arg> refers to inner node of
155cdf0e10cSrcweir 			the configuration tree) to any explicit value (e.g. string, integer) or even void.<br/>
156cdf0e10cSrcweir 			Unfortunately, this implies that if a void value is returned, you won't have a clue if this means
157cdf0e10cSrcweir 			"the path does not exist" (besides the assertion made :), or if the value is really void.
158cdf0e10cSrcweir 		*/
159cdf0e10cSrcweir 		::com::sun::star::uno::Any
160cdf0e10cSrcweir 							getNodeValue(const ::rtl::OUString& _rPath) const throw();
161cdf0e10cSrcweir 
162cdf0e10cSrcweir         ::com::sun::star::uno::Any
getNodeValue(const sal_Char * _pAsciiPath) const163cdf0e10cSrcweir                             getNodeValue( const sal_Char* _pAsciiPath ) const
164cdf0e10cSrcweir         {
165cdf0e10cSrcweir             return getNodeValue( ::rtl::OUString::createFromAscii( _pAsciiPath ) );
166cdf0e10cSrcweir         }
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 		/** write a node value<p/>
169cdf0e10cSrcweir 			The value given is written into the node specified by the given relative path.<br/>
170cdf0e10cSrcweir 			In opposite to <method>getNodeValue</method>, _rName must refer to a leaf in the configuration tree, not an inner
171cdf0e10cSrcweir 			node.
172cdf0e10cSrcweir 			@return		sal_True if and only if the write was successfull.
173cdf0e10cSrcweir 		*/
174cdf0e10cSrcweir 		sal_Bool			setNodeValue(const ::rtl::OUString& _rPath, const ::com::sun::star::uno::Any& _rValue) const throw();
175cdf0e10cSrcweir 
setNodeValue(const sal_Char * _pAsciiPath,const::com::sun::star::uno::Any & _rValue) const176cdf0e10cSrcweir 		sal_Bool			setNodeValue( const sal_Char* _pAsciiPath, const ::com::sun::star::uno::Any& _rValue ) const
177cdf0e10cSrcweir         {
178cdf0e10cSrcweir             return setNodeValue( ::rtl::OUString::createFromAscii( _pAsciiPath ), _rValue );
179cdf0e10cSrcweir         }
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 		/// return the names of the existing children
182cdf0e10cSrcweir 		::com::sun::star::uno::Sequence< ::rtl::OUString >
183cdf0e10cSrcweir 							getNodeNames() const throw();
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 		/** enables or disables name escaping when accessing direct children<p/>
186cdf0e10cSrcweir 			Escaping is disabled by default, usually you enable it for set nodes (e.g. with calling setEscape(isSetNode)).
187cdf0e10cSrcweir 			Once escaping is enabled, you should not access indirect children (e.g. openNode("child/grandchild"), 'cause
188cdf0e10cSrcweir 			escaping for such names may not be supported by the underlying API objects.
189cdf0e10cSrcweir 			@see getEscape
190cdf0e10cSrcweir 		*/
191cdf0e10cSrcweir 		void		setEscape(sal_Bool _bEnable = sal_True);
192cdf0e10cSrcweir 		/** get the flag specifying the current escape behaviour
193cdf0e10cSrcweir 			@see setEscape
194cdf0e10cSrcweir 		*/
getEscape() const195cdf0e10cSrcweir 		sal_Bool	getEscape() const { return m_bEscapeNames; }
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 		/// invalidate the object
198cdf0e10cSrcweir 		virtual void clear() throw();
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 	    // -----------------------
201cdf0e10cSrcweir 	    // meta informations about the node
202cdf0e10cSrcweir 
203cdf0e10cSrcweir         /// checks whether or not the object represents a set node.
204cdf0e10cSrcweir 		sal_Bool isSetNode() const;
205cdf0e10cSrcweir 
206cdf0e10cSrcweir         /// checks whether or not a direct child with a given name exists
207cdf0e10cSrcweir 		sal_Bool hasByName(const ::rtl::OUString& _rName) const throw();
hasByName(const sal_Char * _pAsciiName) const208cdf0e10cSrcweir         sal_Bool hasByName( const sal_Char* _pAsciiName ) const { return hasByName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); }
209cdf0e10cSrcweir 
210cdf0e10cSrcweir         /// checks whether or not a descendent (no matter if direct or indirect) with the given name exists
211cdf0e10cSrcweir 		sal_Bool hasByHierarchicalName( const ::rtl::OUString& _rName ) const throw();
hasByHierarchicalName(const sal_Char * _pAsciiName) const212cdf0e10cSrcweir         sal_Bool hasByHierarchicalName( const sal_Char* _pAsciiName ) const { return hasByHierarchicalName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); }
213cdf0e10cSrcweir 
214cdf0e10cSrcweir         /// check if the objects represents a valid configuration node
isValid() const215cdf0e10cSrcweir 		sal_Bool isValid() const { return m_xHierarchyAccess.is(); }
216cdf0e10cSrcweir 
217cdf0e10cSrcweir         /// check whether the object is read-only of updatable
isReadonly() const218cdf0e10cSrcweir 		sal_Bool isReadonly() const { return !m_xReplaceAccess.is(); }
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 	protected:
221cdf0e10cSrcweir 		// OEventListenerAdapter
222cdf0e10cSrcweir 		virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource );
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 	protected:
225cdf0e10cSrcweir 		enum NAMEORIGIN
226cdf0e10cSrcweir 		{
227cdf0e10cSrcweir 			NO_CONFIGURATION,		/// the name came from a configuration node
228cdf0e10cSrcweir 			NO_CALLER				/// the name came from a client of this class
229cdf0e10cSrcweir 		};
230cdf0e10cSrcweir 		::rtl::OUString normalizeName(const ::rtl::OUString& _rName, NAMEORIGIN _eOrigin) const;
231cdf0e10cSrcweir 	};
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 	//========================================================================
234cdf0e10cSrcweir 	//= OConfigurationTreeRoot
235cdf0e10cSrcweir 	//========================================================================
236cdf0e10cSrcweir 	/** a specialized version of a OConfigurationNode, representing the root
237cdf0e10cSrcweir 		of a configuration sub tree<p/>
238cdf0e10cSrcweir 		Only this class is able to commit any changes made any any OConfigurationNode
239cdf0e10cSrcweir 		objects.
240cdf0e10cSrcweir 	*/
241cdf0e10cSrcweir 	class UNOTOOLS_DLLPUBLIC OConfigurationTreeRoot : public OConfigurationNode
242cdf0e10cSrcweir 	{
243cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >
244cdf0e10cSrcweir 								m_xCommitter;
245cdf0e10cSrcweir 	protected:
246cdf0e10cSrcweir 		/** ctor<p/>
247cdf0e10cSrcweir 		*/
248cdf0e10cSrcweir 		OConfigurationTreeRoot(
249cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >& _rxRootNode
250cdf0e10cSrcweir         );
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 		/** ctor for a readonly node
253cdf0e10cSrcweir 		*/
254cdf0e10cSrcweir 		OConfigurationTreeRoot(
255cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxRootNode
256cdf0e10cSrcweir         );
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 	public:
259cdf0e10cSrcweir 		/// modes to use when creating a top-level node object
260cdf0e10cSrcweir 		enum CREATION_MODE
261cdf0e10cSrcweir 		{
262cdf0e10cSrcweir             /// open the node (i.e. sub tree) for read access only
263cdf0e10cSrcweir             CM_READONLY,
264cdf0e10cSrcweir             /// open the node (i.e. sub tree) for read and write access, fall back to read-only if write access is not possible
265cdf0e10cSrcweir             CM_UPDATABLE
266cdf0e10cSrcweir 		};
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 	public:
269cdf0e10cSrcweir 		/** default ctor<p/>
270cdf0e10cSrcweir 			The object constructed here is invalid (i.e. <method>isValid</method> will return sal_False).
271cdf0e10cSrcweir 		*/
OConfigurationTreeRoot()272cdf0e10cSrcweir 		OConfigurationTreeRoot() :OConfigurationNode() { }
273cdf0e10cSrcweir 
274cdf0e10cSrcweir         /** creates a configuration tree for the given path in the given mode
275cdf0e10cSrcweir         */
276cdf0e10cSrcweir         OConfigurationTreeRoot(
277cdf0e10cSrcweir             const ::comphelper::ComponentContext& i_rContext,
278cdf0e10cSrcweir             const sal_Char* i_pAsciiNodePath,
279cdf0e10cSrcweir             const bool i_bUpdatable
280cdf0e10cSrcweir         );
281cdf0e10cSrcweir 
282cdf0e10cSrcweir         /** creates a configuration tree for the given path in the given mode
283cdf0e10cSrcweir         */
284cdf0e10cSrcweir         OConfigurationTreeRoot(
285cdf0e10cSrcweir             const ::comphelper::ComponentContext& i_rContext,
286cdf0e10cSrcweir             const ::rtl::OUString& i_rNodePath,
287cdf0e10cSrcweir             const bool i_bUpdatable
288cdf0e10cSrcweir         );
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 		/// copy ctor
OConfigurationTreeRoot(const OConfigurationTreeRoot & _rSource)291cdf0e10cSrcweir 		OConfigurationTreeRoot(const OConfigurationTreeRoot& _rSource)
292cdf0e10cSrcweir 			:OConfigurationNode(_rSource), m_xCommitter(_rSource.m_xCommitter) { }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 		/** open a new top-level configuration node
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 			opens a new node which is the root if an own configuration sub tree. This is what "top level" means: The
297cdf0e10cSrcweir 			node does not have a parent. It does not mean that the node represents a module tree (like org.openoffice.Office.Writer
298cdf0e10cSrcweir 			or such).<br/>
299cdf0e10cSrcweir 			In opposite to <method>createWithServiceFactory</method>, createWithProvider expects a configuration provider
300cdf0e10cSrcweir 			to work with.
301cdf0e10cSrcweir 
302cdf0e10cSrcweir             @param		_rxConfProvider	configuration provider to use when retrieving the node.
303cdf0e10cSrcweir 			@param		_rPath			path to the node the object should represent
304cdf0e10cSrcweir 			@param		_nDepth			depth for node retrieval
305cdf0e10cSrcweir 			@param		_eMode			specifies which privileges should be applied when retrieving the node
306cdf0e10cSrcweir 
307cdf0e10cSrcweir             @see	createWithServiceFactory
308cdf0e10cSrcweir 		*/
309cdf0e10cSrcweir 		static OConfigurationTreeRoot createWithProvider(
310cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxConfProvider,
311cdf0e10cSrcweir 			    const ::rtl::OUString& _rPath,
312cdf0e10cSrcweir                 sal_Int32 _nDepth = -1,
313cdf0e10cSrcweir                 CREATION_MODE _eMode = CM_UPDATABLE,
314cdf0e10cSrcweir                 sal_Bool _bLazyWrite = sal_True
315cdf0e10cSrcweir             );
316cdf0e10cSrcweir 
317cdf0e10cSrcweir 		/** open a new top-level configuration node<p/>
318cdf0e10cSrcweir 			opens a new node which is the root if an own configuration sub tree. This is what "top level" means: The
319cdf0e10cSrcweir 			node does not have a parent. It does not mean that the node represents a module tree (like org.openoffice.Office.Writer
320cdf0e10cSrcweir 			or such).<br/>
321cdf0e10cSrcweir 			In opposite to <method>createWithProvider</method>, createWithProvider expects a service factory. This factory
322cdf0e10cSrcweir 			is used to create a configuration provider, and this provider is used to retrieve the node
323cdf0e10cSrcweir 			@see	createWithProvider
324cdf0e10cSrcweir 			@param		_rxORB			service factory to use to create the configuration provider.
325cdf0e10cSrcweir 			@param		_rPath			path to the node the object should represent
326cdf0e10cSrcweir 			@param		_nDepth			depth for node retrieval
327cdf0e10cSrcweir 			@param		_eMode			specifies which privileges should be applied when retrieving the node
328cdf0e10cSrcweir 		*/
329cdf0e10cSrcweir 		static OConfigurationTreeRoot createWithServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
330cdf0e10cSrcweir 			const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_UPDATABLE, sal_Bool _bLazyWrite = sal_True);
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 		/** tolerant version of the <member>createWithServiceFactory</member>
333cdf0e10cSrcweir 
334cdf0e10cSrcweir 			<p>No assertions are thrown in case of an failure to initialize the configuration service, but once
335cdf0e10cSrcweir 			the configuration could be initialized, errors in the creation of the specific node (e.g. because the
336cdf0e10cSrcweir 			given node path does not exist) are still asserted.</p>
337cdf0e10cSrcweir 		*/
338cdf0e10cSrcweir 		static OConfigurationTreeRoot tryCreateWithServiceFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
339cdf0e10cSrcweir 			const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_UPDATABLE, sal_Bool _bLazyWrite = sal_True );
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 		/** commit all changes made on the subtree the object is the root for<p/>
342cdf0e10cSrcweir 			All changes made on any <type>OConfigurationNode</type> object retrieved (maybe indirect) from this root
343cdf0e10cSrcweir 			object are committed when calling this method.
344cdf0e10cSrcweir 			@return		sal_True if and only if the commit was successfull
345cdf0e10cSrcweir 		*/
346cdf0e10cSrcweir 		sal_Bool commit() const throw();
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 		/// invalidate the object
349cdf0e10cSrcweir 		virtual void clear() throw();
350cdf0e10cSrcweir 	};
351cdf0e10cSrcweir 
352cdf0e10cSrcweir //........................................................................
353cdf0e10cSrcweir }	// namespace utl
354cdf0e10cSrcweir //........................................................................
355cdf0e10cSrcweir 
356cdf0e10cSrcweir #endif // _UNOTOOLS_CONFIGNODE_HXX_
357cdf0e10cSrcweir 
358