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