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