1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27
28#ifndef __com_sun_star_sdb_application_XCopyTableWizard_idl__
29#define __com_sun_star_sdb_application_XCopyTableWizard_idl__
30
31#ifndef __com_sun_star_ui_dialogs_XExecutableDialog_idl__
32#include <com/sun/star/ui/dialogs/XExecutableDialog.idl>
33#endif
34#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
35#include <com/sun/star/lang/IllegalArgumentException.idl>
36#endif
37#ifndef __com_sun_star_beans_Optional_idl__
38#include <com/sun/star/beans/Optional.idl>
39#endif
40
41//=============================================================================
42
43module com { module sun { module star { module sdb { module application {
44
45interface XCopyTableListener;
46
47//=============================================================================
48
49/** describes a wizard which can be used to copy table like data from one
50    database to another.
51
52    <p>Copying table data between databases can be a complex task. Especially when
53    it comes to matching field types in the source and in the target database,
54    some heuristics, and sometimes support from the user doing the operation,
55    are required.</p>
56
57    <p>The <code>copy table wizard</code> described by this interfaces cares for those,
58    and other, settings.</p>
59
60    @since OOo 2.4
61 */
62interface XCopyTableWizard : ::com::sun::star::ui::dialogs::XExecutableDialog
63{
64    /** specifies the basic operation for the wizard to execute.
65
66        <p>This must be one of the <type>CopyTableOperation</type> constants.</p>
67
68        <p>At initialization time, you can use this attribute to control the
69        initial operation in the wizard.</p>
70
71        <p>After the wizard has finished, you can use this attribute to determine
72        what operation was actually executed.</p>
73
74        <p>Changing this attribute while the dialog is running is not supported, the
75        result of such an attempt is undefined.</p>
76
77        @throws IllegalArgumentException
78            if you attempt to set an invalid operation, or if the given operation is
79            not supported by the target database type, e.g. if you specified
80            <member>CopyTableOperation::CreateAsView</member> where the database
81            does not support views.
82    */
83    [attribute] short Operation
84    {
85        set raises ( ::com::sun::star::lang::IllegalArgumentException );
86    };
87
88    /** specfies the name of the table in the destination database.
89
90        <p>At initialization time, you can use this attribute to control the
91        initial table name as suggested to the user.</p>
92
93        <p>After the wizard has finished, you can use this attribute to determine
94        what table was actually created resp. to which existing table the source
95        table's data was appended.</p>
96
97        <p>Changing this attribute while the dialog is running is not supported, the
98        result of such an attempt is undefined.</p>
99    */
100    [attribute] string  DestinationTableName;
101
102    /** specifies that a new primary key is to be created in the target database
103
104        <p>At initialization time, you can specify the initial settings for the primary
105        key in the UI.</p>
106
107        <p>You cannot use this attribute to determine the primary key, possibly created
108        by the wizard, after it finished. The reason is that during the wizard run, the
109        user can define an arbitrarily complex primary key, e.g. including multiple columns,
110        which cannot be represented in this simple attribute anymore.</p>
111
112        <p>This attribute is ignored if <member>Operation</member> is
113        <member>CopyTableOperation::AppendData</member>.</p>
114
115        <p>Changing this attribute while the dialog is running is not supported, the
116        result of such an attempt is undefined.</p>
117
118        <p>When a primary key is to be created by the wizard, it will be be an auto-increment
119        column, if possible.</p>
120
121        @throws ::com::sun::star::lang::IllegalArgumentException
122            if the target database does not support primary keys
123    */
124    [attribute] ::com::sun::star::beans::Optional< string >
125                        CreatePrimaryKey
126    {
127        set raises ( ::com::sun::star::lang::IllegalArgumentException );
128    };
129
130    /** specifies that the first row should be used to identify column names.
131
132        <p>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
133        e.g. in the RTF format or in the HTML format.
134        </p>
135    */
136    [attribute] boolean UseHeaderLineAsColumnNames;
137
138    /** adds a listener which is to be notified of progress in the copy operation
139    */
140    void    addCopyTableListener( [in] XCopyTableListener Listener );
141
142    /** removes a listener
143    */
144    void    removeCopyTableListener( [in] XCopyTableListener Listener );
145};
146
147//=============================================================================
148
149}; }; }; }; };
150
151//=============================================================================
152
153#endif
154