1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2/* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19#ifndef __com_sun_star_form_component_DatabaseImageControl_idl__ 20#define __com_sun_star_form_component_DatabaseImageControl_idl__ 21 22#include <com/sun/star/awt/UnoControlImageControlModel.idl> 23 24#include <com/sun/star/form/DataAwareControlModel.idl> 25 26#include <com/sun/star/form/XImageProducerSupplier.idl> 27 28 29 30 module com { module sun { module star { module form { module component { 31 32 33/** specifies the model of a control used for displaying images stored in a database. 34 35 <p>As every com::sun::star::form::DataAwareControlModel, an image control 36 can be bound to a database field. This means that for instance with every record change, the content 37 of the database field is taken, interpreted as image, and displayed in the control.<br> 38 Unlike other more text-based controls, it does not interpret the content of the field as text or double, 39 but as binary stream (see com::sun::star::sdb::XColumn::getBinaryStream()).</p> 40 41 <p>Usually, an image control model can be bound to binary columns only, namely 42 com::sun::star::sdbc::DataType::BINARY, 43 com::sun::star::sdbc::DataType::VARBINARY, 44 com::sun::star::sdbc::DataType::LONGVARBINARY, 45 com::sun::star::sdbc::DataType::OTHER, 46 com::sun::star::sdbc::DataType::LONGVARCHAR</p> 47 48 </p> 49 50 <p>Note that besides taking the image to be displayed from the bound field, there is another option. The 51 com::sun::star::awt::UnoControlImageControlModel::ImageURL property specifies 52 the URL of an image to be displayed. If this property is changed from outside, the respective file 53 is loaded and set as image source.</p> 54 55 <p>In a usual data form, the scenario will be as follows: 56 <ul><li>There is a DatabaseImageControl as part of the document model, which acts as 57 control model for a com::sun::star::form::control::ImageControl.</li> 58 59 <li>The control is a com::sun::star::awt::XImageConsumer for the 60 com::sun::star::awt::XImageProducer supplied by the model.</li> 61 62 <li>Whenever the form's cursor is positioned on a new record, the column the control 63 model is bound to is examined for a binary data stream. This stream is set as source 64 at the image producer, which notifies it's consumers, which leads to the control 65 displaying the image.</li> 66 67 <li>When the user by some interaction tells the control to contain a new image, this is 68 exchanged by URL. For example, implementations of the control service may allow the user 69 to browse for image. After this, the URL of the image is set as 70 com::sun::star::awt::UnoControlImageControlModel::ImageURL 71 property at the model.<br> 72 Now the control loads the image determined by the property value, and starts producing 73 a new data stream, which is displayed by the control (which is a consumer for this stream).<br> 74 From now on, the control and thus the database record counts as modified. If the cursor of the 75 form is moved further, the modified record is saved, means the content of the image pointed to 76 by com::sun::star::awt::UnoControlImageControlModel::ImageURL 77 is saved into the column.</li> 78 </ul> 79 </p> 80 */ 81published service DatabaseImageControl 82{ 83 service com::sun::star::awt::UnoControlImageControlModel; 84 85 service com::sun::star::form::DataAwareControlModel; 86 87 /** supplies the caller with a com::sun::star::awt::XImageProducer. 88 89 <p>Other components can register as com::sun::star::awt::XImageConsumer 90 at this producer. Then they will be notified of any change in the image to be displayed.</p> 91 */ 92 interface com::sun::star::form::XImageProducerSupplier; 93 94 95 /** indicates if it is possible to change the image being displayed. 96 */ 97 [property] boolean ReadOnly; 98 99}; 100 101 102}; }; }; }; }; 103 104#endif 105 106/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 107