bump product version to 4.1.6.2
[LibreOffice.git] / offapi / com / sun / star / form / runtime / XFormOperations.idl
blob4b2fb1e465c74d9c9c2677ff9d283c272c246d7c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /**
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef __com_sun_star_form_runtime_XFormOperations_idl__
21 #define __com_sun_star_form_runtime_XFormOperations_idl__
23 #include <com/sun/star/form/runtime/FeatureState.idl>
24 #include <com/sun/star/lang/XComponent.idl>
25 #include <com/sun/star/sdbc/XRowSet.idl>
26 #include <com/sun/star/sdbc/XResultSetUpdate.idl>
27 #include <com/sun/star/form/runtime/XFormController.idl>
28 #include <com/sun/star/lang/IllegalArgumentException.idl>
29 #include <com/sun/star/lang/WrappedTargetException.idl>
30 #include <com/sun/star/beans/NamedValue.idl>
33 module com { module sun { module star { module form { module runtime {
35 interface XFeatureInvalidation;
38 /** encapsulates operations on a database form.
40 <p>This instance allows for operations on a user interface form, by saving its clients
41 from various tedious and error-prone operations.</p>
43 <p>As an example, imagine you have a database form, displayed in some user
44 interface, which you want to move to the next record.<br/>
45 It is as easy as calling <member scope="com:::sun::star::sdbc">XResultSet::next</member>
46 on this form, right? Wrong. First, you need to care for saving the current
47 record, so the user doesn't lose her input. So you need to call
48 <member scope="com::sun::star::sdbc">XResultSetUpdate::updateRow</member> or
49 <member scope="com::sun::star::sdbc">XResultSetUpdate::insertRow</member>, depending
50 on the form's <member scope="com::sun::star::sdb">RowSet::IsNew</member> property.<br/>
51 But then you're done, right? Wrong, again.<br/>
52 When the user just entered some data into one of the form fields, but did not yet
53 leave this field, then the data is not yet committed to the form, not to talk
54 about being committed to the underlying database. So, before everything else,
55 you would need to obtain the active control of the form, and commit it.<br/>
56 <em>Now</em> you're done ...</p>
58 <p>As another example, consider that you want to delete the current record from the
59 form. You have to take into account any <type scope="com::sun::star::form">XConfirmDeleteListener</type>s
60 registered at the <type scope="com::sun::star::form">FormController</type> or the
61 <type scope="com::sun::star::form::component">DataForm</type>.</p>
63 <p>If you agree that this is ugly to do and maintain, then <code>XFormOperations</code>
64 is for you. It provides a <member>execute</member> method, which will do all of the above
65 for you; plus some similar convenient wrappers for similar functionality.</p>
67 @see FormFeature
69 @since OOo 2.2
71 interface XFormOperations : ::com::sun::star::lang::XComponent
73 /** provides access to the cursor of the form the instance is operating on.
75 [attribute, readonly] ::com::sun::star::sdbc::XRowSet Cursor;
77 /** provides access to the update cursor of the form the instance is operating on.
79 [attribute, readonly] ::com::sun::star::sdbc::XResultSetUpdate UpdateCursor;
81 /** provides access to the form controller which the instance is operating on.
83 <p>Note that it is possible to operate on a user interface form without
84 actually having access to the form controller instance. However, in this
85 case some functionality will not be available. In particular, every feature
86 which relies on the active control of the controller might be of limited use.</p>
88 [attribute, readonly] ::com::sun::star::form::runtime::XFormController Controller;
90 /** retrieves the current state of the given feature
92 <p>You would usually use this to update some user interface to reflect this state.
93 For instance, you could imagine a toolbar button which is associated with a given feature.
94 This button would be enabled if and only if the respective feature is currently
95 available, and be checked if and only if the feature state is a <code>boolean</code>
96 evaluating to <TRUE/>.<p>
98 @param Feature
99 the feature whose state is to be determined. Must be one of the <type>FormFeature</type>
100 constants.<br/>
101 An invalid value here will be silently ignored, and simply return a <type>FeatureState</type>
102 indicating <em>disabled</em> with a <NULL/> state.</p>
104 FeatureState getState(
105 [in] short Feature
108 /** determines whether a feature is currently enabled.
110 <p>Calling this is equivalent to calling <member>getState</member>, and evaluating the
111 <member>FeatureState::Enabled</member> member.</p>
113 @param Feature
114 the feature whose state is to be determined. Must be one of the <type>FormFeature</type>
115 constants.<br/>
116 An invalid value here will be silently ignored, and simply return <FALSE/>.
118 boolean isEnabled(
119 [in] short Feature
122 /** executes the operation associated with the given feature
124 @param Feature
125 the feature which is to be executed. Must be one of the <type>FormFeature</type>
126 constants.
128 @throws ::com::sun::star::lang::IllegalArgumentException
129 if the given Feature is unknown, not executable, or strictly requires arguments
130 to be executed.
132 @throws ::com::sun::star::sdbc::SQLException
133 if a database access error occurs
135 @throws ::com::sun::star::lang::WrappedTargetException
136 if an exception is caught which is no <type scope="com::sun::star::uno">RuntimeException</type>
137 and no <type scope="com::sun::star::sdbc">SQLException</type>.
139 @see executeWithArguments
141 void execute(
142 [in] short Feature
144 raises ( ::com::sun::star::lang::IllegalArgumentException
145 , ::com::sun::star::sdbc::SQLException
146 , ::com::sun::star::lang::WrappedTargetException
149 /** executes the operation associated with the given feature, with passing arguments for execution
151 @param Feature
152 the feature which is to be executed. Must be one of the <type>FormFeature</type>
153 constants.
155 @param Arguments
156 the named arguments for the feature to execute. See the <type>FormFeature</type> list
157 for features which require arguments.
159 @throws ::com::sun::star::lang::IllegalArgumentException
160 if the given feature is unknown, or not executable
162 @throws ::com::sun::star::lang::IllegalArgumentException
163 if the given arguments are not sufficient to execute the feature
165 @throws ::com::sun::star::sdbc::SQLException
166 if a database access error occurs
168 @throws ::com::sun::star::lang::WrappedTargetException
169 if an exception is caught which is no <type scope="com::sun::star::uno">RuntimeException</type>
170 and no <type scope="com::sun::star::sdbc">SQLException</type>.
172 void executeWithArguments(
173 [in] short Feature,
174 [in] sequence< ::com::sun::star::beans::NamedValue > Arguments
176 raises ( ::com::sun::star::lang::IllegalArgumentException
177 , ::com::sun::star::sdbc::SQLException
178 , ::com::sun::star::lang::WrappedTargetException
181 /** commits the current record of the form
183 @param RecordInserted
184 will be <TRUE/> if a record has been inserted, i.e. the form was positioned
185 on the insertion row.
187 @return
188 <TRUE/> if and only if the current record needed being committed. That's the
189 case if the record or the active control of the form were modified.
191 @throws ::com::sun::star::sdbc::SQLException
192 if a database access error occurs
194 boolean commitCurrentRecord(
195 [out] boolean RecordInserted
197 raises ( ::com::sun::star::sdbc::SQLException );
199 /** commits the current control of our controller
201 @throws ::com::sun::star::sdbc::SQLException
202 if a database access error occurs
204 boolean commitCurrentControl(
206 raises ( ::com::sun::star::sdbc::SQLException );
208 /** determines whether the form is currently positioned on the insertion row
210 <p>This is a convenience method only. Calling it is equivalent to examining the
211 <member scope="com::sun::star::sdb">RowSet::IsNew</member> property of the form.</p>
213 @throws ::com::sun::star::lang::WrappedTargetException
214 if an error occurs obtaining the form property
216 boolean isInsertionRow(
218 raises ( ::com::sun::star::lang::WrappedTargetException );
220 /** determines whether the current row of the form is modified
222 <p>This is a convenience method only. Calling it is equivalent to examining the
223 <member scope="com::sun::star::sdb">RowSet::IsModified</member> property of the form.</p>
225 @throws ::com::sun::star::lang::WrappedTargetException
226 if an error occurs obtaining the form property
228 boolean isModifiedRow(
230 raises ( ::com::sun::star::lang::WrappedTargetException );
232 /** denotes the instance which should be notified about features whose state might have changed.
234 <p>If this attribute is not <NULL/>, the instance which it denotes will be notified
235 whenever the state of any supported feature might have changed.</p>
237 <p>For instance, imagine a form whose current row has just been moved to another
238 record, using the <member>execute</member> method. This means that potentially, the state
239 of all movement-related features might have changed.</p>
241 <p>Note that the instance does not actually notify changes in the feature states, but only
242 <em>potential</em> changes: It's up to the callee to react on this appropriately. This is
243 since OpenOffice.org's application framework features own mechanisms to cache and invalidate
244 feature states, so we do not burden this implementation here with such mechanisms.</p>
246 @see FormFeature
248 [attribute] XFeatureInvalidation FeatureInvalidation;
252 }; }; }; }; };
255 #endif
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */