From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001
From: Daniel Baumann The user can choose between ignoring the error and canceling the copy
+ operation. This option is not available if the target database does not support views. Whenever this event is fired to an XCopyTableListener,
+ com::sun::star::lang::EventObject::Source contains the
+ wizard instance which actually does the copying. Usually, this contains an instance of com::sun::star::sdbc::SQLException. There are various cases where the wizard needs to interact with the user (except of
+ course the obvious case to display and operate the wizard dialog itself). For those cases,
+ an interaction handler is needed, which is used for
+
+
+
SQLException
, usually) that happened.
When you do not specify an interaction handler by using the
+ createWithInteractionHandler() constructor, the wizard will use the interaction
+ handler associated with the copy target, i.e. the interaction handler specified when loading
+ the document which the copy target refers to. If the copy target cannot be associated with
+ a database document (e.g. because it is a mere ConnectionResource
, or a connection
+ not obtained from a data source), or if the copy target's database document cannot provide
+ an interaction handler, a newly-created instance of an interaction handler is used.
There's one exception to the above, however: Upon creating the copy table wizard, + the copy source and the copy target descriptors are used to create a Connection. For any + interaction during this phase - including, for instance, necessary authentication -, the + interaction handler of the respective data source is used, no matter what you specified + in createWithInteractionHandler(). Only if there is no such interaction + handler, the processing described above, to find another handler, is applied.
+ + + + @see ::com::sun::star::sdb::ParametersRequest + @see XCopyTableWizard::addCopyTableListener + @see CopyTableContinuation + @see ::com::sun::star::document::MediaDescriptor::InteractionHandler + @see ::com::sun::star::sdb::DatabaseDocument + @see ::com::sun::star::sdb::DataSource + @see ::com::sun::star::sdb::DataAccessDescriptor::ConnectionResource + @see ::com::sun::star::sdb::InteractionHandler + + @since OOo 2.4 + */ +service CopyTableWizard : XCopyTableWizard +{ + /** creates an executable wizard dialog, which is to guide the user through copying + a table from one database to another. + +At creation time, an attempt will be made to obtain the connections described + by Source resp. Dest. Failing to do so will result in an + exception.
+ +If the connection has been newly created by the wizard (e.g. because the
+ data access descriptor specified a DataSource
instead of an ActiveConnection
),
+ then this connection will be disposed upon disposal of the wizard.
The following members of the DataAccessDescriptor
are supported, and evaluated
+ in the given order:
+
ActiveConnection
DataSourceName
DatabaseLocation
ConnectionResource
ConnectionInfo
Command
CommandType
Command
and CommandType
+ are required.
+
+ Additionally to the obvious restrictions (such as that creating a view is not possible + if the copy source and the copy destination denote different databases), the following restrictions + apply to the settings, and possible combinations: +
ConnectionResource
, or an
+ ActiveConnection
which implements a com::sun::star::sdbc::Connection only
+ (as opposed to a com::sun::star::sdb::Connection), then the resulting connection is
+ not able to provide queries, thus a command type QUERY
will be rejected.Filter
, Order
, HavingClause
and GroupBy
+ are unsupported at the moment.Only DataSourceName
, DatabaseLocation
, ActiveConnection
+ are supported, effectively describing the target connection to copy the data to. They're evaluated
+ in the order mentioned here, so if multiple of the are present, only the first one is evaluated.
Also, at the moment the connection which is implied by either of the settings above + must support the com::sun::star::sdb::Connection service. In particular, + it is not sufficient to pass an SDBC-level connection.
+ +Note that creating a view (see CopyTableOperation::CreateAsView) is + not supported if the target connection is an SDBC-level connection only.
+ + @throws ::com::sun::star::lang::IllegalArgumentException + if +Source
or Destination
is `NULL`Source
or Destination
are not sufficient
+ to describe a database connection.Source
is not sufficient to describe the to-be-copied dataSource
or Destination
contain unsupported settings.DataSourceName
member.
+
+ @see ::com::sun::star::sdb::DataAccessDescriptor
+ */
+ create(
+ [in] ::com::sun::star::beans::XPropertySet Source,
+ [in] ::com::sun::star::beans::XPropertySet Destination
+ )
+ raises ( ::com::sun::star::lang::IllegalArgumentException
+ , ::com::sun::star::sdbc::SQLException
+ , ::com::sun::star::lang::WrappedTargetException
+ );
+
+ /** creates an executable wizard dialog, which is to guide the user through copying
+ a table from one database to another.
+
+ The only difference to the create() constructor is that
+ createWithInteractionHandler
takes an additional argument, which
+ can be used to intercept interactions (such as error messages) during the wizard
+ run.
When specifying this parameter, you should use an implementation + supporting the com::sun::star::sdb::InteractionHandler, since + the general-purpose com::sun::star::task::InteractionHandler cannot + handle all requests described above.
+ + @see ::com::sun::star::sdb::InteractionHandler + */ + createWithInteractionHandler( + [in] ::com::sun::star::beans::XPropertySet Source, + [in] ::com::sun::star::beans::XPropertySet Destination, + [in] ::com::sun::star::task::XInteractionHandler InteractionHandler + ) + raises ( ::com::sun::star::lang::IllegalArgumentException + , ::com::sun::star::sdbc::SQLException + , ::com::sun::star::lang::WrappedTargetException + ); + +}; + + +}; }; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/sdb/application/DatabaseObject.idl b/offapi/com/sun/star/sdb/application/DatabaseObject.idl new file mode 100644 index 000000000..366be5002 --- /dev/null +++ b/offapi/com/sun/star/sdb/application/DatabaseObject.idl @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_sdb_application_DatabaseObject_idl__ +#define __com_sun_star_sdb_application_DatabaseObject_idl__ + +#includeNote that table here is a more general term. In OpenOffice.org Base, + views are also represented as tables, since to the user, the behave pretty much + as tables do.
+ */ + const long TABLE = com::sun::star::sdb::CommandType::TABLE; + + /** denotes a query in a database document + */ + const long QUERY = com::sun::star::sdb::CommandType::QUERY; + + /** denotes a form in a database document + */ + const long FORM = 2; + + /** denotes a report in a database document + */ + const long REPORT = 3; +}; + + +}; }; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/sdb/application/DatabaseObjectContainer.idl b/offapi/com/sun/star/sdb/application/DatabaseObjectContainer.idl new file mode 100644 index 000000000..a4e714cdc --- /dev/null +++ b/offapi/com/sun/star/sdb/application/DatabaseObjectContainer.idl @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_sdb_application_DatabaseObjectContainer_idl__ +#define __com_sun_star_sdb_application_DatabaseObjectContainer_idl__ + + +module com { module sun { module star { module sdb { module application { + + +/** denotes different types of (maybe virtual) containers of database objects + +In the database application of OpenOffice.org, database objects (such as + tables, queries, forms, reports) can be organized in folders. This hierarchy can + be imposed externally, or internally. + +
For example, when you connect to a database which supports catalogs and/or schemas, + then those impose a natural order on the tables, in that a catalog or a schema + is a folder of tables.
+ +On the other hand, for forms and reports, OpenOffice.org Base itself allows the + user to create folders to organize the documents - in this case, the hierarchy is + defined in the database document itself.
+ + @see DatabaseObject + + @since OOo 3.0 + */ +constants DatabaseObjectContainer +{ + /** denotes the virtual folder containing all tables of a database, in a context where such a + folder is displayed to the user. + */ + const long TABLES = 1000; + + /** denotes the virtual folder containing all queries of a database, in a context where such a + folder is displayed to the user. + */ + const long QUERIES = 1001; + + /** denotes the virtual folder containing all forms of a database document, in a context where such a + folder is displayed to the user. + */ + const long FORMS = 1002; + + /** denotes the virtual folder containing all reports of a database, in a context where such a + folder is displayed to the user. + */ + const long REPORTS = 1003; + + /** denotes the data source itself, which effectively is the root container for all other + kind of database objects, including other container types. + */ + const long DATA_SOURCE = 1004; + + /** denotes a catalog in a database which supports catalogs + */ + const long CATALOG = 1005; + + /** denotes a schema in a database which supports schemas + */ + const long SCHEMA = 1006; + + /** denotes a folder which is used to organize forms in a database document + */ + const long FORMS_FOLDER = 1007; + + /** denotes a folder which is used to organize reports in a database document + */ + const long REPORTS_FOLDER = 1008; +}; + + +}; }; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/sdb/application/DefaultViewController.idl b/offapi/com/sun/star/sdb/application/DefaultViewController.idl new file mode 100644 index 000000000..c41879e57 --- /dev/null +++ b/offapi/com/sun/star/sdb/application/DefaultViewController.idl @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_sdb_application_DefaultViewController_idl__ +#define __com_sun_star_sdb_application_DefaultViewController_idl__ + +#includeThe ::com::sun::star::ui::ContextMenuExecuteEvent::Selection member
+ of the event passed to an interceptor will not be the controller itself
+ (though the controller also supports the XSelectionSupplier
+ interface), but a component which describes the current selection of the very window where the context
+ menu was requested.
In OpenOffice.org's database application, database objects such as tables, queries, forms,
+ reports are displayed in a tree-like fashion. Currently, only context menu requests on this tree view
+ can be intercepted using the XContextMenuInterception
interface. Context menu requests
+ in other places cannot be intercepted.
For the aforementioned tree view, the selection supplied by the ContextMenuEvent::Selection
+ component is an array of NamedDatabaseObject instances.
The selection is an array of NamedDatabaseObject instances.
+ */ + interface ::com::sun::star::view::XSelectionSupplier; + + /** allows to retrieve and set the title which of the component + */ + interface ::com::sun::star::frame::XTitle; + + /** allows being notified about changes in the component's title + */ + interface ::com::sun::star::frame::XTitleChangeBroadcaster; + + /** allows programmatic access to aspects of the application's user interface. + */ + interface XDatabaseDocumentUI; +}; + + +}; }; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/sdb/application/NamedDatabaseObject.idl b/offapi/com/sun/star/sdb/application/NamedDatabaseObject.idl new file mode 100644 index 000000000..99f239596 --- /dev/null +++ b/offapi/com/sun/star/sdb/application/NamedDatabaseObject.idl @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_sdb_application_NamedDatabaseObject_idl__ +#define __com_sun_star_sdb_application_NamedDatabaseObject_idl__ + + +module com { module sun { module star { module sdb { module application { + + +/** denotes a named database object, or a named folder of database objects + + @since OOo 3.0 +*/ +struct NamedDatabaseObject +{ + /** denotes the type of the object. + +This member is one of the DatabaseObject or DatabaseObjectContainer constants.
+ */ + long Type; + + /** denotes the name of the object + +In case of forms, reports, form folders and report folders, this is the hierarchical
+ path to the object, where the path elements are separated by a slash (/
).
In case of tables, this is the fully qualified name of the table, as required + by the database's table name composition rules.
+ +In case of queries, this is the name of the query.
+ +In case of virtual folders denoted by DatabaseObjectContainer::CATALOG and + DatabaseObjectContainer::SCHEMA, it is +
<schema>
, if the database supports schemas only<catalog>
, if the database supports catalogs only<catalog>.<schema>
, if the database supports both
+ catalogs and schemas, and catalogs are to appear at the beginning of an identifier.<schema>.<catalog>
, if the database supports both
+ catalogs and schemas, and catalogs are to appear at the end of an identifier.In case of the virtual folders denoted by DatabaseObjectContainer::TABLES, + DatabaseObjectContainer::QUERIES, DatabaseObjectContainer::DATA_SOURCE, + DatabaseObjectContainer::FORMS or DatabaseObjectContainer::REPORTS, + this denotes the name of the data source (as denoted by + com::sun::star::sdb::DataSource::Name)
+ + @see XDatabaseMetaData::isCatalogAtStart + @see DatabaseObjectContainer + */ + string Name; +}; + + +}; }; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/sdb/application/XCopyTableListener.idl b/offapi/com/sun/star/sdb/application/XCopyTableListener.idl new file mode 100644 index 000000000..72613157e --- /dev/null +++ b/offapi/com/sun/star/sdb/application/XCopyTableListener.idl @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_sdb_application_XCopyTableListener_idl__ +#define __com_sun_star_sdb_application_XCopyTableListener_idl__ + +#includeCopyTableWizard
.
+
+ @see CopyTableRowEvent
+ @see CopyTableWizard
+ */
+interface XCopyTableListener : ::com::sun::star::lang::XEventListener
+{
+ /** is called when a row is about to be copied.
+
+ This method is called immediately before a row is copied. It might be used, for instance, + to update a progress indicator.
+ + @param Event + describes the current state of the copy operation. + CopyTableRowEvent::SourceData is positioned at the row + which is about to be copied. + */ + void copyingRow( [in] CopyTableRowEvent Event ); + + /** is called when a row was successfully copied. + +This method is called right after a row has been successfully copied. It might be used, + for instance, to update a progress indicator.
+ + @param Event + describes the current state of the copy operation. + CopyTableRowEvent::SourceData is positioned at the row + which was just copied to the target database. + */ + void copiedRow( [in] CopyTableRowEvent Event ); + + /** is called when copying a row failed. + + @param Event + describes the current state of the copy operation. + CopyTableRowEvent::SourceData is positioned at the row + which was attempted to be copied to the target database. + CopyTableRowEvent::Error will contain the actual error which + happened. + + @return + how to continue with copying. Must be one of the CopyTableContinuation + constants. + */ + short copyRowError( [in] CopyTableRowEvent Event ); +}; + + +}; }; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/sdb/application/XCopyTableWizard.idl b/offapi/com/sun/star/sdb/application/XCopyTableWizard.idl new file mode 100644 index 000000000..18b312f4f --- /dev/null +++ b/offapi/com/sun/star/sdb/application/XCopyTableWizard.idl @@ -0,0 +1,138 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_sdb_application_XCopyTableWizard_idl__ +#define __com_sun_star_sdb_application_XCopyTableWizard_idl__ + +#includeCopying table data between databases can be a complex task. Especially when + it comes to matching field types in the source and in the target database, + some heuristics, and sometimes support from the user doing the operation, + are required.
+ +The copy table wizard
described by this interfaces cares for those,
+ and other, settings.
This must be one of the CopyTableOperation constants.
+ +At initialization time, you can use this attribute to control the + initial operation in the wizard.
+ +After the wizard has finished, you can use this attribute to determine + what operation was actually executed.
+ +Changing this attribute while the dialog is running is not supported, the + result of such an attempt is undefined.
+ + @throws IllegalArgumentException + if you attempt to set an invalid operation, or if the given operation is + not supported by the target database type, e.g. if you specified + CopyTableOperation::CreateAsView where the database + does not support views. + */ + [attribute] short Operation + { + set raises ( ::com::sun::star::lang::IllegalArgumentException ); + }; + + /** specifies the name of the table in the destination database. + +At initialization time, you can use this attribute to control the + initial table name as suggested to the user.
+ +After the wizard has finished, you can use this attribute to determine + what table was actually created resp. to which existing table the source + table's data was appended.
+ +Changing this attribute while the dialog is running is not supported, the + result of such an attempt is undefined.
+ */ + [attribute] string DestinationTableName; + + /** specifies that a new primary key is to be created in the target database + +At initialization time, you can specify the initial settings for the primary + key in the UI.
+ +You cannot use this attribute to determine the primary key, possibly created + by the wizard, after it finished. The reason is that during the wizard run, the + user can define an arbitrarily complex primary key, e.g. including multiple columns, + which cannot be represented in this simple attribute anymore.
+ +This attribute is ignored if #Operation is + CopyTableOperation::AppendData.
+ +Changing this attribute while the dialog is running is not supported, the + result of such an attempt is undefined.
+ +When a primary key is to be created by the wizard, it will be an auto-increment + column, if possible.
+ + @throws ::com::sun::star::lang::IllegalArgumentException + if the target database does not support primary keys + */ + [attribute] ::com::sun::star::beans::Optional< string > + CreatePrimaryKey + { + set raises ( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::sdbc::SQLException ); + }; + + /** specifies that the first row should be used to identify column names. + +This attribute is ignored when the source defines the column names which isn't the case when only a part of a table should be copied + e.g. in the RTF format or in the HTML format. +
+ */ + [attribute] boolean UseHeaderLineAsColumnNames; + + /** adds a listener which is to be notified of progress in the copy operation + */ + void addCopyTableListener( [in] XCopyTableListener Listener ); + + /** removes a listener + */ + void removeCopyTableListener( [in] XCopyTableListener Listener ); +}; + + +}; }; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl new file mode 100644 index 000000000..a8f54d4f7 --- /dev/null +++ b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl @@ -0,0 +1,322 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__ +#define __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__ + +#includeThis 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 + */ +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 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 ::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 definitely be + avoided. If you need a separate connection to the data source, use + com::sun::star::sdbc::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 + 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.
+ + @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 (com::sun::star::frame::XModel), + controllers (com::sun::star::frame::XController), or frames + (com::sun::star::frame::XFrame). + + @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 #SubComponents. + + @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 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. + + @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. + +
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.
+ + @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 + +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 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 hierarchical 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`). + +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. | +
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.
+ */ + ::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 DatabaseObject + constants. + + @param DocumentDefinition + Upon 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. + */ + ::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 + +In opposite to createComponent(), this method allows you to specify + additional arguments which are passed to the to-be-loaded component.
+ + + @param ObjectType + specifies the type of the object, must be one of the DatabaseObject + constants. + + @param Arguments + The meaning of the arguments is defined at the service which is + effectively created. See the above + table for a list of those services. + + @param DocumentDefinition + Upon 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.Hidden
flag (set to `TRUE`) in Arguments,
+ manipulate the component, and then finally show it by invoking the show
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::container::NoSuchElementException,
+ ::com::sun::star::sdbc::SQLException );
+};
+
+
+}; }; }; }; };
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/sdb/application/XTableUIProvider.idl b/offapi/com/sun/star/sdb/application/XTableUIProvider.idl
new file mode 100644
index 000000000..e9bb5b53e
--- /dev/null
+++ b/offapi/com/sun/star/sdb/application/XTableUIProvider.idl
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __com_sun_star_sdb_application_XTableUIProvider_idl__
+#define __com_sun_star_sdb_application_XTableUIProvider_idl__
+
+#include The icon will usually be requested once per table, and cached. It + might be requested again if the application settings change, for instance, + if another desktop theme has been activated.
+ + @param TableName + denotes the fully qualified name of the database table. + + @param ColorMode + denotes the color mode of the graphic to retrieve, being one of the + com::sun::star::graphic::GraphicColorMode constants. + @return + the icon which should be used to represent the table in the + database application window, or `NULL` if the default icon + should be used. + */ + com::sun::star::graphic::XGraphic getTableIcon( + [in] string TableName, [in] long ColorMode ); + + /** returns a component which can be used to edit the definition of an + existing table. + + @param DocumentUI + provides access to the UI in which the database document is + currently displayed.