1d1766043SAndrew Rist/**************************************************************
2*2ef7dab5Smseidel *
3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5d1766043SAndrew Rist * distributed with this work for additional information
6d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10*2ef7dab5Smseidel *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*2ef7dab5Smseidel *
13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14d1766043SAndrew Rist * software distributed under the License is distributed on an
15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17d1766043SAndrew Rist * specific language governing permissions and limitations
18d1766043SAndrew Rist * under the License.
19*2ef7dab5Smseidel *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23*2ef7dab5Smseidel
24cdf0e10cSrcweir#ifndef __com_sun_star_form_component_DataForm_idl__
25cdf0e10cSrcweir#define __com_sun_star_form_component_DataForm_idl__
26cdf0e10cSrcweir
27cdf0e10cSrcweir#ifndef __com_sun_star_form_component_Form_idl__
28cdf0e10cSrcweir#include <com/sun/star/form/component/Form.idl>
29cdf0e10cSrcweir#endif
30cdf0e10cSrcweir
31cdf0e10cSrcweir#ifndef __com_sun_star_sdb_RowSet_idl__
32cdf0e10cSrcweir#include <com/sun/star/sdb/RowSet.idl>
33cdf0e10cSrcweir#endif
34cdf0e10cSrcweir
35cdf0e10cSrcweir#ifndef __com_sun_star_form_TabulatorCycle_idl__
36cdf0e10cSrcweir#include <com/sun/star/form/TabulatorCycle.idl>
37cdf0e10cSrcweir#endif
38cdf0e10cSrcweir
39cdf0e10cSrcweir#ifndef __com_sun_star_form_NavigationBarMode_idl__
40cdf0e10cSrcweir#include <com/sun/star/form/NavigationBarMode.idl>
41cdf0e10cSrcweir#endif
42cdf0e10cSrcweir
43cdf0e10cSrcweir#ifndef __com_sun_star_form_XLoadable_idl__
44cdf0e10cSrcweir#include <com/sun/star/form/XLoadable.idl>
45cdf0e10cSrcweir#endif
46cdf0e10cSrcweir
47cdf0e10cSrcweir#ifndef __com_sun_star_sdb_XCompletedExecution_idl__
48cdf0e10cSrcweir#include <com/sun/star/sdb/XCompletedExecution.idl>
49cdf0e10cSrcweir#endif
50cdf0e10cSrcweir
51cdf0e10cSrcweir#ifndef __com_sun_star_awt_TabControllerModel_idl__
52cdf0e10cSrcweir#include <com/sun/star/awt/TabControllerModel.idl>
53cdf0e10cSrcweir#endif
54cdf0e10cSrcweir
55cdf0e10cSrcweir//=============================================================================
56cdf0e10cSrcweir
57cdf0e10cSrcweirmodule com { module sun { module star { module form {
58cdf0e10cSrcweir
59cdf0e10cSrcweir published interface XReset;
60cdf0e10cSrcweir published interface XDatabaseParameterBroadcaster;
61cdf0e10cSrcweir
62cdf0e10cSrcweirmodule component {
63cdf0e10cSrcweir//=============================================================================
64cdf0e10cSrcweir/** This service specifies a form which is connected to a database and
65a893be29SPedro Giffuni	displays the results of SQL queries. It provides the possibility of
66cdf0e10cSrcweir	adding new data records, modifying existing ones, or deleting them.
67cdf0e10cSrcweir
68cdf0e10cSrcweir	<p>A database form is a special kind of enhanced database row set
69cdf0e10cSrcweir	which provides all information for displaying the data and has more
70cdf0e10cSrcweir	possibilities for configuring the data manipulation.</p>
71cdf0e10cSrcweir
72cdf0e10cSrcweir*/
73cdf0e10cSrcweirpublished service DataForm
74cdf0e10cSrcweir{
75cdf0e10cSrcweir	service com::sun::star::sdb::RowSet;
76cdf0e10cSrcweir	service com::sun::star::form::component::Form;
77cdf0e10cSrcweir
78cdf0e10cSrcweir	/** is used to reset controls belonging to the form, and to reset database fields to which the
79cdf0e10cSrcweir        controls are bound
80cdf0e10cSrcweir
81cdf0e10cSrcweir		<p>A <type>DataForm</type> is reset either on explicit request, or after it is moved
82cdf0e10cSrcweir        to the insertion row.</p>
83cdf0e10cSrcweir
84cdf0e10cSrcweir        <p>The insertion row is a virtual row which is used to insert new records. It is reached
85cdf0e10cSrcweir        by calling <member scope="com::sun::star::sdbc">XResultSetUpdate::moveToInsertRow</member>.
86cdf0e10cSrcweir        The <type scope="com::sun::star::sdb">RowSet</type> service specifies exactly which notifications
87cdf0e10cSrcweir        happen in which order when calling <member scope="com::sun::star::sdbc">XResultSetUpdate::moveToInsertRow</member>,
88cdf0e10cSrcweir        and a <type>DataForm</type> implementation extends this with the following contract:
89cdf0e10cSrcweir        <ul><li>After all notifications as defined in the <type scope="com::sun::star::sdb">RowSet</type>
90cdf0e10cSrcweir                service have been sent, the <type>DataForm</type> resets itself, if all
91cdf0e10cSrcweir                <type scope="com::sun::star::form">XResetListeners</type> approve this.</li>
92cdf0e10cSrcweir            <li>After the reset happened, the <member scope="com::sun::star::sdb">RowSet::IsModified</member>
93cdf0e10cSrcweir                property is reset to <FALSE/>. This property might have been switched to <TRUE/> during listener
94cdf0e10cSrcweir                notifications, since listeners are allowed to change field values. Also, the
95cdf0e10cSrcweir                <member scope="com::sun::star::form">XReset::reset</member> implementations of bound control
96cdf0e10cSrcweir                models might have modified the fields they're bound to (by filling them with default values).</li>
97cdf0e10cSrcweir            <li>The reset listeners are notified of the completed reset operation.</li>
98cdf0e10cSrcweir        </ul></p>
99cdf0e10cSrcweir	*/
100cdf0e10cSrcweir	interface com::sun::star::form::XReset;
101cdf0e10cSrcweir
102cdf0e10cSrcweir	/** used to load/unload the form
103cdf0e10cSrcweir		<p>Loading a form is basically the same as executing the underlying row set. In fact, all the
104cdf0e10cSrcweir		functionality of this interface could be simulated by using setting some properties manually,
105cdf0e10cSrcweir        <member scope="com::sun::star::sdbc">XRowSet::execute</member>, moving the row set cursor and so on.</p>
106cdf0e10cSrcweir
107cdf0e10cSrcweir        <p>One main difference between <member>XLoadable::load</member> and <member scope="com::sun::star::sdbc">XRowSet::execute</member>
108cdf0e10cSrcweir		is that if you use the former, the row set is positioned on the first record, while in the latter case
109cdf0e10cSrcweir		it is position <em>before</em> the it.</p>
110cdf0e10cSrcweir	*/
111cdf0e10cSrcweir	interface com::sun::star::form::XLoadable;
112cdf0e10cSrcweir
113cdf0e10cSrcweir	/** can be used to allow an interaction handler to supply missing data during a load process.
114cdf0e10cSrcweir
115cdf0e10cSrcweir		<p>If data is needed during loading a form, then this is usually obtained via broadcaster-listener
116cdf0e10cSrcweir		mechanisms. An example for this (and currently the only one) are parameter values.</p>
117cdf0e10cSrcweir		<p>However, if you use this method, you can pass an interaction handler which should supply these
118cdf0e10cSrcweir		additional data.</p>
119cdf0e10cSrcweir
120cdf0e10cSrcweir		@see com::sun::star::sdb::InteractionHandler
121cdf0e10cSrcweir	*/
122cdf0e10cSrcweir	interface com::sun::star::sdb::XCompletedExecution;
123cdf0e10cSrcweir
124cdf0e10cSrcweir	/** can be used for filling parameters.
125cdf0e10cSrcweir
126cdf0e10cSrcweir		<p>You can add your component as
127cdf0e10cSrcweir		<type scope="com::sun::star::form">XDatabaseParameterListener</type>
128cdf0e10cSrcweir		to a form to get notified whenever the form needs parameter values to be filled in<br/>
129cdf0e10cSrcweir		In a first approach, the form tries to fill any parameters from it's master-detail relation
130cdf0e10cSrcweir		(if any). All values which can't be filled are then passed to all listeners, which can
131cdf0e10cSrcweir		fill them by their own choice.</p>
132cdf0e10cSrcweir
133*2ef7dab5Smseidel		<p>This is slightly changed if the form is loaded using the
134cdf0e10cSrcweir		<member scope="com::sun::star::sdb">XCompletedExecution::connectWithCompletion</member> method. In this case, the parameters
135cdf0e10cSrcweir		are obtained from the interaction handler, not from the listeners</p>
136cdf0e10cSrcweir
137cdf0e10cSrcweir		@see XCompletedExecution
138cdf0e10cSrcweir		@see MasterFields
139cdf0e10cSrcweir		@see DetailFields
140cdf0e10cSrcweir	*/
141cdf0e10cSrcweir	interface com::sun::star::form::XDatabaseParameterBroadcaster;
142cdf0e10cSrcweir
143cdf0e10cSrcweir	//-------------------------------------------------------------------------
144cdf0e10cSrcweir	/** is used for subforms and contains the names of columns of the parent form.
145cdf0e10cSrcweir
146cdf0e10cSrcweir        <p> These columns are typically the foreign key fields of the parent form.
147cdf0e10cSrcweir        The values of theses columns are used to identify the data for the subform.
148*2ef7dab5Smseidel        Each time the parent form changes it's current row, the subform requires
149*2ef7dab5Smseidel        its data based on the values of the master fields.</p>
150cdf0e10cSrcweir
151*2ef7dab5Smseidel        <p>If the form is no sub form (e.g. its parent is not a form itself), this
152cdf0e10cSrcweir        property is not evaluated.</p>
153cdf0e10cSrcweir	*/
154cdf0e10cSrcweir	[property] sequence<string> MasterFields;
155cdf0e10cSrcweir
156cdf0e10cSrcweir	//-------------------------------------------------------------------------
157cdf0e10cSrcweir	/** is used for subforms and contains the names of the columns of the subform
158cdf0e10cSrcweir	    which are related to the master fields of the parent form.
159cdf0e10cSrcweir
160cdf0e10cSrcweir        <p>Entries in this sequence can either denote column names in the sub form,
161*2ef7dab5Smseidel        or parameter names.<br/>
162cdf0e10cSrcweir        For instance, you could base the form on the SQL statement
163cdf0e10cSrcweir        <code>SELECT * FROM invoices WHERE cust_ref = :cid</code>, and add <code>cid</code>
164cdf0e10cSrcweir        to the DetailFields property. In this case, the parameter will be filled from
165cdf0e10cSrcweir        the corresponding master field.<br/>
166cdf0e10cSrcweir        Alternatively, you could simply base your form on the table <code>invoices</code>,
167cdf0e10cSrcweir        and add the column name <code>cust_ref</code> to the DetailFields. In this case,
168cdf0e10cSrcweir        and implicit filter clause <code>WHERE cust_ref = :&lt;new_param_name&gt;</code> will
169cdf0e10cSrcweir        be created, and the artificial parameter will be filled from the corresponding
170cdf0e10cSrcweir        master field.<br/>
171cdf0e10cSrcweir        If a string in this property denotes both a column name and a parameter name, it
172cdf0e10cSrcweir        is undefined which way it is interpreted, but implementations of the service are required
173a893be29SPedro Giffuni        to either decide for the parameter or the column, and proceed as usual.
174cdf0e10cSrcweir        </p>
175cdf0e10cSrcweir
176cdf0e10cSrcweir        <p>The columns specified herein typically represent a part of the primary key
177cdf0e10cSrcweir        fields or their aliases of the detail form.</p>
178cdf0e10cSrcweir
179*2ef7dab5Smseidel        <p>If the form is no sub form (e.g. its parent is not a form itself), this
180cdf0e10cSrcweir        property is not evaluated.</p>
181cdf0e10cSrcweir	*/
182cdf0e10cSrcweir	[property] sequence<string> DetailFields;
183cdf0e10cSrcweir
184cdf0e10cSrcweir	//-------------------------------------------------------------------------
185cdf0e10cSrcweir	/** returns the kind of tabulator controlling.
186cdf0e10cSrcweir	*/
187cdf0e10cSrcweir	[property] com::sun::star::form::TabulatorCycle Cycle;
188cdf0e10cSrcweir
189cdf0e10cSrcweir	//-------------------------------------------------------------------------
190cdf0e10cSrcweir	/** determines how an navigation bar for this form should act.
191cdf0e10cSrcweir	*/
192cdf0e10cSrcweir	[property] com::sun::star::form::NavigationBarMode NavigationBarMode;
193cdf0e10cSrcweir
194cdf0e10cSrcweir	//-------------------------------------------------------------------------
195cdf0e10cSrcweir	/** determines if insertions into the form's row set are allowed.
196*2ef7dab5Smseidel
197cdf0e10cSrcweir		<p>Note that this is a recommendation for user interface components displaying the
198cdf0e10cSrcweir		form. Form implementations may decide to allow for insertions done via the API, even
199cdf0e10cSrcweir		if the property is set to <FALSE/>, but the user interface should respect the property
200cdf0e10cSrcweir		value.</p>
201cdf0e10cSrcweir	*/
202cdf0e10cSrcweir	[property] boolean AllowInserts;
203cdf0e10cSrcweir
204cdf0e10cSrcweir	//-------------------------------------------------------------------------
205cdf0e10cSrcweir	/** determines if modifications of the current record of the form are allowed.
206*2ef7dab5Smseidel
207cdf0e10cSrcweir		<p>Note that this is a recommendation for user interface components displaying the
208cdf0e10cSrcweir		form. Form implementations may decide to allow for updates done via the API, even
209cdf0e10cSrcweir		if the property is set to <FALSE/>, but the user interface should respect the property
210cdf0e10cSrcweir		value.</p>
211cdf0e10cSrcweir	*/
212cdf0e10cSrcweir	[property] boolean AllowUpdates;
213cdf0e10cSrcweir
214cdf0e10cSrcweir	//-------------------------------------------------------------------------
215cdf0e10cSrcweir	/** determines if deletions of records of the form are allowed.
216*2ef7dab5Smseidel
217cdf0e10cSrcweir		<p>Note that this is a recommendation for user interface components displaying the
218cdf0e10cSrcweir		form. Form implementations may decide to allow for deletions done via the API, even
219cdf0e10cSrcweir		if the property is set to <FALSE/>, but the user interface should respect the property
220cdf0e10cSrcweir		value.</p>
221cdf0e10cSrcweir	*/
222cdf0e10cSrcweir	[property] boolean AllowDeletes;
223cdf0e10cSrcweir};
224cdf0e10cSrcweir
225cdf0e10cSrcweir//=============================================================================
226cdf0e10cSrcweir
227cdf0e10cSrcweir}; }; }; }; };
228cdf0e10cSrcweir
229cdf0e10cSrcweir#endif
230