1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 module com
{ module sun
{ module star
{ module sdb
{ module application
{
24 /** provides access to the user interface of a database document
26 <p>This interface is available when a database document has been loaded into
27 a frame, at the controller of this frame.</p>
29 @see com::sun::star::frame::Controller
30 @see com::sun::star::sdb::DatabaseDocument
34 interface XDatabaseDocumentUI
36 /** provides access to the data source belong to the database document
38 [attribute
, readonly] com
::sun
::star
::sdbc
::XDataSource DataSource
;
40 /** provides access to the application's main window
42 <p>Note that reading this attribute is equivalent to querying the component
43 for the com::sun::star::frame::XController interface,
44 asking the controller for its frame, and asking this frame for its
47 @see ::com::sun::star::frame::XController
48 @see ::com::sun::star::frame::XFrame
50 [attribute
, readonly] com
::sun
::star
::awt
::XWindow ApplicationMainWindow
;
52 /** provides access to the current connection of the application
54 <p>Note that the connection returned here is really the working connection
55 of the application. Clients should not misuse it, in particular, closing
56 the connection can yield unexpected results and should definitely be
57 avoided. If you need a separate connection to the data source, use
58 com::sun::star::sdbc::XDataSource::getConnection().</p>
60 [attribute
, readonly] com
::sun
::star
::sdbc
::XConnection ActiveConnection
;
62 /** determines whether the application is currently connected to the database
64 boolean isConnected
();
66 /** lets the application connect to the database
68 <p>If the application is already connected, nothing happens. If it is not
69 connected, the application will try to establish a connection by using
70 com::sun::star::sdbc::XDataSource::getConnection()
71 with the current settings, as specified in the
72 com::sun::star::sdb::DataSource::Settings member.</p>
74 <p>If the connection cannot be established, the respective error message is shown
75 in the application window.</p>
77 @throws ::com::sun::star::sdbc::SQLException
78 if the connection cannot be established
81 raises
( ::com
::sun
::star
::sdbc
::SQLException
);
83 /** contains all sub components of the database document
85 <p>During working with the database, the user might open different sub components:
86 forms, reports, tables, queries. Those components are tracked by the application,
87 and provided in this attribute.</p>
89 <p>The components here might either be documents (com::sun::star::frame::XModel),
90 controllers (com::sun::star::frame::XController), or frames
91 (com::sun::star::frame::XFrame).
95 [attribute
, readonly] sequence
< ::com
::sun
::star
::lang
::XComponent
>
98 /** identifies the given sub component
101 the component to identify. Must be one of the components in #SubComponents.
104 a record describing the sub component. The first element of the returned pair is the type
105 of the component, denoted by one of the DatabaseObject constants. The second
106 element is the name of the component. For object types which support nested structures (forms
107 and reports, actually), this might be a hierarchical name. If the sub component has been newly created,
108 and not yet saved, this name is empty.
110 @throws ::com::sun::star::lang::IllegalArgumentException
111 if the given component is not one of the controller's sub components
113 ::com
::sun
::star
::beans
::Pair
< long, string >
114 identifySubComponent
(
115 [in] ::com
::sun
::star
::lang
::XComponent SubComponent
118 ::com
::sun
::star
::lang
::IllegalArgumentException
121 /** closes all sub components of the database document.
123 <p>During working with the database, the user might open different sub components:
124 forms, reports, tables, queries. If you need to close all those documents, use
125 <code>closeSubComponents</code>, which will gracefully do this.</p>
127 <p>In a first step, the sub components will be suspended
128 (com::sun::star::frame::XController::suspend()). There
129 are basically two reasons why suspending a single sub component can fail: The
130 user might veto it (she's asked if the document is currently modified), and
131 the component might be uncloseable currently, e.g. due to an open modal
132 dialog, or a long-lasting operation running currently (e.g. printing).</p>
134 <p>Once all sub components have been suspended, they will, in a second step,
135 be closed. Again, closing might be vetoed by other instances, e.g. by a close
136 listener registered at the component.</p>
139 `TRUE` if and only if both suspending and closing all sub components succeeds.
143 boolean closeSubComponents
();
145 /** loads the given sub component of the database document
147 <p>This method allows programmatic access to the functionality which is present in the UI:
148 it allows opening a table, query, form, or report for either editing or viewing.</p>
150 <p>This method is a convenience wrapper for API which is also available otherwise. For instance,
151 for loading forms and reports, you could use the com::sun::star::frame::XComponentLoader
152 interface of the ::com::sun::star::sdb::Forms resp. ::com::sun::star::sdb::Reports
155 <p>Note there must exist a connection to the database before you can call this method.</p>
157 <p>If an error occurs opening the given object, then this is reported to the user via an error dialog.</p>
163 specifies the type of the object, must be one of the DatabaseObject
167 specifies the name of the object. In case hierarchical objects are supported
168 (as is the case form forms and reports), hierarchical names are supported here, too.
171 specifies whether the object should be opened for editing (`TRUE`) or viewing (`FALSE`).
173 <p>For the different object types, this means the following
174 <a name="component_types"></a>
175 <table style="width:100%;" border="1 solid black" cellpadding="2" cellspacing="2">
176 <tr style="vertical-align: top;">
178 <td><code>ForEditing</code> = `TRUE`</td>
179 <td><code>ForEditing</code> = `FALSE`</td>
182 <tr style="vertical-align: top;">
183 <td><em>Tables</em></td>
184 <td>A table designer is opened, and allows to edit the structure of the table.
185 See also ::com::sun::star::sdb::TableDesign</td>
186 <td>A table data view is opened, and allows to view and edit the data contained in the table.
187 See also ::com::sun::star::sdb::DataSourceBrowser</td>
190 <tr style="vertical-align: top;">
191 <td><em>Queries</em></td>
192 <td>A query designer is opened, and allows to edit the statement constituting the query.
193 See also ::com::sun::star::sdb::QueryDesign</td>
194 <td>A table data view is opened, and allows to view and edit the data contained in the query.
195 See also ::com::sun::star::sdb::DataSourceBrowser</td>
198 <tr style="vertical-align: top;">
199 <td><em>Forms</em></td>
200 <td>The form document is opened in design mode, that is, you can modify it.</td>
201 <td>The form document is opened in read-only mode, allowing you to view and enter the data
202 which the form is based on, but not the form design.</td>
205 <tr style="vertical-align: top;">
206 <td><em>Reports</em></td>
207 <td>The report document is opened in design mode, that is, you can modify it.</td>
208 <td>The report is executed, and the results will be displayed.</td>
215 the component which has been loaded. This is either a com::sun::star::frame::XModel,
216 or a com::sun::star::frame::XController if the component does is model-less.
218 @throws ::com::sun::star::lang::IllegalArgumentException
219 if ObjectType denotes an invalid object type
221 @throws ::com::sun::star::container::NoSuchElementException
222 if an object with the given name and of the given type does not exist
224 @throws ::com::sun::star::sdbc::SQLException
225 if there is no connection to the database at the time the method is called.
227 ::com
::sun
::star
::lang
::XComponent loadComponent
(
228 [in] long ObjectType
,
229 [in] string ObjectName
,
230 [in] boolean ForEditing
)
231 raises
( ::com
::sun
::star
::lang
::IllegalArgumentException
,
232 ::com
::sun
::star
::container
::NoSuchElementException
,
233 ::com
::sun
::star
::sdbc
::SQLException
);
235 /** loads the given sub component of the database document
237 <p>In opposite to loadComponent(), this method allows you to specify
238 additional arguments which are passed to the to-be-loaded component.</p>
240 <p>The meaning of the arguments is defined at the service which is effectively
241 created. See the <a href="#component_types">above table</a> for a list of those
244 ::com
::sun
::star
::lang
::XComponent loadComponentWithArguments
(
245 [in] long ObjectType
,
246 [in] string ObjectName
,
247 [in] boolean ForEditing
,
248 [in] sequence
< ::com
::sun
::star
::beans
::PropertyValue
> Arguments
)
249 raises
( ::com
::sun
::star
::lang
::IllegalArgumentException
,
250 ::com
::sun
::star
::container
::NoSuchElementException
,
251 ::com
::sun
::star
::sdbc
::SQLException
);
253 /** creates a new sub component of the given type
256 specifies the type of the object, must be one of the DatabaseObject
259 @param DocumentDefinition
260 Upon successful return, and if and only if ObjectType equals DatabaseObject::FORM
261 or DatabaseObject::REPORT, this will contain the com::sun::star::sdb::DocumentDefinition
262 object which controls the sub component.
264 ::com
::sun
::star
::lang
::XComponent createComponent
(
265 [in] long ObjectType
,
266 [out] ::com
::sun
::star
::lang
::XComponent DocumentDefinition
)
267 raises
( ::com
::sun
::star
::lang
::IllegalArgumentException
,
268 ::com
::sun
::star
::sdbc
::SQLException
);
270 /** creates a new sub component of the given type
272 <p>In opposite to createComponent(), this method allows you to specify
273 additional arguments which are passed to the to-be-loaded component.</p>
277 specifies the type of the object, must be one of the DatabaseObject
281 The meaning of the arguments is defined at the service which is
282 effectively created. See the <a href="#component_types">above
283 table</a> for a list of those services.
285 @param DocumentDefinition
286 Upon successful return, and if and only if ObjectType equals DatabaseObject::FORM
287 or DatabaseObject::REPORT, this will contain the com::sun::star::sdb::DocumentDefinition
288 object which controls the sub component.<br/>
289 You can use this object to control various aspects of the sub component. For instance, you could decide
290 to create the component hidden, by passing a <code>Hidden</code> flag (set to `TRUE`) in Arguments,
291 manipulate the component, and then finally show it by invoking the <code>show</code> command at the
294 ::com
::sun
::star
::lang
::XComponent createComponentWithArguments
(
295 [in] long ObjectType
,
296 [in] sequence
< ::com
::sun
::star
::beans
::PropertyValue
> Arguments
,
297 [out] ::com
::sun
::star
::lang
::XComponent DocumentDefinition
)
298 raises
( ::com
::sun
::star
::lang
::IllegalArgumentException
,
299 ::com
::sun
::star
::container
::NoSuchElementException
,
300 ::com
::sun
::star
::sdbc
::SQLException
);
307 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */