summaryrefslogtreecommitdiff
path: root/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl
blob: 088ed540897c8933b462ebcd48b860e6157ad4f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

#ifndef __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__
#define __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__

#include <com/sun/star/sdbc/XDataSource.idl>
#include <com/sun/star/sdbc/SQLException.idl>
#include <com/sun/star/sdbc/XConnection.idl>
#include <com/sun/star/awt/XWindow.idl>
#include <com/sun/star/lang/IllegalArgumentException.idl>
#include <com/sun/star/container/NoSuchElementException.idl>
#include <com/sun/star/lang/XComponent.idl>
#include <com/sun/star/beans/PropertyValue.idl>
#include <com/sun/star/beans/Pair.idl>

//=============================================================================

module com { module sun { module star { module sdb { module application {

//=============================================================================

/** provides access to the user interface of a database document

    <p>This interface is available when a database document has been loaded into
    a frame, at the controller of this frame.</p>

    @see com::sun::star::frame::Controller
    @see com::sun::star::sdb::DatabaseDocument

    @since OOo 2.2
 */
interface XDatabaseDocumentUI
{
    /** provides access to the data source belong to the database document
    */
    [attribute, readonly] com::sun::star::sdbc::XDataSource DataSource;

    /** provides access to the applicatio's main window

        <p>Note that reading this atttribute is equivalent to querying the component
        for the <type scope="com::sun::star::frame">XController</type> interface,
        asking the controller for its frame, and asking this frame for its
        container window.</p>

        @see ::com::sun::star::frame::XController
        @see ::com::sun::star::frame::XFrame
    */
    [attribute, readonly] com::sun::star::awt::XWindow ApplicationMainWindow;

    /** provides access to the current connection of the application

        <p>Note that the connection returned here is really the working connection
        of the application. Clients should not misuse it, in particular, closing
        the connection can yield unexpected results and should definately be
        avoided. If you need a separate connection to the data source, use
        <member scope="com::sun::star::sdbc">XDataSource::getConnection</member>.</p>
    */
    [attribute, readonly] com::sun::star::sdbc::XConnection ActiveConnection;

    /** determines whether the application is currently connected to the database
    */
    boolean isConnected();

    /** lets the application connect to the database

        <p>If the application is already connected, nothing happens. If it is not
        connected, the application will try to establish a connection by using
        <member scope="com::sun::star::sdbc">XDataSource::getConnection</member>
        with the current settings, as specified in the
        <member scope="com::sun::star::sdb">DataSource::Settings</member> member.</p>

        <p>If the connection cannot be established, the respective error message is shown
        in the application window.</p>

        @throws ::com::sun::star::sdbc::SQLException
            if the connection cannot be established
    */
    void    connect()
        raises ( ::com::sun::star::sdbc::SQLException );

    /** contains all sub components of the database document

        <p>During working with the database, the user might open different sub components:
        forms, reports, tables, queries. Those components are tracked by the application,
        and provided in this attribute.</p>

        <p>The components here might either be documents (<type scope="com::sun::star::frame">XModel</type>),
        controllers (<type scope="com::sun::star::frame">XController</type>), or frames
        (<type scope="com::sun::star::frame">XFrame</type>).

        @since OOo 3.0
    */
    [attribute, readonly] sequence< ::com::sun::star::lang::XComponent >
            SubComponents;

    /** identifies the given sub component

        @param SubComponent
            the component to identify. Must be one of the components in <member>SubComponents</member>.

        @return
            a record describing the sub component. The first element of the returned pair is the type
            of the component, denoted by one of the <type>DatabaseObject</type> constants. The second
            element is the name of the component. For object types which support nested structures (forms
            and reports, actually), this might be a hierachical name. If the sub component has been newly created,
            and not yet saved, this name is empty.

        @throws ::com::sun::star::lang::IllegalArgumentException
            if the given component is not one of the controller's sub components
    */
    ::com::sun::star::beans::Pair< long, string >
            identifySubComponent(
                [in] ::com::sun::star::lang::XComponent SubComponent
            )
            raises (
                ::com::sun::star::lang::IllegalArgumentException
            );

