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