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