2010-10-12 15:59:03 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-14 17:39:53 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2004-08-02 14:45:10 +00:00
|
|
|
|
|
|
|
#include "dbwiz.hxx"
|
|
|
|
#include "dbadmin.hrc"
|
|
|
|
#include "dbu_dlg.hrc"
|
|
|
|
#include "dsitems.hxx"
|
2009-07-03 12:24:35 +00:00
|
|
|
#include "dsnItem.hxx"
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/stritem.hxx>
|
|
|
|
#include <svl/eitem.hxx>
|
|
|
|
#include <svl/intitem.hxx>
|
2004-08-02 14:45:10 +00:00
|
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
#include "dbustrings.hrc"
|
|
|
|
#include "adminpages.hxx"
|
|
|
|
#include "generalpage.hxx"
|
|
|
|
#include "localresaccess.hxx"
|
|
|
|
#include "stringlistitem.hxx"
|
|
|
|
#include "propertysetitem.hxx"
|
|
|
|
#include <unotools/confignode.hxx>
|
|
|
|
#include "ConnectionPage.hxx"
|
|
|
|
#include "DriverSettings.hxx"
|
|
|
|
#include "DbAdminImpl.hxx"
|
|
|
|
#include "dbaccess_helpid.hrc"
|
|
|
|
|
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
using namespace svt;
|
|
|
|
using namespace com::sun::star::uno;
|
|
|
|
using namespace com::sun::star::sdbc;
|
|
|
|
using namespace com::sun::star::lang;
|
|
|
|
using namespace com::sun::star::util;
|
|
|
|
using namespace com::sun::star::beans;
|
|
|
|
using namespace com::sun::star::container;
|
|
|
|
|
2004-10-27 12:02:39 +00:00
|
|
|
#define START_PAGE 0
|
|
|
|
#define CONNECTION_PAGE 1
|
|
|
|
#define ADDITIONAL_PAGE_DBASE 2
|
|
|
|
#define ADDITIONAL_PAGE_FLAT 3
|
|
|
|
#define ADDITIONAL_PAGE_LDAP 4
|
2012-02-18 20:24:08 +00:00
|
|
|
//5 was ADDITIONAL_PAGE_ADABAS
|
2004-10-27 12:02:39 +00:00
|
|
|
#define ADDITIONAL_PAGE_MYSQL_JDBC 6
|
|
|
|
#define ADDITIONAL_PAGE_MYSQL_ODBC 7
|
|
|
|
#define ADDITIONAL_PAGE_ORACLE_JDBC 8
|
|
|
|
#define ADDITIONAL_PAGE_ADO 9
|
|
|
|
#define ADDITIONAL_PAGE_ODBC 10
|
|
|
|
#define ADDITIONAL_USERDEFINED 11
|
2008-03-05 15:58:22 +00:00
|
|
|
#define ADDITIONAL_PAGE_MYSQL_NATIVE 12
|
2004-08-02 14:45:10 +00:00
|
|
|
|
2013-08-17 23:43:14 +02:00
|
|
|
// ODbTypeWizDialog
|
2004-08-02 14:45:10 +00:00
|
|
|
ODbTypeWizDialog::ODbTypeWizDialog(Window* _pParent
|
|
|
|
,SfxItemSet* _pItems
|
2013-01-04 09:12:44 +02:00
|
|
|
,const Reference< XComponentContext >& _rxORB
|
2004-08-02 14:45:10 +00:00
|
|
|
,const ::com::sun::star::uno::Any& _aDataSourceName
|
|
|
|
)
|
2008-03-06 17:18:41 +00:00
|
|
|
:OWizardMachine(_pParent, ModuleRes(DLG_DATABASE_TYPE_CHANGE), WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP )
|
2006-06-20 02:06:18 +00:00
|
|
|
,m_pOutSet(NULL)
|
2004-08-02 14:45:10 +00:00
|
|
|
,m_bResetting(sal_False)
|
|
|
|
,m_bApplied(sal_False)
|
|
|
|
,m_bUIEnabled( sal_True )
|
|
|
|
{
|
2013-10-02 16:41:03 +02:00
|
|
|
m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxORB,this,this));
|
2005-06-30 15:32:42 +00:00
|
|
|
m_pImpl->setDataSourceOrName(_aDataSourceName);
|
2004-08-02 14:45:10 +00:00
|
|
|
Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
|
|
|
|
m_pOutSet = new SfxItemSet( *_pItems->GetPool(), _pItems->GetRanges() );
|
|
|
|
|
|
|
|
m_pImpl->translateProperties(xDatasource, *m_pOutSet);
|
|
|
|
m_eType = m_pImpl->getDatasourceType(*m_pOutSet);
|
|
|
|
|
|
|
|
SetPageSizePixel(LogicToPixel(::Size(PAGE_X, PAGE_Y), MAP_APPFONT));
|
|
|
|
ShowButtonFixedLine(sal_True);
|
|
|
|
defaultButton(WZB_NEXT);
|
|
|
|
enableButtons(WZB_FINISH, sal_False);
|
2008-03-06 17:18:41 +00:00
|
|
|
enableAutomaticNextButtonState( true );
|
2004-08-02 14:45:10 +00:00
|
|
|
|
|
|
|
m_pPrevPage->SetHelpId(HID_DBWIZ_PREVIOUS);
|
|
|
|
m_pNextPage->SetHelpId(HID_DBWIZ_NEXT);
|
|
|
|
m_pCancel->SetHelpId(HID_DBWIZ_CANCEL);
|
|
|
|
m_pFinish->SetHelpId(HID_DBWIZ_FINISH);
|
|
|
|
m_pHelp->SetUniqueId(UID_DBWIZ_HELP);
|
|
|
|
// no local resources needed anymore
|
2009-07-03 12:24:35 +00:00
|
|
|
|
|
|
|
DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _pItems->GetItem(DSID_TYPECOLLECTION));
|
|
|
|
m_pCollection = pCollectionItem->getCollection();
|
|
|
|
|
2004-08-02 14:45:10 +00:00
|
|
|
FreeResource();
|
|
|
|
ActivatePage();
|
|
|
|
}
|
|
|
|
|
|
|
|
ODbTypeWizDialog::~ODbTypeWizDialog()
|
|
|
|
{
|
|
|
|
delete m_pOutSet;
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:45:10 +00:00
|
|
|
IMPL_LINK(ODbTypeWizDialog, OnTypeSelected, OGeneralPage*, _pTabPage)
|
|
|
|
{
|
|
|
|
m_eType = _pTabPage->GetSelectedType();
|
2009-07-03 12:24:35 +00:00
|
|
|
const bool bURLRequired = m_pCollection->isConnectionUrlRequired(m_eType);
|
|
|
|
enableButtons(WZB_NEXT,bURLRequired);
|
|
|
|
enableButtons(WZB_FINISH,!bURLRequired);
|
2004-08-02 14:45:10 +00:00
|
|
|
return 1L;
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2008-03-06 17:18:41 +00:00
|
|
|
WizardTypes::WizardState ODbTypeWizDialog::determineNextState( WizardState _nCurrentState ) const
|
2004-08-02 14:45:10 +00:00
|
|
|
{
|
|
|
|
WizardTypes::WizardState nNextState = WZS_INVALID_STATE;
|
|
|
|
switch(_nCurrentState)
|
|
|
|
{
|
|
|
|
case START_PAGE:
|
2009-07-03 12:24:35 +00:00
|
|
|
switch(m_pCollection->determineType(m_eType))
|
2005-03-10 15:49:19 +00:00
|
|
|
{
|
2008-10-01 12:28:29 +00:00
|
|
|
case ::dbaccess::DST_MOZILLA:
|
|
|
|
case ::dbaccess::DST_OUTLOOK:
|
|
|
|
case ::dbaccess::DST_OUTLOOKEXP:
|
|
|
|
case ::dbaccess::DST_EVOLUTION:
|
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
|
|
|
case ::dbaccess::DST_EVOLUTION_GROUPWISE:
|
|
|
|
case ::dbaccess::DST_EVOLUTION_LDAP:
|
2008-10-01 12:28:29 +00:00
|
|
|
case ::dbaccess::DST_KAB:
|
|
|
|
case ::dbaccess::DST_MACAB:
|
2005-03-10 15:49:19 +00:00
|
|
|
nNextState = WZS_INVALID_STATE;
|
|
|
|
break;
|
2009-02-16 07:31:09 +00:00
|
|
|
case ::dbaccess::DST_MYSQL_NATIVE:
|
|
|
|
nNextState = ADDITIONAL_PAGE_MYSQL_NATIVE;
|
|
|
|
break;
|
2005-03-10 15:49:19 +00:00
|
|
|
default:
|
|
|
|
nNextState = CONNECTION_PAGE;
|
|
|
|
break;
|
|
|
|
}
|
2004-08-02 14:45:10 +00:00
|
|
|
break;
|
|
|
|
case CONNECTION_PAGE:
|
2009-07-03 12:24:35 +00:00
|
|
|
switch(m_pCollection->determineType(m_eType))
|
2004-08-02 14:45:10 +00:00
|
|
|
{
|
2008-10-01 12:28:29 +00:00
|
|
|
case ::dbaccess::DST_MOZILLA:
|
|
|
|
case ::dbaccess::DST_THUNDERBIRD:
|
|
|
|
case ::dbaccess::DST_OUTLOOK:
|
|
|
|
case ::dbaccess::DST_OUTLOOKEXP:
|
|
|
|
case ::dbaccess::DST_EVOLUTION:
|
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
|
|
|
case ::dbaccess::DST_EVOLUTION_GROUPWISE:
|
|
|
|
case ::dbaccess::DST_EVOLUTION_LDAP:
|
2008-10-01 12:28:29 +00:00
|
|
|
case ::dbaccess::DST_KAB:
|
|
|
|
case ::dbaccess::DST_MACAB:
|
|
|
|
case ::dbaccess::DST_MSACCESS:
|
|
|
|
case ::dbaccess::DST_MSACCESS_2007:
|
|
|
|
case ::dbaccess::DST_JDBC:
|
|
|
|
case ::dbaccess::DST_CALC:
|
2004-08-02 14:45:10 +00:00
|
|
|
nNextState = WZS_INVALID_STATE;
|
|
|
|
break;
|
2008-10-01 12:28:29 +00:00
|
|
|
case ::dbaccess::DST_DBASE:
|
2004-10-27 12:02:39 +00:00
|
|
|
nNextState = ADDITIONAL_PAGE_DBASE;
|
|
|
|
break;
|
2008-10-01 12:28:29 +00:00
|
|
|
case ::dbaccess::DST_FLAT:
|
2004-10-27 12:02:39 +00:00
|
|
|
nNextState = ADDITIONAL_PAGE_FLAT;
|
|
|
|
break;
|
2008-10-01 12:28:29 +00:00
|
|
|
case ::dbaccess::DST_LDAP:
|
2004-10-27 12:02:39 +00:00
|
|
|
nNextState = ADDITIONAL_PAGE_LDAP;
|
|
|
|
break;
|
2008-10-01 12:28:29 +00:00
|
|
|
case ::dbaccess::DST_MYSQL_JDBC:
|
2004-10-27 12:02:39 +00:00
|
|
|
nNextState = ADDITIONAL_PAGE_MYSQL_JDBC;
|
|
|
|
break;
|
2008-10-01 12:28:29 +00:00
|
|
|
case ::dbaccess::DST_MYSQL_ODBC:
|
2004-10-27 12:02:39 +00:00
|
|
|
nNextState = ADDITIONAL_PAGE_MYSQL_ODBC;
|
|
|
|
break;
|
2008-10-01 12:28:29 +00:00
|
|
|
case ::dbaccess::DST_ORACLE_JDBC:
|
2004-10-27 12:02:39 +00:00
|
|
|
nNextState = ADDITIONAL_PAGE_ORACLE_JDBC;
|
|
|
|
break;
|
2008-10-01 12:28:29 +00:00
|
|
|
case ::dbaccess::DST_ADO:
|
2004-10-27 12:02:39 +00:00
|
|
|
nNextState = ADDITIONAL_PAGE_ADO;
|
|
|
|
break;
|
2008-10-01 12:28:29 +00:00
|
|
|
case ::dbaccess::DST_ODBC:
|
2004-10-27 12:02:39 +00:00
|
|
|
nNextState = ADDITIONAL_PAGE_ODBC;
|
|
|
|
break;
|
2004-08-02 14:45:10 +00:00
|
|
|
default:
|
2004-10-27 12:02:39 +00:00
|
|
|
nNextState = WZS_INVALID_STATE;
|
2004-08-02 14:45:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nNextState;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SfxItemSet* ODbTypeWizDialog::getOutputSet() const
|
|
|
|
{
|
|
|
|
return m_pOutSet;
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:45:10 +00:00
|
|
|
SfxItemSet* ODbTypeWizDialog::getWriteOutputSet()
|
|
|
|
{
|
|
|
|
return m_pOutSet;
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2005-01-21 16:14:46 +00:00
|
|
|
::std::pair< Reference<XConnection>,sal_Bool> ODbTypeWizDialog::createConnection()
|
2004-08-02 14:45:10 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->createConnection();
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2013-01-04 09:12:44 +02:00
|
|
|
Reference< XComponentContext > ODbTypeWizDialog::getORB() const
|
2004-08-02 14:45:10 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->getORB();
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:45:10 +00:00
|
|
|
Reference< XDriver > ODbTypeWizDialog::getDriver()
|
|
|
|
{
|
|
|
|
return m_pImpl->getDriver();
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString ODbTypeWizDialog::getDatasourceType(const SfxItemSet& _rSet) const
|
2004-08-02 14:45:10 +00:00
|
|
|
{
|
|
|
|
return m_pImpl->getDatasourceType(_rSet);
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:45:10 +00:00
|
|
|
void ODbTypeWizDialog::clearPassword()
|
|
|
|
{
|
|
|
|
m_pImpl->clearPassword();
|
|
|
|
}
|
2004-10-27 12:02:39 +00:00
|
|
|
|
2004-08-02 14:45:10 +00:00
|
|
|
TabPage* ODbTypeWizDialog::createPage(WizardState _nState)
|
|
|
|
{
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_uInt16 nStringId = STR_PAGETITLE_ADVANCED;
|
2004-08-02 14:45:10 +00:00
|
|
|
TabPage* pPage = NULL;
|
|
|
|
switch(_nState)
|
|
|
|
{
|
|
|
|
case START_PAGE: // start state
|
2005-06-30 15:32:42 +00:00
|
|
|
{
|
2013-03-21 09:04:55 +01:00
|
|
|
pPage = new OGeneralPageDialog(this,*m_pOutSet);
|
2005-06-30 15:32:42 +00:00
|
|
|
OGeneralPage* pGeneralPage = static_cast< OGeneralPage* >( pPage );
|
|
|
|
pGeneralPage->SetTypeSelectHandler( LINK( this, ODbTypeWizDialog, OnTypeSelected));
|
2004-08-02 14:45:10 +00:00
|
|
|
nStringId = STR_PAGETITLE_GENERAL;
|
2005-06-30 15:32:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2004-08-02 14:45:10 +00:00
|
|
|
case CONNECTION_PAGE:
|
|
|
|
pPage = OConnectionTabPage::Create(this,*m_pOutSet);
|
|
|
|
nStringId = STR_PAGETITLE_CONNECTION;
|
|
|
|
break;
|
|
|
|
|
2004-10-27 12:02:39 +00:00
|
|
|
case ADDITIONAL_PAGE_DBASE:
|
|
|
|
pPage = ODriversSettings::CreateDbase(this,*m_pOutSet);
|
|
|
|
break;
|
|
|
|
case ADDITIONAL_PAGE_FLAT:
|
|
|
|
pPage = ODriversSettings::CreateText(this,*m_pOutSet);
|
|
|
|
break;
|
|
|
|
case ADDITIONAL_PAGE_LDAP:
|
|
|
|
pPage = ODriversSettings::CreateLDAP(this,*m_pOutSet);
|
|
|
|
break;
|
|
|
|
case ADDITIONAL_PAGE_MYSQL_JDBC:
|
|
|
|
pPage = ODriversSettings::CreateMySQLJDBC(this,*m_pOutSet);
|
|
|
|
break;
|
2009-02-16 07:31:09 +00:00
|
|
|
case ADDITIONAL_PAGE_MYSQL_NATIVE:
|
2008-03-05 15:58:22 +00:00
|
|
|
pPage = ODriversSettings::CreateMySQLNATIVE(this,*m_pOutSet);
|
|
|
|
break;
|
2004-10-27 12:02:39 +00:00
|
|
|
case ADDITIONAL_PAGE_MYSQL_ODBC:
|
|
|
|
pPage = ODriversSettings::CreateMySQLODBC(this,*m_pOutSet);
|
|
|
|
break;
|
|
|
|
case ADDITIONAL_PAGE_ORACLE_JDBC:
|
|
|
|
pPage = ODriversSettings::CreateOracleJDBC(this,*m_pOutSet);
|
|
|
|
break;
|
|
|
|
case ADDITIONAL_PAGE_ADO:
|
|
|
|
pPage = ODriversSettings::CreateAdo(this,*m_pOutSet);
|
|
|
|
break;
|
|
|
|
case ADDITIONAL_PAGE_ODBC:
|
|
|
|
pPage = ODriversSettings::CreateODBC(this,*m_pOutSet);
|
|
|
|
break;
|
|
|
|
case ADDITIONAL_USERDEFINED:
|
|
|
|
pPage = ODriversSettings::CreateUser(this,*m_pOutSet);
|
2004-08-02 14:45:10 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-03-12 12:04:35 +01:00
|
|
|
OSL_FAIL("Wrong state!");
|
2004-08-02 14:45:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// register ourself as modified listener
|
|
|
|
if ( pPage )
|
|
|
|
{
|
2013-01-04 11:58:23 +02:00
|
|
|
static_cast<OGenericAdministrationPage*>(pPage)->SetServiceFactory( m_pImpl->getORB() );
|
2004-08-02 14:45:10 +00:00
|
|
|
static_cast<OGenericAdministrationPage*>(pPage)->SetAdminDialog(this,this);
|
2013-09-26 12:17:53 +02:00
|
|
|
pPage->SetText(ModuleRes(nStringId));
|
2004-08-02 14:45:10 +00:00
|
|
|
defaultButton( _nState == START_PAGE ? WZB_NEXT : WZB_FINISH );
|
|
|
|
enableButtons( WZB_FINISH, _nState == START_PAGE ? sal_False : sal_True);
|
|
|
|
pPage->Show();
|
|
|
|
}
|
|
|
|
return pPage;
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:45:10 +00:00
|
|
|
sal_Bool ODbTypeWizDialog::leaveState(WizardState _nState)
|
|
|
|
{
|
|
|
|
SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardDialog::GetPage(_nState));
|
|
|
|
if ( pPage )
|
|
|
|
pPage->FillItemSet(*m_pOutSet);
|
|
|
|
return sal_True;
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
void ODbTypeWizDialog::setTitle(const OUString& _sTitle)
|
2004-08-02 14:45:10 +00:00
|
|
|
{
|
|
|
|
SetText(_sTitle);
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2007-05-10 09:24:58 +00:00
|
|
|
void ODbTypeWizDialog::enableConfirmSettings( bool _bEnable )
|
|
|
|
{
|
|
|
|
enableButtons( WZB_FINISH, _bEnable );
|
|
|
|
// TODO:
|
2011-02-27 22:58:05 +01:00
|
|
|
// this is hacky. At the moment, this method is used in only one case.
|
2007-05-10 09:24:58 +00:00
|
|
|
// As soon as it is to be used more wide-spread, we should find a proper concept
|
|
|
|
// for enabling both the Next and Finish buttons, depending on the current page state.
|
|
|
|
// Plus, the concept must also care for the case where those pages are embedded into
|
|
|
|
// anormal tab dialog.
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:45:10 +00:00
|
|
|
sal_Bool ODbTypeWizDialog::saveDatasource()
|
|
|
|
{
|
|
|
|
SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardDialog::GetPage(getCurrentState()));
|
|
|
|
if ( pPage )
|
|
|
|
pPage->FillItemSet(*m_pOutSet);
|
2009-07-03 12:24:35 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sOldURL;
|
2009-07-03 12:24:35 +00:00
|
|
|
if ( m_pImpl->getCurrentDataSource().is() )
|
|
|
|
m_pImpl->getCurrentDataSource()->getPropertyValue(PROPERTY_URL) >>= sOldURL;
|
2013-01-04 11:38:08 +02:00
|
|
|
DataSourceInfoConverter::convert( getORB(), m_pCollection,sOldURL,m_eType,m_pImpl->getCurrentDataSource());
|
2004-08-02 14:45:10 +00:00
|
|
|
return sal_True;
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2010-05-25 10:17:24 +02:00
|
|
|
IWizardPageController* ODbTypeWizDialog::getPageController( TabPage* _pCurrentPage ) const
|
2004-08-02 14:45:10 +00:00
|
|
|
{
|
|
|
|
OGenericAdministrationPage* pPage = static_cast<OGenericAdministrationPage*>(_pCurrentPage);
|
|
|
|
return pPage;
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2010-05-25 11:43:39 +02:00
|
|
|
sal_Bool ODbTypeWizDialog::onFinish()
|
2004-08-02 14:45:10 +00:00
|
|
|
{
|
|
|
|
saveDatasource();
|
2010-05-25 11:43:39 +02:00
|
|
|
return m_pImpl->saveChanges(*m_pOutSet) ? OWizardMachine::onFinish() : sal_False;
|
2004-08-02 14:45:10 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:45:10 +00:00
|
|
|
} // namespace dbaui
|
2010-10-12 15:59:03 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|