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 #ifndef DBAUI_DBSETUPCONNECTIONPAGES_HXX
31*cdf0e10cSrcweir #include "DBSetupConnectionPages.hxx"
32*cdf0e10cSrcweir #endif
33*cdf0e10cSrcweir #ifndef _DBAUI_SQLMESSAGE_HXX_
34*cdf0e10cSrcweir #include "sqlmessage.hxx"
35*cdf0e10cSrcweir #endif
36*cdf0e10cSrcweir #ifndef _DBU_RESOURCE_HRC_
37*cdf0e10cSrcweir #include "dbu_resource.hrc"
38*cdf0e10cSrcweir #endif
39*cdf0e10cSrcweir #ifndef _DBAUI_AUTOCONTROLS_HRC_
40*cdf0e10cSrcweir #include "AutoControls.hrc"
41*cdf0e10cSrcweir #endif
42*cdf0e10cSrcweir #ifndef _DBAUI_DBADMINSETUP_HRC_
43*cdf0e10cSrcweir #include "dbadminsetup.hrc"
44*cdf0e10cSrcweir #endif
45*cdf0e10cSrcweir #ifndef _SFXITEMSET_HXX
46*cdf0e10cSrcweir #include <svl/itemset.hxx>
47*cdf0e10cSrcweir #endif
48*cdf0e10cSrcweir #ifndef _SFXSTRITEM_HXX
49*cdf0e10cSrcweir #include <svl/stritem.hxx>
50*cdf0e10cSrcweir #endif
51*cdf0e10cSrcweir #ifndef _SFXENUMITEM_HXX
52*cdf0e10cSrcweir #include <svl/eitem.hxx>
53*cdf0e10cSrcweir #endif
54*cdf0e10cSrcweir #ifndef _SFXINTITEM_HXX
55*cdf0e10cSrcweir #include <svl/intitem.hxx>
56*cdf0e10cSrcweir #endif
57*cdf0e10cSrcweir #ifndef _DBAUI_DATASOURCEITEMS_HXX_
58*cdf0e10cSrcweir #include "dsitems.hxx"
59*cdf0e10cSrcweir #endif
60*cdf0e10cSrcweir #include "dsnItem.hxx"
61*cdf0e10cSrcweir #ifndef _DBA_DBACCESS_HELPID_HRC_
62*cdf0e10cSrcweir #include "dbaccess_helpid.hrc"
63*cdf0e10cSrcweir #endif
64*cdf0e10cSrcweir #ifndef _DBAUI_LOCALRESACCESS_HXX_
65*cdf0e10cSrcweir #include "localresaccess.hxx"
66*cdf0e10cSrcweir #endif
67*cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX
68*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
69*cdf0e10cSrcweir #endif
70*cdf0e10cSrcweir #ifndef _SV_MNEMONIC_HXX
71*cdf0e10cSrcweir #include <vcl/mnemonic.hxx>
72*cdf0e10cSrcweir #endif
73*cdf0e10cSrcweir #ifndef _SVTOOLS_CJKOPTIONS_HXX
74*cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
75*cdf0e10cSrcweir #endif
76*cdf0e10cSrcweir #include <jvmaccess/virtualmachine.hxx>
77*cdf0e10cSrcweir #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
78*cdf0e10cSrcweir #include <connectivity/CommonTools.hxx>
79*cdf0e10cSrcweir #endif
80*cdf0e10cSrcweir #ifndef DBAUI_DRIVERSETTINGS_HXX
81*cdf0e10cSrcweir #include "DriverSettings.hxx"
82*cdf0e10cSrcweir #endif
83*cdf0e10cSrcweir #ifndef _DBAUI_DBADMIN_HXX_
84*cdf0e10cSrcweir #include "dbadmin.hxx"
85*cdf0e10cSrcweir #endif
86*cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_HXX_
87*cdf0e10cSrcweir #include <comphelper/types.hxx>
88*cdf0e10cSrcweir #endif
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UI_DIALOGS_XFOLDERPICKER_HPP_
91*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
92*cdf0e10cSrcweir #endif
93*cdf0e10cSrcweir // #106016# ------------------------------------
94*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
95*cdf0e10cSrcweir #include <com/sun/star/task/XInteractionHandler.hpp>
96*cdf0e10cSrcweir #endif
97*cdf0e10cSrcweir #include <com/sun/star/sdbc/XDriverAccess.hpp>
98*cdf0e10cSrcweir #include "dbustrings.hrc"
99*cdf0e10cSrcweir #ifndef SVTOOLS_FILENOTATION_HXX_
100*cdf0e10cSrcweir #include <svl/filenotation.hxx>
101*cdf0e10cSrcweir #endif
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir #include <unotools/localfilehelper.hxx>
104*cdf0e10cSrcweir #include <unotools/ucbhelper.hxx>
105*cdf0e10cSrcweir #include <ucbhelper/commandenvironment.hxx>
106*cdf0e10cSrcweir #include "finteraction.hxx"
107*cdf0e10cSrcweir #include <connectivity/CommonTools.hxx>
108*cdf0e10cSrcweir #include "dbaccess_helpid.hrc"
109*cdf0e10cSrcweir #include <unotools/pathoptions.hxx>
110*cdf0e10cSrcweir #include <svtools/roadmapwizard.hxx>
111*cdf0e10cSrcweir #include "TextConnectionHelper.hxx"
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir //.........................................................................
115*cdf0e10cSrcweir namespace dbaui
116*cdf0e10cSrcweir {
117*cdf0e10cSrcweir //.........................................................................
118*cdf0e10cSrcweir using namespace ::com::sun::star;
119*cdf0e10cSrcweir //	using namespace ::com::sun::star::ucb;
120*cdf0e10cSrcweir //	using namespace ::com::sun::star::ui::dialogs;
121*cdf0e10cSrcweir //	using namespace ::com::sun::star::sdbc;
122*cdf0e10cSrcweir //	using namespace ::com::sun::star::beans;
123*cdf0e10cSrcweir //	using namespace ::com::sun::star::lang;
124*cdf0e10cSrcweir //	using namespace ::com::sun::star::container;
125*cdf0e10cSrcweir //	using namespace ::dbtools;
126*cdf0e10cSrcweir //	using namespace ::svt;
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 	OGenericAdministrationPage*	OTextConnectionPageSetup::CreateTextTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
129*cdf0e10cSrcweir     {
130*cdf0e10cSrcweir         return ( new OTextConnectionPageSetup( pParent, _rAttrSet ) );
131*cdf0e10cSrcweir     }
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 	//========================================================================
135*cdf0e10cSrcweir 	//= OTextConnectionPageSetup
136*cdf0e10cSrcweir 	//========================================================================
137*cdf0e10cSrcweir DBG_NAME(OTextConnectionPageSetup)
138*cdf0e10cSrcweir //------------------------------------------------------------------------
139*cdf0e10cSrcweir 	OTextConnectionPageSetup::OTextConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
140*cdf0e10cSrcweir 		:OConnectionTabPageSetup(pParent, PAGE_DBWIZARD_TEXT, _rCoreAttrs, STR_TEXT_HELPTEXT, STR_TEXT_HEADERTEXT, STR_TEXT_PATH_OR_FILE)
141*cdf0e10cSrcweir 	{
142*cdf0e10cSrcweir         DBG_CTOR(OTextConnectionPageSetup,NULL);
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir         m_pTextConnectionHelper = new OTextConnectionHelper( this, TC_EXTENSION | TC_SEPARATORS );
145*cdf0e10cSrcweir         m_pTextConnectionHelper->SetClickHandler(LINK( this, OTextConnectionPageSetup, ImplGetExtensionHdl ) );
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir         FreeResource();
148*cdf0e10cSrcweir 	}
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
152*cdf0e10cSrcweir 	OTextConnectionPageSetup::~OTextConnectionPageSetup()
153*cdf0e10cSrcweir 	{
154*cdf0e10cSrcweir         DELETEZ(m_pTextConnectionHelper);
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir         DBG_DTOR(OTextConnectionPageSetup,NULL);
157*cdf0e10cSrcweir     }
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir     IMPL_LINK(OTextConnectionPageSetup, ImplGetExtensionHdl, OTextConnectionHelper*, /*_pTextConnectionHelper*/)
160*cdf0e10cSrcweir     {
161*cdf0e10cSrcweir         SetRoadmapStateValue((m_pTextConnectionHelper->GetExtension().Len() > 0) && OConnectionTabPageSetup::checkTestConnection());
162*cdf0e10cSrcweir 	    callModifiedHdl();
163*cdf0e10cSrcweir         return sal_True;
164*cdf0e10cSrcweir     }
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir     bool OTextConnectionPageSetup::checkTestConnection()
168*cdf0e10cSrcweir     {
169*cdf0e10cSrcweir         bool bDoEnable = OConnectionTabPageSetup::checkTestConnection();
170*cdf0e10cSrcweir         bDoEnable = (m_pTextConnectionHelper->GetExtension().Len() > 0) && bDoEnable;
171*cdf0e10cSrcweir         return bDoEnable;
172*cdf0e10cSrcweir     }
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir     // -----------------------------------------------------------------------
175*cdf0e10cSrcweir 	void OTextConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
176*cdf0e10cSrcweir 	{
177*cdf0e10cSrcweir 		OConnectionTabPageSetup::fillControls(_rControlList);
178*cdf0e10cSrcweir         m_pTextConnectionHelper->fillControls(_rControlList);
179*cdf0e10cSrcweir 	}
180*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
181*cdf0e10cSrcweir 	void OTextConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
182*cdf0e10cSrcweir 	{
183*cdf0e10cSrcweir 		OConnectionTabPageSetup::fillWindows(_rControlList);
184*cdf0e10cSrcweir         m_pTextConnectionHelper->fillWindows(_rControlList);
185*cdf0e10cSrcweir 	}
186*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
187*cdf0e10cSrcweir 	void OTextConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
188*cdf0e10cSrcweir 	{
189*cdf0e10cSrcweir 		// first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
190*cdf0e10cSrcweir 		sal_Bool bValid, bReadonly;
191*cdf0e10cSrcweir 		getFlags(_rSet, bValid, bReadonly);
192*cdf0e10cSrcweir         OConnectionTabPageSetup::implInitControls( _rSet, _bSaveValue);
193*cdf0e10cSrcweir 		m_pTextConnectionHelper->implInitControls(_rSet, bValid);
194*cdf0e10cSrcweir 	}
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
198*cdf0e10cSrcweir 	sal_Bool OTextConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
199*cdf0e10cSrcweir 	{
200*cdf0e10cSrcweir         sal_Bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
201*cdf0e10cSrcweir 		bChangedSomething = m_pTextConnectionHelper->FillItemSet(_rSet, bChangedSomething);
202*cdf0e10cSrcweir 		return bChangedSomething;
203*cdf0e10cSrcweir 	}
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir     sal_Bool OTextConnectionPageSetup::prepareLeave(){
207*cdf0e10cSrcweir         return m_pTextConnectionHelper->prepareLeave();
208*cdf0e10cSrcweir     }
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir     OGenericAdministrationPage*	OLDAPConnectionPageSetup::CreateLDAPTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
212*cdf0e10cSrcweir     {
213*cdf0e10cSrcweir         return ( new OLDAPConnectionPageSetup( pParent, _rAttrSet ) );
214*cdf0e10cSrcweir     }
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir 	//========================================================================
218*cdf0e10cSrcweir 	//= OLDAPPageSetup
219*cdf0e10cSrcweir 	//========================================================================
220*cdf0e10cSrcweir 	OLDAPConnectionPageSetup::OLDAPConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
221*cdf0e10cSrcweir         :OGenericAdministrationPage(pParent, ModuleRes(PAGE_DBWIZARD_LDAP), _rCoreAttrs)
222*cdf0e10cSrcweir         ,m_aFTHeaderText        (this, ModuleRes(FT_LDAP_HEADERTEXT))
223*cdf0e10cSrcweir         ,m_aFTHelpText          (this, ModuleRes(FT_LDAP_HELPTEXT))
224*cdf0e10cSrcweir 		,m_aFTHostServer	    (this, ModuleRes(FT_AUTOHOSTNAME))
225*cdf0e10cSrcweir 		,m_aETHostServer	    (this, ModuleRes(ET_AUTOHOSTNAME))
226*cdf0e10cSrcweir         ,m_aFTBaseDN			(this, ModuleRes(FT_AUTOBASEDN))
227*cdf0e10cSrcweir 		,m_aETBaseDN		    (this, ModuleRes(ET_AUTOBASEDN))
228*cdf0e10cSrcweir 		,m_aFTPortNumber		(this, ModuleRes(FT_AUTOPORTNUMBER))
229*cdf0e10cSrcweir 		,m_aNFPortNumber	    (this, ModuleRes(NF_AUTOPORTNUMBER))
230*cdf0e10cSrcweir         ,m_aFTDefaultPortNumber (this, ModuleRes(FT_AUTOPORTNUMBERDEFAULT))
231*cdf0e10cSrcweir         ,m_aCBUseSSL            (this, ModuleRes(CB_WIZ_USESSL))
232*cdf0e10cSrcweir     {
233*cdf0e10cSrcweir         SetControlFontWeight(&m_aFTHeaderText);
234*cdf0e10cSrcweir         m_aFTDefaultPortNumber.SetText(String(ModuleRes(STR_LDAP_DEFAULT)));
235*cdf0e10cSrcweir         m_aETHostServer.SetModifyHdl(getControlModifiedLink());
236*cdf0e10cSrcweir 		m_aETBaseDN.SetModifyHdl(getControlModifiedLink());
237*cdf0e10cSrcweir 		m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
238*cdf0e10cSrcweir         m_aCBUseSSL.SetToggleHdl(getControlModifiedLink());
239*cdf0e10cSrcweir         SetRoadmapStateValue(sal_False);
240*cdf0e10cSrcweir 		FreeResource();
241*cdf0e10cSrcweir 	}
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
244*cdf0e10cSrcweir 	sal_Bool OLDAPConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
245*cdf0e10cSrcweir 	{
246*cdf0e10cSrcweir    		sal_Bool bChangedSomething = sal_False;
247*cdf0e10cSrcweir 		fillString(_rSet,&m_aETBaseDN,DSID_CONN_LDAP_BASEDN, bChangedSomething);
248*cdf0e10cSrcweir 		fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir         if ( m_aETHostServer.GetText() != m_aETHostServer.GetSavedValue() )
251*cdf0e10cSrcweir         {
252*cdf0e10cSrcweir             DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION));
253*cdf0e10cSrcweir             ::dbaccess::ODsnTypeCollection* pCollection = NULL;
254*cdf0e10cSrcweir 		    if (pCollectionItem)
255*cdf0e10cSrcweir 			    pCollection = pCollectionItem->getCollection();
256*cdf0e10cSrcweir 		    DBG_ASSERT(pCollection, "OLDAPConnectionPageSetup::FillItemSet : really need a DSN type collection !");
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir             String sUrl = pCollection->getPrefix( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:ldap:")));
259*cdf0e10cSrcweir             sUrl += m_aETHostServer.GetText();
260*cdf0e10cSrcweir             _rSet.Put(SfxStringItem(DSID_CONNECTURL, sUrl));
261*cdf0e10cSrcweir             bChangedSomething = sal_True;
262*cdf0e10cSrcweir         }
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir         // fillString(_rSet,&m_aETHostServer, DSID_CONNECTURL, bChangedSomething);
265*cdf0e10cSrcweir         fillBool(_rSet,&m_aCBUseSSL,DSID_CONN_LDAP_USESSL,bChangedSomething);
266*cdf0e10cSrcweir         return bChangedSomething;
267*cdf0e10cSrcweir 	}
268*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
269*cdf0e10cSrcweir 	void OLDAPConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
270*cdf0e10cSrcweir 	{
271*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETHostServer));
272*cdf0e10cSrcweir         _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETBaseDN));
273*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
274*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBUseSSL));
275*cdf0e10cSrcweir 	}
276*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
277*cdf0e10cSrcweir 	void OLDAPConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
278*cdf0e10cSrcweir 	{
279*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHelpText));
280*cdf0e10cSrcweir         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostServer));
281*cdf0e10cSrcweir         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTBaseDN));
282*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTPortNumber));
283*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDefaultPortNumber));
284*cdf0e10cSrcweir     }
285*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
286*cdf0e10cSrcweir 	void OLDAPConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
287*cdf0e10cSrcweir 	{
288*cdf0e10cSrcweir 		// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
289*cdf0e10cSrcweir 		sal_Bool bValid, bReadonly;
290*cdf0e10cSrcweir 		getFlags(_rSet, bValid, bReadonly);
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pBaseDN, SfxStringItem, DSID_CONN_LDAP_BASEDN, sal_True);
294*cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_LDAP_PORTNUMBER, sal_True);
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir 		if ( bValid )
297*cdf0e10cSrcweir 		{
298*cdf0e10cSrcweir 			m_aETBaseDN.SetText(pBaseDN->GetValue());
299*cdf0e10cSrcweir 			m_aNFPortNumber.SetValue(pPortNumber->GetValue());
300*cdf0e10cSrcweir 		}
301*cdf0e10cSrcweir    		OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
302*cdf0e10cSrcweir 		callModifiedHdl();
303*cdf0e10cSrcweir 	}
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir     // -----------------------------------------------------------------------
306*cdf0e10cSrcweir 	IMPL_LINK(OLDAPConnectionPageSetup, OnEditModified, Edit*, /*_pEdit*/)
307*cdf0e10cSrcweir 	{
308*cdf0e10cSrcweir         sal_Bool bRoadmapState = ((m_aETHostServer.GetText().Len() != 0 ) && ( m_aETBaseDN.GetText().Len() != 0 ) && (m_aFTPortNumber.GetText().Len() != 0 ));
309*cdf0e10cSrcweir         SetRoadmapStateValue(bRoadmapState);
310*cdf0e10cSrcweir 		callModifiedHdl();
311*cdf0e10cSrcweir 		return 0L;
312*cdf0e10cSrcweir 	}
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir     // ----------------------------------------------------------------------- //OGenericAdministrationPage*
316*cdf0e10cSrcweir 	OMySQLIntroPageSetup* OMySQLIntroPageSetup::CreateMySQLIntroTabPage( Window* _pParent, const SfxItemSet& _rAttrSet )
317*cdf0e10cSrcweir 	{
318*cdf0e10cSrcweir 		return ( new OMySQLIntroPageSetup( _pParent, _rAttrSet) );
319*cdf0e10cSrcweir 	}
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir DBG_NAME(OMySQLIntroPageSetup)
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir     OMySQLIntroPageSetup::OMySQLIntroPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
324*cdf0e10cSrcweir             :OGenericAdministrationPage(pParent, ModuleRes(PAGE_DBWIZARD_MYSQL_INTRO), _rCoreAttrs)
325*cdf0e10cSrcweir             ,m_aRB_ODBCDatabase(this, ModuleRes(RB_CONNECTVIAODBC))
326*cdf0e10cSrcweir             ,m_aRB_JDBCDatabase(this, ModuleRes(RB_CONNECTVIAJDBC))
327*cdf0e10cSrcweir             ,m_aRB_NATIVEDatabase(this, ModuleRes(RB_CONNECTVIANATIVE))
328*cdf0e10cSrcweir             ,m_aFT_ConnectionMode(this, ModuleRes(FT_MYSQLCONNECTIONMODE))
329*cdf0e10cSrcweir             ,m_aFT_Helptext(this, ModuleRes(FT_MYSQL_HELPTEXT))
330*cdf0e10cSrcweir             ,m_aFT_Headertext(this, ModuleRes(FT_MYSQL_HEADERTEXT))
331*cdf0e10cSrcweir     {
332*cdf0e10cSrcweir         DBG_CTOR(OMySQLIntroPageSetup,NULL);
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir         SetControlFontWeight(&m_aFT_Headertext);
335*cdf0e10cSrcweir    		m_aRB_ODBCDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
336*cdf0e10cSrcweir    		m_aRB_JDBCDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
337*cdf0e10cSrcweir         m_aRB_NATIVEDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
338*cdf0e10cSrcweir 		FreeResource();
339*cdf0e10cSrcweir 	}
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir     IMPL_LINK(OMySQLIntroPageSetup, OnSetupModeSelected, RadioButton*, /*_pBox*/)
342*cdf0e10cSrcweir     {
343*cdf0e10cSrcweir         maClickHdl.Call( this );
344*cdf0e10cSrcweir         return true;
345*cdf0e10cSrcweir     }
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
348*cdf0e10cSrcweir 	OMySQLIntroPageSetup::~OMySQLIntroPageSetup()
349*cdf0e10cSrcweir 	{
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir         DBG_DTOR(OMySQLIntroPageSetup,NULL);
352*cdf0e10cSrcweir     }
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
356*cdf0e10cSrcweir 	void OMySQLIntroPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bSaveValue*/)
357*cdf0e10cSrcweir 	{
358*cdf0e10cSrcweir         // show the "Connect directly" option only if the driver is installed
359*cdf0e10cSrcweir         DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION));
360*cdf0e10cSrcweir         bool bHasMySQLNative = ( pCollectionItem != NULL ) && pCollectionItem->getCollection()->hasDriver( "sdbc:mysqlc:" );
361*cdf0e10cSrcweir         if ( bHasMySQLNative )
362*cdf0e10cSrcweir             m_aRB_NATIVEDatabase.Show();
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir         // if any of the options is checked, then there's nothing to do
365*cdf0e10cSrcweir         if ( m_aRB_ODBCDatabase.IsChecked() || m_aRB_JDBCDatabase.IsChecked() || m_aRB_NATIVEDatabase.IsChecked() )
366*cdf0e10cSrcweir             return;
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir         // prefer "native" or "JDBC"
369*cdf0e10cSrcweir         if ( bHasMySQLNative )
370*cdf0e10cSrcweir             m_aRB_NATIVEDatabase.Check();
371*cdf0e10cSrcweir         else
372*cdf0e10cSrcweir             m_aRB_JDBCDatabase.Check();
373*cdf0e10cSrcweir 	}
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
377*cdf0e10cSrcweir 	void OMySQLIntroPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
378*cdf0e10cSrcweir 	{
379*cdf0e10cSrcweir 	}
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
382*cdf0e10cSrcweir 	void OMySQLIntroPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
383*cdf0e10cSrcweir 	{
384*cdf0e10cSrcweir     }
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
388*cdf0e10cSrcweir 	sal_Bool OMySQLIntroPageSetup::FillItemSet(SfxItemSet& /*_rSet*/)
389*cdf0e10cSrcweir 	{
390*cdf0e10cSrcweir         OSL_ENSURE(sal_False,"Who called me?! Please ask oj for more information.");
391*cdf0e10cSrcweir 		return sal_True;
392*cdf0e10cSrcweir 	}
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir     OMySQLIntroPageSetup::ConnectionType OMySQLIntroPageSetup::getMySQLMode()
396*cdf0e10cSrcweir     {
397*cdf0e10cSrcweir         if (m_aRB_JDBCDatabase.IsChecked())
398*cdf0e10cSrcweir             return VIA_JDBC;
399*cdf0e10cSrcweir         else if (m_aRB_NATIVEDatabase.IsChecked())
400*cdf0e10cSrcweir             return VIA_NATIVE;
401*cdf0e10cSrcweir         else
402*cdf0e10cSrcweir             return VIA_ODBC;
403*cdf0e10cSrcweir     }
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir 	// =======================================================================
406*cdf0e10cSrcweir     // = MySQLNativeSetupPage
407*cdf0e10cSrcweir 	// =======================================================================
408*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
409*cdf0e10cSrcweir     MySQLNativeSetupPage::MySQLNativeSetupPage( Window* _pParent, const SfxItemSet& _rCoreAttrs )
410*cdf0e10cSrcweir 		:OGenericAdministrationPage( _pParent, ModuleRes( PAGE_DBWIZARD_MYSQL_NATIVE ), _rCoreAttrs )
411*cdf0e10cSrcweir         ,m_aHeader              ( this, ModuleRes( FT_SETUP_WIZARD_HEADER ) )
412*cdf0e10cSrcweir         ,m_aHelpText            ( this, ModuleRes( FT_SETUP_WIZARD_HELP ) )
413*cdf0e10cSrcweir         ,m_aMySQLSettings       ( *this, getControlModifiedLink() )
414*cdf0e10cSrcweir     {
415*cdf0e10cSrcweir         SetControlFontWeight( &m_aHeader );
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir         LayoutHelper::positionBelow( m_aHelpText, m_aMySQLSettings, UnrelatedControls, 0 );
418*cdf0e10cSrcweir         m_aMySQLSettings.Show();
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir         SetRoadmapStateValue(sal_False);
421*cdf0e10cSrcweir 		FreeResource();
422*cdf0e10cSrcweir     }
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
425*cdf0e10cSrcweir     OGenericAdministrationPage* MySQLNativeSetupPage::Create( Window* pParent, const SfxItemSet& _rAttrSet )
426*cdf0e10cSrcweir     {
427*cdf0e10cSrcweir         return new MySQLNativeSetupPage( pParent, _rAttrSet );
428*cdf0e10cSrcweir     }
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
431*cdf0e10cSrcweir 	void MySQLNativeSetupPage::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList )
432*cdf0e10cSrcweir     {
433*cdf0e10cSrcweir         m_aMySQLSettings.fillControls( _rControlList );
434*cdf0e10cSrcweir     }
435*cdf0e10cSrcweir 
436*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
437*cdf0e10cSrcweir     void MySQLNativeSetupPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
438*cdf0e10cSrcweir     {
439*cdf0e10cSrcweir         _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aHelpText ) );
440*cdf0e10cSrcweir         m_aMySQLSettings.fillWindows( _rControlList );
441*cdf0e10cSrcweir     }
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
444*cdf0e10cSrcweir 	sal_Bool MySQLNativeSetupPage::FillItemSet( SfxItemSet& _rSet )
445*cdf0e10cSrcweir 	{
446*cdf0e10cSrcweir         return m_aMySQLSettings.FillItemSet( _rSet );
447*cdf0e10cSrcweir 	}
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
450*cdf0e10cSrcweir 	void MySQLNativeSetupPage::implInitControls( const SfxItemSet& _rSet, sal_Bool _bSaveValue )
451*cdf0e10cSrcweir 	{
452*cdf0e10cSrcweir         m_aMySQLSettings.implInitControls( _rSet );
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir 		OGenericAdministrationPage::implInitControls( _rSet, _bSaveValue );
455*cdf0e10cSrcweir 
456*cdf0e10cSrcweir 		OnModified( NULL );
457*cdf0e10cSrcweir 	}
458*cdf0e10cSrcweir 
459*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
460*cdf0e10cSrcweir     Link MySQLNativeSetupPage::getControlModifiedLink()
461*cdf0e10cSrcweir     {
462*cdf0e10cSrcweir         return LINK( this, MySQLNativeSetupPage, OnModified );
463*cdf0e10cSrcweir     }
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir     // -----------------------------------------------------------------------
466*cdf0e10cSrcweir 	IMPL_LINK( MySQLNativeSetupPage, OnModified, Edit*, _pEdit )
467*cdf0e10cSrcweir 	{
468*cdf0e10cSrcweir         SetRoadmapStateValue( m_aMySQLSettings.canAdvance() );
469*cdf0e10cSrcweir 
470*cdf0e10cSrcweir         return OGenericAdministrationPage::getControlModifiedLink().Call( _pEdit );
471*cdf0e10cSrcweir 	}
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir 	//========================================================================
474*cdf0e10cSrcweir 	//= OMySQLJDBCConnectionPageSetup
475*cdf0e10cSrcweir 	//========================================================================
476*cdf0e10cSrcweir 	OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( Window* pParent,sal_uInt16 _nResId, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId, sal_uInt16 _nDefaultPortResId, sal_uInt16 _nHelpTextResId, sal_uInt16 _nHeaderTextResId, sal_uInt16 _nDriverClassId)
477*cdf0e10cSrcweir 		:OGenericAdministrationPage(pParent, ModuleRes(_nResId), _rCoreAttrs)
478*cdf0e10cSrcweir         ,m_aFTHelpText          (this, ModuleRes(FT_AUTOWIZARDHELPTEXT))
479*cdf0e10cSrcweir         ,m_aFTDatabasename	    (this, ModuleRes(FT_AUTODATABASENAME))
480*cdf0e10cSrcweir 		,m_aETDatabasename	    (this, ModuleRes(ET_AUTODATABASENAME))
481*cdf0e10cSrcweir         ,m_aFTHostname		    (this, ModuleRes(FT_AUTOHOSTNAME))
482*cdf0e10cSrcweir 		,m_aETHostname		    (this, ModuleRes(ET_AUTOHOSTNAME))
483*cdf0e10cSrcweir 		,m_aFTPortNumber	    (this, ModuleRes(FT_AUTOPORTNUMBER))
484*cdf0e10cSrcweir         ,m_aFTDefaultPortNumber (this, ModuleRes(FT_AUTOPORTNUMBERDEFAULT))
485*cdf0e10cSrcweir 		,m_aNFPortNumber	    (this, ModuleRes(NF_AUTOPORTNUMBER))
486*cdf0e10cSrcweir 		,m_aFTDriverClass	    (this, ModuleRes(FT_AUTOJDBCDRIVERCLASS))
487*cdf0e10cSrcweir 		,m_aETDriverClass	    (this, ModuleRes(ET_AUTOJDBCDRIVERCLASS))
488*cdf0e10cSrcweir 		,m_aPBTestJavaDriver	(this, ModuleRes(PB_AUTOTESTDRIVERCLASS))
489*cdf0e10cSrcweir 		,m_nPortId(_nPortId)
490*cdf0e10cSrcweir 	{
491*cdf0e10cSrcweir         m_aFTDriverClass.SetText(String(ModuleRes(_nDriverClassId)));
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir         m_aFTDefaultPortNumber.SetText(String(ModuleRes(_nDefaultPortResId)));
494*cdf0e10cSrcweir         String sHelpText = String(ModuleRes(_nHelpTextResId));
495*cdf0e10cSrcweir         m_aFTHelpText.SetText(sHelpText);
496*cdf0e10cSrcweir         //TODO this code snippet is redundant
497*cdf0e10cSrcweir         SetHeaderText(FT_AUTOWIZARDHEADER, _nHeaderTextResId);
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir 		m_aETDatabasename.SetModifyHdl(getControlModifiedLink());
500*cdf0e10cSrcweir         m_aETHostname.SetModifyHdl(getControlModifiedLink());
501*cdf0e10cSrcweir 		m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir 	    m_aETDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified));
504*cdf0e10cSrcweir 	    m_aPBTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCConnectionPageSetup,OnTestJavaClickHdl));
505*cdf0e10cSrcweir 
506*cdf0e10cSrcweir         SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
507*cdf0e10cSrcweir         SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
508*cdf0e10cSrcweir 	    ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
509*cdf0e10cSrcweir 	    if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
510*cdf0e10cSrcweir         {
511*cdf0e10cSrcweir             m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
512*cdf0e10cSrcweir         }
513*cdf0e10cSrcweir 
514*cdf0e10cSrcweir         SetRoadmapStateValue(sal_False);
515*cdf0e10cSrcweir 		FreeResource();
516*cdf0e10cSrcweir 	}
517*cdf0e10cSrcweir 
518*cdf0e10cSrcweir 
519*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
520*cdf0e10cSrcweir 	OGenericAdministrationPage*	OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
521*cdf0e10cSrcweir 	{
522*cdf0e10cSrcweir 		return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
523*cdf0e10cSrcweir                                                          PAGE_DBWIZARD_MYSQL_JDBC,
524*cdf0e10cSrcweir                                                          _rAttrSet,
525*cdf0e10cSrcweir                                                          DSID_MYSQL_PORTNUMBER ,
526*cdf0e10cSrcweir                                                          STR_MYSQL_DEFAULT,
527*cdf0e10cSrcweir                                                          STR_MYSQLJDBC_HELPTEXT,
528*cdf0e10cSrcweir                                                          STR_MYSQLJDBC_HEADERTEXT,
529*cdf0e10cSrcweir                                                          STR_MYSQL_DRIVERCLASSTEXT) );
530*cdf0e10cSrcweir 	}
531*cdf0e10cSrcweir 
532*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
533*cdf0e10cSrcweir 	OGenericAdministrationPage*	OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
534*cdf0e10cSrcweir 	{
535*cdf0e10cSrcweir 		return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
536*cdf0e10cSrcweir                                                           PAGE_DBWIZARD_ORACLE,
537*cdf0e10cSrcweir                                                           _rAttrSet,
538*cdf0e10cSrcweir                                                           DSID_ORACLE_PORTNUMBER,
539*cdf0e10cSrcweir                                                           STR_ORACLE_DEFAULT,
540*cdf0e10cSrcweir                                                           STR_ORACLE_HELPTEXT,
541*cdf0e10cSrcweir                                                           STR_ORACLE_HEADERTEXT,
542*cdf0e10cSrcweir                                                           STR_ORACLE_DRIVERCLASSTEXT) );
543*cdf0e10cSrcweir 	}
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
546*cdf0e10cSrcweir 	void OGeneralSpecialJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
547*cdf0e10cSrcweir 	{
548*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDatabasename));
549*cdf0e10cSrcweir         _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDriverClass));
550*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETHostname));
551*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
552*cdf0e10cSrcweir 	}
553*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
554*cdf0e10cSrcweir 	void OGeneralSpecialJDBCConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
555*cdf0e10cSrcweir 	{
556*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHelpText));
557*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDatabasename));
558*cdf0e10cSrcweir         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
559*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTPortNumber));
560*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDefaultPortNumber));
561*cdf0e10cSrcweir         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass));
562*cdf0e10cSrcweir 	}
563*cdf0e10cSrcweir 
564*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
565*cdf0e10cSrcweir 	sal_Bool OGeneralSpecialJDBCConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
566*cdf0e10cSrcweir 	{
567*cdf0e10cSrcweir 		sal_Bool bChangedSomething = sal_False;
568*cdf0e10cSrcweir 	    fillString(_rSet,&m_aETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
569*cdf0e10cSrcweir 		fillString(_rSet,&m_aETHostname,DSID_CONN_HOSTNAME,bChangedSomething);
570*cdf0e10cSrcweir 		fillString(_rSet,&m_aETDatabasename,DSID_DATABASENAME,bChangedSomething);
571*cdf0e10cSrcweir         fillInt32(_rSet,&m_aNFPortNumber,m_nPortId,bChangedSomething );
572*cdf0e10cSrcweir 		return bChangedSomething;
573*cdf0e10cSrcweir 	}
574*cdf0e10cSrcweir 
575*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
576*cdf0e10cSrcweir 	void OGeneralSpecialJDBCConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
577*cdf0e10cSrcweir 	{
578*cdf0e10cSrcweir 		// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
579*cdf0e10cSrcweir 		sal_Bool bValid, bReadonly;
580*cdf0e10cSrcweir 		getFlags(_rSet, bValid, bReadonly);
581*cdf0e10cSrcweir 
582*cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pDatabaseName, SfxStringItem, DSID_DATABASENAME, sal_True);
583*cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True);
584*cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
585*cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, m_nPortId, sal_True);
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir 		if ( bValid )
588*cdf0e10cSrcweir 		{
589*cdf0e10cSrcweir 		    m_aETDatabasename.SetText(pDatabaseName->GetValue());
590*cdf0e10cSrcweir 		    m_aETDatabasename.ClearModifyFlag();
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir 		    m_aETDriverClass.SetText(pDrvItem->GetValue());
593*cdf0e10cSrcweir 		    m_aETDriverClass.ClearModifyFlag();
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir 			m_aETHostname.SetText(pHostName->GetValue());
596*cdf0e10cSrcweir 			m_aETHostname.ClearModifyFlag();
597*cdf0e10cSrcweir 
598*cdf0e10cSrcweir 			m_aNFPortNumber.SetValue(pPortNumber->GetValue());
599*cdf0e10cSrcweir 			m_aNFPortNumber.ClearModifyFlag();
600*cdf0e10cSrcweir 		}
601*cdf0e10cSrcweir 		OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
602*cdf0e10cSrcweir 
603*cdf0e10cSrcweir 		// to get the correct value when saveValue was called by base class
604*cdf0e10cSrcweir 		if ( !m_aETDriverClass.GetText().Len() )
605*cdf0e10cSrcweir 		{
606*cdf0e10cSrcweir 			m_aETDriverClass.SetText(m_sDefaultJdbcDriverName);
607*cdf0e10cSrcweir 			m_aETDriverClass.SetModifyFlag();
608*cdf0e10cSrcweir 		}
609*cdf0e10cSrcweir 		callModifiedHdl();
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir         sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( m_aETDriverClass.GetText().Len() != 0 ));
612*cdf0e10cSrcweir         SetRoadmapStateValue(bRoadmapState);
613*cdf0e10cSrcweir 	}
614*cdf0e10cSrcweir 
615*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
616*cdf0e10cSrcweir 	IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
617*cdf0e10cSrcweir 	{
618*cdf0e10cSrcweir 		OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
619*cdf0e10cSrcweir 
620*cdf0e10cSrcweir 		sal_Bool bSuccess = sal_False;
621*cdf0e10cSrcweir 		try
622*cdf0e10cSrcweir 		{
623*cdf0e10cSrcweir 			if ( m_aETDriverClass.GetText().Len() )
624*cdf0e10cSrcweir 			{
625*cdf0e10cSrcweir // TODO chage jvmaccess
626*cdf0e10cSrcweir 				::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_pAdminDialog->getORB());
627*cdf0e10cSrcweir 				bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aETDriverClass.GetText());
628*cdf0e10cSrcweir 			}
629*cdf0e10cSrcweir 		}
630*cdf0e10cSrcweir         catch(::com::sun::star::uno::Exception&)
631*cdf0e10cSrcweir 		{
632*cdf0e10cSrcweir 		}
633*cdf0e10cSrcweir 
634*cdf0e10cSrcweir 		sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
635*cdf0e10cSrcweir 		OSQLMessageBox aMsg( this, String( ModuleRes( nMessage ) ), String() );
636*cdf0e10cSrcweir 		aMsg.Execute();
637*cdf0e10cSrcweir 		return 0L;
638*cdf0e10cSrcweir 	}
639*cdf0e10cSrcweir 
640*cdf0e10cSrcweir     // -----------------------------------------------------------------------
641*cdf0e10cSrcweir 	IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup, OnEditModified, Edit*, _pEdit)
642*cdf0e10cSrcweir 	{
643*cdf0e10cSrcweir 		if ( _pEdit == &m_aETDriverClass )
644*cdf0e10cSrcweir 			m_aPBTestJavaDriver.Enable( m_aETDriverClass.GetText().Len() != 0 );
645*cdf0e10cSrcweir         sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( m_aETDriverClass.GetText().Len() != 0 ));
646*cdf0e10cSrcweir         SetRoadmapStateValue(bRoadmapState);
647*cdf0e10cSrcweir 		callModifiedHdl();
648*cdf0e10cSrcweir 		return 0L;
649*cdf0e10cSrcweir 	}
650*cdf0e10cSrcweir 
651*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
652*cdf0e10cSrcweir 	OGenericAdministrationPage*	OJDBCConnectionPageSetup::CreateJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
653*cdf0e10cSrcweir 	{
654*cdf0e10cSrcweir 		return ( new OJDBCConnectionPageSetup( pParent, _rAttrSet));
655*cdf0e10cSrcweir 	}
656*cdf0e10cSrcweir 
657*cdf0e10cSrcweir 
658*cdf0e10cSrcweir 	//========================================================================
659*cdf0e10cSrcweir 	//= OMySQLJDBCConnectionPageSetup
660*cdf0e10cSrcweir 	//========================================================================
661*cdf0e10cSrcweir 	OJDBCConnectionPageSetup::OJDBCConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs)
662*cdf0e10cSrcweir 		:OConnectionTabPageSetup(pParent, PAGE_DBWIZARD_JDBC, _rCoreAttrs, STR_JDBC_HELPTEXT, STR_JDBC_HEADERTEXT, STR_COMMONURL)
663*cdf0e10cSrcweir         ,m_aFTDriverClass	    (this, ModuleRes(FT_AUTOJDBCDRIVERCLASS))
664*cdf0e10cSrcweir 		,m_aETDriverClass	    (this, ModuleRes(ET_AUTOJDBCDRIVERCLASS))
665*cdf0e10cSrcweir 		,m_aPBTestJavaDriver	(this, ModuleRes(PB_AUTOTESTDRIVERCLASS))
666*cdf0e10cSrcweir 	{
667*cdf0e10cSrcweir         m_aETDriverClass.SetModifyHdl(LINK(this, OJDBCConnectionPageSetup, OnEditModified));
668*cdf0e10cSrcweir 		m_aPBTestJavaDriver.SetClickHdl(LINK(this,OJDBCConnectionPageSetup,OnTestJavaClickHdl));
669*cdf0e10cSrcweir 		FreeResource();
670*cdf0e10cSrcweir 	}
671*cdf0e10cSrcweir 
672*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
673*cdf0e10cSrcweir 	void OJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
674*cdf0e10cSrcweir 	{
675*cdf0e10cSrcweir         _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDriverClass));
676*cdf0e10cSrcweir 	}
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
679*cdf0e10cSrcweir 	void OJDBCConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
680*cdf0e10cSrcweir 	{
681*cdf0e10cSrcweir         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass));
682*cdf0e10cSrcweir 	}
683*cdf0e10cSrcweir 
684*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
685*cdf0e10cSrcweir 	sal_Bool OJDBCConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
686*cdf0e10cSrcweir 	{
687*cdf0e10cSrcweir 		sal_Bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
688*cdf0e10cSrcweir 		fillString(_rSet,&m_aETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
689*cdf0e10cSrcweir 		return bChangedSomething;
690*cdf0e10cSrcweir 	}
691*cdf0e10cSrcweir 
692*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
693*cdf0e10cSrcweir 	void OJDBCConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
694*cdf0e10cSrcweir 	{
695*cdf0e10cSrcweir 		// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
696*cdf0e10cSrcweir 		sal_Bool bValid, bReadonly;
697*cdf0e10cSrcweir 		getFlags(_rSet, bValid, bReadonly);
698*cdf0e10cSrcweir 
699*cdf0e10cSrcweir 		SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True);
700*cdf0e10cSrcweir 
701*cdf0e10cSrcweir 		if ( bValid )
702*cdf0e10cSrcweir 		{
703*cdf0e10cSrcweir             if ( !pDrvItem->GetValue().Len() )
704*cdf0e10cSrcweir             {
705*cdf0e10cSrcweir                 String sDefaultJdbcDriverName = m_pCollection->getJavaDriverClass(m_eType);
706*cdf0e10cSrcweir                 if ( sDefaultJdbcDriverName.Len() )
707*cdf0e10cSrcweir                 {
708*cdf0e10cSrcweir                     m_aETDriverClass.SetText(sDefaultJdbcDriverName);
709*cdf0e10cSrcweir 			        m_aETDriverClass.SetModifyFlag();
710*cdf0e10cSrcweir                 } // if ( sDefaultJdbcDriverName.Len() )
711*cdf0e10cSrcweir             } // if ( !pJdbcDrvItem->GetValue().Len() )
712*cdf0e10cSrcweir             else
713*cdf0e10cSrcweir             {
714*cdf0e10cSrcweir 			    m_aETDriverClass.SetText(pDrvItem->GetValue());
715*cdf0e10cSrcweir 			    m_aETDriverClass.ClearModifyFlag();
716*cdf0e10cSrcweir             }
717*cdf0e10cSrcweir 		}
718*cdf0e10cSrcweir         sal_Bool bEnable = pDrvItem->GetValue().Len() != 0;
719*cdf0e10cSrcweir         m_aPBTestJavaDriver.Enable(bEnable);
720*cdf0e10cSrcweir 		OConnectionTabPageSetup::implInitControls(_rSet, _bSaveValue);
721*cdf0e10cSrcweir 
722*cdf0e10cSrcweir         SetRoadmapStateValue(checkTestConnection());
723*cdf0e10cSrcweir     }
724*cdf0e10cSrcweir 
725*cdf0e10cSrcweir 
726*cdf0e10cSrcweir 	bool OJDBCConnectionPageSetup::checkTestConnection()
727*cdf0e10cSrcweir 	{
728*cdf0e10cSrcweir 		OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
729*cdf0e10cSrcweir 		sal_Bool bEnableTestConnection = !m_aConnectionURL.IsVisible() || (m_aConnectionURL.GetTextNoPrefix().Len() != 0);
730*cdf0e10cSrcweir 		bEnableTestConnection = bEnableTestConnection && (m_aETDriverClass.GetText().Len() != 0);
731*cdf0e10cSrcweir         return bEnableTestConnection;
732*cdf0e10cSrcweir //		m_aTestConnection.Enable(bEnableTestConnection);
733*cdf0e10cSrcweir 	}
734*cdf0e10cSrcweir 
735*cdf0e10cSrcweir 
736*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
737*cdf0e10cSrcweir 	IMPL_LINK(OJDBCConnectionPageSetup, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
738*cdf0e10cSrcweir 	{
739*cdf0e10cSrcweir 		OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
740*cdf0e10cSrcweir 		sal_Bool bSuccess = sal_False;
741*cdf0e10cSrcweir 		try
742*cdf0e10cSrcweir 		{
743*cdf0e10cSrcweir 			if ( m_aETDriverClass.GetText().Len() )
744*cdf0e10cSrcweir 			{
745*cdf0e10cSrcweir // TODO chage jvmaccess
746*cdf0e10cSrcweir 				::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_pAdminDialog->getORB());
747*cdf0e10cSrcweir 				bSuccess = xJVM.is() && ::connectivity::existsJavaClassByName(xJVM,m_aETDriverClass.GetText());
748*cdf0e10cSrcweir 			}
749*cdf0e10cSrcweir 		}
750*cdf0e10cSrcweir         catch(::com::sun::star::uno::Exception&)
751*cdf0e10cSrcweir 		{
752*cdf0e10cSrcweir 		}
753*cdf0e10cSrcweir 
754*cdf0e10cSrcweir 		sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
755*cdf0e10cSrcweir 		OSQLMessageBox aMsg( this, String( ModuleRes( nMessage ) ), String() );
756*cdf0e10cSrcweir 		aMsg.Execute();
757*cdf0e10cSrcweir 		return 0L;
758*cdf0e10cSrcweir 	}
759*cdf0e10cSrcweir 
760*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
761*cdf0e10cSrcweir 	IMPL_LINK(OJDBCConnectionPageSetup, OnEditModified, Edit*, _pEdit)
762*cdf0e10cSrcweir 	{
763*cdf0e10cSrcweir 		if ( _pEdit == &m_aETDriverClass )
764*cdf0e10cSrcweir 			m_aPBTestJavaDriver.Enable( m_aETDriverClass.GetText().Len() != 0 );
765*cdf0e10cSrcweir         SetRoadmapStateValue(checkTestConnection());
766*cdf0e10cSrcweir 		// tell the listener we were modified
767*cdf0e10cSrcweir 		callModifiedHdl();
768*cdf0e10cSrcweir 		return 0L;
769*cdf0e10cSrcweir 	}
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir 
772*cdf0e10cSrcweir 	OGenericAdministrationPage*	OSpreadSheetConnectionPageSetup::CreateSpreadSheetTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
773*cdf0e10cSrcweir     {
774*cdf0e10cSrcweir         return ( new OSpreadSheetConnectionPageSetup( pParent, _rAttrSet ) );
775*cdf0e10cSrcweir     }
776*cdf0e10cSrcweir 
777*cdf0e10cSrcweir DBG_NAME(OSpreadSheetConnectionPageSetup)
778*cdf0e10cSrcweir 
779*cdf0e10cSrcweir 	OSpreadSheetConnectionPageSetup::OSpreadSheetConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
780*cdf0e10cSrcweir 		:OConnectionTabPageSetup(pParent, PAGE_DBWIZARD_SPREADSHEET, _rCoreAttrs, STR_SPREADSHEET_HELPTEXT, STR_SPREADSHEET_HEADERTEXT, STR_SPREADSHEETPATH)
781*cdf0e10cSrcweir             , m_aCBPasswordrequired(this, ModuleRes(CB_SPREADSHEETPASSWORDREQUIRED))
782*cdf0e10cSrcweir     {
783*cdf0e10cSrcweir         DBG_CTOR(OSpreadSheetConnectionPageSetup,NULL);
784*cdf0e10cSrcweir 
785*cdf0e10cSrcweir    		m_aCBPasswordrequired.SetToggleHdl(getControlModifiedLink());
786*cdf0e10cSrcweir 		FreeResource();
787*cdf0e10cSrcweir 	}
788*cdf0e10cSrcweir 
789*cdf0e10cSrcweir 
790*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
791*cdf0e10cSrcweir 	OSpreadSheetConnectionPageSetup::~OSpreadSheetConnectionPageSetup()
792*cdf0e10cSrcweir 	{
793*cdf0e10cSrcweir 
794*cdf0e10cSrcweir         DBG_DTOR(OSpreadSheetConnectionPageSetup,NULL);
795*cdf0e10cSrcweir     }
796*cdf0e10cSrcweir 
797*cdf0e10cSrcweir 
798*cdf0e10cSrcweir 	void OSpreadSheetConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
799*cdf0e10cSrcweir 	{
800*cdf0e10cSrcweir 	}
801*cdf0e10cSrcweir 
802*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
803*cdf0e10cSrcweir 	void OSpreadSheetConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
804*cdf0e10cSrcweir 	{
805*cdf0e10cSrcweir         OConnectionTabPageSetup::fillControls(_rControlList);
806*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBPasswordrequired));
807*cdf0e10cSrcweir 
808*cdf0e10cSrcweir     }
809*cdf0e10cSrcweir 
810*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
811*cdf0e10cSrcweir 	void OSpreadSheetConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
812*cdf0e10cSrcweir 	{
813*cdf0e10cSrcweir         OConnectionTabPageSetup::implInitControls(_rSet, _bSaveValue);
814*cdf0e10cSrcweir 	}
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
817*cdf0e10cSrcweir 	sal_Bool OSpreadSheetConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
818*cdf0e10cSrcweir 	{
819*cdf0e10cSrcweir         sal_Bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
820*cdf0e10cSrcweir 		fillBool(_rSet,&m_aCBPasswordrequired,DSID_PASSWORDREQUIRED,bChangedSomething);
821*cdf0e10cSrcweir         return bChangedSomething;
822*cdf0e10cSrcweir 	}
823*cdf0e10cSrcweir 
824*cdf0e10cSrcweir 	OGenericAdministrationPage*	OAuthentificationPageSetup::CreateAuthentificationTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
825*cdf0e10cSrcweir     {
826*cdf0e10cSrcweir         return ( new OAuthentificationPageSetup( pParent, _rAttrSet) );
827*cdf0e10cSrcweir     }
828*cdf0e10cSrcweir 
829*cdf0e10cSrcweir DBG_NAME(OAuthentificationPageSetup)
830*cdf0e10cSrcweir 
831*cdf0e10cSrcweir 	OAuthentificationPageSetup::OAuthentificationPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
832*cdf0e10cSrcweir         :OGenericAdministrationPage(pParent, ModuleRes(PAGE_DBWIZARD_AUTHENTIFICATION), _rCoreAttrs )
833*cdf0e10cSrcweir         , m_aFTHelpText             (this, ModuleRes(FT_AUTHENTIFICATIONHELPTEXT))
834*cdf0e10cSrcweir         , m_aFTHeaderText           (this, ModuleRes(FT_AUTHENTIFICATIONHEADERTEXT))
835*cdf0e10cSrcweir 		, m_aFTUserName             (this, ModuleRes(FT_GENERALUSERNAME))
836*cdf0e10cSrcweir 		, m_aETUserName             (this, ModuleRes(ET_GENERALUSERNAME))
837*cdf0e10cSrcweir 		, m_aCBPasswordRequired     (this, ModuleRes(CB_GENERALPASSWORDREQUIRED))
838*cdf0e10cSrcweir         , m_aPBTestConnection       (this, ModuleRes(PB_TESTCONNECTION))
839*cdf0e10cSrcweir     {
840*cdf0e10cSrcweir         DBG_CTOR(OAuthentificationPageSetup,NULL);
841*cdf0e10cSrcweir 
842*cdf0e10cSrcweir         SetControlFontWeight(&m_aFTHeaderText);
843*cdf0e10cSrcweir 		m_aETUserName.SetModifyHdl(getControlModifiedLink());
844*cdf0e10cSrcweir 		m_aCBPasswordRequired.SetClickHdl(getControlModifiedLink());
845*cdf0e10cSrcweir    		m_aPBTestConnection.SetClickHdl(LINK(this,OGenericAdministrationPage,OnTestConnectionClickHdl));
846*cdf0e10cSrcweir 		FreeResource();
847*cdf0e10cSrcweir 
848*cdf0e10cSrcweir         LayoutHelper::fitSizeRightAligned( m_aPBTestConnection );
849*cdf0e10cSrcweir 	}
850*cdf0e10cSrcweir 
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
853*cdf0e10cSrcweir 	OAuthentificationPageSetup::~OAuthentificationPageSetup()
854*cdf0e10cSrcweir 	{
855*cdf0e10cSrcweir 
856*cdf0e10cSrcweir         DBG_DTOR(OAuthentificationPageSetup,NULL);
857*cdf0e10cSrcweir     }
858*cdf0e10cSrcweir 
859*cdf0e10cSrcweir 
860*cdf0e10cSrcweir 	void OAuthentificationPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
861*cdf0e10cSrcweir 	{
862*cdf0e10cSrcweir         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHelpText));
863*cdf0e10cSrcweir         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTUserName));
864*cdf0e10cSrcweir 		_rControlList.push_back(new ODisableWrapper<PushButton>(&m_aPBTestConnection));
865*cdf0e10cSrcweir 	}
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
868*cdf0e10cSrcweir 	void OAuthentificationPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
869*cdf0e10cSrcweir 	{
870*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETUserName));
871*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBPasswordRequired));
872*cdf0e10cSrcweir     }
873*cdf0e10cSrcweir 
874*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
875*cdf0e10cSrcweir 	void OAuthentificationPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bSaveValue*/)
876*cdf0e10cSrcweir 	{
877*cdf0e10cSrcweir         // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
878*cdf0e10cSrcweir 		sal_Bool bValid, bReadonly;
879*cdf0e10cSrcweir 		getFlags(_rSet, bValid, bReadonly);
880*cdf0e10cSrcweir         SFX_ITEMSET_GET(_rSet, pUidItem, SfxStringItem, DSID_USER, sal_True);
881*cdf0e10cSrcweir         SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True);
882*cdf0e10cSrcweir 
883*cdf0e10cSrcweir         m_aETUserName.SetText(pUidItem->GetValue());
884*cdf0e10cSrcweir 	    m_aCBPasswordRequired.Check(pAllowEmptyPwd->GetValue());
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir         m_aETUserName.ClearModifyFlag();
887*cdf0e10cSrcweir 	}
888*cdf0e10cSrcweir 
889*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
890*cdf0e10cSrcweir 	sal_Bool OAuthentificationPageSetup::FillItemSet( SfxItemSet& _rSet )
891*cdf0e10cSrcweir 	{
892*cdf0e10cSrcweir 		sal_Bool bChangedSomething = sal_False;
893*cdf0e10cSrcweir 
894*cdf0e10cSrcweir 		if (m_aETUserName.GetText() != m_aETUserName.GetSavedValue())
895*cdf0e10cSrcweir 		{
896*cdf0e10cSrcweir 			_rSet.Put(SfxStringItem(DSID_USER, m_aETUserName.GetText()));
897*cdf0e10cSrcweir 			_rSet.Put(SfxStringItem(DSID_PASSWORD, String()));
898*cdf0e10cSrcweir 			bChangedSomething = sal_True;
899*cdf0e10cSrcweir 		}
900*cdf0e10cSrcweir 		fillBool(_rSet,&m_aCBPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething);
901*cdf0e10cSrcweir         return bChangedSomething;
902*cdf0e10cSrcweir 	}
903*cdf0e10cSrcweir 
904*cdf0e10cSrcweir 
905*cdf0e10cSrcweir 	OGenericAdministrationPage*	OFinalDBPageSetup::CreateFinalDBTabPageSetup( Window* pParent, const SfxItemSet& _rAttrSet)
906*cdf0e10cSrcweir     {
907*cdf0e10cSrcweir         return ( new OFinalDBPageSetup( pParent, _rAttrSet) );
908*cdf0e10cSrcweir     }
909*cdf0e10cSrcweir 
910*cdf0e10cSrcweir DBG_NAME(OFinalDBPageSetup)
911*cdf0e10cSrcweir 
912*cdf0e10cSrcweir 	OFinalDBPageSetup::OFinalDBPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
913*cdf0e10cSrcweir     :OGenericAdministrationPage(pParent, ModuleRes(PAGE_DBWIZARD_FINAL), _rCoreAttrs )
914*cdf0e10cSrcweir     , m_aFTFinalHeader              (this, ModuleRes(FT_FINALHEADER))
915*cdf0e10cSrcweir     , m_aFTFinalHelpText            (this, ModuleRes(FT_FINALHELPTEXT))
916*cdf0e10cSrcweir     , m_aRBRegisterDataSource       (this, ModuleRes(RB_REGISTERDATASOURCE))
917*cdf0e10cSrcweir     , m_aRBDontregisterDataSource   (this, ModuleRes(RB_DONTREGISTERDATASOURCE))
918*cdf0e10cSrcweir     , m_aFTAdditionalSettings       (this, ModuleRes(FT_ADDITIONALSETTINGS))
919*cdf0e10cSrcweir     , m_aCBOpenAfterwards           (this, ModuleRes(CB_OPENAFTERWARDS))
920*cdf0e10cSrcweir     , m_aCBStartTableWizard         (this, ModuleRes(CB_STARTTABLEWIZARD))
921*cdf0e10cSrcweir     , m_aFTFinalText                (this, ModuleRes(FT_FINALTEXT))
922*cdf0e10cSrcweir     {
923*cdf0e10cSrcweir         DBG_CTOR(OFinalDBPageSetup,NULL);
924*cdf0e10cSrcweir 
925*cdf0e10cSrcweir         String stext = m_aFTFinalHeader.GetText();
926*cdf0e10cSrcweir         SetControlFontWeight(&m_aFTFinalHeader);
927*cdf0e10cSrcweir 		m_aCBOpenAfterwards.SetClickHdl(LINK(this, OFinalDBPageSetup, OnOpenSelected));
928*cdf0e10cSrcweir 		m_aCBStartTableWizard.SetClickHdl(getControlModifiedLink());
929*cdf0e10cSrcweir 		m_aRBRegisterDataSource.SetState(sal_True);
930*cdf0e10cSrcweir         FreeResource();
931*cdf0e10cSrcweir 
932*cdf0e10cSrcweir         sal_Int32 nUnrelatedHeight  = LogicToPixel( Size( 0, UNRELATED_CONTROLS ), MAP_APPFONT ).Height();
933*cdf0e10cSrcweir         sal_Int32 nRelatedHeight    = LogicToPixel( Size( 0, RELATED_CONTROLS ), MAP_APPFONT ).Height();
934*cdf0e10cSrcweir 
935*cdf0e10cSrcweir         ::std::pair<Window*,sal_Int32> pWindows[] = {
936*cdf0e10cSrcweir             ::std::pair<Window*,sal_Int32>(&m_aFTFinalHelpText,nRelatedHeight)
937*cdf0e10cSrcweir             ,::std::pair<Window*,sal_Int32>(&m_aRBRegisterDataSource,nRelatedHeight)
938*cdf0e10cSrcweir             ,::std::pair<Window*,sal_Int32>(&m_aRBDontregisterDataSource,nUnrelatedHeight)
939*cdf0e10cSrcweir             ,::std::pair<Window*,sal_Int32>(&m_aFTAdditionalSettings,nRelatedHeight)
940*cdf0e10cSrcweir             ,::std::pair<Window*,sal_Int32>(&m_aCBOpenAfterwards,nRelatedHeight)
941*cdf0e10cSrcweir             ,::std::pair<Window*,sal_Int32>(&m_aCBStartTableWizard,nUnrelatedHeight)
942*cdf0e10cSrcweir             ,::std::pair<Window*,sal_Int32>(&m_aFTFinalText,nUnrelatedHeight)
943*cdf0e10cSrcweir         };
944*cdf0e10cSrcweir 
945*cdf0e10cSrcweir         Point aPos(m_aFTFinalHeader.GetPosPixel());
946*cdf0e10cSrcweir         Size aStart(m_aFTFinalHeader.GetSizePixel());
947*cdf0e10cSrcweir         aPos.Y() += aStart.Height() + nUnrelatedHeight;
948*cdf0e10cSrcweir 		sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
949*cdf0e10cSrcweir 		for (sal_Int32 i=0; i < nCount; ++i)
950*cdf0e10cSrcweir 		{
951*cdf0e10cSrcweir             aPos.X() = pWindows[i].first->GetPosPixel().X();
952*cdf0e10cSrcweir             Size aSize = pWindows[i].first->GetSizePixel();
953*cdf0e10cSrcweir             FixedText* pText = dynamic_cast<FixedText*>(pWindows[i].first);
954*cdf0e10cSrcweir             if ( pText )
955*cdf0e10cSrcweir                 aSize = pText->CalcMinimumSize(aSize.Width());
956*cdf0e10cSrcweir             pWindows[i].first->SetPosSizePixel(aPos,aSize);
957*cdf0e10cSrcweir             aPos.Y() += aSize.Height() + pWindows[i].second;
958*cdf0e10cSrcweir         }
959*cdf0e10cSrcweir 	}
960*cdf0e10cSrcweir 
961*cdf0e10cSrcweir 
962*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
963*cdf0e10cSrcweir 	OFinalDBPageSetup::~OFinalDBPageSetup()
964*cdf0e10cSrcweir 	{
965*cdf0e10cSrcweir 
966*cdf0e10cSrcweir         DBG_DTOR(OFinalDBPageSetup,NULL);
967*cdf0e10cSrcweir     }
968*cdf0e10cSrcweir 
969*cdf0e10cSrcweir     sal_Bool OFinalDBPageSetup::IsDatabaseDocumentToBeRegistered()
970*cdf0e10cSrcweir     {
971*cdf0e10cSrcweir         return m_aRBRegisterDataSource.IsChecked() && m_aRBRegisterDataSource.IsEnabled();
972*cdf0e10cSrcweir     }
973*cdf0e10cSrcweir 
974*cdf0e10cSrcweir     sal_Bool OFinalDBPageSetup::IsDatabaseDocumentToBeOpened()
975*cdf0e10cSrcweir     {
976*cdf0e10cSrcweir         return m_aCBOpenAfterwards.IsChecked() && m_aCBOpenAfterwards.IsEnabled();
977*cdf0e10cSrcweir     }
978*cdf0e10cSrcweir 
979*cdf0e10cSrcweir     sal_Bool OFinalDBPageSetup::IsTableWizardToBeStarted()
980*cdf0e10cSrcweir     {
981*cdf0e10cSrcweir         return m_aCBStartTableWizard.IsChecked() && m_aCBStartTableWizard.IsEnabled();
982*cdf0e10cSrcweir     }
983*cdf0e10cSrcweir 
984*cdf0e10cSrcweir 
985*cdf0e10cSrcweir 	void OFinalDBPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
986*cdf0e10cSrcweir 	{
987*cdf0e10cSrcweir         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTFinalHeader));
988*cdf0e10cSrcweir         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTFinalHelpText));
989*cdf0e10cSrcweir         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTAdditionalSettings));
990*cdf0e10cSrcweir         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTFinalText));
991*cdf0e10cSrcweir     }
992*cdf0e10cSrcweir 
993*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
994*cdf0e10cSrcweir 	void OFinalDBPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
995*cdf0e10cSrcweir 	{
996*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBOpenAfterwards));
997*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBStartTableWizard));
998*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<RadioButton>(&m_aRBRegisterDataSource));
999*cdf0e10cSrcweir 		_rControlList.push_back(new OSaveValueWrapper<RadioButton>(&m_aRBDontregisterDataSource));
1000*cdf0e10cSrcweir     }
1001*cdf0e10cSrcweir 
1002*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
1003*cdf0e10cSrcweir 	void OFinalDBPageSetup::implInitControls(const SfxItemSet& /*_rSet*/, sal_Bool /*_bSaveValue*/)
1004*cdf0e10cSrcweir 	{
1005*cdf0e10cSrcweir         m_aCBOpenAfterwards.Check();
1006*cdf0e10cSrcweir 	}
1007*cdf0e10cSrcweir 
1008*cdf0e10cSrcweir     void OFinalDBPageSetup::enableTableWizardCheckBox( sal_Bool _bSupportsTableCreation)
1009*cdf0e10cSrcweir     {
1010*cdf0e10cSrcweir         m_aCBStartTableWizard.Enable(_bSupportsTableCreation);
1011*cdf0e10cSrcweir     }
1012*cdf0e10cSrcweir 
1013*cdf0e10cSrcweir 	// -----------------------------------------------------------------------
1014*cdf0e10cSrcweir 	sal_Bool OFinalDBPageSetup::FillItemSet( SfxItemSet& /*_rSet*/ )
1015*cdf0e10cSrcweir 	{
1016*cdf0e10cSrcweir         return sal_True;
1017*cdf0e10cSrcweir 	}
1018*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
1019*cdf0e10cSrcweir 	IMPL_LINK(OFinalDBPageSetup, OnOpenSelected, CheckBox*, _pBox)
1020*cdf0e10cSrcweir     {
1021*cdf0e10cSrcweir 		m_aCBStartTableWizard.Enable( _pBox->IsEnabled() && _pBox->IsChecked() );
1022*cdf0e10cSrcweir 		callModifiedHdl();
1023*cdf0e10cSrcweir 		// outta here
1024*cdf0e10cSrcweir 		return 0L;
1025*cdf0e10cSrcweir 	}
1026*cdf0e10cSrcweir //.........................................................................
1027*cdf0e10cSrcweir }
1028*cdf0e10cSrcweir // namespace dbaui
1029*cdf0e10cSrcweir //.........................................................................
1030