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