    /** closes all sub components of the database document.

        <p>During working with the database, the user might open different sub components:
        forms, reports, tables, queries. If you need to close all those documents, use
        <code>closeSubComponents</code>, which will gracefully do this.</p>

        <p>In a first step, the sub components will be suspended
        (<member scope="com::sun::star::frame">XController::suspend</member>). There
        are basically two reasons why suspending a single sub component can fail: The
        user might veto it (she's asked if the document is currently modified), and
        the component might be uncloseable currently, e.g. due to an open modal
        dialog, or a long-lasting operation running currently (e.g. printing).</p>

        <p>Once all sub components have been suspended, they will, in a second step,
        be closed. Again, closing might be vetoed by other instances, e.g. by a close
        listener registered at the component.</p>

        @return
            <TRUE/> if and only if both suspending and closing all sub components succeeds.

        @since OOo 3.0
    */
    boolean closeSubComponents();

    /** loads the given sub component of the database document

        <p>This method allows programmatic access to the functionality which is present in the UI:
        it allows opening a table, query, form, or report for either editing or viewing.</p>

        <p>This method is a convenience wrapper for API which is also available otherwise. For instance,
        for loading forms and reports, you could use the <type scope="com::sun::star::frame">XComponentLoader</type>
        interface of the <type scope="::com::sun::star::sdb">Forms</type> resp. <type scope="::com::sun::star::sdb">Reports</type>
        collections.</p>

        <p>Note there must exist a connection to the database before you can call this method.</p>

        <p>If an error occurs opening the given object, then this is reported to the user via an error dialog.</p>

        @see isConnected
        @see connect

        @param ObjectType
            specifies the type of the object, must be one of the <type>DatabaseObject</type>
            constants.

        @param ObjectName
            specifies the name of the object. In case hierachical objects are supported
            (as is the case form forms and reports), hierarchical names are supported here, too.

        @param ForEditing
            specifies whether the object should be opened for editing (<TRUE/>) or viewing (<FALSE/>).

            <p>For the different object types, this means the following
            <a name="component_types"></a>
            <table style="width:100%;" border="1 solid black" cellpadding="2" cellspacing="2"><tbody>
              <tr style="vertical-align: top;">
                <td></td>
                <td><code>ForEditing</code> = <TRUE/></td>
                <td><code>ForEditing</code> = <FALSE/></td>
              </tr>

              <tr style="vertical-align: top;">
                <td><em>Tables</em></td>
                <td>A table designer is opened, and allows to edit the structure of the table.
                    See also <type scope="::com::sun::star::sdb">TableDesign</type></td>
                <td>A table data view is opened, and allows to view and edit the data contained in the table.
                    See also <type scope="::com::sun::star::sdb">DataSourceBrowser</type></td>
              </tr>

              <tr style="vertical-align: top;">
                <td><em>Queries</em></td>
                <td>A query designer is opened, and allows to edit the statement constituting the query.
                    See also <type scope="::com::sun::star::sdb">QueryDesign</type></td>
                <td>A table data view is opened, and allows to view and edit the data contained in the query.
                    See also <type scope="::com::sun::star::sdb">DataSourceBrowser</type></td>
              </tr>

              <tr style="vertical-align: top;">
                <td><em>Forms</em></td>
                <td>The form document is opened in design mode, that is, you can modify it.</td>
                <td>The form document is opened in read-only mode, allowing you to view and enter the data
                    which the form is based on, but not the form design.</td>
              </tr>

              <tr style="vertical-align: top;">
                <td><em>Reports</em></td>
                <td>The report document is opened in design mode, that is, you can modify it.</td>
                <td>The report is executed, and the results will be displayed.</td>
              </tr>

            </tbody></table>
            </p>

        @return
            the component which has been loaded. This is either an <type scope="com::sun::star::frame">XModel</type>,
            or an <type scope="com::sun::star::frame">XController</type> if the component does is model-less.

        @throws ::com::sun::star::lang::IllegalArgumentException
            if <arg>ObjectType</arg> denotes an invalid object type

        @throws ::com::sun::star::container::NoSuchElementException
            if an object with the given name and of the given type does not exist

        @throws ::com::sun::star::sdbc::SQLException
            if there is no connection to the database at the time the method is called.
    */
    ::com::sun::star::lang::XComponent loadComponent(
                    [in] long ObjectType,
                    [in] string ObjectName,
                    [in] boolean ForEditing )
        raises ( ::com::sun::star::lang::IllegalArgumentException,
                 ::com::sun::star::container::NoSuchElementException,
                 ::com::sun::star::sdbc::SQLException );

