1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_dbaccess.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifndef DBAUI_DBWIZ_HXX 32*cdf0e10cSrcweir #include "dbwiz.hxx" 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir #ifndef _DBAUI_DBADMIN_HRC_ 35*cdf0e10cSrcweir #include "dbadmin.hrc" 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #ifndef _DBU_DLG_HRC_ 38*cdf0e10cSrcweir #include "dbu_dlg.hrc" 39*cdf0e10cSrcweir #endif 40*cdf0e10cSrcweir #ifndef _DBAUI_DATASOURCEITEMS_HXX_ 41*cdf0e10cSrcweir #include "dsitems.hxx" 42*cdf0e10cSrcweir #endif 43*cdf0e10cSrcweir #include "dsnItem.hxx" 44*cdf0e10cSrcweir #ifndef _SFXSTRITEM_HXX 45*cdf0e10cSrcweir #include <svl/stritem.hxx> 46*cdf0e10cSrcweir #endif 47*cdf0e10cSrcweir #ifndef _SFXENUMITEM_HXX 48*cdf0e10cSrcweir #include <svl/eitem.hxx> 49*cdf0e10cSrcweir #endif 50*cdf0e10cSrcweir #ifndef _SFXINTITEM_HXX 51*cdf0e10cSrcweir #include <svl/intitem.hxx> 52*cdf0e10cSrcweir #endif 53*cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX 54*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 55*cdf0e10cSrcweir #endif 56*cdf0e10cSrcweir #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC 57*cdf0e10cSrcweir #include "dbustrings.hrc" 58*cdf0e10cSrcweir #endif 59*cdf0e10cSrcweir #ifndef _DBAUI_ADMINPAGES_HXX_ 60*cdf0e10cSrcweir #include "adminpages.hxx" 61*cdf0e10cSrcweir #endif 62*cdf0e10cSrcweir #ifndef _DBAUI_GENERALPAGE_HXX_ 63*cdf0e10cSrcweir #include "generalpage.hxx" 64*cdf0e10cSrcweir #endif 65*cdf0e10cSrcweir #ifndef _DBAUI_LOCALRESACCESS_HXX_ 66*cdf0e10cSrcweir #include "localresaccess.hxx" 67*cdf0e10cSrcweir #endif 68*cdf0e10cSrcweir #ifndef _DBAUI_STRINGLISTITEM_HXX_ 69*cdf0e10cSrcweir #include "stringlistitem.hxx" 70*cdf0e10cSrcweir #endif 71*cdf0e10cSrcweir #ifndef _DBAUI_PROPERTYSETITEM_HXX_ 72*cdf0e10cSrcweir #include "propertysetitem.hxx" 73*cdf0e10cSrcweir #endif 74*cdf0e10cSrcweir #ifndef _UNOTOOLS_CONFIGNODE_HXX_ 75*cdf0e10cSrcweir #include <unotools/confignode.hxx> 76*cdf0e10cSrcweir #endif 77*cdf0e10cSrcweir #ifndef DBAUI_CONNECTIONPAGE_HXX 78*cdf0e10cSrcweir #include "ConnectionPage.hxx" 79*cdf0e10cSrcweir #endif 80*cdf0e10cSrcweir #ifndef DBAUI_DRIVERSETTINGS_HXX 81*cdf0e10cSrcweir #include "DriverSettings.hxx" 82*cdf0e10cSrcweir #endif 83*cdf0e10cSrcweir #ifndef _DBAUI_DBADMINIMPL_HXX_ 84*cdf0e10cSrcweir #include "DbAdminImpl.hxx" 85*cdf0e10cSrcweir #endif 86*cdf0e10cSrcweir #ifndef _DBA_DBACCESS_HELPID_HRC_ 87*cdf0e10cSrcweir #include "dbaccess_helpid.hrc" 88*cdf0e10cSrcweir #endif 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir //......................................................................... 91*cdf0e10cSrcweir namespace dbaui 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir //......................................................................... 94*cdf0e10cSrcweir using namespace svt; 95*cdf0e10cSrcweir using namespace com::sun::star::uno; 96*cdf0e10cSrcweir using namespace com::sun::star::sdbc; 97*cdf0e10cSrcweir using namespace com::sun::star::lang; 98*cdf0e10cSrcweir using namespace com::sun::star::util; 99*cdf0e10cSrcweir using namespace com::sun::star::beans; 100*cdf0e10cSrcweir using namespace com::sun::star::container; 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir #define START_PAGE 0 103*cdf0e10cSrcweir #define CONNECTION_PAGE 1 104*cdf0e10cSrcweir #define ADDITIONAL_PAGE_DBASE 2 105*cdf0e10cSrcweir #define ADDITIONAL_PAGE_FLAT 3 106*cdf0e10cSrcweir #define ADDITIONAL_PAGE_LDAP 4 107*cdf0e10cSrcweir #define ADDITIONAL_PAGE_ADABAS 5 108*cdf0e10cSrcweir #define ADDITIONAL_PAGE_MYSQL_JDBC 6 109*cdf0e10cSrcweir #define ADDITIONAL_PAGE_MYSQL_ODBC 7 110*cdf0e10cSrcweir #define ADDITIONAL_PAGE_ORACLE_JDBC 8 111*cdf0e10cSrcweir #define ADDITIONAL_PAGE_ADO 9 112*cdf0e10cSrcweir #define ADDITIONAL_PAGE_ODBC 10 113*cdf0e10cSrcweir #define ADDITIONAL_USERDEFINED 11 114*cdf0e10cSrcweir #define ADDITIONAL_PAGE_MYSQL_NATIVE 12 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir DBG_NAME(ODbTypeWizDialog) 118*cdf0e10cSrcweir //========================================================================= 119*cdf0e10cSrcweir //= ODbTypeWizDialog 120*cdf0e10cSrcweir //========================================================================= 121*cdf0e10cSrcweir //------------------------------------------------------------------------- 122*cdf0e10cSrcweir ODbTypeWizDialog::ODbTypeWizDialog(Window* _pParent 123*cdf0e10cSrcweir ,SfxItemSet* _pItems 124*cdf0e10cSrcweir ,const Reference< XMultiServiceFactory >& _rxORB 125*cdf0e10cSrcweir ,const ::com::sun::star::uno::Any& _aDataSourceName 126*cdf0e10cSrcweir ) 127*cdf0e10cSrcweir :OWizardMachine(_pParent, ModuleRes(DLG_DATABASE_TYPE_CHANGE), WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP ) 128*cdf0e10cSrcweir ,m_pOutSet(NULL) 129*cdf0e10cSrcweir ,m_bResetting(sal_False) 130*cdf0e10cSrcweir ,m_bApplied(sal_False) 131*cdf0e10cSrcweir ,m_bUIEnabled( sal_True ) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir DBG_CTOR(ODbTypeWizDialog,NULL); 134*cdf0e10cSrcweir m_pImpl = ::std::auto_ptr<ODbDataSourceAdministrationHelper>(new ODbDataSourceAdministrationHelper(_rxORB,this,this)); 135*cdf0e10cSrcweir m_pImpl->setDataSourceOrName(_aDataSourceName); 136*cdf0e10cSrcweir Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource(); 137*cdf0e10cSrcweir m_pOutSet = new SfxItemSet( *_pItems->GetPool(), _pItems->GetRanges() ); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir m_pImpl->translateProperties(xDatasource, *m_pOutSet); 140*cdf0e10cSrcweir m_eType = m_pImpl->getDatasourceType(*m_pOutSet); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir SetPageSizePixel(LogicToPixel(::Size(PAGE_X, PAGE_Y), MAP_APPFONT)); 143*cdf0e10cSrcweir ShowButtonFixedLine(sal_True); 144*cdf0e10cSrcweir defaultButton(WZB_NEXT); 145*cdf0e10cSrcweir enableButtons(WZB_FINISH, sal_False); 146*cdf0e10cSrcweir enableAutomaticNextButtonState( true ); 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir m_pPrevPage->SetHelpId(HID_DBWIZ_PREVIOUS); 149*cdf0e10cSrcweir m_pNextPage->SetHelpId(HID_DBWIZ_NEXT); 150*cdf0e10cSrcweir m_pCancel->SetHelpId(HID_DBWIZ_CANCEL); 151*cdf0e10cSrcweir m_pFinish->SetHelpId(HID_DBWIZ_FINISH); 152*cdf0e10cSrcweir m_pHelp->SetUniqueId(UID_DBWIZ_HELP); 153*cdf0e10cSrcweir // no local resources needed anymore 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _pItems->GetItem(DSID_TYPECOLLECTION)); 156*cdf0e10cSrcweir m_pCollection = pCollectionItem->getCollection(); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir FreeResource(); 159*cdf0e10cSrcweir ActivatePage(); 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir //------------------------------------------------------------------------- 163*cdf0e10cSrcweir ODbTypeWizDialog::~ODbTypeWizDialog() 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir DBG_DTOR(ODbTypeWizDialog,NULL); 166*cdf0e10cSrcweir delete m_pOutSet; 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir //------------------------------------------------------------------------- 169*cdf0e10cSrcweir IMPL_LINK(ODbTypeWizDialog, OnTypeSelected, OGeneralPage*, _pTabPage) 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir m_eType = _pTabPage->GetSelectedType(); 172*cdf0e10cSrcweir const bool bURLRequired = m_pCollection->isConnectionUrlRequired(m_eType); 173*cdf0e10cSrcweir enableButtons(WZB_NEXT,bURLRequired); 174*cdf0e10cSrcweir enableButtons(WZB_FINISH,!bURLRequired); 175*cdf0e10cSrcweir return 1L; 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir //------------------------------------------------------------------------- 178*cdf0e10cSrcweir WizardTypes::WizardState ODbTypeWizDialog::determineNextState( WizardState _nCurrentState ) const 179*cdf0e10cSrcweir { 180*cdf0e10cSrcweir WizardTypes::WizardState nNextState = WZS_INVALID_STATE; 181*cdf0e10cSrcweir switch(_nCurrentState) 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir case START_PAGE: 184*cdf0e10cSrcweir switch(m_pCollection->determineType(m_eType)) 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir case ::dbaccess::DST_MOZILLA: 187*cdf0e10cSrcweir case ::dbaccess::DST_OUTLOOK: 188*cdf0e10cSrcweir case ::dbaccess::DST_OUTLOOKEXP: 189*cdf0e10cSrcweir case ::dbaccess::DST_EVOLUTION: 190*cdf0e10cSrcweir case ::dbaccess::DST_EVOLUTION_GROUPWISE: 191*cdf0e10cSrcweir case ::dbaccess::DST_EVOLUTION_LDAP: 192*cdf0e10cSrcweir case ::dbaccess::DST_KAB: 193*cdf0e10cSrcweir case ::dbaccess::DST_MACAB: 194*cdf0e10cSrcweir nNextState = WZS_INVALID_STATE; 195*cdf0e10cSrcweir break; 196*cdf0e10cSrcweir case ::dbaccess::DST_MYSQL_NATIVE: 197*cdf0e10cSrcweir nNextState = ADDITIONAL_PAGE_MYSQL_NATIVE; 198*cdf0e10cSrcweir break; 199*cdf0e10cSrcweir default: 200*cdf0e10cSrcweir nNextState = CONNECTION_PAGE; 201*cdf0e10cSrcweir break; 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir break; 204*cdf0e10cSrcweir case CONNECTION_PAGE: 205*cdf0e10cSrcweir switch(m_pCollection->determineType(m_eType)) 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir case ::dbaccess::DST_MOZILLA: 208*cdf0e10cSrcweir case ::dbaccess::DST_THUNDERBIRD: 209*cdf0e10cSrcweir case ::dbaccess::DST_OUTLOOK: 210*cdf0e10cSrcweir case ::dbaccess::DST_OUTLOOKEXP: 211*cdf0e10cSrcweir case ::dbaccess::DST_EVOLUTION: 212*cdf0e10cSrcweir case ::dbaccess::DST_EVOLUTION_GROUPWISE: 213*cdf0e10cSrcweir case ::dbaccess::DST_EVOLUTION_LDAP: 214*cdf0e10cSrcweir case ::dbaccess::DST_KAB: 215*cdf0e10cSrcweir case ::dbaccess::DST_MACAB: 216*cdf0e10cSrcweir case ::dbaccess::DST_MSACCESS: 217*cdf0e10cSrcweir case ::dbaccess::DST_MSACCESS_2007: 218*cdf0e10cSrcweir case ::dbaccess::DST_JDBC: 219*cdf0e10cSrcweir case ::dbaccess::DST_CALC: 220*cdf0e10cSrcweir nNextState = WZS_INVALID_STATE; 221*cdf0e10cSrcweir break; 222*cdf0e10cSrcweir case ::dbaccess::DST_DBASE: 223*cdf0e10cSrcweir nNextState = ADDITIONAL_PAGE_DBASE; 224*cdf0e10cSrcweir break; 225*cdf0e10cSrcweir case ::dbaccess::DST_FLAT: 226*cdf0e10cSrcweir nNextState = ADDITIONAL_PAGE_FLAT; 227*cdf0e10cSrcweir break; 228*cdf0e10cSrcweir case ::dbaccess::DST_LDAP: 229*cdf0e10cSrcweir nNextState = ADDITIONAL_PAGE_LDAP; 230*cdf0e10cSrcweir break; 231*cdf0e10cSrcweir case ::dbaccess::DST_ADABAS: 232*cdf0e10cSrcweir nNextState = ADDITIONAL_PAGE_ADABAS; 233*cdf0e10cSrcweir break; 234*cdf0e10cSrcweir case ::dbaccess::DST_MYSQL_JDBC: 235*cdf0e10cSrcweir nNextState = ADDITIONAL_PAGE_MYSQL_JDBC; 236*cdf0e10cSrcweir break; 237*cdf0e10cSrcweir case ::dbaccess::DST_MYSQL_ODBC: 238*cdf0e10cSrcweir nNextState = ADDITIONAL_PAGE_MYSQL_ODBC; 239*cdf0e10cSrcweir break; 240*cdf0e10cSrcweir case ::dbaccess::DST_ORACLE_JDBC: 241*cdf0e10cSrcweir nNextState = ADDITIONAL_PAGE_ORACLE_JDBC; 242*cdf0e10cSrcweir break; 243*cdf0e10cSrcweir case ::dbaccess::DST_ADO: 244*cdf0e10cSrcweir nNextState = ADDITIONAL_PAGE_ADO; 245*cdf0e10cSrcweir break; 246*cdf0e10cSrcweir case ::dbaccess::DST_ODBC: 247*cdf0e10cSrcweir nNextState = ADDITIONAL_PAGE_ODBC; 248*cdf0e10cSrcweir break; 249*cdf0e10cSrcweir default: 250*cdf0e10cSrcweir nNextState = WZS_INVALID_STATE; 251*cdf0e10cSrcweir break; 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir break; 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir return nNextState; 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 260*cdf0e10cSrcweir const SfxItemSet* ODbTypeWizDialog::getOutputSet() const 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir return m_pOutSet; 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 265*cdf0e10cSrcweir SfxItemSet* ODbTypeWizDialog::getWriteOutputSet() 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir return m_pOutSet; 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 270*cdf0e10cSrcweir ::std::pair< Reference<XConnection>,sal_Bool> ODbTypeWizDialog::createConnection() 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir return m_pImpl->createConnection(); 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 275*cdf0e10cSrcweir Reference< XMultiServiceFactory > ODbTypeWizDialog::getORB() const 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir return m_pImpl->getORB(); 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 280*cdf0e10cSrcweir Reference< XDriver > ODbTypeWizDialog::getDriver() 281*cdf0e10cSrcweir { 282*cdf0e10cSrcweir return m_pImpl->getDriver(); 283*cdf0e10cSrcweir } 284*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 285*cdf0e10cSrcweir ::rtl::OUString ODbTypeWizDialog::getDatasourceType(const SfxItemSet& _rSet) const 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir return m_pImpl->getDatasourceType(_rSet); 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 290*cdf0e10cSrcweir void ODbTypeWizDialog::clearPassword() 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir m_pImpl->clearPassword(); 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 296*cdf0e10cSrcweir TabPage* ODbTypeWizDialog::createPage(WizardState _nState) 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir sal_uInt16 nStringId = STR_PAGETITLE_ADVANCED; 299*cdf0e10cSrcweir TabPage* pPage = NULL; 300*cdf0e10cSrcweir switch(_nState) 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir case START_PAGE: // start state 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir pPage = OGeneralPage::Create(this,*m_pOutSet); 305*cdf0e10cSrcweir OGeneralPage* pGeneralPage = static_cast< OGeneralPage* >( pPage ); 306*cdf0e10cSrcweir pGeneralPage->SetTypeSelectHandler( LINK( this, ODbTypeWizDialog, OnTypeSelected)); 307*cdf0e10cSrcweir // pGeneralPage->SetCreationModeHandler( LINK( this, ODbTypeWizDialog, TODO ) ); 308*cdf0e10cSrcweir nStringId = STR_PAGETITLE_GENERAL; 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir break; 311*cdf0e10cSrcweir case CONNECTION_PAGE: 312*cdf0e10cSrcweir pPage = OConnectionTabPage::Create(this,*m_pOutSet); 313*cdf0e10cSrcweir nStringId = STR_PAGETITLE_CONNECTION; 314*cdf0e10cSrcweir break; 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir case ADDITIONAL_PAGE_DBASE: 317*cdf0e10cSrcweir pPage = ODriversSettings::CreateDbase(this,*m_pOutSet); 318*cdf0e10cSrcweir break; 319*cdf0e10cSrcweir case ADDITIONAL_PAGE_FLAT: 320*cdf0e10cSrcweir pPage = ODriversSettings::CreateText(this,*m_pOutSet); 321*cdf0e10cSrcweir break; 322*cdf0e10cSrcweir case ADDITIONAL_PAGE_LDAP: 323*cdf0e10cSrcweir pPage = ODriversSettings::CreateLDAP(this,*m_pOutSet); 324*cdf0e10cSrcweir break; 325*cdf0e10cSrcweir case ADDITIONAL_PAGE_ADABAS: 326*cdf0e10cSrcweir pPage = ODriversSettings::CreateAdabas(this,*m_pOutSet); 327*cdf0e10cSrcweir break; 328*cdf0e10cSrcweir case ADDITIONAL_PAGE_MYSQL_JDBC: 329*cdf0e10cSrcweir pPage = ODriversSettings::CreateMySQLJDBC(this,*m_pOutSet); 330*cdf0e10cSrcweir break; 331*cdf0e10cSrcweir case ADDITIONAL_PAGE_MYSQL_NATIVE: 332*cdf0e10cSrcweir pPage = ODriversSettings::CreateMySQLNATIVE(this,*m_pOutSet); 333*cdf0e10cSrcweir break; 334*cdf0e10cSrcweir case ADDITIONAL_PAGE_MYSQL_ODBC: 335*cdf0e10cSrcweir pPage = ODriversSettings::CreateMySQLODBC(this,*m_pOutSet); 336*cdf0e10cSrcweir break; 337*cdf0e10cSrcweir case ADDITIONAL_PAGE_ORACLE_JDBC: 338*cdf0e10cSrcweir pPage = ODriversSettings::CreateOracleJDBC(this,*m_pOutSet); 339*cdf0e10cSrcweir break; 340*cdf0e10cSrcweir case ADDITIONAL_PAGE_ADO: 341*cdf0e10cSrcweir pPage = ODriversSettings::CreateAdo(this,*m_pOutSet); 342*cdf0e10cSrcweir break; 343*cdf0e10cSrcweir case ADDITIONAL_PAGE_ODBC: 344*cdf0e10cSrcweir pPage = ODriversSettings::CreateODBC(this,*m_pOutSet); 345*cdf0e10cSrcweir break; 346*cdf0e10cSrcweir case ADDITIONAL_USERDEFINED: 347*cdf0e10cSrcweir pPage = ODriversSettings::CreateUser(this,*m_pOutSet); 348*cdf0e10cSrcweir break; 349*cdf0e10cSrcweir default: 350*cdf0e10cSrcweir OSL_ENSURE(0,"Wrong state!"); 351*cdf0e10cSrcweir break; 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir // register ourself as modified listener 355*cdf0e10cSrcweir if ( pPage ) 356*cdf0e10cSrcweir { 357*cdf0e10cSrcweir static_cast<OGenericAdministrationPage*>(pPage)->SetServiceFactory(m_pImpl->getORB()); 358*cdf0e10cSrcweir static_cast<OGenericAdministrationPage*>(pPage)->SetAdminDialog(this,this); 359*cdf0e10cSrcweir // open our own resource block, as the page titles are strings local to this block 360*cdf0e10cSrcweir LocalResourceAccess aDummy(DLG_DATABASE_ADMINISTRATION, RSC_TABDIALOG); 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir pPage->SetText(String(ModuleRes(nStringId))); 363*cdf0e10cSrcweir defaultButton( _nState == START_PAGE ? WZB_NEXT : WZB_FINISH ); 364*cdf0e10cSrcweir enableButtons( WZB_FINISH, _nState == START_PAGE ? sal_False : sal_True); 365*cdf0e10cSrcweir pPage->Show(); 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir return pPage; 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 370*cdf0e10cSrcweir sal_Bool ODbTypeWizDialog::leaveState(WizardState _nState) 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardDialog::GetPage(_nState)); 373*cdf0e10cSrcweir if ( pPage ) 374*cdf0e10cSrcweir pPage->FillItemSet(*m_pOutSet); 375*cdf0e10cSrcweir return sal_True; 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 378*cdf0e10cSrcweir void ODbTypeWizDialog::setTitle(const ::rtl::OUString& _sTitle) 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir SetText(_sTitle); 381*cdf0e10cSrcweir } 382*cdf0e10cSrcweir //------------------------------------------------------------------------- 383*cdf0e10cSrcweir void ODbTypeWizDialog::enableConfirmSettings( bool _bEnable ) 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir enableButtons( WZB_FINISH, _bEnable ); 386*cdf0e10cSrcweir // TODO: 387*cdf0e10cSrcweir // this is hacky. At the moment, this method is used in only one case (#b6532894#). 388*cdf0e10cSrcweir // As soon as it is to be used more wide-spread, we should find a proper concept 389*cdf0e10cSrcweir // for enabling both the Next and Finish buttons, depending on the current page state. 390*cdf0e10cSrcweir // Plus, the concept must also care for the case where those pages are embedded into 391*cdf0e10cSrcweir // anormal tab dialog. 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir //------------------------------------------------------------------------- 394*cdf0e10cSrcweir sal_Bool ODbTypeWizDialog::saveDatasource() 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardDialog::GetPage(getCurrentState())); 397*cdf0e10cSrcweir if ( pPage ) 398*cdf0e10cSrcweir pPage->FillItemSet(*m_pOutSet); 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir DataSourceInfoConverter aConverter(getORB()); 401*cdf0e10cSrcweir ::rtl::OUString sOldURL; 402*cdf0e10cSrcweir if ( m_pImpl->getCurrentDataSource().is() ) 403*cdf0e10cSrcweir m_pImpl->getCurrentDataSource()->getPropertyValue(PROPERTY_URL) >>= sOldURL; 404*cdf0e10cSrcweir aConverter.convert(m_pCollection,sOldURL,m_eType,m_pImpl->getCurrentDataSource()); 405*cdf0e10cSrcweir return sal_True; 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 408*cdf0e10cSrcweir IWizardPageController* ODbTypeWizDialog::getPageController( TabPage* _pCurrentPage ) const 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir OGenericAdministrationPage* pPage = static_cast<OGenericAdministrationPage*>(_pCurrentPage); 411*cdf0e10cSrcweir return pPage; 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 414*cdf0e10cSrcweir sal_Bool ODbTypeWizDialog::onFinish() 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir saveDatasource(); 417*cdf0e10cSrcweir return m_pImpl->saveChanges(*m_pOutSet) ? OWizardMachine::onFinish() : sal_False; 418*cdf0e10cSrcweir } 419*cdf0e10cSrcweir //......................................................................... 420*cdf0e10cSrcweir } // namespace dbaui 421*cdf0e10cSrcweir //......................................................................... 422