1*96de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*96de5490SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*96de5490SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*96de5490SAndrew Rist  * distributed with this work for additional information
6*96de5490SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*96de5490SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*96de5490SAndrew Rist  * "License"); you may not use this file except in compliance
9*96de5490SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*96de5490SAndrew Rist  *
11*96de5490SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*96de5490SAndrew Rist  *
13*96de5490SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*96de5490SAndrew Rist  * software distributed under the License is distributed on an
15*96de5490SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96de5490SAndrew Rist  * KIND, either express or implied.  See the License for the
17*96de5490SAndrew Rist  * specific language governing permissions and limitations
18*96de5490SAndrew Rist  * under the License.
19*96de5490SAndrew Rist  *
20*96de5490SAndrew Rist  *************************************************************/
21*96de5490SAndrew Rist 
22*96de5490SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef ADABASUI_NEWDB_HXX
25cdf0e10cSrcweir #include "ANewDb.hxx"
26cdf0e10cSrcweir #endif
27cdf0e10cSrcweir #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
28cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _DBHELPER_DBEXCEPTION_HXX_
31cdf0e10cSrcweir #include <connectivity/dbexception.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef adabasui_ADABAS_CREATEDB_HXX
34cdf0e10cSrcweir #include "AdabasNewDb.hxx"
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef adabasui_SHARED_DBUSTRINGS_HRC
37cdf0e10cSrcweir #include "adabasuistrings.hrc"
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX
40cdf0e10cSrcweir #include <vcl/msgbox.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir 
43cdf0e10cSrcweir using namespace adabasui;
44cdf0e10cSrcweir using namespace dbtools;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
47cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx;
48cdf0e10cSrcweir using namespace ::com::sun::star::sdb;
49cdf0e10cSrcweir 
createRegistryInfo_OAdabasCreateDialog()50cdf0e10cSrcweir extern "C" void SAL_CALL createRegistryInfo_OAdabasCreateDialog()
51cdf0e10cSrcweir {
52cdf0e10cSrcweir 	static OMultiInstanceAutoRegistration< OAdabasCreateDialog > aAutoRegistration;
53cdf0e10cSrcweir }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir using namespace ::com::sun::star::uno;
57cdf0e10cSrcweir using namespace ::com::sun::star::lang;
58cdf0e10cSrcweir using namespace ::com::sun::star::beans;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir //=========================================================================
61cdf0e10cSrcweir //-------------------------------------------------------------------------
OAdabasCreateDialog(const Reference<XMultiServiceFactory> & _rxORB)62cdf0e10cSrcweir OAdabasCreateDialog::OAdabasCreateDialog(const Reference< XMultiServiceFactory >& _rxORB)
63cdf0e10cSrcweir 	:OAdabasCreateDialogBase(_rxORB)
64cdf0e10cSrcweir 	,m_pDialog(NULL)
65cdf0e10cSrcweir {
66cdf0e10cSrcweir 	registerProperty(PROPERTY_CREATECATALOG,	PROPERTY_ID_CREATECATALOG,		PropertyAttribute::TRANSIENT,&m_xCreateCatalog,		::getCppuType(&m_xCreateCatalog));
67cdf0e10cSrcweir 	registerProperty(PROPERTY_DATABASENAME,		PROPERTY_ID_DATABASENAME,		PropertyAttribute::TRANSIENT,&m_sDatabaseName,		::getCppuType(&m_sDatabaseName));
68cdf0e10cSrcweir 	registerProperty(PROPERTY_CONTROL_USER,		PROPERTY_ID_CONTROL_USER,		PropertyAttribute::TRANSIENT,&m_sControlUser,		::getCppuType(&m_sControlUser));
69cdf0e10cSrcweir 	registerProperty(PROPERTY_CONTROL_PASSWORD, PROPERTY_ID_CONTROL_PASSWORD,	PropertyAttribute::TRANSIENT,&m_sControlPassword,	::getCppuType(&m_sControlPassword));
70cdf0e10cSrcweir 	registerProperty(PROPERTY_USER,				PROPERTY_ID_USER,				PropertyAttribute::TRANSIENT,&m_sUser,				::getCppuType(&m_sUser));
71cdf0e10cSrcweir 	registerProperty(PROPERTY_PASSWORD,			PROPERTY_ID_PASSWORD,			PropertyAttribute::TRANSIENT,&m_sUserPassword,		::getCppuType(&m_sUserPassword));
72cdf0e10cSrcweir 	registerProperty(PROPERTY_CACHESIZE,		PROPERTY_ID_CACHESIZE,			PropertyAttribute::TRANSIENT,&m_nCacheSize,			::getCppuType(&m_nCacheSize));
73cdf0e10cSrcweir }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir //-------------------------------------------------------------------------
getImplementationId()76cdf0e10cSrcweir Sequence<sal_Int8> SAL_CALL OAdabasCreateDialog::getImplementationId(  ) throw(RuntimeException)
77cdf0e10cSrcweir {
78cdf0e10cSrcweir 	static ::cppu::OImplementationId aId;
79cdf0e10cSrcweir 	return aId.getImplementationId();
80cdf0e10cSrcweir }
81cdf0e10cSrcweir 
82cdf0e10cSrcweir //-------------------------------------------------------------------------
Create(const Reference<XMultiServiceFactory> & _rxFactory)83cdf0e10cSrcweir Reference< XInterface > SAL_CALL OAdabasCreateDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory)
84cdf0e10cSrcweir {
85cdf0e10cSrcweir 	return *(new OAdabasCreateDialog(_rxFactory));
86cdf0e10cSrcweir }
87cdf0e10cSrcweir 
88cdf0e10cSrcweir //-------------------------------------------------------------------------
getImplementationName()89cdf0e10cSrcweir ::rtl::OUString SAL_CALL OAdabasCreateDialog::getImplementationName() throw(RuntimeException)
90cdf0e10cSrcweir {
91cdf0e10cSrcweir 	return getImplementationName_Static();
92cdf0e10cSrcweir }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir //-------------------------------------------------------------------------
getImplementationName_Static()95cdf0e10cSrcweir ::rtl::OUString OAdabasCreateDialog::getImplementationName_Static() throw(RuntimeException)
96cdf0e10cSrcweir {
97cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii("org.openoffice.comp.adabasui.AdabasCreateDialog");
98cdf0e10cSrcweir }
99cdf0e10cSrcweir 
100cdf0e10cSrcweir //-------------------------------------------------------------------------
getSupportedServiceNames()101cdf0e10cSrcweir ::comphelper::StringSequence SAL_CALL OAdabasCreateDialog::getSupportedServiceNames() throw(RuntimeException)
102cdf0e10cSrcweir {
103cdf0e10cSrcweir 	return getSupportedServiceNames_Static();
104cdf0e10cSrcweir }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir //-------------------------------------------------------------------------
getSupportedServiceNames_Static()107cdf0e10cSrcweir ::comphelper::StringSequence OAdabasCreateDialog::getSupportedServiceNames_Static() throw(RuntimeException)
108cdf0e10cSrcweir {
109cdf0e10cSrcweir 	::comphelper::StringSequence aSupported(1);
110cdf0e10cSrcweir 	aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.AdabasCreationDialog");
111cdf0e10cSrcweir 	return aSupported;
112cdf0e10cSrcweir }
113cdf0e10cSrcweir 
114cdf0e10cSrcweir //-------------------------------------------------------------------------
getPropertySetInfo()115cdf0e10cSrcweir Reference<XPropertySetInfo>  SAL_CALL OAdabasCreateDialog::getPropertySetInfo() throw(RuntimeException)
116cdf0e10cSrcweir {
117cdf0e10cSrcweir 	Reference<XPropertySetInfo>  xInfo( createPropertySetInfo( getInfoHelper() ) );
118cdf0e10cSrcweir 	return xInfo;
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir //-------------------------------------------------------------------------
getInfoHelper()122cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& OAdabasCreateDialog::getInfoHelper()
123cdf0e10cSrcweir {
124cdf0e10cSrcweir 	return *const_cast<OAdabasCreateDialog*>(this)->getArrayHelper();
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir //------------------------------------------------------------------------------
createArrayHelper() const128cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* OAdabasCreateDialog::createArrayHelper( ) const
129cdf0e10cSrcweir {
130cdf0e10cSrcweir 	Sequence< Property > aProps;
131cdf0e10cSrcweir 	describeProperties(aProps);
132cdf0e10cSrcweir 	return new ::cppu::OPropertyArrayHelper(aProps);
133cdf0e10cSrcweir }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir //------------------------------------------------------------------------------
createDialog(Window * _pParent)136cdf0e10cSrcweir Dialog*	OAdabasCreateDialog::createDialog(Window* _pParent)
137cdf0e10cSrcweir {
138cdf0e10cSrcweir 	if(!m_xCreateCatalog.is())
139cdf0e10cSrcweir 		throw SQLException();
140cdf0e10cSrcweir 	m_pDialog = new OAdabasNewDbDlg(_pParent,m_xCreateCatalog,m_aContext.getLegacyServiceFactory());
141cdf0e10cSrcweir 	return m_pDialog;
142cdf0e10cSrcweir }
143cdf0e10cSrcweir // -----------------------------------------------------------------------------
executedDialog(sal_Int16 _nExecutionResult)144cdf0e10cSrcweir void OAdabasCreateDialog::executedDialog(sal_Int16 _nExecutionResult)
145cdf0e10cSrcweir {
146cdf0e10cSrcweir 	if(m_pDialog && _nExecutionResult == RET_OK)
147cdf0e10cSrcweir 	{ // fill the variables
148cdf0e10cSrcweir 		m_sDatabaseName		= m_pDialog->GetDatabaseName();
149cdf0e10cSrcweir 		m_sControlUser		= m_pDialog->GetControlUser();
150cdf0e10cSrcweir 		m_sControlPassword	= m_pDialog->GetControlPassword();
151cdf0e10cSrcweir 		m_sUser				= m_pDialog->GetUser();
152cdf0e10cSrcweir 		m_sUserPassword		= m_pDialog->GetUserPassword();
153cdf0e10cSrcweir 		m_nCacheSize		= m_pDialog->GetCacheSize();
154cdf0e10cSrcweir 	}
155cdf0e10cSrcweir }
156cdf0e10cSrcweir // -----------------------------------------------------------------------------
157cdf0e10cSrcweir 
158