LibreOffice
LibreOffice 24.2 SDK API Reference
Public Member Functions | Public Attributes | List of all members
XDatabaseDocumentUI Interface Reference

provides access to the user interface of a database document More...

import"XDatabaseDocumentUI.idl";

Inheritance diagram for XDatabaseDocumentUI:
DefaultViewController

Public Member Functions

boolean isConnected ()
 determines whether the application is currently connected to the database More...
 
void connect () raises ( ::com::sun::star::sdbc::SQLException )
 lets the application connect to the database More...
 
::com::sun::star::beans::Pair< long, string > identifySubComponent ([in] ::com::sun::star::lang::XComponent SubComponent) raises ( ::com::sun::star::lang::IllegalArgumentException )
 identifies the given sub component More...
 
boolean closeSubComponents ()
 closes all sub components of the database document. More...
 
::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 More...
 
::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 )
 loads the given sub component of the database document More...
 
::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 More...
 
::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::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException )
 creates a new sub component of the given type More...
 

Public Attributes

com::sun::star::sdbc::XDataSource DataSource
 provides access to the data source belong to the database document More...
 
com::sun::star::awt::XWindow ApplicationMainWindow
 provides access to the application's main window More...
 
com::sun::star::sdbc::XConnection ActiveConnection
 provides access to the current connection of the application More...
 
sequence< ::com::sun::star::lang::XComponentSubComponents
 contains all sub components of the database document More...
 

Detailed Description

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 also
com::sun::star::frame::Controller
com::sun::star::sdb::DatabaseDocument
Since
OOo 2.2

Member Function Documentation

◆ closeSubComponents()

boolean closeSubComponents ( )

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 (com::sun::star::frame::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.

Returns
TRUE if and only if both suspending and closing all sub components succeeds.
Since
OOo 3.0

◆ connect()

void connect ( )
raises (::com::sun::star::sdbc::SQLException
)

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 com::sun::star::sdbc::XDataSource::getConnection() with the current settings, as specified in the com::sun::star::sdb::DataSource::Settings member.

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

Exceptions
com::sun::star::sdbc::SQLExceptionif the connection cannot be established

◆ createComponent()

::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

Parameters
ObjectTypespecifies the type of the object, must be one of the DatabaseObject constants.
DocumentDefinitionUpon successful return, and if and only if ObjectType equals DatabaseObject::FORM or DatabaseObject::REPORT, this will contain the com::sun::star::sdb::DocumentDefinition object which controls the sub component.

◆ createComponentWithArguments()

creates a new sub component of the given type

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

Parameters
ObjectTypespecifies the type of the object, must be one of the DatabaseObject constants.
ArgumentsThe meaning of the arguments is defined at the service which is effectively created. See the above table for a list of those services.
DocumentDefinitionUpon successful return, and if and only if ObjectType equals DatabaseObject::FORM or DatabaseObject::REPORT, this will contain the com::sun::star::sdb::DocumentDefinition object which controls the sub component.
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 Hidden flag (set to TRUE) in Arguments, manipulate the component, and then finally show it by invoking the show command at the definition object.

◆ identifySubComponent()

::com::sun::star::beans::Pair< long, string > identifySubComponent ( [in] ::com::sun::star::lang::XComponent  SubComponent)
raises (::com::sun::star::lang::IllegalArgumentException
)

identifies the given sub component

Parameters
SubComponentthe component to identify. Must be one of the components in SubComponents.
Returns
a record describing the sub component. The first element of the returned pair is the type of the component, denoted by one of the DatabaseObject 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 hierarchical name. If the sub component has been newly created, and not yet saved, this name is empty.
Exceptions
com::sun::star::lang::IllegalArgumentExceptionif the given component is not one of the controller's sub components

◆ isConnected()

boolean isConnected ( )

determines whether the application is currently connected to the database

◆ loadComponent()

::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

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 com::sun::star::frame::XComponentLoader interface of the com::sun::star::sdb::Forms resp. com::sun::star::sdb::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 also
isConnected
connect
Parameters
ObjectTypespecifies the type of the object, must be one of the DatabaseObject constants.
ObjectNamespecifies the name of the object. In case hierarchical objects are supported (as is the case form forms and reports), hierarchical names are supported here, too.
ForEditingspecifies whether the object should be opened for editing (TRUE) or viewing (FALSE).

For the different object types, this means the following

ForEditing = TRUE

ForEditing = FALSE

Tables A table designer is opened, and allows to edit the structure of the table. See also com::sun::star::sdb::TableDesign

A table data view is opened, and allows to view and edit the data contained in the table. See also com::sun::star::sdb::DataSourceBrowser

Queries A query designer is opened, and allows to edit the statement constituting the query. See also com::sun::star::sdb::QueryDesign

A table data view is opened, and allows to view and edit the data contained in the query. See also com::sun::star::sdb::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.

Returns
the component which has been loaded. This is either a com::sun::star::frame::XModel, or a com::sun::star::frame::XController if the component does is model-less.
Exceptions
com::sun::star::lang::IllegalArgumentExceptionif ObjectType denotes an invalid object type
com::sun::star::container::NoSuchElementExceptionif an object with the given name and of the given type does not exist
com::sun::star::sdbc::SQLExceptionif there is no connection to the database at the time the method is called.

◆ loadComponentWithArguments()

::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
)

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 arguments is defined at the service which is effectively created. See the above table for a list of those services.

Member Data Documentation

◆ ActiveConnection

com::sun::star::sdbc::XConnection ActiveConnection
attributereadonly

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 definitely be avoided. If you need a separate connection to the data source, use com::sun::star::sdbc::XDataSource::getConnection().

◆ ApplicationMainWindow

com::sun::star::awt::XWindow ApplicationMainWindow
attributereadonly

provides access to the application's main window

Note that reading this attribute is equivalent to querying the component for the com::sun::star::frame::XController interface, asking the controller for its frame, and asking this frame for its container window.

See also
com::sun::star::frame::XController
com::sun::star::frame::XFrame

◆ DataSource

provides access to the data source belong to the database document

◆ SubComponents

sequence< ::com::sun::star::lang::XComponent > SubComponents
attributereadonly

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 (com::sun::star::frame::XModel), controllers (com::sun::star::frame::XController), or frames (com::sun::star::frame::XFrame).

Since
OOo 3.0

The documentation for this interface was generated from the following file: