1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23#ifndef __com_sun_star_form_component_DatabaseImageControl_idl__
24#define __com_sun_star_form_component_DatabaseImageControl_idl__
25
26#ifndef __com_sun_star_awt_UnoControlImageControlModel_idl__
27#include <com/sun/star/awt/UnoControlImageControlModel.idl>
28#endif
29
30#ifndef __com_sun_star_form_DataAwareControlModel_idl__
31#include <com/sun/star/form/DataAwareControlModel.idl>
32#endif
33
34#ifndef __com_sun_star_form_XImageProducerSupplier_idl__
35#include <com/sun/star/form/XImageProducerSupplier.idl>
36#endif
37
38
39//=============================================================================
40
41 module com {  module sun {  module star {  module form {  module component {
42
43//=============================================================================
44
45/** specifies the model of a control used for displaying images stored in a database.
46
47	<p>As every <type scope="com::sun::star::form">DataAwareControlModel</type>, an image control
48	can be bound to a database field. This means that for instance with every record change, the content
49	of the database field is taken, interpreted as image, and displayed in the control.<br/>
50	Unlike other more text-based controls, it does not interpret the content of the field as text or double,
51	but as binary stream (see <member scope="com::sun::star::sdb">XColumn::getBinaryStream</member>).</p>
52
53	<p>Usually, an image control model can be bound to binary columns only,	namely
54	<member scope="com::sun::star::sdbc">DataType::BINARY</member>,
55	<member scope="com::sun::star::sdbc">DataType::VARBINARY</member>,
56	<member scope="com::sun::star::sdbc">DataType::LONGVARBINARY</member>,
57	<member scope="com::sun::star::sdbc">DataType::OTHER</member>,
58	<member scope="com::sun::star::sdbc">DataType::LONGVARCHAR</member></p>
59
60	<p/>
61
62	<p>Note that besides taking the image to be displayed from the bound field, there is another option. The
63	<member scope="com::sun::star::awt">UnoControlImageControlModel::ImageURL</member> property specifies
64	the URL of an image to be displayed. If this property is changed from outside, the respective file
65	is loaded and set as image source.</p>
66
67	<p>In a usual data form, the scenario will be as follows:
68		<ul><li>There is a DatabaseImageControl as part of the document model, which acts as
69				control model for an <type scope="com::sun::star::form::control">ImageControl</type>.</li>
70
71			<li>The control is an <type scope="com::sun::star::awt">XImageConsumer</type> for the
72				<type scope="com::sun::star::awt">XImageProducer</type> supplied by the model.</li>
73
74			<li>Whenever the form's cursor is positioned on a new record, the column the control
75				model is bound to is examined for a binary data stream. This stream is set as source
76				at the image producer, which notifies it's consumers, which leads to the control
77				displaying the image.</li>
78
79			<li>When the user by some interaction tells the control to contain a new image, this is
80				exchanged by URL. For example, implementations of the control service may allow the user
81				to browse for image. After this, the URL of the image is set as
82				<member scope="com::sun::star::awt">UnoControlImageControlModel::ImageURL</member>
83				property at the model.<br/>
84				Now the control loads the image determined by the property value, and starts producing
85				a new data stream, which is displayed by the control (which is a consumer for this stream).<br/>
86				From now on, the control and thus the database record counts as modified. If the cursor of the
87				form is moved further, the modified record is saved, means the content of the image pointed to
88				by <member scope="com::sun::star::awt">UnoControlImageControlModel::ImageURL</member>
89				is saved into the column.</li>
90		</ul>
91	</p>
92 */
93published service DatabaseImageControl
94{
95	service com::sun::star::awt::UnoControlImageControlModel;
96
97	service com::sun::star::form::DataAwareControlModel;
98
99	/** supplies the caller with an <type scope="com::sun::star::awt">XImageProducer</type>.
100
101		<p>Other components can register as <type scope="com::sun::star::awt">XImageConsumer</type>
102		at this producer. Then they will be notified of any change in the image to be displayed.</p>
103	 */
104	interface com::sun::star::form::XImageProducerSupplier;
105
106	//-------------------------------------------------------------------------
107
108	/** indicates if it is possible to change the image being displayed.
109	 */
110	[property] boolean ReadOnly;
111
112};
113
114//=============================================================================
115
116}; }; }; }; };
117
118#endif
119