Update ooo320-m1
[ooovba.git] / dbaccess / source / ui / dlg / DBSetupConnectionPages.cxx
blob438c498d1a71a009f68b9ccde81808958afa7246
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DBSetupConnectionPages.cxx,v $
10 * $Revision: 1.19.18.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
33 #ifndef DBAUI_DBSETUPCONNECTIONPAGES_HXX
34 #include "DBSetupConnectionPages.hxx"
35 #endif
36 #ifndef _DBAUI_SQLMESSAGE_HXX_
37 #include "sqlmessage.hxx"
38 #endif
39 #ifndef _DBU_RESOURCE_HRC_
40 #include "dbu_resource.hrc"
41 #endif
42 #ifndef _DBAUI_AUTOCONTROLS_HRC_
43 #include "AutoControls.hrc"
44 #endif
45 #ifndef _DBAUI_DBADMINSETUP_HRC_
46 #include "dbadminsetup.hrc"
47 #endif
48 #ifndef _SFXITEMSET_HXX
49 #include <svtools/itemset.hxx>
50 #endif
51 #ifndef _SFXSTRITEM_HXX
52 #include <svtools/stritem.hxx>
53 #endif
54 #ifndef _SFXENUMITEM_HXX
55 #include <svtools/eitem.hxx>
56 #endif
57 #ifndef _SFXINTITEM_HXX
58 #include <svtools/intitem.hxx>
59 #endif
60 #ifndef _DBAUI_DATASOURCEITEMS_HXX_
61 #include "dsitems.hxx"
62 #endif
63 #include "dsnItem.hxx"
64 #ifndef _DBA_DBACCESS_HELPID_HRC_
65 #include "dbaccess_helpid.hrc"
66 #endif
67 #ifndef _DBAUI_LOCALRESACCESS_HXX_
68 #include "localresaccess.hxx"
69 #endif
70 #ifndef _SV_MSGBOX_HXX
71 #include <vcl/msgbox.hxx>
72 #endif
73 #ifndef _SV_MNEMONIC_HXX
74 #include <vcl/mnemonic.hxx>
75 #endif
76 #ifndef _SVTOOLS_CJKOPTIONS_HXX
77 #include <svtools/cjkoptions.hxx>
78 #endif
79 #include <jvmaccess/virtualmachine.hxx>
80 #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
81 #include <connectivity/CommonTools.hxx>
82 #endif
83 #ifndef DBAUI_DRIVERSETTINGS_HXX
84 #include "DriverSettings.hxx"
85 #endif
86 #ifndef _DBAUI_DBADMIN_HXX_
87 #include "dbadmin.hxx"
88 #endif
89 #ifndef _COMPHELPER_TYPES_HXX_
90 #include <comphelper/types.hxx>
91 #endif
93 #ifndef _COM_SUN_STAR_UI_DIALOGS_XFOLDERPICKER_HPP_
94 #include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
95 #endif
96 // #106016# ------------------------------------
97 #ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
98 #include <com/sun/star/task/XInteractionHandler.hpp>
99 #endif
100 #include <com/sun/star/sdbc/XDriverAccess.hpp>
101 #include "dbustrings.hrc"
102 #ifndef SVTOOLS_FILENOTATION_HXX_
103 #include <svtools/filenotation.hxx>
104 #endif
106 #include <unotools/localfilehelper.hxx>
107 #include <unotools/ucbhelper.hxx>
108 #include <ucbhelper/commandenvironment.hxx>
109 #include "finteraction.hxx"
110 #include <connectivity/CommonTools.hxx>
111 #include "dbaccess_helpid.hrc"
112 #include <svtools/pathoptions.hxx>
113 #include <svtools/roadmapwizard.hxx>
114 #include "TextConnectionHelper.hxx"
117 //.........................................................................
118 namespace dbaui
120 //.........................................................................
121 using namespace ::com::sun::star;
122 // using namespace ::com::sun::star::ucb;
123 // using namespace ::com::sun::star::ui::dialogs;
124 // using namespace ::com::sun::star::sdbc;
125 // using namespace ::com::sun::star::beans;
126 // using namespace ::com::sun::star::lang;
127 // using namespace ::com::sun::star::container;
128 // using namespace ::dbtools;
129 // using namespace ::svt;
131 OGenericAdministrationPage* OTextConnectionPageSetup::CreateTextTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
133 return ( new OTextConnectionPageSetup( pParent, _rAttrSet ) );
137 //========================================================================
138 //= OTextConnectionPageSetup
139 //========================================================================
140 DBG_NAME(OTextConnectionPageSetup)
141 //------------------------------------------------------------------------
142 OTextConnectionPageSetup::OTextConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
143 :OConnectionTabPageSetup(pParent, PAGE_DBWIZARD_TEXT, _rCoreAttrs, STR_TEXT_HELPTEXT, STR_TEXT_HEADERTEXT, STR_TEXT_PATH_OR_FILE)
145 DBG_CTOR(OTextConnectionPageSetup,NULL);
147 m_pTextConnectionHelper = new OTextConnectionHelper( this, TC_EXTENSION | TC_SEPARATORS );
148 m_pTextConnectionHelper->SetClickHandler(LINK( this, OTextConnectionPageSetup, ImplGetExtensionHdl ) );
150 FreeResource();
154 // -----------------------------------------------------------------------
155 OTextConnectionPageSetup::~OTextConnectionPageSetup()
157 DELETEZ(m_pTextConnectionHelper);
159 DBG_DTOR(OTextConnectionPageSetup,NULL);
162 IMPL_LINK(OTextConnectionPageSetup, ImplGetExtensionHdl, OTextConnectionHelper*, /*_pTextConnectionHelper*/)
164 SetRoadmapStateValue((m_pTextConnectionHelper->GetExtension().Len() > 0) && OConnectionTabPageSetup::checkTestConnection());
165 callModifiedHdl();
166 return sal_True;
170 bool OTextConnectionPageSetup::checkTestConnection()
172 bool bDoEnable = OConnectionTabPageSetup::checkTestConnection();
173 bDoEnable = (m_pTextConnectionHelper->GetExtension().Len() > 0) && bDoEnable;
174 return bDoEnable;
177 // -----------------------------------------------------------------------
178 void OTextConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
180 OConnectionTabPageSetup::fillControls(_rControlList);
181 m_pTextConnectionHelper->fillControls(_rControlList);
183 // -----------------------------------------------------------------------
184 void OTextConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
186 OConnectionTabPageSetup::fillWindows(_rControlList);
187 m_pTextConnectionHelper->fillWindows(_rControlList);
189 // -----------------------------------------------------------------------
190 void OTextConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
192 // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
193 sal_Bool bValid, bReadonly;
194 getFlags(_rSet, bValid, bReadonly);
195 OConnectionTabPageSetup::implInitControls( _rSet, _bSaveValue);
196 m_pTextConnectionHelper->implInitControls(_rSet, bValid);
200 // -----------------------------------------------------------------------
201 sal_Bool OTextConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
203 sal_Bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
204 bChangedSomething = m_pTextConnectionHelper->FillItemSet(_rSet, bChangedSomething);
205 return bChangedSomething;
209 sal_Bool OTextConnectionPageSetup::prepareLeave(){
210 return m_pTextConnectionHelper->prepareLeave();
214 OGenericAdministrationPage* OLDAPConnectionPageSetup::CreateLDAPTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
216 return ( new OLDAPConnectionPageSetup( pParent, _rAttrSet ) );
220 //========================================================================
221 //= OLDAPPageSetup
222 //========================================================================
223 OLDAPConnectionPageSetup::OLDAPConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
224 :OGenericAdministrationPage(pParent, ModuleRes(PAGE_DBWIZARD_LDAP), _rCoreAttrs)
225 ,m_aFTHeaderText (this, ModuleRes(FT_LDAP_HEADERTEXT))
226 ,m_aFTHelpText (this, ModuleRes(FT_LDAP_HELPTEXT))
227 ,m_aFTHostServer (this, ModuleRes(FT_AUTOHOSTNAME))
228 ,m_aETHostServer (this, ModuleRes(ET_AUTOHOSTNAME))
229 ,m_aFTBaseDN (this, ModuleRes(FT_AUTOBASEDN))
230 ,m_aETBaseDN (this, ModuleRes(ET_AUTOBASEDN))
231 ,m_aFTPortNumber (this, ModuleRes(FT_AUTOPORTNUMBER))
232 ,m_aNFPortNumber (this, ModuleRes(NF_AUTOPORTNUMBER))
233 ,m_aFTDefaultPortNumber (this, ModuleRes(FT_AUTOPORTNUMBERDEFAULT))
234 ,m_aCBUseSSL (this, ModuleRes(CB_WIZ_USESSL))
236 SetControlFontWeight(&m_aFTHeaderText);
237 m_aFTDefaultPortNumber.SetText(String(ModuleRes(STR_LDAP_DEFAULT)));
238 m_aETHostServer.SetModifyHdl(getControlModifiedLink());
239 m_aETBaseDN.SetModifyHdl(getControlModifiedLink());
240 m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
241 m_aCBUseSSL.SetToggleHdl(getControlModifiedLink());
242 SetRoadmapStateValue(sal_False);
243 FreeResource();
246 // -----------------------------------------------------------------------
247 sal_Bool OLDAPConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
249 sal_Bool bChangedSomething = sal_False;
250 fillString(_rSet,&m_aETBaseDN,DSID_CONN_LDAP_BASEDN, bChangedSomething);
251 fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
253 if ( m_aETHostServer.GetText() != m_aETHostServer.GetSavedValue() )
255 DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION));
256 ::dbaccess::ODsnTypeCollection* pCollection = NULL;
257 if (pCollectionItem)
258 pCollection = pCollectionItem->getCollection();
259 DBG_ASSERT(pCollection, "OLDAPConnectionPageSetup::FillItemSet : really need a DSN type collection !");
261 String sUrl = pCollection->getPrefix( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:ldap:")));
262 sUrl += m_aETHostServer.GetText();
263 _rSet.Put(SfxStringItem(DSID_CONNECTURL, sUrl));
264 bChangedSomething = sal_True;
267 // fillString(_rSet,&m_aETHostServer, DSID_CONNECTURL, bChangedSomething);
268 fillBool(_rSet,&m_aCBUseSSL,DSID_CONN_LDAP_USESSL,bChangedSomething);
269 return bChangedSomething;
271 // -----------------------------------------------------------------------
272 void OLDAPConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
274 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETHostServer));
275 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETBaseDN));
276 _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
277 _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBUseSSL));
279 // -----------------------------------------------------------------------
280 void OLDAPConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
282 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHelpText));
283 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostServer));
284 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTBaseDN));
285 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTPortNumber));
286 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDefaultPortNumber));
288 // -----------------------------------------------------------------------
289 void OLDAPConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
291 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
292 sal_Bool bValid, bReadonly;
293 getFlags(_rSet, bValid, bReadonly);
296 SFX_ITEMSET_GET(_rSet, pBaseDN, SfxStringItem, DSID_CONN_LDAP_BASEDN, sal_True);
297 SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_LDAP_PORTNUMBER, sal_True);
299 if ( bValid )
301 m_aETBaseDN.SetText(pBaseDN->GetValue());
302 m_aNFPortNumber.SetValue(pPortNumber->GetValue());
304 OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
305 callModifiedHdl();
308 // -----------------------------------------------------------------------
309 IMPL_LINK(OLDAPConnectionPageSetup, OnEditModified, Edit*, /*_pEdit*/)
311 sal_Bool bRoadmapState = ((m_aETHostServer.GetText().Len() != 0 ) && ( m_aETBaseDN.GetText().Len() != 0 ) && (m_aFTPortNumber.GetText().Len() != 0 ));
312 SetRoadmapStateValue(bRoadmapState);
313 callModifiedHdl();
314 return 0L;
318 // ----------------------------------------------------------------------- //OGenericAdministrationPage*
319 OMySQLIntroPageSetup* OMySQLIntroPageSetup::CreateMySQLIntroTabPage( Window* _pParent, const SfxItemSet& _rAttrSet )
321 return ( new OMySQLIntroPageSetup( _pParent, _rAttrSet) );
324 DBG_NAME(OMySQLIntroPageSetup)
326 OMySQLIntroPageSetup::OMySQLIntroPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
327 :OGenericAdministrationPage(pParent, ModuleRes(PAGE_DBWIZARD_MYSQL_INTRO), _rCoreAttrs)
328 ,m_aRB_ODBCDatabase(this, ModuleRes(RB_CONNECTVIAODBC))
329 ,m_aRB_JDBCDatabase(this, ModuleRes(RB_CONNECTVIAJDBC))
330 ,m_aRB_NATIVEDatabase(this, ModuleRes(RB_CONNECTVIANATIVE))
331 ,m_aFT_ConnectionMode(this, ModuleRes(FT_MYSQLCONNECTIONMODE))
332 ,m_aFT_Helptext(this, ModuleRes(FT_MYSQL_HELPTEXT))
333 ,m_aFT_Headertext(this, ModuleRes(FT_MYSQL_HEADERTEXT))
335 DBG_CTOR(OMySQLIntroPageSetup,NULL);
337 SetControlFontWeight(&m_aFT_Headertext);
338 m_aRB_ODBCDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
339 m_aRB_JDBCDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
340 m_aRB_NATIVEDatabase.SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
341 FreeResource();
344 IMPL_LINK(OMySQLIntroPageSetup, OnSetupModeSelected, RadioButton*, /*_pBox*/)
346 maClickHdl.Call( this );
347 return true;
350 // -----------------------------------------------------------------------
351 OMySQLIntroPageSetup::~OMySQLIntroPageSetup()
354 DBG_DTOR(OMySQLIntroPageSetup,NULL);
358 // -----------------------------------------------------------------------
359 void OMySQLIntroPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bSaveValue*/)
361 // show the "Connect directly" option only if the driver is installed
362 DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION));
363 bool bHasMySQLNative = ( pCollectionItem != NULL ) && pCollectionItem->getCollection()->hasDriver( "sdbc:mysqlc:" );
364 if ( bHasMySQLNative )
365 m_aRB_NATIVEDatabase.Show();
367 // if any of the options is checked, then there's nothing to do
368 if ( m_aRB_ODBCDatabase.IsChecked() || m_aRB_JDBCDatabase.IsChecked() || m_aRB_NATIVEDatabase.IsChecked() )
369 return;
371 // prefer "native" or "JDBC"
372 if ( bHasMySQLNative )
373 m_aRB_NATIVEDatabase.Check();
374 else
375 m_aRB_JDBCDatabase.Check();
379 // -----------------------------------------------------------------------
380 void OMySQLIntroPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
384 // -----------------------------------------------------------------------
385 void OMySQLIntroPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
390 // -----------------------------------------------------------------------
391 BOOL OMySQLIntroPageSetup::FillItemSet(SfxItemSet& /*_rSet*/)
393 OSL_ENSURE(sal_False,"Who called me?! Please ask oj for more information.");
394 return sal_True;
398 OMySQLIntroPageSetup::ConnectionType OMySQLIntroPageSetup::getMySQLMode()
400 if (m_aRB_JDBCDatabase.IsChecked())
401 return VIA_JDBC;
402 else if (m_aRB_NATIVEDatabase.IsChecked())
403 return VIA_NATIVE;
404 else
405 return VIA_ODBC;
408 // =======================================================================
409 // = MySQLNativeSetupPage
410 // =======================================================================
411 // -----------------------------------------------------------------------
412 MySQLNativeSetupPage::MySQLNativeSetupPage( Window* _pParent, const SfxItemSet& _rCoreAttrs )
413 :OGenericAdministrationPage( _pParent, ModuleRes( PAGE_DBWIZARD_MYSQL_NATIVE ), _rCoreAttrs )
414 ,m_aHeader ( this, ModuleRes( FT_SETUP_WIZARD_HEADER ) )
415 ,m_aHelpText ( this, ModuleRes( FT_SETUP_WIZARD_HELP ) )
416 ,m_aMySQLSettings ( *this, getControlModifiedLink() )
418 SetControlFontWeight( &m_aHeader );
420 LayoutHelper::positionBelow( m_aHelpText, m_aMySQLSettings, UnrelatedControls, 0 );
421 m_aMySQLSettings.Show();
423 SetRoadmapStateValue(sal_False);
424 FreeResource();
427 // -----------------------------------------------------------------------
428 OGenericAdministrationPage* MySQLNativeSetupPage::Create( Window* pParent, const SfxItemSet& _rAttrSet )
430 return new MySQLNativeSetupPage( pParent, _rAttrSet );
433 // -----------------------------------------------------------------------
434 void MySQLNativeSetupPage::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList )
436 m_aMySQLSettings.fillControls( _rControlList );
439 // -----------------------------------------------------------------------
440 void MySQLNativeSetupPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
442 _rControlList.push_back( new ODisableWrapper< FixedText >( &m_aHelpText ) );
443 m_aMySQLSettings.fillWindows( _rControlList );
446 // -----------------------------------------------------------------------
447 sal_Bool MySQLNativeSetupPage::FillItemSet( SfxItemSet& _rSet )
449 return m_aMySQLSettings.FillItemSet( _rSet );
452 // -----------------------------------------------------------------------
453 void MySQLNativeSetupPage::implInitControls( const SfxItemSet& _rSet, sal_Bool _bSaveValue )
455 m_aMySQLSettings.implInitControls( _rSet );
457 OGenericAdministrationPage::implInitControls( _rSet, _bSaveValue );
459 OnModified( NULL );
462 // -----------------------------------------------------------------------
463 Link MySQLNativeSetupPage::getControlModifiedLink()
465 return LINK( this, MySQLNativeSetupPage, OnModified );
468 // -----------------------------------------------------------------------
469 IMPL_LINK( MySQLNativeSetupPage, OnModified, Edit*, _pEdit )
471 SetRoadmapStateValue( m_aMySQLSettings.canAdvance() );
473 return OGenericAdministrationPage::getControlModifiedLink().Call( _pEdit );
476 //========================================================================
477 //= OMySQLJDBCConnectionPageSetup
478 //========================================================================
479 OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( Window* pParent,USHORT _nResId, const SfxItemSet& _rCoreAttrs ,USHORT _nPortId, USHORT _nDefaultPortResId, USHORT _nHelpTextResId, USHORT _nHeaderTextResId, USHORT _nDriverClassId)
480 :OGenericAdministrationPage(pParent, ModuleRes(_nResId), _rCoreAttrs)
481 ,m_aFTHelpText (this, ModuleRes(FT_AUTOWIZARDHELPTEXT))
482 ,m_aFTDatabasename (this, ModuleRes(FT_AUTODATABASENAME))
483 ,m_aETDatabasename (this, ModuleRes(ET_AUTODATABASENAME))
484 ,m_aFTHostname (this, ModuleRes(FT_AUTOHOSTNAME))
485 ,m_aETHostname (this, ModuleRes(ET_AUTOHOSTNAME))
486 ,m_aFTPortNumber (this, ModuleRes(FT_AUTOPORTNUMBER))
487 ,m_aFTDefaultPortNumber (this, ModuleRes(FT_AUTOPORTNUMBERDEFAULT))
488 ,m_aNFPortNumber (this, ModuleRes(NF_AUTOPORTNUMBER))
489 ,m_aFTDriverClass (this, ModuleRes(FT_AUTOJDBCDRIVERCLASS))
490 ,m_aETDriverClass (this, ModuleRes(ET_AUTOJDBCDRIVERCLASS))
491 ,m_aPBTestJavaDriver (this, ModuleRes(PB_AUTOTESTDRIVERCLASS))
492 ,m_nPortId(_nPortId)
494 m_aFTDriverClass.SetText(String(ModuleRes(_nDriverClassId)));
496 m_aFTDefaultPortNumber.SetText(String(ModuleRes(_nDefaultPortResId)));
497 String sHelpText = String(ModuleRes(_nHelpTextResId));
498 m_aFTHelpText.SetText(sHelpText);
499 //TODO this code snippet is redundant
500 SetHeaderText(FT_AUTOWIZARDHEADER, _nHeaderTextResId);
502 m_aETDatabasename.SetModifyHdl(getControlModifiedLink());
503 m_aETHostname.SetModifyHdl(getControlModifiedLink());
504 m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
506 m_aETDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified));
507 m_aPBTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCConnectionPageSetup,OnTestJavaClickHdl));
509 SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
510 SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
511 ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
512 if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
514 m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
517 SetRoadmapStateValue(sal_False);
518 FreeResource();
522 // -----------------------------------------------------------------------
523 OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
525 return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
526 PAGE_DBWIZARD_MYSQL_JDBC,
527 _rAttrSet,
528 DSID_MYSQL_PORTNUMBER ,
529 STR_MYSQL_DEFAULT,
530 STR_MYSQLJDBC_HELPTEXT,
531 STR_MYSQLJDBC_HEADERTEXT,
532 STR_MYSQL_DRIVERCLASSTEXT) );
535 // -----------------------------------------------------------------------
536 OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
538 return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
539 PAGE_DBWIZARD_ORACLE,
540 _rAttrSet,
541 DSID_ORACLE_PORTNUMBER,
542 STR_ORACLE_DEFAULT,
543 STR_ORACLE_HELPTEXT,
544 STR_ORACLE_HEADERTEXT,
545 STR_ORACLE_DRIVERCLASSTEXT) );
548 // -----------------------------------------------------------------------
549 void OGeneralSpecialJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
551 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDatabasename));
552 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDriverClass));
553 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETHostname));
554 _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
556 // -----------------------------------------------------------------------
557 void OGeneralSpecialJDBCConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
559 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHelpText));
560 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDatabasename));
561 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
562 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTPortNumber));
563 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDefaultPortNumber));
564 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass));
567 // -----------------------------------------------------------------------
568 sal_Bool OGeneralSpecialJDBCConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
570 sal_Bool bChangedSomething = sal_False;
571 fillString(_rSet,&m_aETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
572 fillString(_rSet,&m_aETHostname,DSID_CONN_HOSTNAME,bChangedSomething);
573 fillString(_rSet,&m_aETDatabasename,DSID_DATABASENAME,bChangedSomething);
574 fillInt32(_rSet,&m_aNFPortNumber,m_nPortId,bChangedSomething );
575 return bChangedSomething;
578 // -----------------------------------------------------------------------
579 void OGeneralSpecialJDBCConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
581 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
582 sal_Bool bValid, bReadonly;
583 getFlags(_rSet, bValid, bReadonly);
585 SFX_ITEMSET_GET(_rSet, pDatabaseName, SfxStringItem, DSID_DATABASENAME, sal_True);
586 SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True);
587 SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
588 SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, m_nPortId, sal_True);
590 if ( bValid )
592 m_aETDatabasename.SetText(pDatabaseName->GetValue());
593 m_aETDatabasename.ClearModifyFlag();
595 m_aETDriverClass.SetText(pDrvItem->GetValue());
596 m_aETDriverClass.ClearModifyFlag();
598 m_aETHostname.SetText(pHostName->GetValue());
599 m_aETHostname.ClearModifyFlag();
601 m_aNFPortNumber.SetValue(pPortNumber->GetValue());
602 m_aNFPortNumber.ClearModifyFlag();
604 OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
606 // to get the correct value when saveValue was called by base class
607 if ( !m_aETDriverClass.GetText().Len() )
609 m_aETDriverClass.SetText(m_sDefaultJdbcDriverName);
610 m_aETDriverClass.SetModifyFlag();
612 callModifiedHdl();
614 sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( m_aETDriverClass.GetText().Len() != 0 ));
615 SetRoadmapStateValue(bRoadmapState);
618 // -----------------------------------------------------------------------
619 IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
621 OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
623 sal_Bool bSuccess = sal_False;
626 if ( m_aETDriverClass.GetText().Len() )
628 // TODO chage jvmaccess
629 ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_pAdminDialog->getORB());
630 bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aETDriverClass.GetText());
633 catch(::com::sun::star::uno::Exception&)
637 USHORT nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
638 OSQLMessageBox aMsg( this, String( ModuleRes( nMessage ) ), String() );
639 aMsg.Execute();
640 return 0L;
643 // -----------------------------------------------------------------------
644 IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup, OnEditModified, Edit*, _pEdit)
646 if ( _pEdit == &m_aETDriverClass )
647 m_aPBTestJavaDriver.Enable( m_aETDriverClass.GetText().Len() != 0 );
648 sal_Bool bRoadmapState = ((m_aETDatabasename.GetText().Len() != 0 ) && ( m_aETHostname.GetText().Len() != 0 ) && (m_aNFPortNumber.GetText().Len() != 0 ) && ( m_aETDriverClass.GetText().Len() != 0 ));
649 SetRoadmapStateValue(bRoadmapState);
650 callModifiedHdl();
651 return 0L;
654 // -----------------------------------------------------------------------
655 OGenericAdministrationPage* OJDBCConnectionPageSetup::CreateJDBCTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
657 return ( new OJDBCConnectionPageSetup( pParent, _rAttrSet));
661 //========================================================================
662 //= OMySQLJDBCConnectionPageSetup
663 //========================================================================
664 OJDBCConnectionPageSetup::OJDBCConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs)
665 :OConnectionTabPageSetup(pParent, PAGE_DBWIZARD_JDBC, _rCoreAttrs, STR_JDBC_HELPTEXT, STR_JDBC_HEADERTEXT, STR_COMMONURL)
666 ,m_aFTDriverClass (this, ModuleRes(FT_AUTOJDBCDRIVERCLASS))
667 ,m_aETDriverClass (this, ModuleRes(ET_AUTOJDBCDRIVERCLASS))
668 ,m_aPBTestJavaDriver (this, ModuleRes(PB_AUTOTESTDRIVERCLASS))
670 m_aETDriverClass.SetModifyHdl(LINK(this, OJDBCConnectionPageSetup, OnEditModified));
671 m_aPBTestJavaDriver.SetClickHdl(LINK(this,OJDBCConnectionPageSetup,OnTestJavaClickHdl));
672 FreeResource();
675 // -----------------------------------------------------------------------
676 void OJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
678 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETDriverClass));
681 // -----------------------------------------------------------------------
682 void OJDBCConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
684 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass));
687 // -----------------------------------------------------------------------
688 sal_Bool OJDBCConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
690 sal_Bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
691 fillString(_rSet,&m_aETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
692 return bChangedSomething;
695 // -----------------------------------------------------------------------
696 void OJDBCConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
698 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
699 sal_Bool bValid, bReadonly;
700 getFlags(_rSet, bValid, bReadonly);
702 SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True);
704 if ( bValid )
706 if ( !pDrvItem->GetValue().Len() )
708 String sDefaultJdbcDriverName = m_pCollection->getJavaDriverClass(m_eType);
709 if ( sDefaultJdbcDriverName.Len() )
711 m_aETDriverClass.SetText(sDefaultJdbcDriverName);
712 m_aETDriverClass.SetModifyFlag();
713 } // if ( sDefaultJdbcDriverName.Len() )
714 } // if ( !pJdbcDrvItem->GetValue().Len() )
715 else
717 m_aETDriverClass.SetText(pDrvItem->GetValue());
718 m_aETDriverClass.ClearModifyFlag();
721 sal_Bool bEnable = pDrvItem->GetValue().Len() != 0;
722 m_aPBTestJavaDriver.Enable(bEnable);
723 OConnectionTabPageSetup::implInitControls(_rSet, _bSaveValue);
725 SetRoadmapStateValue(checkTestConnection());
729 bool OJDBCConnectionPageSetup::checkTestConnection()
731 OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
732 BOOL bEnableTestConnection = !m_aConnectionURL.IsVisible() || (m_aConnectionURL.GetTextNoPrefix().Len() != 0);
733 bEnableTestConnection = bEnableTestConnection && (m_aETDriverClass.GetText().Len() != 0);
734 return bEnableTestConnection;
735 // m_aTestConnection.Enable(bEnableTestConnection);
739 // -----------------------------------------------------------------------
740 IMPL_LINK(OJDBCConnectionPageSetup, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
742 OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
743 sal_Bool bSuccess = sal_False;
746 if ( m_aETDriverClass.GetText().Len() )
748 // TODO chage jvmaccess
749 ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_pAdminDialog->getORB());
750 bSuccess = xJVM.is() && ::connectivity::existsJavaClassByName(xJVM,m_aETDriverClass.GetText());
753 catch(::com::sun::star::uno::Exception&)
757 USHORT nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
758 OSQLMessageBox aMsg( this, String( ModuleRes( nMessage ) ), String() );
759 aMsg.Execute();
760 return 0L;
763 // -----------------------------------------------------------------------
764 IMPL_LINK(OJDBCConnectionPageSetup, OnEditModified, Edit*, _pEdit)
766 if ( _pEdit == &m_aETDriverClass )
767 m_aPBTestJavaDriver.Enable( m_aETDriverClass.GetText().Len() != 0 );
768 SetRoadmapStateValue(checkTestConnection());
769 // tell the listener we were modified
770 callModifiedHdl();
771 return 0L;
775 OGenericAdministrationPage* OSpreadSheetConnectionPageSetup::CreateSpreadSheetTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
777 return ( new OSpreadSheetConnectionPageSetup( pParent, _rAttrSet ) );
780 DBG_NAME(OSpreadSheetConnectionPageSetup)
782 OSpreadSheetConnectionPageSetup::OSpreadSheetConnectionPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
783 :OConnectionTabPageSetup(pParent, PAGE_DBWIZARD_SPREADSHEET, _rCoreAttrs, STR_SPREADSHEET_HELPTEXT, STR_SPREADSHEET_HEADERTEXT, STR_SPREADSHEETPATH)
784 , m_aCBPasswordrequired(this, ModuleRes(CB_SPREADSHEETPASSWORDREQUIRED))
786 DBG_CTOR(OSpreadSheetConnectionPageSetup,NULL);
788 m_aCBPasswordrequired.SetToggleHdl(getControlModifiedLink());
789 FreeResource();
793 // -----------------------------------------------------------------------
794 OSpreadSheetConnectionPageSetup::~OSpreadSheetConnectionPageSetup()
797 DBG_DTOR(OSpreadSheetConnectionPageSetup,NULL);
801 void OSpreadSheetConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
805 // -----------------------------------------------------------------------
806 void OSpreadSheetConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
808 OConnectionTabPageSetup::fillControls(_rControlList);
809 _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBPasswordrequired));
813 // -----------------------------------------------------------------------
814 void OSpreadSheetConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
816 OConnectionTabPageSetup::implInitControls(_rSet, _bSaveValue);
819 // -----------------------------------------------------------------------
820 sal_Bool OSpreadSheetConnectionPageSetup::FillItemSet( SfxItemSet& _rSet )
822 sal_Bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
823 fillBool(_rSet,&m_aCBPasswordrequired,DSID_PASSWORDREQUIRED,bChangedSomething);
824 return bChangedSomething;
827 OGenericAdministrationPage* OAuthentificationPageSetup::CreateAuthentificationTabPage( Window* pParent, const SfxItemSet& _rAttrSet )
829 return ( new OAuthentificationPageSetup( pParent, _rAttrSet) );
832 DBG_NAME(OAuthentificationPageSetup)
834 OAuthentificationPageSetup::OAuthentificationPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
835 :OGenericAdministrationPage(pParent, ModuleRes(PAGE_DBWIZARD_AUTHENTIFICATION), _rCoreAttrs )
836 , m_aFTHelpText (this, ModuleRes(FT_AUTHENTIFICATIONHELPTEXT))
837 , m_aFTHeaderText (this, ModuleRes(FT_AUTHENTIFICATIONHEADERTEXT))
838 , m_aFTUserName (this, ModuleRes(FT_GENERALUSERNAME))
839 , m_aETUserName (this, ModuleRes(ET_GENERALUSERNAME))
840 , m_aCBPasswordRequired (this, ModuleRes(CB_GENERALPASSWORDREQUIRED))
841 , m_aPBTestConnection (this, ModuleRes(PB_TESTCONNECTION))
843 DBG_CTOR(OAuthentificationPageSetup,NULL);
845 SetControlFontWeight(&m_aFTHeaderText);
846 m_aETUserName.SetModifyHdl(getControlModifiedLink());
847 m_aCBPasswordRequired.SetClickHdl(getControlModifiedLink());
848 m_aPBTestConnection.SetClickHdl(LINK(this,OGenericAdministrationPage,OnTestConnectionClickHdl));
849 FreeResource();
853 // -----------------------------------------------------------------------
854 OAuthentificationPageSetup::~OAuthentificationPageSetup()
857 DBG_DTOR(OAuthentificationPageSetup,NULL);
861 void OAuthentificationPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
863 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHelpText));
864 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTUserName));
865 _rControlList.push_back(new ODisableWrapper<PushButton>(&m_aPBTestConnection));
868 // -----------------------------------------------------------------------
869 void OAuthentificationPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
871 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETUserName));
872 _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBPasswordRequired));
875 // -----------------------------------------------------------------------
876 void OAuthentificationPageSetup::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bSaveValue*/)
878 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
879 sal_Bool bValid, bReadonly;
880 getFlags(_rSet, bValid, bReadonly);
881 SFX_ITEMSET_GET(_rSet, pUidItem, SfxStringItem, DSID_USER, sal_True);
882 SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True);
884 m_aETUserName.SetText(pUidItem->GetValue());
885 m_aCBPasswordRequired.Check(pAllowEmptyPwd->GetValue());
887 m_aETUserName.ClearModifyFlag();
890 // -----------------------------------------------------------------------
891 sal_Bool OAuthentificationPageSetup::FillItemSet( SfxItemSet& _rSet )
893 sal_Bool bChangedSomething = sal_False;
895 if (m_aETUserName.GetText() != m_aETUserName.GetSavedValue())
897 _rSet.Put(SfxStringItem(DSID_USER, m_aETUserName.GetText()));
898 _rSet.Put(SfxStringItem(DSID_PASSWORD, String()));
899 bChangedSomething = sal_True;
901 fillBool(_rSet,&m_aCBPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething);
902 return bChangedSomething;
906 OGenericAdministrationPage* OFinalDBPageSetup::CreateFinalDBTabPageSetup( Window* pParent, const SfxItemSet& _rAttrSet)
908 return ( new OFinalDBPageSetup( pParent, _rAttrSet) );
911 DBG_NAME(OFinalDBPageSetup)
913 OFinalDBPageSetup::OFinalDBPageSetup( Window* pParent, const SfxItemSet& _rCoreAttrs )
914 :OGenericAdministrationPage(pParent, ModuleRes(PAGE_DBWIZARD_FINAL), _rCoreAttrs )
915 , m_aFTFinalHeader (this, ModuleRes(FT_FINALHEADER))
916 , m_aFTFinalHelpText (this, ModuleRes(FT_FINALHELPTEXT))
917 , m_aRBRegisterDataSource (this, ModuleRes(RB_REGISTERDATASOURCE))
918 , m_aRBDontregisterDataSource (this, ModuleRes(RB_DONTREGISTERDATASOURCE))
919 , m_aFTAdditionalSettings (this, ModuleRes(FT_ADDITIONALSETTINGS))
920 , m_aCBOpenAfterwards (this, ModuleRes(CB_OPENAFTERWARDS))
921 , m_aCBStartTableWizard (this, ModuleRes(CB_STARTTABLEWIZARD))
922 , m_aFTFinalText (this, ModuleRes(FT_FINALTEXT))
924 DBG_CTOR(OFinalDBPageSetup,NULL);
926 String stext = m_aFTFinalHeader.GetText();
927 SetControlFontWeight(&m_aFTFinalHeader);
928 m_aCBOpenAfterwards.SetClickHdl(LINK(this, OFinalDBPageSetup, OnOpenSelected));
929 m_aCBStartTableWizard.SetClickHdl(getControlModifiedLink());
930 m_aRBRegisterDataSource.SetState(sal_True);
931 FreeResource();
933 sal_Int32 nUnrelatedHeight = LogicToPixel( Size( 0, UNRELATED_CONTROLS ), MAP_APPFONT ).Height();
934 sal_Int32 nRelatedHeight = LogicToPixel( Size( 0, RELATED_CONTROLS ), MAP_APPFONT ).Height();
936 ::std::pair<Window*,sal_Int32> pWindows[] = {
937 ::std::pair<Window*,sal_Int32>(&m_aFTFinalHelpText,nRelatedHeight)
938 ,::std::pair<Window*,sal_Int32>(&m_aRBRegisterDataSource,nRelatedHeight)
939 ,::std::pair<Window*,sal_Int32>(&m_aRBDontregisterDataSource,nUnrelatedHeight)
940 ,::std::pair<Window*,sal_Int32>(&m_aFTAdditionalSettings,nRelatedHeight)
941 ,::std::pair<Window*,sal_Int32>(&m_aCBOpenAfterwards,nRelatedHeight)
942 ,::std::pair<Window*,sal_Int32>(&m_aCBStartTableWizard,nUnrelatedHeight)
943 ,::std::pair<Window*,sal_Int32>(&m_aFTFinalText,nUnrelatedHeight)
946 Point aPos(m_aFTFinalHeader.GetPosPixel());
947 Size aStart(m_aFTFinalHeader.GetSizePixel());
948 aPos.Y() += aStart.Height() + nUnrelatedHeight;
949 sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
950 for (sal_Int32 i=0; i < nCount; ++i)
952 aPos.X() = pWindows[i].first->GetPosPixel().X();
953 Size aSize = pWindows[i].first->GetSizePixel();
954 FixedText* pText = dynamic_cast<FixedText*>(pWindows[i].first);
955 CheckBox* pCheck = dynamic_cast<CheckBox*>(pWindows[i].first);
956 RadioButton* pRadio = dynamic_cast<RadioButton*>(pWindows[i].first);
957 if ( pText )
958 aSize = pText->CalcMinimumSize(aSize.Width());
959 else if ( pRadio )
960 aSize = pRadio->CalcMinimumSize(aSize.Width());
961 else if ( pCheck )
962 aSize = pCheck->CalcMinimumSize(aSize.Width());
963 pWindows[i].first->SetPosSizePixel(aPos,aSize);
964 aPos.Y() += aSize.Height() + pWindows[i].second;
969 // -----------------------------------------------------------------------
970 OFinalDBPageSetup::~OFinalDBPageSetup()
973 DBG_DTOR(OFinalDBPageSetup,NULL);
976 sal_Bool OFinalDBPageSetup::IsDatabaseDocumentToBeRegistered()
978 return m_aRBRegisterDataSource.IsChecked() && m_aRBRegisterDataSource.IsEnabled();
981 sal_Bool OFinalDBPageSetup::IsDatabaseDocumentToBeOpened()
983 return m_aCBOpenAfterwards.IsChecked() && m_aCBOpenAfterwards.IsEnabled();
986 sal_Bool OFinalDBPageSetup::IsTableWizardToBeStarted()
988 return m_aCBStartTableWizard.IsChecked() && m_aCBStartTableWizard.IsEnabled();
992 void OFinalDBPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
994 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTFinalHeader));
995 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTFinalHelpText));
996 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTAdditionalSettings));
997 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTFinalText));
1000 // -----------------------------------------------------------------------
1001 void OFinalDBPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
1003 _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBOpenAfterwards));
1004 _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBStartTableWizard));
1005 _rControlList.push_back(new OSaveValueWrapper<RadioButton>(&m_aRBRegisterDataSource));
1006 _rControlList.push_back(new OSaveValueWrapper<RadioButton>(&m_aRBDontregisterDataSource));
1009 // -----------------------------------------------------------------------
1010 void OFinalDBPageSetup::implInitControls(const SfxItemSet& /*_rSet*/, sal_Bool /*_bSaveValue*/)
1012 m_aCBOpenAfterwards.Check();
1015 void OFinalDBPageSetup::enableTableWizardCheckBox( sal_Bool _bSupportsTableCreation)
1017 m_aCBStartTableWizard.Enable(_bSupportsTableCreation);
1020 // -----------------------------------------------------------------------
1021 sal_Bool OFinalDBPageSetup::FillItemSet( SfxItemSet& /*_rSet*/ )
1023 return sal_True;
1025 // -----------------------------------------------------------------------------
1026 IMPL_LINK(OFinalDBPageSetup, OnOpenSelected, CheckBox*, _pBox)
1028 m_aCBStartTableWizard.Enable( _pBox->IsEnabled() && _pBox->IsChecked() );
1029 callModifiedHdl();
1030 // outta here
1031 return 0L;
1033 //.........................................................................
1035 // namespace dbaui
1036 //.........................................................................