1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24#ifndef __com_sun_star_sdb_application_XCopyTableWizard_idl__
25#define __com_sun_star_sdb_application_XCopyTableWizard_idl__
26
27#ifndef __com_sun_star_ui_dialogs_XExecutableDialog_idl__
28#include <com/sun/star/ui/dialogs/XExecutableDialog.idl>
29#endif
30#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
31#include <com/sun/star/lang/IllegalArgumentException.idl>
32#endif
33#ifndef __com_sun_star_beans_Optional_idl__
34#include <com/sun/star/beans/Optional.idl>
35#endif
36
37//=============================================================================
38
39module com { module sun { module star { module sdb { module application {
40
41interface XCopyTableListener;
42
43//=============================================================================
44
45/** describes a wizard which can be used to copy table like data from one
46    database to another.
47
48    <p>Copying table data between databases can be a complex task. Especially when
49    it comes to matching field types in the source and in the target database,
50    some heuristics, and sometimes support from the user doing the operation,
51    are required.</p>
52
53    <p>The <code>copy table wizard</code> described by this interfaces cares for those,
54    and other, settings.</p>
55
56    @since OpenOffice 2.4
57 */
58interface XCopyTableWizard : ::com::sun::star::ui::dialogs::XExecutableDialog
59{
60    /** specifies the basic operation for the wizard to execute.
61
62        <p>This must be one of the <type>CopyTableOperation</type> constants.</p>
63
64        <p>At initialization time, you can use this attribute to control the
65        initial operation in the wizard.</p>
66
67        <p>After the wizard has finished, you can use this attribute to determine
68        what operation was actually executed.</p>
69
70        <p>Changing this attribute while the dialog is running is not supported, the
71        result of such an attempt is undefined.</p>
72
73        @throws IllegalArgumentException
74            if you attempt to set an invalid operation, or if the given operation is
75            not supported by the target database type, e.g. if you specified
76            <member>CopyTableOperation::CreateAsView</member> where the database
77            does not support views.
78    */
79    [attribute] short Operation
80    {
81        set raises ( ::com::sun::star::lang::IllegalArgumentException );
82    };
83
84    /** specfies the name of the table in the destination database.
85
86        <p>At initialization time, you can use this attribute to control the
87        initial table name as suggested to the user.</p>
88
89        <p>After the wizard has finished, you can use this attribute to determine
90        what table was actually created resp. to which existing table the source
91        table's data was appended.</p>
92
93        <p>Changing this attribute while the dialog is running is not supported, the
94        result of such an attempt is undefined.</p>
95    */
96    [attribute] string  DestinationTableName;
97
98    /** specifies that a new primary key is to be created in the target database
99
100        <p>At initialization time, you can specify the initial settings for the primary
101        key in the UI.</p>
102
103        <p>You cannot use this attribute to determine the primary key, possibly created
104        by the wizard, after it finished. The reason is that during the wizard run, the
105        user can define an arbitrarily complex primary key, e.g. including multiple columns,
106        which cannot be represented in this simple attribute anymore.</p>
107
108        <p>This attribute is ignored if <member>Operation</member> is
109        <member>CopyTableOperation::AppendData</member>.</p>
110
111        <p>Changing this attribute while the dialog is running is not supported, the
112        result of such an attempt is undefined.</p>
113
114        <p>When a primary key is to be created by the wizard, it will be be an auto-increment
115        column, if possible.</p>
116
117        @throws ::com::sun::star::lang::IllegalArgumentException
118            if the target database does not support primary keys
119    */
120    [attribute] ::com::sun::star::beans::Optional< string >
121                        CreatePrimaryKey
122    {
123        set raises ( ::com::sun::star::lang::IllegalArgumentException );
124    };
125
126    /** specifies that the first row should be used to identify column names.
127
128        <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
129        e.g. in the RTF format or in the HTML format.
130        </p>
131    */
132    [attribute] boolean UseHeaderLineAsColumnNames;
133
134    /** adds a listener which is to be notified of progress in the copy operation
135    */
136    void    addCopyTableListener( [in] XCopyTableListener Listener );
137
138    /** removes a listener
139    */
140    void    removeCopyTableListener( [in] XCopyTableListener Listener );
141};
142
143//=============================================================================
144
145}; }; }; }; };
146
147//=============================================================================
148
149#endif
150