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_DataAwareControlModel_idl__ 24#define __com_sun_star_form_DataAwareControlModel_idl__ 25 26#ifndef __com_sun_star_form_FormControlModel_idl__ 27#include <com/sun/star/form/FormControlModel.idl> 28#endif 29 30#ifndef __com_sun_star_form_XBoundComponent_idl__ 31#include <com/sun/star/form/XBoundComponent.idl> 32#endif 33 34#ifndef __com_sun_star_form_XLoadListener_idl__ 35#include <com/sun/star/form/XLoadListener.idl> 36#endif 37 38#ifndef __com_sun_star_form_XReset_idl__ 39#include <com/sun/star/form/XReset.idl> 40#endif 41 42#ifndef __com_sun_star_beans_XPropertySet_idl__ 43#include <com/sun/star/beans/XPropertySet.idl> 44#endif 45 46//============================================================================= 47 48 module com { module sun { module star { module form { 49 50//============================================================================= 51 52/** is an abstract service for specialized <type>FormControlModel</type>s 53 which are data aware and thus can be bound to a data source. 54 55 <p>The connection between a data-aware control model and a form whose data the 56 control should display is made by parentship relations. The parent of a data-aware 57 control model (see <type scope="com::sun::star::container">XChild</type>, inherited 58 via the <type>FormControlModel</type> and <type>FormComponent</type> services) has 59 always to be a <type scope="com::sun::star::form::component">DataForm</type>.</p> 60 */ 61published service DataAwareControlModel 62{ 63 service com::sun::star::form::FormControlModel; 64 65 /** makes it possible to transfer the data of the model to the connected data field. 66 <p> 67 This interface is optional, if a component doesn't support it, it has to forward 68 the changes of its value to the field it is connected to immediately (means whenever a user 69 interaction changes its content). 70 </p> 71 */ 72 [optional] interface com::sun::star::form::XBoundComponent; 73 74 75 /** must be implemented in order to recognize when the containing form of the model connects 76 to its data source (loads its data). After loading the form, the model may bind to its 77 related field source.<br/> 78 This interface will seldom be used directly from outside. 79 */ 80 interface com::sun::star::form::XLoadListener; 81 82 83 /** Each <type>DataAwareControlModel</type> should be resettable for setting default values. 84 85 <p>In the context of a control model which is data-aware, the semantics of <em>default value</em> 86 (see <type>XReset</type>) is as follows:<br/> 87 If (and only if) the control is valid bound to a column of its <type scope="com::sun::star::form::component">DataForm</type>, and the form 88 is not positioned on a new record (see <member scope="com::sun::star::sdb">RowSet::IsNew</member>), then 89 <member>XReset::reset</member> does not reset the model's value to its default value, but uses the 90 underlying column value.<br/> 91 In all other cases, the model is reset to the default value as specified by the respective property.</p> 92 93 <p>For an example, have a look at the <type scope="com::sun::star::form::component">TextField</type>. It inherites 94 the <member scope="com::sun::star::awt">UnoControlEditModel::Text</member> property from the underlying 95 service, and additionally specifies the <member scope="com::sun::star::form::component">TextField::DefaultText</member>. 96 </p> 97 98 <p>In the context of a <type scope="com::sun::star::form::component">DataForm</type>, controls are 99 automatically reset when one of the following applies 100 <ul><li>The form is reset by invoking its <type>XReset</type> interface.</li> 101 <li>The form moves to a new record.</li> 102 <li>The changes in the current record of the form are undone</li> 103 </ul> 104 </p> 105 */ 106 interface com::sun::star::form::XReset; 107 108 //------------------------------------------------------------------------- 109 110 /** specifies the name of the bound database field. 111 112 <p>This property makes sense in the <em>context</em> of the control model only. Normally, a control model 113 is a child of a <type scope="com::sun::star::form::component">DataForm</type>, which is bound 114 to a higher level object such as a table or query - more general, a result set.<br/> 115 This member here describes the column of this result set which the control should act for.</p> 116 117 <p>Not every control model can be bound to every database column. Usually, super services of the 118 <type>DataAwareControlModel</type> restrict the column types they can be used with.</p> 119 120 @see DataAwareControlModel::BoundField 121 */ 122 [property] string DataField; 123 124 /** determines whether or not input into this field is required, when it is actually bound to a database field. 125 126 <p>If this property is set to <FALSE/>, then the form runtime will not check the control/model for 127 <NULL/> values before submitting data to the database. Usually, if a control model is bound to 128 a database field which cannot be <NULL/>, and the model itself does not have a value, then the database 129 update is prevented, showing an error message to the user. To disable this behavior on a per-control 130 basis, use the <code>InputRequired</code> property.</p> 131 132 @since OpenOffice 3.1 133 */ 134 [optional, property] boolean InputRequired; 135 136 //------------------------------------------------------------------------- 137 138 /** references to the cursor field to which the control is bound. 139 <p>Applies only if the form the control model belongs to is loaded and the control is valid bound. 140 The referenced field supports the <type scope="com::sun::star::sdb">Column</type> service. 141 </p> 142 @see DataAwareControlModel::DataField 143 */ 144 [readonly, property] com::sun::star::beans::XPropertySet BoundField; 145 146 //------------------------------------------------------------------------- 147 148 /** references to a control model within the same document which should be used as a label. 149 <p>Any user interface action which needs to refer to the control is assumed to use this 150 property.<br/> 151 A very common design method for forms is to group a data aware control with a label control, 152 with the latter describing the content of the former. For instance, you may have a 153 <type scope="com::sun::star::form::component">TextField</type>, which is bound to the e-mail 154 column of your data source. Then you will probably add a 155 <type scope="com::sun::star::form::component">FixedText</type> whose label is "E-Mail", 156 and associate it with the TextField by setting it as <member>LabelControl</member>.<br/> 157 Now if you imagine a component offering data search in a form, this component will examine 158 the <member>LabelControl</member> property, find the <type scope="com::sun::star::form::component">FixedText</type>, 159 examine its label, and use this label to refer to the <type scope="com::sun::star::form::component">TextField</type>. 160 </p> 161 <p>When setting the property, a number of constraints apply: 162 <ul> 163 <li>The object which is to be set has to support the following interfaces 164 <ul><li><type scope="com::sun::star::awt">XControlModel</type></li> 165 <li><type scope="com::sun::star::lang">XServiceInfo</type></li> 166 <li><type scope="com::sun::star::beans">XPropertySet</type></li> 167 <li><type scope="com::sun::star::container">XChild</type></li> 168 </ul> 169 </il> 170 <li>It has to be a part of the same document as the model whose property is to be modified.</il> 171 <li>Additionally, the support of a special service, indicating that the model is of the right type, 172 is required. Which kind of service is in the request depends on the type of the control model.<br/> 173 174 For instance, text fields (<type scope="com::sun::star::form::component">TextField</type>) can be 175 labeled by label controls only (<type scope="com::sun::star::form::component">FixedText</type>), 176 and radio buttons (<type scope="com::sun::star::form::component">RadioButton</type>) can be labeled 177 by group boxes (<type scope="com::sun::star::form::component">GroupBox</type>) only. 178 </li> 179 </ul> 180 </p> 181 */ 182 [property] com::sun::star::beans::XPropertySet LabelControl; 183 184}; 185 186//============================================================================= 187 188}; }; }; }; 189 190#endif 191