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