1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef __com_sun_star_inspection_XPropertyHandler_idl__
20 #define __com_sun_star_inspection_XPropertyHandler_idl__
22 #include
<com
/sun
/star
/beans
/PropertyState.idl
>
23 #include
<com
/sun
/star
/beans
/Property.idl
>
24 #include
<com
/sun
/star
/beans
/XPropertyChangeListener.idl
>
25 #include
<com
/sun
/star
/inspection
/LineDescriptor.idl
>
26 #include
<com
/sun
/star
/lang
/NullPointerException.idl
>
27 #include
<com
/sun
/star
/beans
/UnknownPropertyException.idl
>
28 #include
<com
/sun
/star
/beans
/PropertyVetoException.idl
>
29 #include
<com
/sun
/star
/lang
/XComponent.idl
>
30 #include
<com
/sun
/star
/inspection
/InteractiveSelectionResult.idl
>
32 module com
{ module sun
{ module star
{ module inspection
{
34 interface XObjectInspectorUI
;
35 interface XPropertyControlFactory
;
37 /** is the basic interface for object inspection.
39 <p>The ObjectInspector itself does not know anything about the object
40 it is inspecting, all information is obtained via XPropertyHandlers.
41 Also, property handlers are responsible for describing the user interface which should
42 be used to interact with the user, with respect to a given aspect of the inspected
50 interface XPropertyHandler
52 /** used for controlling resources acquired by the handler
54 <p>com::sun::star::lang::XComponent::dispose() is invoked when the property handler is not
55 needed by the object inspector anymore. Handler implementations should clean up any
58 interface com
::sun
::star
::lang
::XComponent
;
60 /** binds the property handler to a new component
62 the component to inspect. Must not be `NULL`
63 @throws com::sun::star::lang::NullPointerException
64 if the component is `NULL`
66 void inspect
( [in] com
::sun
::star
::uno
::XInterface Component
)
67 raises
( com
::sun
::star
::lang
::NullPointerException
);
69 /** retrieves the current value of a property
71 the name of the property whose value is to be retrieved
72 @throws com::sun::star::beans::UnknownPropertyException
73 if the given property is not supported by the property handler
76 getPropertyValue
( [in] string PropertyName
)
77 raises
(::com
::sun
::star
::beans
::UnknownPropertyException
);
79 /** sets the value of a property
82 the name of the property whose value is to be set
84 the property value to set
85 @throws com::sun::star::beans::UnknownPropertyException
86 if the given property is not supported by the property handler
89 setPropertyValue
( [in] string PropertyName
, [in] any Value
)
90 raises
(::com
::sun
::star
::beans
::UnknownPropertyException
,
91 ::com
::sun
::star
::beans
::PropertyVetoException
);
93 /** returns the state of a property
96 the name of the property whose state is to be retrieved
97 @throws com::sun::star::beans::UnknownPropertyException
98 if the given property is not supported by the property handler
100 com
::sun
::star
::beans
::PropertyState
101 getPropertyState
( [in] string PropertyName
)
102 raises
(::com
::sun
::star
::beans
::UnknownPropertyException
);
104 /** describes the UI to be used to represent the property
106 the name of the property whose user interface is to be described
108 @param ControlFactory
109 a factory for creating XPropertyControl instances. Must not be `NULL`.
111 the descriptor of the property line.
112 @throws com::sun::star::beans::UnknownPropertyException
113 if the given property is not supported by this handler
114 @throws com::sun::star::lang::NullPointerException
115 if ControlFactory is `NULL`.
116 @see PropertyControlType
120 describePropertyLine
(
121 [in] string PropertyName
,
122 [in] XPropertyControlFactory ControlFactory
124 raises
(::com
::sun
::star
::beans
::UnknownPropertyException
, ::com
::sun
::star
::lang
::NullPointerException
);
126 /** converts a given control-compatible value to a property value
128 <p>In describePropertyLine(), a property handler declared which type of control
129 should be used to display the value of a certain property. To allow to use the same control
130 type for different properties, and in particular, for properties of different type,
131 conversions between controls values and property values are needed.</p>
133 <p>This method converts a control value into a property value, which subsequently can be used
134 in conjunction with setPropertyValue().</p>
137 The name of the conversion's target property.
139 The to-be-converted control value. This value has been obtained from an XPropertyControl,
140 using its XPropertyControl::Value attribute.
142 @throws com::sun::star::beans::UnknownPropertyException
143 if the given property is not supported by the property handler
145 @see convertToControlValue
146 @see describePropertyLine
147 @see XPropertyControl
148 @see getPropertyValue
151 convertToPropertyValue
(
152 [in] string PropertyName
,
153 [in] any ControlValue
155 raises
(::com
::sun
::star
::beans
::UnknownPropertyException
);
157 /** converts a given property value to a control-compatible value
159 <p>In describePropertyLine(), a property handler declared which type of control
160 should be used to display the value of a certain property. To allow to use the same control
161 type for different properties, and in particular, for properties of different type,
162 conversions between controls values and property values are needed.</p>
164 <p>This method converts a property value, which has previously been obtained using
165 getPropertyValue(), into a control-compatible value, which can be used
166 with XPropertyControl's XPropertyControl::Value attribute.</p>
168 <p>A usual application of this method are list boxes: There is a generic list box implementation,
169 which is able to display a simple list of strings. Usually, every string represents one
170 possible property value. To translate between those property values and the displayed strings,
171 convertToControlValue() and convertToPropertyValue() are used.</p>
173 <p>The method is not invoked if the control's value type (XPropertyControl::ValueType
174 equals the property's value type.</p>
177 The name of the property whose value is to be converted.
179 The to-be-converted property value.
180 @param ControlValueType
181 The target type of the conversion. This type is determined by the control which
182 is used to display the property, which in turn is determined by the handler itself
183 in describePropertyLine().<br/>
184 Speaking strictly, this is passed for convenience only, since every XPropertyHandler
185 implementation should know exactly which type to expect, since it implicitly determined this type
186 in describePropertyLine() by creating an appropriate XPropertyControl.
188 @throws com::sun::star::beans::UnknownPropertyException
189 if the given property is not supported by the property handler
191 @see convertToPropertyValue
192 @see describePropertyLine
193 @see XPropertyControl
194 @see getPropertyValue
197 convertToControlValue
(
198 [in] string PropertyName
,
199 [in] any PropertyValue
,
200 [in] type ControlValueType
202 raises
(::com
::sun
::star
::beans
::UnknownPropertyException
);
204 /** registers a listener for notification about property value changes
206 <p>An XPropertyHandler implementation might decide to ignore this call.
207 However, in this case property value changes made by third party components are not
208 reflected in the object inspector.</p>
210 <p>If a handler implementation supports property change listeners, it must be able to cope
211 with a call to addPropertyChangeListener() even if currently no component is
212 being inspected. In this case, the listener must become active as soon as a new introspection
213 is set in the next inspect() call.</p>
216 the listener to notify about property changes
217 @throws com::sun::star::lang::NullPointerException
218 if the listener is `NULL`
219 @see removePropertyChangeListener
222 addPropertyChangeListener
( [in] com
::sun
::star
::beans
::XPropertyChangeListener Listener
)
223 raises
( com
::sun
::star
::lang
::NullPointerException
);
225 /** revokes a listener for notification about property value changes
226 @see addPropertyChangeListener
229 removePropertyChangeListener
( [in] com
::sun
::star
::beans
::XPropertyChangeListener Listener
);
231 /** returns the properties which the handler can handle
233 <p>A handler is allowed to return an empty sequence here, indicating that for
234 the given introspection, no properties handling can be provided. This might happen
235 when a fixed set of property handlers is used for a variety of components to inspect,
236 where not all handlers can really cope with all components.</p>
238 <p>In the case of returning an empty sequence here, the property handler is ignored
239 by all further processing in the object inspector.</p>
241 sequence
< com
::sun
::star
::beans
::Property
>
242 getSupportedProperties
();
244 /** returns the properties which are to be superseded by this handler
246 <p>Besides defining an own set of properties (see getSupportedProperties()),
247 a property handler can also declare that foreign properties (which it is
248 <em>not</em> responsible for) are superseded by its own properties.</p>
250 <p>This is usually used if your handler is used with another, more generic one, which
251 should continue to be responsible for all properties, except a few which your
252 handler handles more elegantly.</p>
254 <p>In such a case, simply return those properties here.</p>
256 <p>There is a precedence in the property handlers used by an ObjectInspector,
257 which also is important for the superseded properties. This precedence is implied by the
258 precedence of factories to create the property handlers, as denoted in the
259 XObjectInspectorModel::HandlerFactories attribute.</p>
261 <p>With this in mind, property handlers can only supersede properties which are supported
262 by a handler preceding them, but not properties of handlers succeeding them.</p>
264 <p>For instance, imaging an XObjectInspectorModel which provides three
265 factories, for handler <code>A</code>, <code>B</code>, and <code>C</code> - in this order.
266 Now if <code>A</code> supports the property <code>Foo</code>, <code>C</code> supports
267 <code>Bar</code>, and <code>B</code> supersedes both <code>Foo</code> and <code>Bar</code>,
268 them the result is <code>Bar</code> is still present. This is because <code>B</code> precedes
269 <code>C</code>, so it cannot, by definition, supersede properties which are supported by
272 <p>If getSupportedProperties() returned an empty sequence, this method will
275 @see XObjectInspectorModel::HandlerFactories
278 getSupersededProperties
( );
280 /** retrieve the actuating properties which this handler is interested in
282 <p>In general, properties can be declared as "actuating", that is, when their value
283 changes, the UI for other properties needs to be updated (e.g. enabled or disabled).</p>
285 <p>With this method, a handler can declare that it feels responsible for some/all
286 of the depending properties of certain actuating properties.</p>
288 <p>Whenever the value of an actuating property changes, all handlers which expressed
289 their interest in this particular actuating properties are called with their
290 actuatingPropertyChanged() method.</p>
292 <p>If getSupportedProperties() returned an empty sequence, this method will
296 getActuatingProperties
( );
298 /** determines whether a given property, which the handler is responsible for, is composable.
300 <p>An object inspector can inspect multiple components at once, displaying the <em>intersection</em>
301 of their properties. For this, all components are examined for their properties, and all properties
302 which exist for all components, <em>and</em> are declared to be composable by their respective handler,
303 are displayed in the inspector UI.</p>
306 the name of the property whose composability is to be determined
307 @throws com::sun::star::beans::UnknownPropertyException
308 if the given property is not supported by the property handler
310 boolean isComposable
( [in] string PropertyName
)
311 raises
(::com
::sun
::star
::beans
::UnknownPropertyException
);
313 /** called when a browse button belonging to a property UI representation has been clicked
315 <p>Property handlers can raise a dedicated UI for entering or somehow changing a property value.
316 Usually, this will be a modal dialog, but it can also be a non-modal user interface component.</p>
318 <p>Availability of this feature is indicated by the LineDescriptor::HasPrimaryButton
319 and LineDescriptor::HasSecondaryButton members of a LineDescriptor,
320 which the XPropertyHandler fills in its describePropertyLine() method.</p>
322 <p>When this method is called, the property handler should raise the UI needed to enter the
323 property value, and return the result of this (see InteractiveSelectionResult).</p>
325 <p>It is recommended that property handlers do not directly set the property value which has
326 been obtained from the user, but store it in the output-parameter Data, and return
327 InteractiveSelectionResult::ObtainedValue.</p>
329 <p>If a handler sets the new property value directly, and returns
330 InteractiveSelectionResult::ObtainedValue, this implies that the property
331 cannot properly be handled in case the object inspector is inspecting an intersection of
332 multiple components, since in this case onInteractivePropertySelection()
333 will be called at one handler only, however the new property would have to be forwarded to
336 <p>If a property is not composable, directly setting the new property value does not yield any problem,
337 as long as property listeners are properly notified of the change.</p>
340 The name of the property whose browse button has been clicked
343 `TRUE` if and only if the primary button has been clicked, `FALSE` otherwise
346 If the method returns InteractiveSelectionResult::ObtainedValue,
347 then outData contains the value which has been interactively obtained
348 from the user, and which still needs to be set at the inspected component.
351 provides access to the object inspector UI. Implementations should use this if
352 the property selection requires non-modal user input. In those cases,
353 onInteractivePropertySelection() should return InteractiveSelectionResult::Pending,
354 and the UI for (at least) the property whose input is still pending should be disabled.
357 the result of the interactive property value selection.
359 @throws com::sun::star::beans::UnknownPropertyException
360 if the given property is not supported by the property handler
361 @throws com::sun::star::lang::NullPointerException
362 if InspectorUI is `NULL`
364 @see describePropertyLine
365 @see addPropertyChangeListener
368 ::com
::sun
::star
::inspection
::InteractiveSelectionResult
369 onInteractivePropertySelection
(
370 [in] string PropertyName
,
371 [in] boolean Primary
,
373 [in] XObjectInspectorUI InspectorUI
375 raises
(::com
::sun
::star
::beans
::UnknownPropertyException
, ::com
::sun
::star
::lang
::NullPointerException
);
377 /** updates the UI of dependent properties when the value of a certain actuating property changed
379 <p>This method is called whenever a property value changes, limited to those properties
380 whose changes the handler expressed interest in (see getActuatingProperties()).</p>
382 @param ActuatingPropertyName
383 the id of the actuating property.
385 the new value of the property
387 the old value of the property
389 a callback for updating the object inspector UI
391 If `TRUE`, the method is called for the first-time update of the respective property, that
392 is, when the property browser is just initializing with the properties of the introspected
394 If `FALSE`, there was a real com::sun::star::beans::XPropertyChangeListener::propertyChange()
395 event which triggered the call.<br/>
397 In some cases it may be necessary to differentiate between both situations. For instance,
398 if you want to set the value of another property when an actuating property's value changed,
399 you should definitely not do this when FirstTimeInit is `TRUE`.
400 @throws com::sun::star::lang::NullPointerException
401 if InspectorUI is `NULL`
404 actuatingPropertyChanged
(
405 [in] string ActuatingPropertyName
,
408 [in] XObjectInspectorUI InspectorUI
,
409 [in] boolean FirstTimeInit
411 raises
(::com
::sun
::star
::lang
::NullPointerException
);
413 /** suspends the handler
415 <p>A XPropertyHandler is used by a XObjectInspector instance,
416 which implements the XController interface. By definition, a XObjectInspector always forwards
417 all suspend requests (com::sun::star::frame::XController::suspend()) to
418 all its handlers.</p>
420 <p>The usual use case for this method are non-modal user interface components used
421 for property value input. Such a component might have been opened during
422 onInteractivePropertySelection(). If a property handler receives a
423 suspend() call, it should forward the suspension request to the UI
424 component, and veto suspension of the XObjectInspector as appropriate.</p>
426 <p>If suspension is not to be vetoed, then all non-modal UI components opened
427 by the handler should have been closed when it returns from the suspend() call.</p>
430 Whether the handler is to be suspended `TRUE` or reactivated (`FALSE`). The
431 latter happens if a handler was successfully suspended, but an external instance
432 vetoed the whole suspension process.
435 `TRUE` if the handler does allow suspension, `FALSE` if it vetoes it.
437 boolean suspend
( [in] boolean Suspend
);
447 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */