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_CONNECTIONPAGE_HXX
32*cdf0e10cSrcweir #include "ConnectionPage.hxx"
33*cdf0e10cSrcweir #endif
34*cdf0e10cSrcweir #ifndef DBAUI_CONNECTIONPAGE_HRC
35*cdf0e10cSrcweir #include "ConnectionPage.hrc"
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir #ifndef _DBU_DLG_HRC_
38*cdf0e10cSrcweir #include "dbu_dlg.hrc"
39*cdf0e10cSrcweir #endif
40*cdf0e10cSrcweir #ifndef DBACCESS_DSMETA_HXX
41*cdf0e10cSrcweir #include "dsmeta.hxx"
42*cdf0e10cSrcweir #endif
43*cdf0e10cSrcweir #ifndef _SFXITEMSET_HXX
44*cdf0e10cSrcweir #include <svl/itemset.hxx>
45*cdf0e10cSrcweir #endif
46*cdf0e10cSrcweir #ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX
47*cdf0e10cSrcweir #include <unotools/pathoptions.hxx>
48*cdf0e10cSrcweir #endif
49*cdf0e10cSrcweir #ifndef _SFXSTRITEM_HXX
50*cdf0e10cSrcweir #include <svl/stritem.hxx>
51*cdf0e10cSrcweir #endif
52*cdf0e10cSrcweir #ifndef _SFXENUMITEM_HXX
53*cdf0e10cSrcweir #include <svl/eitem.hxx>
54*cdf0e10cSrcweir #endif
55*cdf0e10cSrcweir #ifndef _SFXINTITEM_HXX
56*cdf0e10cSrcweir #include <svl/intitem.hxx>
57*cdf0e10cSrcweir #endif
58*cdf0e10cSrcweir #ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
59*cdf0e10cSrcweir #include <unotools/moduleoptions.hxx>
60*cdf0e10cSrcweir #endif
61*cdf0e10cSrcweir #ifndef _DBAUI_DATASOURCEITEMS_HXX_
62*cdf0e10cSrcweir #include "dsitems.hxx"
63*cdf0e10cSrcweir #endif
64*cdf0e10cSrcweir #ifndef _DBA_DBACCESS_HELPID_HRC_
65*cdf0e10cSrcweir #include "dbaccess_helpid.hrc"
66*cdf0e10cSrcweir #endif
67*cdf0e10cSrcweir #ifndef _DBAUI_LOCALRESACCESS_HXX_
68*cdf0e10cSrcweir #include "localresaccess.hxx"
69*cdf0e10cSrcweir #endif
70*cdf0e10cSrcweir #ifndef _OSL_PROCESS_H_
71*cdf0e10cSrcweir #include <osl/process.h>
72*cdf0e10cSrcweir #endif
73*cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX
74*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
75*cdf0e10cSrcweir #endif
76*cdf0e10cSrcweir #ifndef _FILEDLGHELPER_HXX
77*cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx>
78*cdf0e10cSrcweir #endif
79*cdf0e10cSrcweir #ifndef _DBAUI_DBADMIN_HXX_
80*cdf0e10cSrcweir #include "dbadmin.hxx"
81*cdf0e10cSrcweir #endif
82*cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_HXX_
83*cdf0e10cSrcweir #include <comphelper/types.hxx>
84*cdf0e10cSrcweir #endif
85*cdf0e10cSrcweir #ifndef _VCL_STDTEXT_HXX
86*cdf0e10cSrcweir #include <vcl/stdtext.hxx>
87*cdf0e10cSrcweir #endif
88*cdf0e10cSrcweir #ifndef _DBAUI_SQLMESSAGE_HXX_
89*cdf0e10cSrcweir #include "sqlmessage.hxx"
90*cdf0e10cSrcweir #endif
91*cdf0e10cSrcweir #ifndef _DBAUI_ODBC_CONFIG_HXX_
92*cdf0e10cSrcweir #include "odbcconfig.hxx"
93*cdf0e10cSrcweir #endif
94*cdf0e10cSrcweir #ifndef _DBAUI_DSSELECT_HXX_
95*cdf0e10cSrcweir #include "dsselect.hxx"
96*cdf0e10cSrcweir #endif
97*cdf0e10cSrcweir #ifndef SVTOOLS_FILENOTATION_HXX_
98*cdf0e10cSrcweir #include <svl/filenotation.hxx>
99*cdf0e10cSrcweir #endif
100*cdf0e10cSrcweir #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
101*cdf0e10cSrcweir #include "dbustrings.hrc"
102*cdf0e10cSrcweir #endif
103*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UI_DIALOGS_XFOLDERPICKER_HPP_
104*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
105*cdf0e10cSrcweir #endif
106*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
107*cdf0e10cSrcweir #include <com/sun/star/sdbc/XRow.hpp>
108*cdf0e10cSrcweir #endif
109*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
110*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
111*cdf0e10cSrcweir #endif
112*cdf0e10cSrcweir // #106016# ------------------------------------
113*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
114*cdf0e10cSrcweir #include <com/sun/star/task/XInteractionHandler.hpp>
115*cdf0e10cSrcweir #endif
116*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_TASK_XPROGRESSHANDLER_HPP_
117*cdf0e10cSrcweir #include <com/sun/star/ucb/XProgressHandler.hpp>
118*cdf0e10cSrcweir #endif
119*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
120*cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp>
121*cdf0e10cSrcweir #endif
122*cdf0e10cSrcweir #ifndef  _COM_SUN_STAR_UI_DIALOGS_EXTENDEDFILEPICKERELEMENTIDS_HPP_
123*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
124*cdf0e10cSrcweir #endif
125*cdf0e10cSrcweir #ifndef  _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERCONTROLACCESS_HPP_
126*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
127*cdf0e10cSrcweir #endif
128*cdf0e10cSrcweir #ifndef  _COM_SUN_STAR_UI_DIALOGS_XFILEPICKER_HPP_
129*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
130*cdf0e10cSrcweir #endif
131*cdf0e10cSrcweir #ifndef DBAUI_TOOLS_HXX
132*cdf0e10cSrcweir #include "UITools.hxx"
133*cdf0e10cSrcweir #endif
134*cdf0e10cSrcweir #ifndef _UNOTOOLS_LOCALFILEHELPER_HXX
135*cdf0e10cSrcweir #include <unotools/localfilehelper.hxx>
136*cdf0e10cSrcweir #endif
137*cdf0e10cSrcweir #ifndef _UNOTOOLS_UCBHELPER_HXX
138*cdf0e10cSrcweir #include <unotools/ucbhelper.hxx>
139*cdf0e10cSrcweir #endif
140*cdf0e10cSrcweir #ifndef _UCBHELPER_COMMANDENVIRONMENT_HXX
141*cdf0e10cSrcweir #include <ucbhelper/commandenvironment.hxx>
142*cdf0e10cSrcweir #endif
143*cdf0e10cSrcweir #ifndef DBAUI_FILEPICKER_INTERACTION_HXX
144*cdf0e10cSrcweir #include "finteraction.hxx"
145*cdf0e10cSrcweir #endif
146*cdf0e10cSrcweir #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
147*cdf0e10cSrcweir #include <connectivity/CommonTools.hxx>
148*cdf0e10cSrcweir #endif
149*cdf0e10cSrcweir #ifndef _URLOBJ_HXX
150*cdf0e10cSrcweir #include <tools/urlobj.hxx>
151*cdf0e10cSrcweir #endif
152*cdf0e10cSrcweir #ifndef _SFX_DOCFILT_HACK_HXX
153*cdf0e10cSrcweir #include <sfx2/docfilt.hxx>
154*cdf0e10cSrcweir #endif
155*cdf0e10cSrcweir #include "dsnItem.hxx"
156*cdf0e10cSrcweir #if defined(WNT)
157*cdf0e10cSrcweir #define _ADO_DATALINK_BROWSE_
158*cdf0e10cSrcweir #endif
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir #ifdef _ADO_DATALINK_BROWSE_
161*cdf0e10cSrcweir #if defined( WNT )
162*cdf0e10cSrcweir     #include <tools/prewin.h>
163*cdf0e10cSrcweir     #include <windows.h>
164*cdf0e10cSrcweir     #include <tools/postwin.h>
165*cdf0e10cSrcweir #endif
166*cdf0e10cSrcweir #ifndef _SV_SYSDATA_HXX
167*cdf0e10cSrcweir #include <vcl/sysdata.hxx>
168*cdf0e10cSrcweir #endif
169*cdf0e10cSrcweir #ifndef _DBAUI_ADO_DATALINK_HXX_
170*cdf0e10cSrcweir #include "adodatalinks.hxx"
171*cdf0e10cSrcweir #endif
172*cdf0e10cSrcweir #endif //_ADO_DATALINK_BROWSE_
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir #include "AutoControls.hrc"
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir //.........................................................................
177*cdf0e10cSrcweir namespace dbaui
178*cdf0e10cSrcweir {
179*cdf0e10cSrcweir //.........................................................................
180*cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
181*cdf0e10cSrcweir 	using namespace ::com::sun::star::ucb;
182*cdf0e10cSrcweir 	using namespace ::com::sun::star::ui::dialogs;
183*cdf0e10cSrcweir 	using namespace ::com::sun::star::sdbc;
184*cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
185*cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
186*cdf0e10cSrcweir 	using namespace ::com::sun::star::container;
187*cdf0e10cSrcweir 	using namespace ::dbtools;
188*cdf0e10cSrcweir 	using namespace ::svt;
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir 	SfxTabPage*	OConnectionTabPage::Create( Window* pParent,	const SfxItemSet& _rAttrSet )
191*cdf0e10cSrcweir 	{
192*cdf0e10cSrcweir 		return ( new OConnectionTabPage( pParent, _rAttrSet ) );
193*cdf0e10cSrcweir 	}
194*cdf0e10cSrcweir 	//========================================================================
195*cdf0e10cSrcweir 	//= OConnectionTabPage
196*cdf0e10cSrcweir 	//========================================================================
197*cdf0e10cSrcweir 	DBG_NAME(OConnectionTabPage)
198*cdf0e10cSrcweir 	OConnectionTabPage::OConnectionTabPage(Window* pParent, const SfxItemSet& _rCoreAttrs)
199*cdf0e10cSrcweir         :OConnectionHelper(pParent, ModuleRes(PAGE_CONNECTION), _rCoreAttrs)
200*cdf0e10cSrcweir 		,m_bUserGrabFocus(sal_True)
201*cdf0e10cSrcweir 		,m_aFL1(this, ModuleRes(FL_SEPARATOR1))
202*cdf0e10cSrcweir 		,m_aFL2(this, ModuleRes(FL_SEPARATOR2))
203*cdf0e10cSrcweir 		,m_aUserNameLabel(this, ModuleRes(FT_USERNAME))
204*cdf0e10cSrcweir 		,m_aUserName(this, ModuleRes(ET_USERNAME))
205*cdf0e10cSrcweir 		,m_aPasswordRequired(this, ModuleRes(CB_PASSWORD_REQUIRED))
206*cdf0e10cSrcweir 		,m_aFL3(this, ModuleRes(FL_SEPARATOR3))
207*cdf0e10cSrcweir 		,m_aJavaDriverLabel(this, ModuleRes(FT_JDBCDRIVERCLASS))
208*cdf0e10cSrcweir 		,m_aJavaDriver(this, ModuleRes(ET_JDBCDRIVERCLASS))
209*cdf0e10cSrcweir 		,m_aTestJavaDriver(this, ModuleRes(PB_TESTDRIVERCLASS))
210*cdf0e10cSrcweir 		,m_aTestConnection(this, ModuleRes(PB_TESTCONNECTION))
211*cdf0e10cSrcweir 	{
212*cdf0e10cSrcweir 		DBG_CTOR(OConnectionTabPage,NULL);
213*cdf0e10cSrcweir 		m_aConnectionURL.SetModifyHdl(LINK(this, OConnectionTabPage, OnEditModified));
214*cdf0e10cSrcweir 		m_aJavaDriver.SetModifyHdl(getControlModifiedLink());
215*cdf0e10cSrcweir 		m_aJavaDriver.SetModifyHdl(LINK(this, OConnectionTabPage, OnEditModified));
216*cdf0e10cSrcweir 		m_aUserName.SetModifyHdl(getControlModifiedLink());
217*cdf0e10cSrcweir 		m_aPasswordRequired.SetClickHdl(getControlModifiedLink());
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 		m_aTestConnection.SetClickHdl(LINK(this,OGenericAdministrationPage,OnTestConnectionClickHdl));
220*cdf0e10cSrcweir 		m_aTestJavaDriver.SetClickHdl(LINK(this,OConnectionTabPage,OnTestJavaClickHdl));
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 		FreeResource();
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir         LayoutHelper::fitSizeRightAligned( m_aTestConnection );
225*cdf0e10cSrcweir 	}
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
228*cdf0e10cSrcweir 	OConnectionTabPage::~OConnectionTabPage()
229*cdf0e10cSrcweir 	{
230*cdf0e10cSrcweir 		DBG_DTOR(OConnectionTabPage,NULL);
231*cdf0e10cSrcweir 	}
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir     // -----------------------------------------------------------------------
234*cdf0e10cSrcweir 	void OConnectionTabPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
235*cdf0e10cSrcweir 	{
236*cdf0e10cSrcweir 		// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
237*cdf0e10cSrcweir 		sal_Bool bValid, bReadonly;
238*cdf0e10cSrcweir 		getFlags(_rSet, bValid, bReadonly);
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir         m_eType = m_pAdminDialog->getDatasourceType(_rSet);
241*cdf0e10cSrcweir         OConnectionHelper::implInitControls( _rSet, _bSaveValue);
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 		LocalResourceAccess aLocRes( PAGE_CONNECTION, RSC_TABPAGE );
244*cdf0e10cSrcweir         ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
245*cdf0e10cSrcweir 		switch( eType )
246*cdf0e10cSrcweir 		{
247*cdf0e10cSrcweir 			case  ::dbaccess::DST_DBASE:
248*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_DBASE_PATH_OR_FILE)));
249*cdf0e10cSrcweir 				m_aConnectionURL.SetHelpId(HID_DSADMIN_DBASE_PATH);
250*cdf0e10cSrcweir 				break;
251*cdf0e10cSrcweir 			case  ::dbaccess::DST_FLAT:
252*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_FLAT_PATH_OR_FILE)));
253*cdf0e10cSrcweir 				m_aConnectionURL.SetHelpId(HID_DSADMIN_FLAT_PATH);
254*cdf0e10cSrcweir 				break;
255*cdf0e10cSrcweir 			case  ::dbaccess::DST_CALC:
256*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_CALC_PATH_OR_FILE)));
257*cdf0e10cSrcweir 				m_aConnectionURL.SetHelpId(HID_DSADMIN_CALC_PATH);
258*cdf0e10cSrcweir 				break;
259*cdf0e10cSrcweir 			case  ::dbaccess::DST_ADABAS:
260*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_ADABAS_DATABASE_NAME)));
261*cdf0e10cSrcweir 				m_aConnectionURL.SetHelpId(HID_DSADMIN_ADABAS_DATABASE);
262*cdf0e10cSrcweir 				break;
263*cdf0e10cSrcweir 			case  ::dbaccess::DST_ADO:
264*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_COMMONURL)));
265*cdf0e10cSrcweir 				break;
266*cdf0e10cSrcweir 			case  ::dbaccess::DST_MSACCESS:
267*cdf0e10cSrcweir             case  ::dbaccess::DST_MSACCESS_2007:
268*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_MSACCESS_MDB_FILE)));
269*cdf0e10cSrcweir 				m_aConnectionURL.SetHelpId(HID_DSADMIN_MSACCESS_MDB_FILE);
270*cdf0e10cSrcweir 				break;
271*cdf0e10cSrcweir             case  ::dbaccess::DST_MYSQL_NATIVE:
272*cdf0e10cSrcweir 			case  ::dbaccess::DST_MYSQL_JDBC:
273*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_MYSQL_DATABASE_NAME)));
274*cdf0e10cSrcweir                 m_aConnectionURL.SetHelpId( HID_DSADMIN_MYSQL_DATABASE );
275*cdf0e10cSrcweir 				break;
276*cdf0e10cSrcweir 			case  ::dbaccess::DST_ORACLE_JDBC:
277*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_ORACLE_DATABASE_NAME)));
278*cdf0e10cSrcweir 				m_aConnectionURL.SetHelpId(HID_DSADMIN_ORACLE_DATABASE);
279*cdf0e10cSrcweir 				break;
280*cdf0e10cSrcweir 			case  ::dbaccess::DST_MYSQL_ODBC:
281*cdf0e10cSrcweir 			case  ::dbaccess::DST_ODBC:
282*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_NAME_OF_ODBC_DATASOURCE)));
283*cdf0e10cSrcweir 				m_aConnectionURL.SetHelpId( eType ==  ::dbaccess::DST_MYSQL_ODBC ? HID_DSADMIN_MYSQL_ODBC_DATASOURCE : HID_DSADMIN_ODBC_DATASOURCE);
284*cdf0e10cSrcweir 				break;
285*cdf0e10cSrcweir 			case  ::dbaccess::DST_LDAP:
286*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_HOSTNAME)));
287*cdf0e10cSrcweir 				m_aConnectionURL.SetHelpId( HID_DSADMIN_LDAP_HOSTNAME );
288*cdf0e10cSrcweir 				break;
289*cdf0e10cSrcweir 			case  ::dbaccess::DST_MOZILLA:
290*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_MOZILLA_PROFILE_NAME)));
291*cdf0e10cSrcweir 				m_aConnectionURL.SetHelpId( HID_DSADMIN_MOZILLA_PROFILE_NAME );
292*cdf0e10cSrcweir 				break;
293*cdf0e10cSrcweir 			case  ::dbaccess::DST_THUNDERBIRD:
294*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_THUNDERBIRD_PROFILE_NAME)));
295*cdf0e10cSrcweir 				m_aConnectionURL.SetHelpId( HID_DSADMIN_THUNDERBIRD_PROFILE_NAME );
296*cdf0e10cSrcweir 				break;
297*cdf0e10cSrcweir 			case  ::dbaccess::DST_OUTLOOK:
298*cdf0e10cSrcweir 			case  ::dbaccess::DST_OUTLOOKEXP:
299*cdf0e10cSrcweir 			case  ::dbaccess::DST_EVOLUTION:
300*cdf0e10cSrcweir 			case  ::dbaccess::DST_EVOLUTION_GROUPWISE:
301*cdf0e10cSrcweir 			case  ::dbaccess::DST_EVOLUTION_LDAP:
302*cdf0e10cSrcweir 			case  ::dbaccess::DST_KAB:
303*cdf0e10cSrcweir 			case  ::dbaccess::DST_MACAB:
304*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_NO_ADDITIONAL_SETTINGS)));
305*cdf0e10cSrcweir 				{
306*cdf0e10cSrcweir 					String sText = m_aFT_Connection.GetText();
307*cdf0e10cSrcweir 					sText.SearchAndReplaceAscii("%test",m_aTestConnection.GetText());
308*cdf0e10cSrcweir 					String sTemp;
309*cdf0e10cSrcweir 					sText.SearchAndReplaceAscii("~",sTemp);
310*cdf0e10cSrcweir 					m_aFT_Connection.SetText(sText);
311*cdf0e10cSrcweir 				}
312*cdf0e10cSrcweir 				m_aConnectionURL.Hide();
313*cdf0e10cSrcweir 				break;
314*cdf0e10cSrcweir 			case  ::dbaccess::DST_JDBC:
315*cdf0e10cSrcweir 			default:
316*cdf0e10cSrcweir                 m_aFT_Connection.SetText(String(ModuleRes(STR_COMMONURL)));
317*cdf0e10cSrcweir 				break;
318*cdf0e10cSrcweir 		}
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir         ;
321*cdf0e10cSrcweir         AuthenticationMode eAuthMode( DataSourceMetaData::getAuthentication( m_eType ) );
322*cdf0e10cSrcweir         bool bShowUserAuthenfication = ( eAuthMode != AuthNone );
323*cdf0e10cSrcweir         bool bShowUser = ( eAuthMode == AuthUserPwd );
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir         m_aPB_Connection.SetHelpId(HID_DSADMIN_BROWSECONN);
326*cdf0e10cSrcweir 		m_aFL2.Show( bShowUserAuthenfication );
327*cdf0e10cSrcweir 		m_aUserNameLabel.Show( bShowUser && bShowUserAuthenfication );
328*cdf0e10cSrcweir 		m_aUserName.Show( bShowUser && bShowUserAuthenfication );
329*cdf0e10cSrcweir 		m_aPasswordRequired.Show( bShowUserAuthenfication );
330*cdf0e10cSrcweir         if ( !bShowUser && bShowUserAuthenfication )
331*cdf0e10cSrcweir             m_aPasswordRequired.SetPosPixel(m_aUserNameLabel.GetPosPixel());
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir 		// collect the items
334*cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pUidItem, SfxStringItem, DSID_USER, sal_True);
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pJdbcDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True);
337*cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
338*cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True);
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir 		// forward the values to the controls
341*cdf0e10cSrcweir 		if ( bValid )
342*cdf0e10cSrcweir 		{
343*cdf0e10cSrcweir 			m_aUserName.SetText(pUidItem->GetValue());
344*cdf0e10cSrcweir 			m_aPasswordRequired.Check(pAllowEmptyPwd->GetValue());
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir 			String sUrl = pUrlItem->GetValue();
347*cdf0e10cSrcweir 			setURL( sUrl );
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir             const sal_Bool bEnableJDBC = m_pCollection->determineType(m_eType) == ::dbaccess::DST_JDBC;
350*cdf0e10cSrcweir             if ( !pJdbcDrvItem->GetValue().Len() )
351*cdf0e10cSrcweir             {
352*cdf0e10cSrcweir                 String sDefaultJdbcDriverName = m_pCollection->getJavaDriverClass(m_eType);
353*cdf0e10cSrcweir                 if ( sDefaultJdbcDriverName.Len() )
354*cdf0e10cSrcweir                 {
355*cdf0e10cSrcweir                     m_aJavaDriver.SetText(sDefaultJdbcDriverName);
356*cdf0e10cSrcweir 			        m_aJavaDriver.SetModifyFlag();
357*cdf0e10cSrcweir                 }
358*cdf0e10cSrcweir             } // if ( !pJdbcDrvItem->GetValue().Len() )
359*cdf0e10cSrcweir             else
360*cdf0e10cSrcweir 			    m_aJavaDriver.SetText(pJdbcDrvItem->GetValue());
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir 			m_aJavaDriverLabel.Show(bEnableJDBC);
363*cdf0e10cSrcweir 			m_aJavaDriver.Show(bEnableJDBC);
364*cdf0e10cSrcweir 			m_aTestJavaDriver.Show(bEnableJDBC);
365*cdf0e10cSrcweir 			m_aTestJavaDriver.Enable( m_aJavaDriver.GetText().Len() != 0);
366*cdf0e10cSrcweir 			m_aFL3.Show(bEnableJDBC);
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 			checkTestConnection();
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir 			m_aUserName.ClearModifyFlag();
371*cdf0e10cSrcweir 			m_aConnectionURL.ClearModifyFlag();
372*cdf0e10cSrcweir 			m_aJavaDriver.ClearModifyFlag();
373*cdf0e10cSrcweir 		}
374*cdf0e10cSrcweir 	}
375*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
376*cdf0e10cSrcweir 	void OConnectionTabPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
377*cdf0e10cSrcweir 	{
378*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL1));
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL2));
381*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aJavaDriverLabel));
382*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<PushButton>(&m_aTestJavaDriver));
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL3));
385*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aUserNameLabel));
386*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<PushButton>(&m_aTestConnection));
387*cdf0e10cSrcweir         OConnectionHelper::fillWindows(_rControlList);
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir 	}
390*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
391*cdf0e10cSrcweir 	void OConnectionTabPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
392*cdf0e10cSrcweir 	{
393*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aJavaDriver));
394*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aUserName));
395*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aPasswordRequired));
396*cdf0e10cSrcweir         OConnectionHelper::fillControls(_rControlList);
397*cdf0e10cSrcweir 	}
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
400*cdf0e10cSrcweir 	sal_Bool OConnectionTabPage::FillItemSet(SfxItemSet& _rSet)
401*cdf0e10cSrcweir 	{
402*cdf0e10cSrcweir 		sal_Bool bChangedSomething = sal_False;
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir 		if (m_aUserName.GetText() != m_aUserName.GetSavedValue())
405*cdf0e10cSrcweir 		{
406*cdf0e10cSrcweir 			_rSet.Put(SfxStringItem(DSID_USER, m_aUserName.GetText()));
407*cdf0e10cSrcweir 			_rSet.Put(SfxStringItem(DSID_PASSWORD, String()));
408*cdf0e10cSrcweir 			bChangedSomething = sal_True;
409*cdf0e10cSrcweir 		}
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir 		fillBool(_rSet,&m_aPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething);
412*cdf0e10cSrcweir 
413*cdf0e10cSrcweir 		if ( m_pCollection->determineType(m_eType) ==  ::dbaccess::DST_JDBC )
414*cdf0e10cSrcweir 		{
415*cdf0e10cSrcweir 			fillString(_rSet,&m_aJavaDriver, DSID_JDBCDRIVERCLASS, bChangedSomething);
416*cdf0e10cSrcweir 		}
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir 		fillString(_rSet,&m_aConnectionURL, DSID_CONNECTURL, bChangedSomething);
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir 		return bChangedSomething;
421*cdf0e10cSrcweir 	}
422*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
423*cdf0e10cSrcweir 	IMPL_LINK(OConnectionTabPage, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
424*cdf0e10cSrcweir 	{
425*cdf0e10cSrcweir 		OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
426*cdf0e10cSrcweir 		sal_Bool bSuccess = sal_False;
427*cdf0e10cSrcweir 		try
428*cdf0e10cSrcweir 		{
429*cdf0e10cSrcweir 			if ( m_aJavaDriver.GetText().Len() )
430*cdf0e10cSrcweir 			{
431*cdf0e10cSrcweir 				::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_pAdminDialog->getORB());
432*cdf0e10cSrcweir 				bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aJavaDriver.GetText());
433*cdf0e10cSrcweir 			}
434*cdf0e10cSrcweir 		}
435*cdf0e10cSrcweir 		catch(Exception&)
436*cdf0e10cSrcweir 		{
437*cdf0e10cSrcweir 		}
438*cdf0e10cSrcweir 
439*cdf0e10cSrcweir 		sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
440*cdf0e10cSrcweir 		OSQLMessageBox aMsg( this, String( ModuleRes( nMessage ) ), String() );
441*cdf0e10cSrcweir 		aMsg.Execute();
442*cdf0e10cSrcweir 		return 0L;
443*cdf0e10cSrcweir 	}
444*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
445*cdf0e10cSrcweir 	bool OConnectionTabPage::checkTestConnection()
446*cdf0e10cSrcweir 	{
447*cdf0e10cSrcweir 		OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
448*cdf0e10cSrcweir 		sal_Bool bEnableTestConnection = !m_aConnectionURL.IsVisible() || (m_aConnectionURL.GetTextNoPrefix().Len() != 0);
449*cdf0e10cSrcweir 		if ( m_pCollection->determineType(m_eType) ==  ::dbaccess::DST_JDBC )
450*cdf0e10cSrcweir 			bEnableTestConnection = bEnableTestConnection && (m_aJavaDriver.GetText().Len() != 0);
451*cdf0e10cSrcweir 		m_aTestConnection.Enable(bEnableTestConnection);
452*cdf0e10cSrcweir         return true;
453*cdf0e10cSrcweir 	}
454*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
455*cdf0e10cSrcweir 	IMPL_LINK(OConnectionTabPage, OnEditModified, Edit*, _pEdit)
456*cdf0e10cSrcweir 	{
457*cdf0e10cSrcweir 		if ( _pEdit == &m_aJavaDriver )
458*cdf0e10cSrcweir 			m_aTestJavaDriver.Enable( m_aJavaDriver.GetText().Len() != 0 );
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir 		checkTestConnection();
461*cdf0e10cSrcweir 		// tell the listener we were modified
462*cdf0e10cSrcweir 		callModifiedHdl();
463*cdf0e10cSrcweir 		return 0L;
464*cdf0e10cSrcweir 	}
465*cdf0e10cSrcweir //.........................................................................
466*cdf0e10cSrcweir }	// namespace dbaui
467*cdf0e10cSrcweir //.........................................................................
468*cdf0e10cSrcweir 
469