xref: /AOO41X/main/offapi/com/sun/star/form/runtime/XFormOperations.idl (revision 96af39f745f380c70aec9fab3a79dc8b37f680ac)
1d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
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
10cdf0e10cSrcweir *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
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.
19cdf0e10cSrcweir *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir#ifndef __com_sun_star_form_runtime_XFormOperations_idl__
25cdf0e10cSrcweir#define __com_sun_star_form_runtime_XFormOperations_idl__
26cdf0e10cSrcweir
27cdf0e10cSrcweir#ifndef __com_sun_star_form_runtime_FeatureState_idl__
28cdf0e10cSrcweir#include <com/sun/star/form/runtime/FeatureState.idl>
29cdf0e10cSrcweir#endif
30cdf0e10cSrcweir
31cdf0e10cSrcweir#ifndef __com_sun_star_lang_XComponent_idl__
32cdf0e10cSrcweir#include <com/sun/star/lang/XComponent.idl>
33cdf0e10cSrcweir#endif
34cdf0e10cSrcweir#ifndef __com_sun_star_sdbc_XRowSet_idl__
35cdf0e10cSrcweir#include <com/sun/star/sdbc/XRowSet.idl>
36cdf0e10cSrcweir#endif
37cdf0e10cSrcweir#ifndef __com_sun_star_sdbc_XResultSetUpdate_idl__
38cdf0e10cSrcweir#include <com/sun/star/sdbc/XResultSetUpdate.idl>
39cdf0e10cSrcweir#endif
40cdf0e10cSrcweir#ifndef __com_sun_star_form_runtime_XFormController_idl__
41cdf0e10cSrcweir#include <com/sun/star/form/runtime/XFormController.idl>
42cdf0e10cSrcweir#endif
43cdf0e10cSrcweir#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
44cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
45cdf0e10cSrcweir#endif
46cdf0e10cSrcweir#ifndef __com_sun_star_lang_WrappedTargetException_idl__
47cdf0e10cSrcweir#include <com/sun/star/lang/WrappedTargetException.idl>
48cdf0e10cSrcweir#endif
49cdf0e10cSrcweir#ifndef __com_sun_star_beans_NamedValue_idl__
50cdf0e10cSrcweir#include <com/sun/star/beans/NamedValue.idl>
51cdf0e10cSrcweir#endif
52cdf0e10cSrcweir
53cdf0e10cSrcweir//=============================================================================
54cdf0e10cSrcweir
55cdf0e10cSrcweirmodule com { module sun { module star { module form { module runtime {
56cdf0e10cSrcweir
57cdf0e10cSrcweirinterface XFeatureInvalidation;
58cdf0e10cSrcweir
59cdf0e10cSrcweir//=============================================================================
60cdf0e10cSrcweir
61cdf0e10cSrcweir/** encapsulates operations on a database form.
62cdf0e10cSrcweir
63cdf0e10cSrcweir    <p>This instance allows for operations on a user interface form, by saving its clients
64cdf0e10cSrcweir    from various tedious and error-prone operations.</p>
65cdf0e10cSrcweir
66cdf0e10cSrcweir    <p>As an example, imagine you have a database form, displayed in some user
67cdf0e10cSrcweir    interface, which you want to move to the next record.<br/>
68cdf0e10cSrcweir    It is as easy as calling <member scope="com:::sun::star::sdbc">XResultSet::next</member>
69cdf0e10cSrcweir    on this form, right? Wrong. First, you need to care for saving the current
70cdf0e10cSrcweir    record, so the user doesn't lose her input. So you need to call
71cdf0e10cSrcweir    <member scope="com::sun::star::sdbc">XResultSetUpdate::updateRow</member> or
72cdf0e10cSrcweir    <member scope="com::sun::star::sdbc">XResultSetUpdate::insertRow</member>, depending
73cdf0e10cSrcweir    on the form's <member scope="com::sun::star::sdb">RowSet::IsNew</member> property.<br/>
74cdf0e10cSrcweir    But then you're done, right? Wrong, again.<br/>
75cdf0e10cSrcweir    When the user just entered some data into one of the form fields, but did not yet
76cdf0e10cSrcweir    leave this field, then the data is not yet committed to the form, not to talk
77cdf0e10cSrcweir    about being committed to the underlying database. So, before everything else,
78cdf0e10cSrcweir    you would nee to obtain the active control of the form, and commit it.<br/>
79cdf0e10cSrcweir    <em>Now</em> you're done ...</p>
80cdf0e10cSrcweir
81cdf0e10cSrcweir    <p>As another example, consider that you want to delete the current record from the
82cdf0e10cSrcweir    form. You have to take into account any <type scope="com::sun::star::form">XConfirmDeleteListener</type>s
83cdf0e10cSrcweir    registered at the <type scope="com::sun::star::form">FormController</type> or the
84cdf0e10cSrcweir    <type scope="com::sun::star::form::component">DataForm</type>.</p>
85cdf0e10cSrcweir
86cdf0e10cSrcweir    <p>If you agree that this is ugly to do and maintain, then <code>XFormOperations</code>
87cdf0e10cSrcweir    is for you. It provides a <member>execute</member> method, which will do all of the above
88cdf0e10cSrcweir    for you; plus some similar convenient wrappers for similar functionality.</p>
89cdf0e10cSrcweir
90cdf0e10cSrcweir    @see FormFeature
91cdf0e10cSrcweir
92*96af39f7SJürgen Schmidt    @since OpenOffice 2.2
93cdf0e10cSrcweir */
94cdf0e10cSrcweirinterface XFormOperations : ::com::sun::star::lang::XComponent
95cdf0e10cSrcweir{
96cdf0e10cSrcweir    /** provides access to the cursor of the form the instance is operating on.
97cdf0e10cSrcweir    */
98cdf0e10cSrcweir    [attribute, readonly]   ::com::sun::star::sdbc::XRowSet             Cursor;
99cdf0e10cSrcweir
100cdf0e10cSrcweir    /** provides access to the update cursor of the form the instance is operating on.
101cdf0e10cSrcweir    */
102cdf0e10cSrcweir    [attribute, readonly]   ::com::sun::star::sdbc::XResultSetUpdate    UpdateCursor;
103cdf0e10cSrcweir
104cdf0e10cSrcweir    /** provides access to the form controller which the instance is operating on.
105cdf0e10cSrcweir
106cdf0e10cSrcweir        <p>Note that it is possible to operate on a user interface form without
107cdf0e10cSrcweir        actually having access to the form controller instance. However, in this
108cdf0e10cSrcweir        case some functionality will not be available. In particular, every feature
109cdf0e10cSrcweir        which relies on the active control of the controller might be of limited use.</p>
110cdf0e10cSrcweir    */
111cdf0e10cSrcweir    [attribute, readonly]   ::com::sun::star::form::runtime::XFormController    Controller;
112cdf0e10cSrcweir
113cdf0e10cSrcweir    /** retrieves the current state of the given feature
114cdf0e10cSrcweir
115cdf0e10cSrcweir        <p>You would usually use this to update some user interface to reflect this state.
116cdf0e10cSrcweir        For instance, you could imagine a toolbar button which is associated with a given feature.
117cdf0e10cSrcweir        This button would be enabled if and only if the respective feature is currently
118cdf0e10cSrcweir        available, and be checked if and only if the feature state is a <code>boolean</code>
119cdf0e10cSrcweir        evaluating to <TRUE/>.<p>
120cdf0e10cSrcweir
121cdf0e10cSrcweir        @param Feature
122cdf0e10cSrcweir            the feature whose state is to be determimed. Must be one of the <type>FormFeature</type>
123cdf0e10cSrcweir            constants.<br/>
124cdf0e10cSrcweir            An invalid value here will be silently ignored, and simply return a <type>FeatureState</type>
125cdf0e10cSrcweir            indicating <em>disabled</em> with a <NULL/> state.</p>
126cdf0e10cSrcweir    */
127cdf0e10cSrcweir    FeatureState    getState(
128cdf0e10cSrcweir                        [in] short Feature
129cdf0e10cSrcweir                    );
130cdf0e10cSrcweir
131cdf0e10cSrcweir    /** determines whether a feature is currently enabled.
132cdf0e10cSrcweir
133cdf0e10cSrcweir        <p>Calling this is equivalent to calling <member>getState</member>, and evaluating the
134cdf0e10cSrcweir        <member>FeatureState::Enabled</member> member.</p>
135cdf0e10cSrcweir
136cdf0e10cSrcweir        @param Feature
137cdf0e10cSrcweir            the feature whose state is to be determimed. Must be one of the <type>FormFeature</type>
138cdf0e10cSrcweir            constants.<br/>
139cdf0e10cSrcweir            An invalid value here will be silently ignored, and simply return <FALSE/>.
140cdf0e10cSrcweir    */
141cdf0e10cSrcweir    boolean         isEnabled(
142cdf0e10cSrcweir                        [in] short Feature
143cdf0e10cSrcweir                    );
144cdf0e10cSrcweir
145cdf0e10cSrcweir    /** executes the operation associated with the given feature
146cdf0e10cSrcweir
147cdf0e10cSrcweir        @param Feature
148cdf0e10cSrcweir            the feature which is to be executed. Must be one of the <type>FormFeature</type>
149cdf0e10cSrcweir            constants.
150cdf0e10cSrcweir
151cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
152cdf0e10cSrcweir            if the given Feature is unknown, not executable, or striclty requires arguments
153cdf0e10cSrcweir            to be executed.
154cdf0e10cSrcweir
155cdf0e10cSrcweir        @throws ::com::sun::star::sdbc::SQLException
156cdf0e10cSrcweir            if a database access erorr occurs
157cdf0e10cSrcweir
158cdf0e10cSrcweir        @throws ::com::sun::star::lang::WrappedTargetException
159cdf0e10cSrcweir            if an exception is caught which is no <type scope="com::sun::star::uno">RuntimeException</type>
160cdf0e10cSrcweir            and no <type scope="com::sun::star::sdbc">SQLException</type>.
161cdf0e10cSrcweir
162cdf0e10cSrcweir        @see executeWithArguments
163cdf0e10cSrcweir    */
164cdf0e10cSrcweir    void            execute(
165cdf0e10cSrcweir                        [in] short Feature
166cdf0e10cSrcweir                    )
167cdf0e10cSrcweir                    raises  (   ::com::sun::star::lang::IllegalArgumentException
168cdf0e10cSrcweir                            ,   ::com::sun::star::sdbc::SQLException
169cdf0e10cSrcweir                            ,   ::com::sun::star::lang::WrappedTargetException
170cdf0e10cSrcweir                            );
171cdf0e10cSrcweir
172cdf0e10cSrcweir    /** executes the operation associated with the given feature, with passing arguments for execution
173cdf0e10cSrcweir
174cdf0e10cSrcweir        @param Feature
175cdf0e10cSrcweir            the feature which is to be executed. Must be one of the <type>FormFeature</type>
176cdf0e10cSrcweir            constants.
177cdf0e10cSrcweir
178cdf0e10cSrcweir        @param Arguments
179cdf0e10cSrcweir            the named arguments for the feature to execute. See the <type>FormFeature</type> list
180cdf0e10cSrcweir            for features which require arguments.
181cdf0e10cSrcweir
182cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
183cdf0e10cSrcweir            if the given feature is unknown, or not executable
184cdf0e10cSrcweir
185cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
186cdf0e10cSrcweir            if the given arguments are not sufficient to execute the feature
187cdf0e10cSrcweir
188cdf0e10cSrcweir        @throws ::com::sun::star::sdbc::SQLException
189cdf0e10cSrcweir            if a database access erorr occurs
190cdf0e10cSrcweir
191cdf0e10cSrcweir        @throws ::com::sun::star::lang::WrappedTargetException
192cdf0e10cSrcweir            if an exception is caught which is no <type scope="com::sun::star::uno">RuntimeException</type>
193cdf0e10cSrcweir            and no <type scope="com::sun::star::sdbc">SQLException</type>.
194cdf0e10cSrcweir    */
195cdf0e10cSrcweir    void            executeWithArguments(
196cdf0e10cSrcweir                        [in] short Feature,
197cdf0e10cSrcweir                        [in] sequence< ::com::sun::star::beans::NamedValue > Arguments
198cdf0e10cSrcweir                    )
199cdf0e10cSrcweir                    raises  (   ::com::sun::star::lang::IllegalArgumentException
200cdf0e10cSrcweir                            ,   ::com::sun::star::sdbc::SQLException
201cdf0e10cSrcweir                            ,   ::com::sun::star::lang::WrappedTargetException
202cdf0e10cSrcweir                            );
203cdf0e10cSrcweir
204cdf0e10cSrcweir    /** commits the current record of the form
205cdf0e10cSrcweir
206cdf0e10cSrcweir        @param RecordInserted
207cdf0e10cSrcweir            will be <TRUE/> if a record has been inserted, i.e. the form was positioned
208cdf0e10cSrcweir            on the insertion row.
209cdf0e10cSrcweir
210cdf0e10cSrcweir        @return
211cdf0e10cSrcweir            <TRUE/> if and only if the current record needed being committed. That's the
212cdf0e10cSrcweir            case if the record or the active control of the form were modified.
213cdf0e10cSrcweir
214cdf0e10cSrcweir        @throws ::com::sun::star::sdbc::SQLException
215cdf0e10cSrcweir            if a database access erorr occurs
216cdf0e10cSrcweir    */
217cdf0e10cSrcweir    boolean         commitCurrentRecord(
218cdf0e10cSrcweir                        [out] boolean RecordInserted
219cdf0e10cSrcweir                    )
220cdf0e10cSrcweir                    raises ( ::com::sun::star::sdbc::SQLException );
221cdf0e10cSrcweir
222cdf0e10cSrcweir    /** commits the current control of our controller
223cdf0e10cSrcweir
224cdf0e10cSrcweir        @throws ::com::sun::star::sdbc::SQLException
225cdf0e10cSrcweir            if a database access erorr occurs
226cdf0e10cSrcweir    */
227cdf0e10cSrcweir    boolean         commitCurrentControl(
228cdf0e10cSrcweir                    )
229cdf0e10cSrcweir                    raises ( ::com::sun::star::sdbc::SQLException );
230cdf0e10cSrcweir
231cdf0e10cSrcweir    /** determines whether the form is currently positioned on the insertion row
232cdf0e10cSrcweir
233cdf0e10cSrcweir        <p>This is a convenience method only. Calling it es equivalent to examing the
234cdf0e10cSrcweir        <member scope="com::sun::star::sdb">RowSet::IsNew</member> property of the form.</p>
235cdf0e10cSrcweir
236cdf0e10cSrcweir        @throws ::com::sun::star::lang::WrappedTargetException
237cdf0e10cSrcweir            if an error occurs obtaining the form property
238cdf0e10cSrcweir    */
239cdf0e10cSrcweir    boolean         isInsertionRow(
240cdf0e10cSrcweir                    )
241cdf0e10cSrcweir                    raises ( ::com::sun::star::lang::WrappedTargetException );
242cdf0e10cSrcweir
243cdf0e10cSrcweir    /** determines whether the current row of the form is modified
244cdf0e10cSrcweir
245cdf0e10cSrcweir        <p>This is a convenience method only. Calling it es equivalent to examing the
246cdf0e10cSrcweir        <member scope="com::sun::star::sdb">RowSet::IsModified</member> property of the form.</p>
247cdf0e10cSrcweir
248cdf0e10cSrcweir        @throws ::com::sun::star::lang::WrappedTargetException
249cdf0e10cSrcweir            if an error occurs obtaining the form property
250cdf0e10cSrcweir    */
251cdf0e10cSrcweir    boolean         isModifiedRow(
252cdf0e10cSrcweir                    )
253cdf0e10cSrcweir                    raises ( ::com::sun::star::lang::WrappedTargetException );
254cdf0e10cSrcweir
255cdf0e10cSrcweir    /** denotes the instance which should be notified about features whose state might have changed.
256cdf0e10cSrcweir
257cdf0e10cSrcweir        <p>If this attribute is not <NULL/>, the instance which it denotes will be notified
258cdf0e10cSrcweir        whenever the state of any supported feature might have changed.</p>
259cdf0e10cSrcweir
260cdf0e10cSrcweir        <p>For instance, imagine a form whose current row has just been moved to another
261cdf0e10cSrcweir        record, using the <member>execute</member> method. This means that potentially, the state
262cdf0e10cSrcweir        of all movement-related features might have changed.</p>
263cdf0e10cSrcweir
264cdf0e10cSrcweir        <p>Note that the instance does not actually notify changes in the feature states, but only
265cdf0e10cSrcweir        <em>potential</em> changes: It's up to the callee to react on this appropriately. This is
266cdf0e10cSrcweir        since OpenOffice.org's application framework features own mechanisms to cache and invalidate
267cdf0e10cSrcweir        feature states, so we do not burden this implementation here with such mechanisms.</p>
268cdf0e10cSrcweir
269cdf0e10cSrcweir        @see FormFeature
270cdf0e10cSrcweir    */
271cdf0e10cSrcweir    [attribute] XFeatureInvalidation    FeatureInvalidation;
272cdf0e10cSrcweir};
273cdf0e10cSrcweir
274cdf0e10cSrcweir//=============================================================================
275cdf0e10cSrcweir
276cdf0e10cSrcweir}; }; }; }; };
277cdf0e10cSrcweir
278cdf0e10cSrcweir//=============================================================================
279cdf0e10cSrcweir
280cdf0e10cSrcweir#endif
281