    /** loads the given sub component of the database document

        <p>In opposite to <member>loadComponent</member>, this method allows you to specify
        additional arguments which are passed to the to-be-loaded component.</p>

        <p>The meaning of the the arguments is defined at the service which is effectively
        created. See the <a href="#component_types">above table</a> for a list of those
        services.</p>
    */
    ::com::sun::star::lang::XComponent loadComponentWithArguments(
                    [in] long ObjectType,
                    [in] string ObjectName,
                    [in] boolean ForEditing,
                    [in] sequence< ::com::sun::star::beans::PropertyValue > Arguments )
        raises ( ::com::sun::star::lang::IllegalArgumentException,
                 ::com::sun::star::container::NoSuchElementException,
                 ::com::sun::star::sdbc::SQLException );

    /** creates a new sub component of the given type

        @param ObjectType
            specifies the type of the object, must be one of the <type>DatabaseObject</type>
            constants.

        @param DocumentDefinition
            Upon successful return, and if and only if <arg>ObjectType</arg> equals <member>DatabaseObject::FORM</member>
            or <member>DatabaseObject::REPORT</member>, this will contain the <type scope="com::sun::star::sdb">DocumentDefinition</type>
            object which controls the sub component.
    */
    ::com::sun::star::lang::XComponent createComponent(
                    [in] long ObjectType,
                    [out] ::com::sun::star::lang::XComponent DocumentDefinition )
        raises ( ::com::sun::star::lang::IllegalArgumentException,
                 ::com::sun::star::sdbc::SQLException );

    /** creates a new sub component of the given type

        <p>In opposite to <member>createComponent</member>, this method allows you to specify
        additional arguments which are passed to the to-be-loaded component.</p>

        <p>The meaning of the the arguments is defined at the service which is effectively
        created. See the <a href="#component_types">above table</a> for a list of those
        services.</p>

        @param ObjectType
            specifies the type of the object, must be one of the <type>DatabaseObject</type>
            constants.

        @param DocumentDefinition
            Upon successful return, and if and only if <arg>ObjectType</arg> equals <member>DatabaseObject::FORM</member>
            or <member>DatabaseObject::REPORT</member>, this will contain the <type scope="com::sun::star::sdb">DocumentDefinition</type>
            object which controls the sub component.<br/>
            You can use this object to control various aspects of the sub component. For instance, you could decide
            to create the component hidden, by passing a <code>Hidden</code> flag (set to <TRUE/>) in <arg>Arguments</arg>,
            manipulate the component, and then finally show it by invoking the <code>show</code> command at the
            definition object.
    */
    ::com::sun::star::lang::XComponent createComponentWithArguments(
                    [in] long ObjectType,
                    [in] sequence< ::com::sun::star::beans::PropertyValue > Arguments,
                    [out] ::com::sun::star::lang::XComponent DocumentDefinition )
        raises ( ::com::sun::star::lang::IllegalArgumentException,
                 ::com::sun::star::sdbc::SQLException );
};

//=============================================================================

}; }; }; }; };

//=============================================================================

#endif