merge the formfield patch from ooo-build
[ooovba.git] / offapi / com / sun / star / configuration / ConfigurationProvider.idl
blobb5515bdfe86124908347b58923f5ffc84c9694dd
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: ConfigurationProvider.idl,v $
10 * $Revision: 1.14 $
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 ************************************************************************/
30 #ifndef __com_sun_star_configuration_ConfigurationProvider_idl__
31 #define __com_sun_star_configuration_ConfigurationProvider_idl__
33 #ifndef __com_sun_star_lang_XMultiServiceFactory_idl__
34 #include <com/sun/star/lang/XMultiServiceFactory.idl>
35 #endif
37 #ifndef __com_sun_star_lang_XComponent_idl__
38 #include <com/sun/star/lang/XComponent.idl>
39 #endif
41 //=============================================================================
43 module com { module sun { module star { module configuration {
45 //=============================================================================
46 /** manages one, or more, complete sets of configuration data and serves as a
47 factory for objects that provide access to a subset of the configuration.
49 <p>An implementation is usually obtained from a
50 <type scope="com::sun::star::lang">ServiceManager</type>. The arguments passed to
51 <member scope="com::sun::star::lang">XMultiComponentFactory::createInstanceWithContextAndArguments()</member>
52 select the configuration data source. Arguments must be provided as
53 <type scope="com::sun::star::beans">NamedValue</type>
54 or <type scope="com::sun::star::beans">PropertyValue</type>.
55 If the parameters given are incomplete missing values are taken
56 from the context or the environment. If an instance already exists for the
57 given set of arguments, the existing instance may be reused.
58 In particular, instantiating a provider without explicit arguments to access
59 the default configuration data will always yield the same
60 <type scope="com::sun::star::configuration">DefaultProvider</type> object.
61 </p>
62 <p>Some arguments for
63 <member scope="com::sun::star::lang">XMultiServiceFactory::createInstanceWithArguments()</member>
64 may be given default values during creation of this service. In particular
65 this applies to the parameters <code>"Locale"</code> and <code>"EnableAsync"</code>.
66 </p>
68 published service ConfigurationProvider
70 /** allows creating access objects for specific views such as subsets and fragments
71 of the configuration.
73 <p>The parameter <var>aServiceSpecifier</var> passed to
74 <member scope="com::sun::star::lang">XMultiServiceFactory::createInstanceWithArguments()</member>
75 supports at least the service specifiers
76 <code>"com.sun.star.configuration.ConfigurationAccess"</code> and
77 <code>"com.sun.star.configuration.ConfigurationUpdateAccess"</code>.
78 </p>
80 <p>Using the first of these service specifiers requests a read-only view of
81 the configuration.
82 The object that is created implements service <type>ConfigurationAccess</type>.
83 To reflect its <em>element role</em> as root of the view, it implements
84 service <type>AccessRootElement</type>.
85 </p>
87 <p>Using the second form requests an updatable view of the configuration.
88 The object that is created should implement service
89 <type>ConfigurationUpdateAccess</type>. To reflect its <em>element role</em>
90 which includes controlling updates for the whole view, it implements
91 service <type>UpdateRootElement</type>.
92 <BR />If the root element of the view is marked read-only (as indicated
93 by <const scope="com::sun::star::beans">PropertyAttributes::READONLY</const>),
94 the implementation may either raise an exception or return a (read-only)
95 <type>ConfigurationAccess</type>/<type>AccessRootElement</type> instead.
96 </p>
98 <p>The arguments passed to
99 <member scope="com::sun::star::lang">XMultiServiceFactory::createInstanceWithArguments()</member>
100 in parameter <var>aArguments</var> specify the view of the configuration that
101 should be created. That is, they determine the subset of elements that can be
102 accessed starting from the returned object. Each element of the argument
103 sequence should be a <type scope="com::sun::star::beans">PropertyValue</type>
104 or a <type scope="com::sun::star::beans">NamedValue</type>,
105 so that the parameters can be identified by name rather than by position.
106 </p>
108 <p>What combinations of arguments are supported depends on the service name.
109 </p>
111 <p>With both of the standard service-specifiers above, an implementation must
112 accept a single argument named <code>nodepath</code> of type <atom>string</atom>.
113 This argument must contain the absolute path to an element of the
114 configuration. The view that is selected consists of the named element and
115 all its decendants.
116 </p>
118 <p>Other arguments can be used to control the behavior of the view. These
119 are different for different implementations. Whether and how they are used
120 may also depend on the configuration store and configuration that were
121 selected when the provider was created.
122 </p>
124 <p>An implementation must ignore unknown arguments.</p>
126 <p>Some parameters that are commonly supported are:</p>
128 <ul>
129 <li>
130 <strong>Selecting data into a view:</strong>
131 <dl>
132 <dt><code>"nodepath"</code> : <atom>string</atom></dt>
133 <dd>specifies the location of the view root in the configuration.</dd>
134 <dt><code>"depth"</code> : <atom>short</atom></dt>
135 <dd>specifies that elements of the hierarchy that are more than the given
136 number of nesting levels away from the root need not be included in the
137 view.
138 </dd>
139 <dt><code>"locale"</code> : <type scope="com::sun::star::lang">Locale</type></dt>
140 <dd>specifies the locale for which localized values should be
141 retrieved.
142 </dd>
143 </dl>
145 <p><strong>Example:</strong> In the hierarchy
146 <BR /><pre>
147 A - B1 - C1
149 - B2 - C2 (localized: de, en, fr, ..)
151 | - C3 - D1
152 | | |
153 | | - D2 - E1
154 | |
155 | - C4 - D3 - E2 - F1
156 | | |
157 | | - F2
159 | - C5
161 - B3
163 - B4 - C6 - D4 - E3
165 </pre>
166 <BR />selecting a view with <code>nodepath = "/A/B2"</code>,
167 <code>depth = 2</code> and <code>locale = &lt;Locale for en_US&gt;</code>
168 would result in the tree fragment
169 <BR /><pre>
170 (A-) B2 - C2 (en)
172 - C3 - D1
174 | - D2 (..)
176 - C4 - D3 (..)
178 - C5
180 </pre>
181 </p>
182 </li>
184 <li>
185 <strong>Controlling cache behavior:</strong> (with providers that
186 cache configuration data)
187 <dl>
188 <dt><code>"enableasync"</code> : <atom>boolean</atom></dt>
189 <dd>controls how updates are handled in the cache. If <TRUE/>, the
190 cache may operate in <em>write-back</em> mode, where updates at
191 first only affect the cache and are written to persistent storage
192 at some later time. If <FALSE/>, the cache must operate in
193 <em>write-through</em> mode, where updates are written to persistent
194 storage at once - that is before
195 <member scope="com::sun::star::util">XChangesBatch::commitChanges()</member>
196 returns.
197 <p><em>This parameter was formerly called <code>"lazywrite"</code>.
198 The old name should still be supported for compatibility.
199 </em></p>
200 </dd>
202 <dt><code>"nocache"</code> : <atom>boolean</atom></dt>
203 <dd>This deprecated parameter
204 specifies that data for the view is not taken from the cache, but
205 read directly from storage. This may entail that future changes that
206 become visible in the cache are not reflected in this view and that
207 changes done through this view are not reflected in the cache.
208 <BR /><strong>Use with caution !</strong>
209 <p><em>This parameter is not supported by all implementations and may be
210 silently ignored !
211 </em></p>
212 </dd>
213 </dl>
214 </li>
215 </ul>
217 <p><member scope="com::sun::star::lang">XMultiServiceFactory::createInstance()</member>
218 may be unusable. Only an implementation that supports service names that can be
219 used with no further arguments support this method. It should return the
220 same result as if
221 <member scope="com::sun::star::lang">XMultiServiceFactory::createInstanceWithArguments()</member>
222 had been called using an empty sequence of arguments.
223 </p>
225 interface com::sun::star::lang::XMultiServiceFactory;
228 /** allows controlling or observing the lifetime of the configuration.
230 <p>The owner of the provider may dispose of this object
231 using <member scope="com::sun::star::lang">XComponent::dispose()</member>.
232 Note that the default provider is owned by the
233 <type scope="com::sun::star::lang">ServiceManager</type> and should not be
234 disposed of by user code.
235 </p>
237 <p>Views created by the provider generally refer to data that is managed by
238 the provider. Therefore, disposing of the provider will cause all objects
239 belonging to these views to be disposed of as well. This does not apply to
240 <em>snapshot</em> views that have their own copy of the data, if available.
241 </p>
244 interface com::sun::star::lang::XComponent;
248 //=============================================================================
250 }; }; }; };
252 #endif