Update ooo320-m1
[ooovba.git] / offapi / com / sun / star / form / DataAwareControlModel.idl
blob10e764467a3349c3a89cbcdb048f7519baef2112
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DataAwareControlModel.idl,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef __com_sun_star_form_DataAwareControlModel_idl__
31 #define __com_sun_star_form_DataAwareControlModel_idl__
33 #ifndef __com_sun_star_form_FormControlModel_idl__
34 #include <com/sun/star/form/FormControlModel.idl>
35 #endif
37 #ifndef __com_sun_star_form_XBoundComponent_idl__
38 #include <com/sun/star/form/XBoundComponent.idl>
39 #endif
41 #ifndef __com_sun_star_form_XLoadListener_idl__
42 #include <com/sun/star/form/XLoadListener.idl>
43 #endif
45 #ifndef __com_sun_star_form_XReset_idl__
46 #include <com/sun/star/form/XReset.idl>
47 #endif
49 #ifndef __com_sun_star_beans_XPropertySet_idl__
50 #include <com/sun/star/beans/XPropertySet.idl>
51 #endif
54 //=============================================================================
56 module com { module sun { module star { module form {
58 //=============================================================================
60 /** is an abstract service for specialized <type>FormControlModel</type>s
61 which are data aware and thus can be bound to a data source.
63 <p>The connection between a data-aware control model and a form which's data the
64 control should display is made by parentship relations. The parent of a data-aware
65 control model (see <type scope="com::sun::star::container">XChild</type>, inherited
66 via the <type>FormControlModel</type> and <type>FormComponent</type> services) has
67 always to be a <type scope="com::sun::star::form::component">DataForm</type>.</p>
69 published service DataAwareControlModel
71 service com::sun::star::form::FormControlModel;
73 /** makes it possible to transfer the data of the model to the connected data field.
74 <p>
75 This interface is optional, if a component doesn't support it, it has to forward
76 the changes of it's value to the field it is connected to immediately (means whenever a user
77 interaction changes it's content).
78 </p>
80 [optional] interface com::sun::star::form::XBoundComponent;
83 /** must be implemented in order to recognize when the containing form of the model connects
84 to its data source (loads its data). After loading the form, the model may bind to its
85 related field source.<br/>
86 This interface will seldom be used directly from outside.
88 interface com::sun::star::form::XLoadListener;
91 /** Each <type>DataAwareControlModel</type> should be resettable for setting default values.
93 <p>In the context of a control model which is data-aware, the semantics of <em>default value</em>
94 (see <type>XReset</type>) is as follows:<br/>
95 If (and only if) the control is valid bound to a column of it's <typee scope="com::sun::star::form::component">DataForm</type>, and the form
96 is not positioned on a new record (see <member scope="com::sun::star::sdb">RowSet::IsNew</member>), then
97 <member>XReset::reset</member> does not reset the model's value to it's default value, but uses the
98 underlying column value.<br/>
99 In all other cases, the model is reset to the default value as specified by the respective property.</p>
101 <p>For an example, have a look at the <type scope="com::sun::star::form::component">TextField</type>. It inherites
102 the <member scope="com::sun::star::awt">UnoControlEditModel::Text</member> property from the underlying
103 service, and additionally specifies the <member scope="com::sun::star::form::component">TextField::DefaultText</member>.
104 </p>
106 <p>In the context of a <type scope="com::sun::star::form::component">DataForm</type>, controls are
107 automatically reset when one of the following applies
108 <ul><li>The form is reset by invoking it's <type>XReset</type> interface.</li>
109 <li>The form moves to a new record.</li>
110 <li>The changes in the current record of the form are undone</li>
111 </ul>
112 </p>
114 interface com::sun::star::form::XReset;
116 //-------------------------------------------------------------------------
118 /** specifies the name of the bound database field.
120 <p>This property makes sense in the <em>context</em> of the control model only. Normally, a control model
121 is a child of a <type scope="com::sun::star::form::component">DataForm</type>, which is bound
122 to a higher level object such as a table or query - more general, a result set.<br/>
123 This member here describes the column of this result set which the control should act for.</p>
125 <p>Not every control model can be bound to every database column. Usually, super services of the
126 <type>DataAwareControlModel</type> restrict the column types they can be used with.</p>
128 @see DataAwareControlModel::BoundField
130 [property] string DataField;
132 /** determines whether or not input into this field is required, when it is actually bound to a database field.
134 <p>If this property is set to <FALSE/>, then the form runtime will not check the control/model for
135 <NULL/> values before submitting data to the database. Usually, if a control model is bound to
136 a database field which cannot be <NULL/>, and the model itself does not have a value, then the database
137 update is prevented, showing an error message to the user. To disable this behavior on a per-control
138 basis, use the <code>InputRequired</code> property.</p>
140 @since OOo 3.1
142 [optional, property] boolean InputRequired;
144 //-------------------------------------------------------------------------
146 /** references to the cursor field to which the control is bound.
147 <p>Applies only if the form the control model belongs to is loaded and the control is valid bound.
148 The referenced field supports the <type scope="com::sun::star::sdb">Column</type> service.
149 </p>
150 @see DataAwareControlModel::DataField
152 [readonly, property] com::sun::star::beans::XPropertySet BoundField;
154 //-------------------------------------------------------------------------
156 /** references to a control model within the same document which should be used as a label.
157 <p>Any user interface action which needs to refer to the control is assumed to use this
158 property. <br/>
159 A very common design method for forms is to group a data aware control with a label control,
160 with the latter describing the content of the former. For instance, you may have a
161 <type scope="com::sun::star::form::component">TextField</type>, which is bound to the e-mail
162 column of your data source. Then you will probably add a
163 <type scope="com::sun::star::form::component">FixedText</type> which's label is "E-Mail",
164 and associate it with the TextField by setting it as <member>LabelControl</member>.<br/>
165 Now if you imagine a component offering data search in a form, this component will examine
166 the <member>LabelControl</member> property, find the <type scope="com::sun::star::form::component">FixedText</type>,
167 examine it's label, and use this label to refer to the <type scope="com::sun::star::form::component">TextField</type>.
168 </p>
169 <p>When setting the property, a number of constraints apply:
170 <ul>
171 <li>The object which is to be set has to support the following interfaces
172 <ul><li><type scope="com::sun::star::awt">XControlModel</type></li>
173 <li><type scope="com::sun::star::lang">XServiceInfo</type></li>
174 <li><type scope="com::sun::star::beans">XPropertySet</type></li>
175 <li><type scope="com::sun::star::container">XChild</type></li>
176 </ul>
177 </il>
178 <li>It has to be a part of the same document as the model who's property is to be modified.</il>
179 <li>Additionally, the support of a special service, indicating that the model is of the right type,
180 is required. Which kind of service is in the request depends on the type of the control model.<br/>
182 For instance, text fields (<type scope="com::sun::star::form::component">TextField</type>) can be
183 labelled by label controls only (<type scope="com::sun::star::form::component">FixedText</type>),
184 and radio buttons (<type scope="com::sun::star::form::component">RadioButton</type>) can be labelled
185 by group boxes (<type scope="com::sun::star::form::component">GroupBox</type>) only.
186 </li>
187 </ul>
188 </p>
190 [property] com::sun::star::beans::XPropertySet LabelControl;
194 //=============================================================================
196 }; }; }; };
198 #endif