update dev300-m58
[ooovba.git] / dbaccess / source / ext / adabas / ANewDb.cxx
blob01296e3d07193ce7f90234b53c8de5c64d74c072
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ANewDb.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef ADABASUI_NEWDB_HXX
32 #include "ANewDb.hxx"
33 #endif
34 #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
35 #include <cppuhelper/typeprovider.hxx>
36 #endif
37 #ifndef _DBHELPER_DBEXCEPTION_HXX_
38 #include <connectivity/dbexception.hxx>
39 #endif
40 #ifndef adabasui_ADABAS_CREATEDB_HXX
41 #include "AdabasNewDb.hxx"
42 #endif
43 #ifndef adabasui_SHARED_DBUSTRINGS_HRC
44 #include "adabasuistrings.hrc"
45 #endif
46 #ifndef _SV_MSGBOX_HXX
47 #include <vcl/msgbox.hxx>
48 #endif
50 using namespace adabasui;
51 using namespace dbtools;
53 using namespace ::com::sun::star::sdbc;
54 using namespace ::com::sun::star::sdbcx;
55 using namespace ::com::sun::star::sdb;
57 extern "C" void SAL_CALL createRegistryInfo_OAdabasCreateDialog()
59 static OMultiInstanceAutoRegistration< OAdabasCreateDialog > aAutoRegistration;
63 using namespace ::com::sun::star::uno;
64 using namespace ::com::sun::star::lang;
65 using namespace ::com::sun::star::beans;
67 //=========================================================================
68 //-------------------------------------------------------------------------
69 OAdabasCreateDialog::OAdabasCreateDialog(const Reference< XMultiServiceFactory >& _rxORB)
70 :OAdabasCreateDialogBase(_rxORB)
71 ,m_pDialog(NULL)
73 registerProperty(PROPERTY_CREATECATALOG, PROPERTY_ID_CREATECATALOG, PropertyAttribute::TRANSIENT,&m_xCreateCatalog, ::getCppuType(&m_xCreateCatalog));
74 registerProperty(PROPERTY_DATABASENAME, PROPERTY_ID_DATABASENAME, PropertyAttribute::TRANSIENT,&m_sDatabaseName, ::getCppuType(&m_sDatabaseName));
75 registerProperty(PROPERTY_CONTROL_USER, PROPERTY_ID_CONTROL_USER, PropertyAttribute::TRANSIENT,&m_sControlUser, ::getCppuType(&m_sControlUser));
76 registerProperty(PROPERTY_CONTROL_PASSWORD, PROPERTY_ID_CONTROL_PASSWORD, PropertyAttribute::TRANSIENT,&m_sControlPassword, ::getCppuType(&m_sControlPassword));
77 registerProperty(PROPERTY_USER, PROPERTY_ID_USER, PropertyAttribute::TRANSIENT,&m_sUser, ::getCppuType(&m_sUser));
78 registerProperty(PROPERTY_PASSWORD, PROPERTY_ID_PASSWORD, PropertyAttribute::TRANSIENT,&m_sUserPassword, ::getCppuType(&m_sUserPassword));
79 registerProperty(PROPERTY_CACHESIZE, PROPERTY_ID_CACHESIZE, PropertyAttribute::TRANSIENT,&m_nCacheSize, ::getCppuType(&m_nCacheSize));
82 //-------------------------------------------------------------------------
83 Sequence<sal_Int8> SAL_CALL OAdabasCreateDialog::getImplementationId( ) throw(RuntimeException)
85 static ::cppu::OImplementationId aId;
86 return aId.getImplementationId();
89 //-------------------------------------------------------------------------
90 Reference< XInterface > SAL_CALL OAdabasCreateDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory)
92 return *(new OAdabasCreateDialog(_rxFactory));
95 //-------------------------------------------------------------------------
96 ::rtl::OUString SAL_CALL OAdabasCreateDialog::getImplementationName() throw(RuntimeException)
98 return getImplementationName_Static();
101 //-------------------------------------------------------------------------
102 ::rtl::OUString OAdabasCreateDialog::getImplementationName_Static() throw(RuntimeException)
104 return ::rtl::OUString::createFromAscii("org.openoffice.comp.adabasui.AdabasCreateDialog");
107 //-------------------------------------------------------------------------
108 ::comphelper::StringSequence SAL_CALL OAdabasCreateDialog::getSupportedServiceNames() throw(RuntimeException)
110 return getSupportedServiceNames_Static();
113 //-------------------------------------------------------------------------
114 ::comphelper::StringSequence OAdabasCreateDialog::getSupportedServiceNames_Static() throw(RuntimeException)
116 ::comphelper::StringSequence aSupported(1);
117 aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.AdabasCreationDialog");
118 return aSupported;
121 //-------------------------------------------------------------------------
122 Reference<XPropertySetInfo> SAL_CALL OAdabasCreateDialog::getPropertySetInfo() throw(RuntimeException)
124 Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
125 return xInfo;
128 //-------------------------------------------------------------------------
129 ::cppu::IPropertyArrayHelper& OAdabasCreateDialog::getInfoHelper()
131 return *const_cast<OAdabasCreateDialog*>(this)->getArrayHelper();
134 //------------------------------------------------------------------------------
135 ::cppu::IPropertyArrayHelper* OAdabasCreateDialog::createArrayHelper( ) const
137 Sequence< Property > aProps;
138 describeProperties(aProps);
139 return new ::cppu::OPropertyArrayHelper(aProps);
142 //------------------------------------------------------------------------------
143 Dialog* OAdabasCreateDialog::createDialog(Window* _pParent)
145 if(!m_xCreateCatalog.is())
146 throw SQLException();
147 m_pDialog = new OAdabasNewDbDlg(_pParent,m_xCreateCatalog,m_aContext.getLegacyServiceFactory());
148 return m_pDialog;
150 // -----------------------------------------------------------------------------
151 void OAdabasCreateDialog::executedDialog(sal_Int16 _nExecutionResult)
153 if(m_pDialog && _nExecutionResult == RET_OK)
154 { // fill the variables
155 m_sDatabaseName = m_pDialog->GetDatabaseName();
156 m_sControlUser = m_pDialog->GetControlUser();
157 m_sControlPassword = m_pDialog->GetControlPassword();
158 m_sUser = m_pDialog->GetUser();
159 m_sUserPassword = m_pDialog->GetUserPassword();
160 m_nCacheSize = m_pDialog->GetCacheSize();
163 // -----------------------------------------------------------------------------