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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_dbui.hxx"
26 
27 #ifndef _DBU_REGHELPER_HXX_
28 #include "dbu_reghelper.hxx"
29 #endif
30 #ifndef _COM_SUN_STAR_DOCUMENT_XEVENTLISTENER_HPP_
31 #include <com/sun/star/document/XEventListener.hpp>
32 #endif
33 #ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
34 #include <com/sun/star/container/XSet.hpp>
35 #endif
36 #ifndef DBAUI_DBTYPEWIZDLGSETUP_HXX
37 #include "DBTypeWizDlgSetup.hxx"
38 #endif
39 #ifndef DBAUI_DBWIZSETUP_HXX
40 #include "dbwizsetup.hxx"
41 #endif
42 #ifndef _COM_SUN_STAR_SDB_XOFFICEDATABASEDOCUMENT_HPP_
43 #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
44 #endif
45 #ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_
46 #include <com/sun/star/sdbc/XDataSource.hpp>
47 #endif
48 #ifndef _SV_MSGBOX_HXX
49 #include <vcl/msgbox.hxx>
50 #endif
51 
52 using namespace dbaui;
53 namespace css = ::com::sun::star;
54 
createRegistryInfo_ODBTypeWizDialogSetup()55 extern "C" void SAL_CALL createRegistryInfo_ODBTypeWizDialogSetup()
56 {
57 	static OMultiInstanceAutoRegistration< ODBTypeWizDialogSetup > aAutoRegistration;
58 }
59 
60 //.........................................................................
61 namespace dbaui
62 {
63 //.........................................................................
64 
65 	using namespace ::com::sun::star::uno;
66 	using namespace ::com::sun::star::lang;
67 	using namespace ::com::sun::star::beans;
68     using namespace ::com::sun::star::sdb;
69     using namespace ::com::sun::star::sdbc;
70 
71 //=========================================================================
72 //-------------------------------------------------------------------------
ODBTypeWizDialogSetup(const Reference<XMultiServiceFactory> & _rxORB)73 ODBTypeWizDialogSetup::ODBTypeWizDialogSetup(const Reference< XMultiServiceFactory >& _rxORB)
74 	:ODatabaseAdministrationDialog(_rxORB)
75     ,m_bOpenDatabase(sal_True)
76 	,m_bStartTableWizard(sal_False)
77 {
78     registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenDatabase")), 3, PropertyAttribute::TRANSIENT,
79 		&m_bOpenDatabase, getBooleanCppuType());
80 
81     registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartTableWizard")), 4, PropertyAttribute::TRANSIENT,
82 		&m_bStartTableWizard, getBooleanCppuType());
83 }
84 //-------------------------------------------------------------------------
getImplementationId()85 Sequence<sal_Int8> SAL_CALL ODBTypeWizDialogSetup::getImplementationId(  ) throw(RuntimeException)
86 {
87 	static ::cppu::OImplementationId aId;
88 	return aId.getImplementationId();
89 }
90 
91 //-------------------------------------------------------------------------
Create(const Reference<XMultiServiceFactory> & _rxFactory)92 Reference< XInterface > SAL_CALL ODBTypeWizDialogSetup::Create(const Reference< XMultiServiceFactory >& _rxFactory)
93 {
94 	Reference < XInterface > xDBWizard = *(new ODBTypeWizDialogSetup(_rxFactory));
95 	return xDBWizard;
96 }
97 
98 //-------------------------------------------------------------------------
getImplementationName()99 ::rtl::OUString SAL_CALL ODBTypeWizDialogSetup::getImplementationName() throw(RuntimeException)
100 {
101 	return getImplementationName_Static();
102 }
103 
104 //-------------------------------------------------------------------------
getImplementationName_Static()105 ::rtl::OUString ODBTypeWizDialogSetup::getImplementationName_Static() throw(RuntimeException)
106 {
107 	return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.dbu.ODBTypeWizDialogSetup"));
108 }
109 
110 //-------------------------------------------------------------------------
getSupportedServiceNames()111 ::comphelper::StringSequence SAL_CALL ODBTypeWizDialogSetup::getSupportedServiceNames() throw(RuntimeException)
112 {
113 	return getSupportedServiceNames_Static();
114 }
115 
116 //-------------------------------------------------------------------------
getSupportedServiceNames_Static()117 ::comphelper::StringSequence ODBTypeWizDialogSetup::getSupportedServiceNames_Static() throw(RuntimeException)
118 {
119 	::comphelper::StringSequence aSupported(1);
120 	aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatabaseWizardDialog"));
121 	return aSupported;
122 }
123 
124 //-------------------------------------------------------------------------
getPropertySetInfo()125 Reference<XPropertySetInfo>  SAL_CALL ODBTypeWizDialogSetup::getPropertySetInfo() throw(RuntimeException)
126 {
127 	return createPropertySetInfo( getInfoHelper() );
128 }
129 
130 //-------------------------------------------------------------------------
getInfoHelper()131 ::cppu::IPropertyArrayHelper& ODBTypeWizDialogSetup::getInfoHelper()
132 {
133 	return *const_cast<ODBTypeWizDialogSetup*>(this)->getArrayHelper();
134 }
135 
136 //------------------------------------------------------------------------------
createArrayHelper() const137 ::cppu::IPropertyArrayHelper* ODBTypeWizDialogSetup::createArrayHelper( ) const
138 {
139 	Sequence< Property > aProps;
140 	describeProperties(aProps);
141 	return new ::cppu::OPropertyArrayHelper(aProps);
142 }
143 //------------------------------------------------------------------------------
createDialog(Window * _pParent)144 Dialog*	ODBTypeWizDialogSetup::createDialog(Window* _pParent)
145 {
146 	return new ODbTypeWizDialogSetup(_pParent, m_pDatasourceItems, m_aContext.getLegacyServiceFactory(), m_aInitialSelection);
147 }
148 // -----------------------------------------------------------------------------
executedDialog(sal_Int16 _nExecutionResult)149 void ODBTypeWizDialogSetup::executedDialog(sal_Int16 _nExecutionResult)
150 {
151     if ( _nExecutionResult == RET_OK )
152     {
153         const ODbTypeWizDialogSetup* pDialog = static_cast< ODbTypeWizDialogSetup* >( m_pDialog );
154         m_bOpenDatabase = pDialog->IsDatabaseDocumentToBeOpened();
155         m_bStartTableWizard = pDialog->IsTableWizardToBeStarted();
156     }
157 }
158 
159 //.........................................................................
160 }	// namespace dbaui
161 //.........................................................................
162 
163