1d1766043SAndrew Rist/************************************************************** 2d1766043SAndrew Rist * 3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4d1766043SAndrew Rist * or more contributor license agreements. See the NOTICE file 5d1766043SAndrew Rist * distributed with this work for additional information 6d1766043SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the 8d1766043SAndrew Rist * "License"); you may not use this file except in compliance 9d1766043SAndrew Rist * with the License. You may obtain a copy of the License at 10d1766043SAndrew Rist * 11d1766043SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12d1766043SAndrew Rist * 13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing, 14d1766043SAndrew Rist * software distributed under the License is distributed on an 15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16d1766043SAndrew Rist * KIND, either express or implied. See the License for the 17d1766043SAndrew Rist * specific language governing permissions and limitations 18d1766043SAndrew Rist * under the License. 19d1766043SAndrew Rist * 20d1766043SAndrew Rist *************************************************************/ 21d1766043SAndrew Rist 22d1766043SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir#ifndef __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__ 25cdf0e10cSrcweir#define __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__ 26cdf0e10cSrcweir 27cdf0e10cSrcweir#include <com/sun/star/sdbc/XDataSource.idl> 28cdf0e10cSrcweir#include <com/sun/star/sdbc/SQLException.idl> 29cdf0e10cSrcweir#include <com/sun/star/sdbc/XConnection.idl> 30cdf0e10cSrcweir#include <com/sun/star/awt/XWindow.idl> 31cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl> 32cdf0e10cSrcweir#include <com/sun/star/container/NoSuchElementException.idl> 33cdf0e10cSrcweir#include <com/sun/star/lang/XComponent.idl> 34cdf0e10cSrcweir#include <com/sun/star/beans/PropertyValue.idl> 35cdf0e10cSrcweir#include <com/sun/star/beans/Pair.idl> 36cdf0e10cSrcweir 37cdf0e10cSrcweir//============================================================================= 38cdf0e10cSrcweir 39cdf0e10cSrcweirmodule com { module sun { module star { module sdb { module application { 40cdf0e10cSrcweir 41cdf0e10cSrcweir//============================================================================= 42cdf0e10cSrcweir 43cdf0e10cSrcweir/** provides access to the user interface of a database document 44cdf0e10cSrcweir 45cdf0e10cSrcweir <p>This interface is available when a database document has been loaded into 46cdf0e10cSrcweir a frame, at the controller of this frame.</p> 47cdf0e10cSrcweir 48cdf0e10cSrcweir @see com::sun::star::frame::Controller 49cdf0e10cSrcweir @see com::sun::star::sdb::DatabaseDocument 50cdf0e10cSrcweir 51c4dc0a1aSJürgen Schmidt @since OpenOffice 2.2 52cdf0e10cSrcweir */ 53cdf0e10cSrcweirpublished interface XDatabaseDocumentUI 54cdf0e10cSrcweir{ 55cdf0e10cSrcweir /** provides access to the data source belong to the database document 56cdf0e10cSrcweir */ 57cdf0e10cSrcweir [attribute, readonly] com::sun::star::sdbc::XDataSource DataSource; 58cdf0e10cSrcweir 59cdf0e10cSrcweir /** provides access to the applicatio's main window 60cdf0e10cSrcweir 61cdf0e10cSrcweir <p>Note that reading this atttribute is equivalent to querying the component 62cdf0e10cSrcweir for the <type scope="com::sun::star::frame">XController</type> interface, 63cdf0e10cSrcweir asking the controller for its frame, and asking this frame for its 64cdf0e10cSrcweir container window.</p> 65cdf0e10cSrcweir 66cdf0e10cSrcweir @see ::com::sun::star::frame::XController 67cdf0e10cSrcweir @see ::com::sun::star::frame::XFrame 68cdf0e10cSrcweir */ 69cdf0e10cSrcweir [attribute, readonly] com::sun::star::awt::XWindow ApplicationMainWindow; 70cdf0e10cSrcweir 71cdf0e10cSrcweir /** provides access to the current connection of the application 72cdf0e10cSrcweir 73cdf0e10cSrcweir <p>Note that the connection returned here is really the working connection 74cdf0e10cSrcweir of the application. Clients should not misuse it, in particular, closing 75*a893be29SPedro Giffuni the connection can yield unexpected results and should definitely be 76cdf0e10cSrcweir avoided. If you need a separate connection to the data source, use 77cdf0e10cSrcweir <member scope="com::sun::star::sdbc">XDataSource::getConnection</member>.</p> 78cdf0e10cSrcweir */ 79cdf0e10cSrcweir [attribute, readonly] com::sun::star::sdbc::XConnection ActiveConnection; 80cdf0e10cSrcweir 81cdf0e10cSrcweir /** determines whether the application is currently connected to the database 82cdf0e10cSrcweir */ 83cdf0e10cSrcweir boolean isConnected(); 84cdf0e10cSrcweir 85cdf0e10cSrcweir /** lets the application connect to the database 86cdf0e10cSrcweir 87cdf0e10cSrcweir <p>If the application is already connected, nothing happens. If it is not 88cdf0e10cSrcweir connected, the application will try to establish a connection by using 89cdf0e10cSrcweir <member scope="com::sun::star::sdbc">XDataSource::getConnection</member> 90cdf0e10cSrcweir with the current settings, as specified in the 91cdf0e10cSrcweir <member scope="com::sun::star::sdb">DataSource::Settings</member> member.</p> 92cdf0e10cSrcweir 93cdf0e10cSrcweir <p>If the connection cannot be established, the respective error message is shown 94cdf0e10cSrcweir in the application window.</p> 95cdf0e10cSrcweir 96cdf0e10cSrcweir @throws ::com::sun::star::sdbc::SQLException 97cdf0e10cSrcweir if the connection cannot be established 98cdf0e10cSrcweir */ 99cdf0e10cSrcweir void connect() 100cdf0e10cSrcweir raises ( ::com::sun::star::sdbc::SQLException ); 101cdf0e10cSrcweir 102cdf0e10cSrcweir /** contains all sub components of the database document 103cdf0e10cSrcweir 104cdf0e10cSrcweir <p>During working with the database, the user might open different sub components: 105cdf0e10cSrcweir forms, reports, tables, queries. Those components are tracked by the application, 106cdf0e10cSrcweir and provided in this attribute.</p> 107cdf0e10cSrcweir 108cdf0e10cSrcweir <p>The components here might either be documents (<type scope="com::sun::star::frame">XModel</type>), 109cdf0e10cSrcweir controllers (<type scope="com::sun::star::frame">XController</type>), or frames 110cdf0e10cSrcweir (<type scope="com::sun::star::frame">XFrame</type>). 111cdf0e10cSrcweir 112c4dc0a1aSJürgen Schmidt @since OpenOffice 3.0 113cdf0e10cSrcweir */ 114cdf0e10cSrcweir [attribute, readonly] sequence< ::com::sun::star::lang::XComponent > 115cdf0e10cSrcweir SubComponents; 116cdf0e10cSrcweir 117cdf0e10cSrcweir /** identifies the given sub component 118cdf0e10cSrcweir 119cdf0e10cSrcweir @param SubComponent 120cdf0e10cSrcweir the component to identify. Must be one of the components in <member>SubComponents</member>. 121cdf0e10cSrcweir 122cdf0e10cSrcweir @return 123cdf0e10cSrcweir a record describing the sub component. The first element of the returned pair is the type 124cdf0e10cSrcweir of the component, denoted by one of the <type>DatabaseObject</type> constants. The second 125cdf0e10cSrcweir element is the name of the component. For object types which support nested structures (forms 126*a893be29SPedro Giffuni and reports, actually), this might be a hierarchical name. If the subcomponent has been newly created, 127cdf0e10cSrcweir and not yet saved, this name is empty. 128cdf0e10cSrcweir 129cdf0e10cSrcweir @throws ::com::sun::star::lang::IllegalArgumentException 130cdf0e10cSrcweir if the given component is not one of the controller's sub components 131cdf0e10cSrcweir */ 132cdf0e10cSrcweir ::com::sun::star::beans::Pair< long, string > 133cdf0e10cSrcweir identifySubComponent( 134cdf0e10cSrcweir [in] ::com::sun::star::lang::XComponent SubComponent 135cdf0e10cSrcweir ) 136cdf0e10cSrcweir raises ( 137cdf0e10cSrcweir ::com::sun::star::lang::IllegalArgumentException 138cdf0e10cSrcweir ); 139cdf0e10cSrcweir 140cdf0e10cSrcweir /** closes all sub components of the database document. 141cdf0e10cSrcweir 142cdf0e10cSrcweir <p>During working with the database, the user might open different sub components: 143cdf0e10cSrcweir forms, reports, tables, queries. If you need to close all those documents, use 144cdf0e10cSrcweir <code>closeSubComponents</code>, which will gracefully do this.</p> 145cdf0e10cSrcweir 146cdf0e10cSrcweir <p>In a first step, the sub components will be suspended 147cdf0e10cSrcweir (<member scope="com::sun::star::frame">XController::suspend</member>). There 148cdf0e10cSrcweir are basically two reasons why suspending a single sub component can fail: The 149cdf0e10cSrcweir user might veto it (she's asked if the document is currently modified), and 150cdf0e10cSrcweir the component might be uncloseable currently, e.g. due to an open modal 151cdf0e10cSrcweir dialog, or a long-lasting operation running currently (e.g. printing).</p> 152cdf0e10cSrcweir 153cdf0e10cSrcweir <p>Once all sub components have been suspended, they will, in a second step, 154cdf0e10cSrcweir be closed. Again, closing might be vetoed by other instances, e.g. by a close 155cdf0e10cSrcweir listener registered at the component.</p> 156cdf0e10cSrcweir 157cdf0e10cSrcweir @return 158cdf0e10cSrcweir <TRUE/> if and only if both suspending and closing all sub components succeeds. 159cdf0e10cSrcweir 160c4dc0a1aSJürgen Schmidt @since OpenOffice 3.0 161cdf0e10cSrcweir */ 162cdf0e10cSrcweir boolean closeSubComponents(); 163cdf0e10cSrcweir 164cdf0e10cSrcweir /** loads the given sub component of the database document 165cdf0e10cSrcweir 166cdf0e10cSrcweir <p>This method allows programmatic access to the functionality which is present in the UI: 167cdf0e10cSrcweir it allows opening a table, query, form, or report for either editing or viewing.</p> 168cdf0e10cSrcweir 169cdf0e10cSrcweir <p>This method is a convenience wrapper for API which is also available otherwise. For instance, 170cdf0e10cSrcweir for loading forms and reports, you could use the <type scope="com::sun::star::frame">XComponentLoader</type> 171cdf0e10cSrcweir interface of the <type scope="::com::sun::star::sdb">Forms</type> resp. <type scope="::com::sun::star::sdb">Reports</type> 172cdf0e10cSrcweir collections.</p> 173cdf0e10cSrcweir 174cdf0e10cSrcweir <p>Note there must exist a connection to the database before you can call this method.</p> 175cdf0e10cSrcweir 176cdf0e10cSrcweir <p>If an error occurs opening the given object, then this is reported to the user via an error dialog.</p> 177cdf0e10cSrcweir 178cdf0e10cSrcweir @see isConnected 179cdf0e10cSrcweir @see connect 180cdf0e10cSrcweir 181cdf0e10cSrcweir @param ObjectType 182cdf0e10cSrcweir specifies the type of the object, must be one of the <type>DatabaseObject</type> 183cdf0e10cSrcweir constants. 184cdf0e10cSrcweir 185cdf0e10cSrcweir @param ObjectName 186*a893be29SPedro Giffuni specifies the name of the object. In case hierarchical objects are supported 187cdf0e10cSrcweir (as is the case form forms and reports), hierarchical names are supported here, too. 188cdf0e10cSrcweir 189cdf0e10cSrcweir @param ForEditing 190cdf0e10cSrcweir specifies whether the object should be opened for editing (<TRUE/>) or viewing (<FALSE/>). 191cdf0e10cSrcweir 192cdf0e10cSrcweir <p>For the different object types, this means the following 193cdf0e10cSrcweir <a name="component_types"></a> 194cdf0e10cSrcweir <table style="width:100%;" border="1 solid black" cellpadding="2" cellspacing="2"><tbody> 195cdf0e10cSrcweir <tr style="vertical-align: top;"> 196cdf0e10cSrcweir <td></td> 197cdf0e10cSrcweir <td><code>ForEditing</code> = <TRUE/></td> 198cdf0e10cSrcweir <td><code>ForEditing</code> = <FALSE/></td> 199cdf0e10cSrcweir </tr> 200cdf0e10cSrcweir 201cdf0e10cSrcweir <tr style="vertical-align: top;"> 202cdf0e10cSrcweir <td><em>Tables</em></td> 203cdf0e10cSrcweir <td>A table designer is opened, and allows to edit the structure of the table. 204cdf0e10cSrcweir See also <type scope="::com::sun::star::sdb">TableDesign</type></td> 205cdf0e10cSrcweir <td>A table data view is opened, and allows to view and edit the data contained in the table. 206cdf0e10cSrcweir See also <type scope="::com::sun::star::sdb">DataSourceBrowser</type></td> 207cdf0e10cSrcweir </tr> 208cdf0e10cSrcweir 209cdf0e10cSrcweir <tr style="vertical-align: top;"> 210cdf0e10cSrcweir <td><em>Queries</em></td> 211cdf0e10cSrcweir <td>A query designer is opened, and allows to edit the statement constituting the query. 212cdf0e10cSrcweir See also <type scope="::com::sun::star::sdb">QueryDesign</type></td> 213cdf0e10cSrcweir <td>A table data view is opened, and allows to view and edit the data contained in the query. 214cdf0e10cSrcweir See also <type scope="::com::sun::star::sdb">DataSourceBrowser</type></td> 215cdf0e10cSrcweir </tr> 216cdf0e10cSrcweir 217cdf0e10cSrcweir <tr style="vertical-align: top;"> 218cdf0e10cSrcweir <td><em>Forms</em></td> 219cdf0e10cSrcweir <td>The form document is opened in design mode, that is, you can modify it.</td> 220cdf0e10cSrcweir <td>The form document is opened in read-only mode, allowing you to view and enter the data 221cdf0e10cSrcweir which the form is based on, but not the form design.</td> 222cdf0e10cSrcweir </tr> 223cdf0e10cSrcweir 224cdf0e10cSrcweir <tr style="vertical-align: top;"> 225cdf0e10cSrcweir <td><em>Reports</em></td> 226cdf0e10cSrcweir <td>The report document is opened in design mode, that is, you can modify it.</td> 227cdf0e10cSrcweir <td>The report is executed, and the results will be displayed.</td> 228cdf0e10cSrcweir </tr> 229cdf0e10cSrcweir 230cdf0e10cSrcweir </tbody></table> 231cdf0e10cSrcweir </p> 232cdf0e10cSrcweir 233cdf0e10cSrcweir @return 234cdf0e10cSrcweir the component which has been loaded. This is either an <type scope="com::sun::star::frame">XModel</type>, 235cdf0e10cSrcweir or an <type scope="com::sun::star::frame">XController</type> if the component does is model-less. 236cdf0e10cSrcweir 237cdf0e10cSrcweir @throws ::com::sun::star::lang::IllegalArgumentException 238cdf0e10cSrcweir if <arg>ObjectType</arg> denotes an invalid object type 239cdf0e10cSrcweir 240cdf0e10cSrcweir @throws ::com::sun::star::container::NoSuchElementException 241cdf0e10cSrcweir if an object with the given name and of the given type does not exist 242cdf0e10cSrcweir 243cdf0e10cSrcweir @throws ::com::sun::star::sdbc::SQLException 244cdf0e10cSrcweir if there is no connection to the database at the time the method is called. 245cdf0e10cSrcweir */ 246cdf0e10cSrcweir ::com::sun::star::lang::XComponent loadComponent( 247cdf0e10cSrcweir [in] long ObjectType, 248cdf0e10cSrcweir [in] string ObjectName, 249cdf0e10cSrcweir [in] boolean ForEditing ) 250cdf0e10cSrcweir raises ( ::com::sun::star::lang::IllegalArgumentException, 251cdf0e10cSrcweir ::com::sun::star::container::NoSuchElementException, 252cdf0e10cSrcweir ::com::sun::star::sdbc::SQLException ); 253cdf0e10cSrcweir 254cdf0e10cSrcweir /** loads the given sub component of the database document 255cdf0e10cSrcweir 256cdf0e10cSrcweir <p>In opposite to <member>loadComponent</member>, this method allows you to specify 257cdf0e10cSrcweir additional arguments which are passed to the to-be-loaded component.</p> 258cdf0e10cSrcweir 259cdf0e10cSrcweir <p>The meaning of the the arguments is defined at the service which is effectively 260cdf0e10cSrcweir created. See the <a href="#component_types">above table</a> for a list of those 261cdf0e10cSrcweir services.</p> 262cdf0e10cSrcweir */ 263cdf0e10cSrcweir ::com::sun::star::lang::XComponent loadComponentWithArguments( 264cdf0e10cSrcweir [in] long ObjectType, 265cdf0e10cSrcweir [in] string ObjectName, 266cdf0e10cSrcweir [in] boolean ForEditing, 267cdf0e10cSrcweir [in] sequence< ::com::sun::star::beans::PropertyValue > Arguments ) 268cdf0e10cSrcweir raises ( ::com::sun::star::lang::IllegalArgumentException, 269cdf0e10cSrcweir ::com::sun::star::container::NoSuchElementException, 270cdf0e10cSrcweir ::com::sun::star::sdbc::SQLException ); 271cdf0e10cSrcweir 272cdf0e10cSrcweir /** creates a new sub component of the given type 273cdf0e10cSrcweir 274cdf0e10cSrcweir @param ObjectType 275cdf0e10cSrcweir specifies the type of the object, must be one of the <type>DatabaseObject</type> 276cdf0e10cSrcweir constants. 277cdf0e10cSrcweir 278cdf0e10cSrcweir @param DocumentDefinition 279cdf0e10cSrcweir Upon successful return, and if and only if <arg>ObjectType</arg> equals <member>DatabaseObject::FORM</member> 280cdf0e10cSrcweir or <member>DatabaseObject::REPORT</member>, this will contain the <type scope="com::sun::star::sdb">DocumentDefinition</type> 281cdf0e10cSrcweir object which controls the sub component. 282cdf0e10cSrcweir */ 283cdf0e10cSrcweir ::com::sun::star::lang::XComponent createComponent( 284cdf0e10cSrcweir [in] long ObjectType, 285cdf0e10cSrcweir [out] ::com::sun::star::lang::XComponent DocumentDefinition ) 286cdf0e10cSrcweir raises ( ::com::sun::star::lang::IllegalArgumentException, 287cdf0e10cSrcweir ::com::sun::star::sdbc::SQLException ); 288cdf0e10cSrcweir 289cdf0e10cSrcweir /** creates a new sub component of the given type 290cdf0e10cSrcweir 291cdf0e10cSrcweir <p>In opposite to <member>createComponent</member>, this method allows you to specify 292cdf0e10cSrcweir additional arguments which are passed to the to-be-loaded component.</p> 293cdf0e10cSrcweir 294cdf0e10cSrcweir <p>The meaning of the the arguments is defined at the service which is effectively 295cdf0e10cSrcweir created. See the <a href="#component_types">above table</a> for a list of those 296cdf0e10cSrcweir services.</p> 297cdf0e10cSrcweir 298cdf0e10cSrcweir @param ObjectType 299cdf0e10cSrcweir specifies the type of the object, must be one of the <type>DatabaseObject</type> 300cdf0e10cSrcweir constants. 301cdf0e10cSrcweir 302cdf0e10cSrcweir @param DocumentDefinition 303cdf0e10cSrcweir Upon successful return, and if and only if <arg>ObjectType</arg> equals <member>DatabaseObject::FORM</member> 304cdf0e10cSrcweir or <member>DatabaseObject::REPORT</member>, this will contain the <type scope="com::sun::star::sdb">DocumentDefinition</type> 305cdf0e10cSrcweir object which controls the sub component.<br/> 306cdf0e10cSrcweir You can use this object to control various aspects of the sub component. For instance, you could decide 307cdf0e10cSrcweir to create the component hidden, by passing a <code>Hidden</code> flag (set to <TRUE/>) in <arg>Arguments</arg>, 308cdf0e10cSrcweir manipulate the component, and then finally show it by invoking the <code>show</code> command at the 309cdf0e10cSrcweir definition object. 310cdf0e10cSrcweir */ 311cdf0e10cSrcweir ::com::sun::star::lang::XComponent createComponentWithArguments( 312cdf0e10cSrcweir [in] long ObjectType, 313cdf0e10cSrcweir [in] sequence< ::com::sun::star::beans::PropertyValue > Arguments, 314cdf0e10cSrcweir [out] ::com::sun::star::lang::XComponent DocumentDefinition ) 315cdf0e10cSrcweir raises ( ::com::sun::star::lang::IllegalArgumentException, 316cdf0e10cSrcweir ::com::sun::star::sdbc::SQLException ); 317cdf0e10cSrcweir}; 318cdf0e10cSrcweir 319cdf0e10cSrcweir//============================================================================= 320cdf0e10cSrcweir 321cdf0e10cSrcweir}; }; }; }; }; 322cdf0e10cSrcweir 323cdf0e10cSrcweir//============================================================================= 324cdf0e10cSrcweir 325cdf0e10cSrcweir#endif 326cdf0e10cSrcweir 327