/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: XDatabaseDocumentUI.idl,v $ * $Revision: 1.7 $ * * 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 * * for a copy of the LGPLv3 License. * ************************************************************************/ #ifndef __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__ #define __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__ #ifndef __com_sun_star_sdbc_XDataSource_idl__ #include #endif #ifndef __com_sun_star_sdbc_SQLException_idl__ #include #endif #ifndef __com_sun_star_sdbc_XConnection_idl__ #include #endif #ifndef __com_sun_star_awt_XWindow_idl__ #include #endif #ifndef __com_sun_star_lang_IllegalArgumentException_idl__ #include #endif #ifndef __com_sun_star_container_NoSuchElementException_idl__ #include #endif #ifndef __com_sun_star_lang_XComponent_idl__ #include #endif #ifndef __com_sun_star_beans_PropertyValue_idl__ #include #endif //============================================================================= module com { module sun { module star { module sdb { module application { //============================================================================= /** provides access to the user interface of a database document

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

@see com::sun::star::frame::Controller @see com::sun::star::sdb::DatabaseDocument @since OOo 2.2.0 */ 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

Note that reading this atttribute is equivalent to querying the component for the XController interface, asking the controller for its frame, and asking this frame for its container window.

@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

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 XDataSource::getConnection.

*/ [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

If the application is already connected, nothing happens. If it is not connected, the application will try to establish a connection by using XDataSource::getConnection with the current settings, as specified in the DataSource::Settings member.

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

@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

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.

The components here might either be documents (XModel), controllers (XController), or frames (XFrame). @since OOo 3.0 */ [attribute, readonly] sequence< ::com::sun::star::lang::XComponent > SubComponents; /** closes all sub components of the database document.

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 closeSubComponents, which will gracefully do this.

In a first step, the sub components will be suspended (XController::suspend). 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).

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.

@return 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

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.

This method is a convenience wrapper for API which is also available otherwise. For instance, for loading forms and reports, you could use the XComponentLoader interface of the Forms resp. Reports collections.

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

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

@see isConnected @see connect @param ObjectType specifies the type of the object, must be one of the DatabaseObject 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 () or viewing ().

For the different object types, this means the following
ForEditing = ForEditing =
Tables A table designer is opened, and allows to edit the structure of the table. See also TableDesign A table data view is opened, and allows to view and edit the data contained in the table. See also DataSourceBrowser
Queries A query designer is opened, and allows to edit the statement constituting the query. See also QueryDesign A table data view is opened, and allows to view and edit the data contained in the query. See also DataSourceBrowser
Forms The form document is opened in design mode, that is, you can modify it. 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.
Reports The report document is opened in design mode, that is, you can modify it. The report is executed, and the results will be displayed.

@return the component which has been loaded. This is either an XModel, or an XController if the component does is model-less. @throws ::com::sun::star::lang::IllegalArgumentException if ObjectType 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

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

The meaning of the the arguments is defined at the service which is effectively created. See the above table for a list of those services.

*/ ::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 ); }; //============================================================================= }; }; }; }; }; //============================================================================= #endif