1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_dbaccess.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "detailpages.hxx" 32*cdf0e10cSrcweir #include "sqlmessage.hxx" 33*cdf0e10cSrcweir #include "dsmeta.hxx" 34*cdf0e10cSrcweir #include "advancedsettings.hxx" 35*cdf0e10cSrcweir #include "DbAdminImpl.hxx" 36*cdf0e10cSrcweir #include "dsitems.hxx" 37*cdf0e10cSrcweir #include "dbfindex.hxx" 38*cdf0e10cSrcweir #include "localresaccess.hxx" 39*cdf0e10cSrcweir #include "dsnItem.hxx" 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #include "dbaccess_helpid.hrc" 42*cdf0e10cSrcweir #include "dbu_dlg.hrc" 43*cdf0e10cSrcweir #include "dbadmin.hrc" 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #ifndef _SFXITEMSET_HXX 46*cdf0e10cSrcweir #include <svl/itemset.hxx> 47*cdf0e10cSrcweir #endif 48*cdf0e10cSrcweir #ifndef _SFXSTRITEM_HXX 49*cdf0e10cSrcweir #include <svl/stritem.hxx> 50*cdf0e10cSrcweir #endif 51*cdf0e10cSrcweir #ifndef _SFXENUMITEM_HXX 52*cdf0e10cSrcweir #include <svl/eitem.hxx> 53*cdf0e10cSrcweir #endif 54*cdf0e10cSrcweir #ifndef _SFXINTITEM_HXX 55*cdf0e10cSrcweir #include <svl/intitem.hxx> 56*cdf0e10cSrcweir #endif 57*cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX 58*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 59*cdf0e10cSrcweir #endif 60*cdf0e10cSrcweir #ifndef _SV_MNEMONIC_HXX 61*cdf0e10cSrcweir #include <vcl/mnemonic.hxx> 62*cdf0e10cSrcweir #endif 63*cdf0e10cSrcweir #ifndef _SVTOOLS_CJKOPTIONS_HXX 64*cdf0e10cSrcweir #include <svl/cjkoptions.hxx> 65*cdf0e10cSrcweir #endif 66*cdf0e10cSrcweir #include <jvmaccess/virtualmachine.hxx> 67*cdf0e10cSrcweir #ifndef DBAUI_ADABASPAGE_HRC 68*cdf0e10cSrcweir #include "AdabasPage.hrc" 69*cdf0e10cSrcweir #endif 70*cdf0e10cSrcweir #ifndef _DBAUI_ADASTAT_HXX_ 71*cdf0e10cSrcweir #include "AdabasStat.hxx" 72*cdf0e10cSrcweir #endif 73*cdf0e10cSrcweir #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ 74*cdf0e10cSrcweir #include <connectivity/CommonTools.hxx> 75*cdf0e10cSrcweir #endif 76*cdf0e10cSrcweir #ifndef DBAUI_DRIVERSETTINGS_HXX 77*cdf0e10cSrcweir #include "DriverSettings.hxx" 78*cdf0e10cSrcweir #endif 79*cdf0e10cSrcweir #ifndef _DBAUI_DBADMIN_HXX_ 80*cdf0e10cSrcweir #include "dbadmin.hxx" 81*cdf0e10cSrcweir #endif 82*cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_HXX_ 83*cdf0e10cSrcweir #include <comphelper/types.hxx> 84*cdf0e10cSrcweir #endif 85*cdf0e10cSrcweir #include "AutoControls.hrc" 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir //......................................................................... 88*cdf0e10cSrcweir namespace dbaui 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir //......................................................................... 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 93*cdf0e10cSrcweir using namespace ::com::sun::star::sdbc; 94*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 95*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 96*cdf0e10cSrcweir using namespace ::com::sun::star::container; 97*cdf0e10cSrcweir using namespace ::dbtools; 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir //======================================================================== 100*cdf0e10cSrcweir //= OCommonBehaviourTabPage 101*cdf0e10cSrcweir //======================================================================== 102*cdf0e10cSrcweir DBG_NAME(OCommonBehaviourTabPage) 103*cdf0e10cSrcweir //------------------------------------------------------------------------ 104*cdf0e10cSrcweir OCommonBehaviourTabPage::OCommonBehaviourTabPage(Window* pParent, sal_uInt16 nResId, const SfxItemSet& _rCoreAttrs, 105*cdf0e10cSrcweir sal_uInt32 nControlFlags,bool _bFreeResource) 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir :OGenericAdministrationPage(pParent, ModuleRes(nResId), _rCoreAttrs) 108*cdf0e10cSrcweir ,m_pOptionsLabel(NULL) 109*cdf0e10cSrcweir ,m_pOptions(NULL) 110*cdf0e10cSrcweir ,m_pDataConvertFixedLine(NULL) 111*cdf0e10cSrcweir ,m_pCharsetLabel(NULL) 112*cdf0e10cSrcweir ,m_pCharset(NULL) 113*cdf0e10cSrcweir ,m_pAutoFixedLine(NULL) 114*cdf0e10cSrcweir ,m_pAutoRetrievingEnabled(NULL) 115*cdf0e10cSrcweir ,m_pAutoIncrementLabel(NULL) 116*cdf0e10cSrcweir ,m_pAutoIncrement(NULL) 117*cdf0e10cSrcweir ,m_pAutoRetrievingLabel(NULL) 118*cdf0e10cSrcweir ,m_pAutoRetrieving(NULL) 119*cdf0e10cSrcweir ,m_nControlFlags(nControlFlags) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir DBG_CTOR(OCommonBehaviourTabPage,NULL); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS) 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir m_pOptionsLabel = new FixedText(this, ModuleRes(FT_OPTIONS)); 126*cdf0e10cSrcweir m_pOptions = new Edit(this, ModuleRes(ET_OPTIONS)); 127*cdf0e10cSrcweir m_pOptions->SetModifyHdl(getControlModifiedLink()); 128*cdf0e10cSrcweir } 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET) 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir m_pDataConvertFixedLine = new FixedLine(this, ModuleRes(FL_DATACONVERT)); 133*cdf0e10cSrcweir m_pCharsetLabel = new FixedText(this, ModuleRes(FT_CHARSET)); 134*cdf0e10cSrcweir m_pCharset = new CharSetListBox(this, ModuleRes(LB_CHARSET)); 135*cdf0e10cSrcweir m_pCharset->SetSelectHdl(getControlModifiedLink()); 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir Window* pWindows[] = { m_pAutoRetrievingEnabled, m_pAutoFixedLine, 139*cdf0e10cSrcweir m_pAutoIncrementLabel, m_pAutoIncrement, 140*cdf0e10cSrcweir m_pAutoRetrievingLabel, m_pAutoRetrieving }; 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); 143*cdf0e10cSrcweir for (sal_Int32 i=1; i < nCount; ++i) 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir if ( pWindows[i] ) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir Window* pPrev = pWindows[i-1]; 148*cdf0e10cSrcweir for (sal_Int32 j = i-1; pPrev == NULL && j >= 0 ; --j) 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir pPrev = pWindows[j]; 151*cdf0e10cSrcweir } 152*cdf0e10cSrcweir if ( pPrev ) 153*cdf0e10cSrcweir pWindows[i]->SetZOrder(pPrev, WINDOW_ZORDER_BEHIND); 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir if ( _bFreeResource ) 158*cdf0e10cSrcweir FreeResource(); 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir // ----------------------------------------------------------------------- 162*cdf0e10cSrcweir OCommonBehaviourTabPage::~OCommonBehaviourTabPage() 163*cdf0e10cSrcweir { 164*cdf0e10cSrcweir DELETEZ(m_pOptionsLabel); 165*cdf0e10cSrcweir DELETEZ(m_pOptions); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir DELETEZ(m_pDataConvertFixedLine); 168*cdf0e10cSrcweir DELETEZ(m_pCharsetLabel); 169*cdf0e10cSrcweir DELETEZ(m_pCharset); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir DELETEZ(m_pAutoFixedLine); 172*cdf0e10cSrcweir DELETEZ(m_pAutoIncrementLabel); 173*cdf0e10cSrcweir DELETEZ(m_pAutoIncrement); 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir DELETEZ(m_pAutoRetrievingEnabled); 176*cdf0e10cSrcweir DELETEZ(m_pAutoRetrievingLabel); 177*cdf0e10cSrcweir DELETEZ(m_pAutoRetrieving); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir DBG_DTOR(OCommonBehaviourTabPage,NULL); 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir // ----------------------------------------------------------------------- 183*cdf0e10cSrcweir void OCommonBehaviourTabPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS) 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(m_pOptionsLabel)); 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET) 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedLine>(m_pDataConvertFixedLine)); 193*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(m_pCharsetLabel)); 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir // ----------------------------------------------------------------------- 197*cdf0e10cSrcweir void OCommonBehaviourTabPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS) 200*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(m_pOptions)); 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET) 203*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<ListBox>(m_pCharset)); 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir // ----------------------------------------------------------------------- 207*cdf0e10cSrcweir void OCommonBehaviourTabPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa) 210*cdf0e10cSrcweir sal_Bool bValid, bReadonly; 211*cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly); 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir // collect the items 214*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pOptionsItem, SfxStringItem, DSID_ADDITIONALOPTIONS, sal_True); 215*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pCharsetItem, SfxStringItem, DSID_CHARSET, sal_True); 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir // forward the values to the controls 218*cdf0e10cSrcweir if (bValid) 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS) 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir m_pOptions->SetText(pOptionsItem->GetValue()); 223*cdf0e10cSrcweir m_pOptions->ClearModifyFlag(); 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir m_pCharset->SelectEntryByIanaName( pCharsetItem->GetValue() ); 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue); 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir // ----------------------------------------------------------------------- 234*cdf0e10cSrcweir sal_Bool OCommonBehaviourTabPage::FillItemSet(SfxItemSet& _rSet) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir sal_Bool bChangedSomething = sal_False; 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir fillString(_rSet,m_pOptions,DSID_ADDITIONALOPTIONS,bChangedSomething); 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir if ( m_pCharset->StoreSelectedCharSet( _rSet, DSID_CHARSET ) ) 246*cdf0e10cSrcweir bChangedSomething = sal_True; 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir return bChangedSomething; 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir //======================================================================== 253*cdf0e10cSrcweir //= ODbaseDetailsPage 254*cdf0e10cSrcweir //======================================================================== 255*cdf0e10cSrcweir DBG_NAME(ODbaseDetailsPage) 256*cdf0e10cSrcweir //------------------------------------------------------------------------ 257*cdf0e10cSrcweir ODbaseDetailsPage::ODbaseDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs ) 258*cdf0e10cSrcweir :OCommonBehaviourTabPage(pParent, PAGE_DBASE, _rCoreAttrs, CBTP_USE_CHARSET ,false) 259*cdf0e10cSrcweir ,m_aShowDeleted (this, ModuleRes(CB_SHOWDELETEDROWS)) 260*cdf0e10cSrcweir ,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) ) 261*cdf0e10cSrcweir ,m_aFT_Message (this, ModuleRes( FT_SPECIAL_MESSAGE) ) 262*cdf0e10cSrcweir ,m_aIndexes (this, ModuleRes(PB_INDICIES)) 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir DBG_CTOR(ODbaseDetailsPage,NULL); 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir m_aIndexes.SetClickHdl(LINK(this, ODbaseDetailsPage, OnButtonClicked)); 267*cdf0e10cSrcweir m_aShowDeleted.SetClickHdl(LINK(this, ODbaseDetailsPage, OnButtonClicked)); 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir // correct the z-order which is mixed-up because the base class constructed some controls before we did 270*cdf0e10cSrcweir m_pCharset->SetZOrder(&m_aShowDeleted, WINDOW_ZORDER_BEFOR); 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir FreeResource(); 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir // ----------------------------------------------------------------------- 276*cdf0e10cSrcweir ODbaseDetailsPage::~ODbaseDetailsPage() 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir DBG_DTOR(ODbaseDetailsPage,NULL); 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir // ----------------------------------------------------------------------- 283*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateDbase( Window* pParent, const SfxItemSet& _rAttrSet ) 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir return ( new ODbaseDetailsPage( pParent, _rAttrSet ) ); 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir // ----------------------------------------------------------------------- 289*cdf0e10cSrcweir void ODbaseDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir OCommonBehaviourTabPage::fillControls(_rControlList); 292*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aShowDeleted)); 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir // ----------------------------------------------------------------------- 295*cdf0e10cSrcweir void ODbaseDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir OCommonBehaviourTabPage::fillWindows(_rControlList); 298*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1)); 299*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFT_Message)); 300*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<PushButton>(&m_aIndexes)); 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir // ----------------------------------------------------------------------- 303*cdf0e10cSrcweir void ODbaseDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue) 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa) 306*cdf0e10cSrcweir sal_Bool bValid, bReadonly; 307*cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly); 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir // get the DSN string (needed for the index dialog) 310*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True); 311*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True); 312*cdf0e10cSrcweir ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL; 313*cdf0e10cSrcweir if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len()) 314*cdf0e10cSrcweir m_sDsn = pTypeCollection->cutPrefix(pUrlItem->GetValue()); 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir // get the other relevant items 317*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pDeletedItem, SfxBoolItem, DSID_SHOWDELETEDROWS, sal_True); 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir if ( bValid ) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir m_aShowDeleted.Check( pDeletedItem->GetValue() ); 322*cdf0e10cSrcweir m_aFT_Message.Show(m_aShowDeleted.IsChecked()); 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue); 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir // ----------------------------------------------------------------------- 329*cdf0e10cSrcweir sal_Bool ODbaseDetailsPage::FillItemSet( SfxItemSet& _rSet ) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet); 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir fillBool(_rSet,&m_aShowDeleted,DSID_SHOWDELETEDROWS,bChangedSomething); 334*cdf0e10cSrcweir return bChangedSomething; 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir //------------------------------------------------------------------------ 338*cdf0e10cSrcweir IMPL_LINK( ODbaseDetailsPage, OnButtonClicked, Button*, pButton ) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir if (&m_aIndexes == pButton) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir ODbaseIndexDialog aIndexDialog(this, m_sDsn); 343*cdf0e10cSrcweir aIndexDialog.Execute(); 344*cdf0e10cSrcweir } 345*cdf0e10cSrcweir else 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir m_aFT_Message.Show(m_aShowDeleted.IsChecked()); 348*cdf0e10cSrcweir // it was one of the checkboxes -> we count as modified from now on 349*cdf0e10cSrcweir callModifiedHdl(); 350*cdf0e10cSrcweir } 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir return 0; 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir //======================================================================== 356*cdf0e10cSrcweir //= OAdoDetailsPage 357*cdf0e10cSrcweir //======================================================================== 358*cdf0e10cSrcweir DBG_NAME(OAdoDetailsPage) 359*cdf0e10cSrcweir // ----------------------------------------------------------------------- 360*cdf0e10cSrcweir OAdoDetailsPage::OAdoDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs ) 361*cdf0e10cSrcweir :OCommonBehaviourTabPage(pParent, PAGE_ADO, _rCoreAttrs, CBTP_USE_CHARSET ) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir DBG_CTOR(OAdoDetailsPage,NULL); 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir // ----------------------------------------------------------------------- 368*cdf0e10cSrcweir OAdoDetailsPage::~OAdoDetailsPage() 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir DBG_DTOR(OAdoDetailsPage,NULL); 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir // ----------------------------------------------------------------------- 374*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateAdo( Window* pParent, const SfxItemSet& _rAttrSet ) 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir return ( new OAdoDetailsPage( pParent, _rAttrSet ) ); 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir // ----------------------------------------------------------------------- 380*cdf0e10cSrcweir //======================================================================== 381*cdf0e10cSrcweir //= OOdbcDetailsPage 382*cdf0e10cSrcweir //======================================================================== 383*cdf0e10cSrcweir OOdbcDetailsPage::OOdbcDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs ) 384*cdf0e10cSrcweir :OCommonBehaviourTabPage(pParent, PAGE_ODBC, _rCoreAttrs, CBTP_USE_CHARSET | CBTP_USE_OPTIONS,false) 385*cdf0e10cSrcweir ,m_aFL_1 (this, ModuleRes(FL_SEPARATOR1)) 386*cdf0e10cSrcweir ,m_aUseCatalog (this, ModuleRes(CB_USECATALOG)) 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir m_aUseCatalog.SetToggleHdl(getControlModifiedLink()); 389*cdf0e10cSrcweir FreeResource(); 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir Window* pWindows[] = { m_pCharsetLabel, m_pCharset 392*cdf0e10cSrcweir ,m_pOptionsLabel,m_pOptions,&m_aUseCatalog 393*cdf0e10cSrcweir }; 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); 396*cdf0e10cSrcweir for (sal_Int32 i=1; i < nCount; ++i) 397*cdf0e10cSrcweir pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND); 398*cdf0e10cSrcweir } 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir // ----------------------------------------------------------------------- 401*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateODBC( Window* pParent, const SfxItemSet& _rAttrSet ) 402*cdf0e10cSrcweir { 403*cdf0e10cSrcweir return ( new OOdbcDetailsPage( pParent, _rAttrSet ) ); 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir // ----------------------------------------------------------------------- 407*cdf0e10cSrcweir sal_Bool OOdbcDetailsPage::FillItemSet( SfxItemSet& _rSet ) 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet); 410*cdf0e10cSrcweir fillBool(_rSet,&m_aUseCatalog,DSID_USECATALOG,bChangedSomething); 411*cdf0e10cSrcweir return bChangedSomething; 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir // ----------------------------------------------------------------------- 414*cdf0e10cSrcweir void OOdbcDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir OCommonBehaviourTabPage::fillControls(_rControlList); 417*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aUseCatalog)); 418*cdf0e10cSrcweir } 419*cdf0e10cSrcweir // ----------------------------------------------------------------------- 420*cdf0e10cSrcweir void OOdbcDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir OCommonBehaviourTabPage::fillWindows(_rControlList); 423*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1)); 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir // ----------------------------------------------------------------------- 426*cdf0e10cSrcweir void OOdbcDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue) 427*cdf0e10cSrcweir { 428*cdf0e10cSrcweir // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa) 429*cdf0e10cSrcweir sal_Bool bValid, bReadonly; 430*cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly); 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pUseCatalogItem, SfxBoolItem, DSID_USECATALOG, sal_True); 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir if ( bValid ) 435*cdf0e10cSrcweir m_aUseCatalog.Check(pUseCatalogItem->GetValue()); 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue); 438*cdf0e10cSrcweir } 439*cdf0e10cSrcweir //======================================================================== 440*cdf0e10cSrcweir //= OOdbcDetailsPage 441*cdf0e10cSrcweir //======================================================================== 442*cdf0e10cSrcweir OUserDriverDetailsPage::OUserDriverDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs ) 443*cdf0e10cSrcweir :OCommonBehaviourTabPage(pParent, PAGE_USERDRIVER, _rCoreAttrs, 444*cdf0e10cSrcweir CBTP_USE_CHARSET | CBTP_USE_OPTIONS ,false) 445*cdf0e10cSrcweir ,m_aFTHostname (this, ModuleRes(FT_HOSTNAME)) 446*cdf0e10cSrcweir ,m_aEDHostname (this, ModuleRes(ET_HOSTNAME)) 447*cdf0e10cSrcweir ,m_aPortNumber (this, ModuleRes(FT_PORTNUMBER)) 448*cdf0e10cSrcweir ,m_aNFPortNumber (this, ModuleRes(NF_PORTNUMBER)) 449*cdf0e10cSrcweir ,m_aUseCatalog (this, ModuleRes(CB_USECATALOG)) 450*cdf0e10cSrcweir { 451*cdf0e10cSrcweir m_aUseCatalog.SetToggleHdl(getControlModifiedLink()); 452*cdf0e10cSrcweir FreeResource(); 453*cdf0e10cSrcweir } 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir // ----------------------------------------------------------------------- 456*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateUser( Window* pParent, const SfxItemSet& _rAttrSet ) 457*cdf0e10cSrcweir { 458*cdf0e10cSrcweir return ( new OUserDriverDetailsPage( pParent, _rAttrSet ) ); 459*cdf0e10cSrcweir } 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir // ----------------------------------------------------------------------- 462*cdf0e10cSrcweir sal_Bool OUserDriverDetailsPage::FillItemSet( SfxItemSet& _rSet ) 463*cdf0e10cSrcweir { 464*cdf0e10cSrcweir sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet); 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_PORTNUMBER,bChangedSomething); 467*cdf0e10cSrcweir fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething); 468*cdf0e10cSrcweir fillBool(_rSet,&m_aUseCatalog,DSID_USECATALOG,bChangedSomething); 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir return bChangedSomething; 471*cdf0e10cSrcweir } 472*cdf0e10cSrcweir // ----------------------------------------------------------------------- 473*cdf0e10cSrcweir void OUserDriverDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) 474*cdf0e10cSrcweir { 475*cdf0e10cSrcweir OCommonBehaviourTabPage::fillControls(_rControlList); 476*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname)); 477*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aUseCatalog)); 478*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber)); 479*cdf0e10cSrcweir } 480*cdf0e10cSrcweir // ----------------------------------------------------------------------- 481*cdf0e10cSrcweir void OUserDriverDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir OCommonBehaviourTabPage::fillWindows(_rControlList); 484*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname)); 485*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber)); 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir // ----------------------------------------------------------------------- 488*cdf0e10cSrcweir void OUserDriverDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue) 489*cdf0e10cSrcweir { 490*cdf0e10cSrcweir // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa) 491*cdf0e10cSrcweir sal_Bool bValid, bReadonly; 492*cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly); 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pUseCatalogItem, SfxBoolItem, DSID_USECATALOG, sal_True); 495*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True); 496*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_PORTNUMBER, sal_True); 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir if ( bValid ) 499*cdf0e10cSrcweir { 500*cdf0e10cSrcweir m_aEDHostname.SetText(pHostName->GetValue()); 501*cdf0e10cSrcweir m_aEDHostname.ClearModifyFlag(); 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir m_aNFPortNumber.SetValue(pPortNumber->GetValue()); 504*cdf0e10cSrcweir m_aNFPortNumber.ClearModifyFlag(); 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir m_aUseCatalog.Check(pUseCatalogItem->GetValue()); 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue); 510*cdf0e10cSrcweir } 511*cdf0e10cSrcweir //======================================================================== 512*cdf0e10cSrcweir //= OMySQLODBCDetailsPage 513*cdf0e10cSrcweir //======================================================================== 514*cdf0e10cSrcweir OMySQLODBCDetailsPage::OMySQLODBCDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs ) 515*cdf0e10cSrcweir :OCommonBehaviourTabPage(pParent, PAGE_MYSQL_ODBC, _rCoreAttrs, CBTP_USE_CHARSET ) 516*cdf0e10cSrcweir { 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir 519*cdf0e10cSrcweir // ----------------------------------------------------------------------- 520*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateMySQLODBC( Window* pParent, const SfxItemSet& _rAttrSet ) 521*cdf0e10cSrcweir { 522*cdf0e10cSrcweir return ( new OMySQLODBCDetailsPage( pParent, _rAttrSet ) ); 523*cdf0e10cSrcweir } 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir //======================================================================== 526*cdf0e10cSrcweir //= OMySQLJDBCDetailsPage 527*cdf0e10cSrcweir //======================================================================== 528*cdf0e10cSrcweir OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage( Window* pParent,sal_uInt16 _nResId, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId) 529*cdf0e10cSrcweir :OCommonBehaviourTabPage(pParent, _nResId, _rCoreAttrs, CBTP_USE_CHARSET ,false) 530*cdf0e10cSrcweir ,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) ) 531*cdf0e10cSrcweir ,m_aFTHostname (this, ModuleRes(FT_HOSTNAME)) 532*cdf0e10cSrcweir ,m_aEDHostname (this, ModuleRes(ET_HOSTNAME)) 533*cdf0e10cSrcweir ,m_aPortNumber (this, ModuleRes(FT_PORTNUMBER)) 534*cdf0e10cSrcweir ,m_aNFPortNumber (this, ModuleRes(NF_PORTNUMBER)) 535*cdf0e10cSrcweir ,m_aFTSocket (this, ModuleRes(FT_SOCKET)) 536*cdf0e10cSrcweir ,m_aEDSocket (this, ModuleRes(ET_SOCKET)) 537*cdf0e10cSrcweir ,m_aFTDriverClass (this, ModuleRes(FT_JDBCDRIVERCLASS)) 538*cdf0e10cSrcweir ,m_aEDDriverClass (this, ModuleRes(ET_JDBCDRIVERCLASS)) 539*cdf0e10cSrcweir ,m_aTestJavaDriver (this, ModuleRes(PB_TESTDRIVERCLASS)) 540*cdf0e10cSrcweir ,m_nPortId(_nPortId) 541*cdf0e10cSrcweir ,m_bUseClass(true) 542*cdf0e10cSrcweir { 543*cdf0e10cSrcweir SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True); 544*cdf0e10cSrcweir SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True); 545*cdf0e10cSrcweir ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL; 546*cdf0e10cSrcweir if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() ) 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue()); 549*cdf0e10cSrcweir } 550*cdf0e10cSrcweir if ( m_sDefaultJdbcDriverName.Len() ) 551*cdf0e10cSrcweir { 552*cdf0e10cSrcweir m_aEDDriverClass.SetModifyHdl(getControlModifiedLink()); 553*cdf0e10cSrcweir m_aEDDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCDetailsPage, OnEditModified)); 554*cdf0e10cSrcweir m_aTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCDetailsPage,OnTestJavaClickHdl)); 555*cdf0e10cSrcweir } 556*cdf0e10cSrcweir else 557*cdf0e10cSrcweir { 558*cdf0e10cSrcweir m_bUseClass = false; 559*cdf0e10cSrcweir m_aFTDriverClass.Show(sal_False); 560*cdf0e10cSrcweir m_aEDDriverClass.Show(sal_False); 561*cdf0e10cSrcweir m_aTestJavaDriver.Show(sal_False); 562*cdf0e10cSrcweir } 563*cdf0e10cSrcweir 564*cdf0e10cSrcweir m_aFTSocket.Show(PAGE_MYSQL_JDBC == _nResId && !m_bUseClass); 565*cdf0e10cSrcweir m_aEDSocket.Show(PAGE_MYSQL_JDBC == _nResId && !m_bUseClass); 566*cdf0e10cSrcweir 567*cdf0e10cSrcweir m_aEDHostname.SetModifyHdl(getControlModifiedLink()); 568*cdf0e10cSrcweir m_aNFPortNumber.SetModifyHdl(getControlModifiedLink()); 569*cdf0e10cSrcweir m_aEDSocket.SetModifyHdl(getControlModifiedLink()); 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir Window* pWindows[] = { &m_aFTHostname,&m_aEDHostname, 572*cdf0e10cSrcweir &m_aPortNumber,&m_aNFPortNumber,&m_aFTSocket,&m_aEDSocket, 573*cdf0e10cSrcweir &m_aFTDriverClass, &m_aEDDriverClass,&m_aTestJavaDriver, 574*cdf0e10cSrcweir m_pCharsetLabel, m_pCharset}; 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); 577*cdf0e10cSrcweir for (sal_Int32 i=1; i < nCount; ++i) 578*cdf0e10cSrcweir pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND); 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir FreeResource(); 581*cdf0e10cSrcweir } 582*cdf0e10cSrcweir 583*cdf0e10cSrcweir // ----------------------------------------------------------------------- 584*cdf0e10cSrcweir void OGeneralSpecialJDBCDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) 585*cdf0e10cSrcweir { 586*cdf0e10cSrcweir OCommonBehaviourTabPage::fillControls(_rControlList); 587*cdf0e10cSrcweir if ( m_bUseClass ) 588*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDDriverClass)); 589*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname)); 590*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber)); 591*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDSocket)); 592*cdf0e10cSrcweir } 593*cdf0e10cSrcweir // ----------------------------------------------------------------------- 594*cdf0e10cSrcweir void OGeneralSpecialJDBCDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) 595*cdf0e10cSrcweir { 596*cdf0e10cSrcweir OCommonBehaviourTabPage::fillWindows(_rControlList); 597*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname)); 598*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber)); 599*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTSocket)); 600*cdf0e10cSrcweir if ( m_bUseClass ) 601*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass)); 602*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1)); 603*cdf0e10cSrcweir } 604*cdf0e10cSrcweir 605*cdf0e10cSrcweir // ----------------------------------------------------------------------- 606*cdf0e10cSrcweir sal_Bool OGeneralSpecialJDBCDetailsPage::FillItemSet( SfxItemSet& _rSet ) 607*cdf0e10cSrcweir { 608*cdf0e10cSrcweir sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet); 609*cdf0e10cSrcweir if ( m_bUseClass ) 610*cdf0e10cSrcweir fillString(_rSet,&m_aEDDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething); 611*cdf0e10cSrcweir fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething); 612*cdf0e10cSrcweir fillString(_rSet,&m_aEDSocket,DSID_CONN_SOCKET,bChangedSomething); 613*cdf0e10cSrcweir fillInt32(_rSet,&m_aNFPortNumber,m_nPortId,bChangedSomething ); 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir return bChangedSomething; 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir // ----------------------------------------------------------------------- 618*cdf0e10cSrcweir void OGeneralSpecialJDBCDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue) 619*cdf0e10cSrcweir { 620*cdf0e10cSrcweir // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa) 621*cdf0e10cSrcweir sal_Bool bValid, bReadonly; 622*cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly); 623*cdf0e10cSrcweir 624*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True); 625*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True); 626*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, m_nPortId, sal_True); 627*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pSocket, SfxStringItem, DSID_CONN_SOCKET, sal_True); 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir if ( bValid ) 630*cdf0e10cSrcweir { 631*cdf0e10cSrcweir if ( m_bUseClass ) 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir m_aEDDriverClass.SetText(pDrvItem->GetValue()); 634*cdf0e10cSrcweir m_aEDDriverClass.ClearModifyFlag(); 635*cdf0e10cSrcweir } 636*cdf0e10cSrcweir 637*cdf0e10cSrcweir m_aEDHostname.SetText(pHostName->GetValue()); 638*cdf0e10cSrcweir m_aEDHostname.ClearModifyFlag(); 639*cdf0e10cSrcweir 640*cdf0e10cSrcweir m_aNFPortNumber.SetValue(pPortNumber->GetValue()); 641*cdf0e10cSrcweir m_aNFPortNumber.ClearModifyFlag(); 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir m_aEDSocket.SetText(pSocket->GetValue()); 644*cdf0e10cSrcweir m_aEDSocket.ClearModifyFlag(); 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue); 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir // to get the correcxt value when saveValue was called by base class 650*cdf0e10cSrcweir if ( m_bUseClass && !m_aEDDriverClass.GetText().Len() ) 651*cdf0e10cSrcweir { 652*cdf0e10cSrcweir m_aEDDriverClass.SetText(m_sDefaultJdbcDriverName); 653*cdf0e10cSrcweir m_aEDDriverClass.SetModifyFlag(); 654*cdf0e10cSrcweir } 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir // ----------------------------------------------------------------------- 657*cdf0e10cSrcweir IMPL_LINK(OGeneralSpecialJDBCDetailsPage, OnTestJavaClickHdl, PushButton*, /*_pButton*/) 658*cdf0e10cSrcweir { 659*cdf0e10cSrcweir OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF"); 660*cdf0e10cSrcweir OSL_ENSURE(m_bUseClass,"Who called me?"); 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir sal_Bool bSuccess = sal_False; 663*cdf0e10cSrcweir try 664*cdf0e10cSrcweir { 665*cdf0e10cSrcweir if ( m_aEDDriverClass.GetText().Len() ) 666*cdf0e10cSrcweir { 667*cdf0e10cSrcweir // TODO chage jvmaccess 668*cdf0e10cSrcweir ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_pAdminDialog->getORB()); 669*cdf0e10cSrcweir bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aEDDriverClass.GetText()); 670*cdf0e10cSrcweir } 671*cdf0e10cSrcweir } 672*cdf0e10cSrcweir catch(Exception&) 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; 677*cdf0e10cSrcweir OSQLMessageBox aMsg( this, String( ModuleRes( nMessage ) ), String() ); 678*cdf0e10cSrcweir aMsg.Execute(); 679*cdf0e10cSrcweir return 0L; 680*cdf0e10cSrcweir } 681*cdf0e10cSrcweir // ----------------------------------------------------------------------- 682*cdf0e10cSrcweir IMPL_LINK(OGeneralSpecialJDBCDetailsPage, OnEditModified, Edit*, _pEdit) 683*cdf0e10cSrcweir { 684*cdf0e10cSrcweir if ( m_bUseClass && _pEdit == &m_aEDDriverClass ) 685*cdf0e10cSrcweir m_aTestJavaDriver.Enable( m_aEDDriverClass.GetText().Len() != 0 ); 686*cdf0e10cSrcweir 687*cdf0e10cSrcweir // tell the listener we were modified 688*cdf0e10cSrcweir callModifiedHdl(); 689*cdf0e10cSrcweir return 0L; 690*cdf0e10cSrcweir } 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir //======================================================================== 693*cdf0e10cSrcweir //= MySQLNativePage 694*cdf0e10cSrcweir //======================================================================== 695*cdf0e10cSrcweir MySQLNativePage::MySQLNativePage( Window* pParent, const SfxItemSet& _rCoreAttrs ) 696*cdf0e10cSrcweir :OCommonBehaviourTabPage(pParent, PAGE_MYSQL_NATIVE, _rCoreAttrs, CBTP_USE_CHARSET, false ) 697*cdf0e10cSrcweir ,m_aSeparator1 ( this, ModuleRes( FL_SEPARATOR1) ) 698*cdf0e10cSrcweir ,m_aMySQLSettings ( *this, getControlModifiedLink() ) 699*cdf0e10cSrcweir ,m_aSeparator2 ( this, ModuleRes(FL_SEPARATOR2)) 700*cdf0e10cSrcweir ,m_aUserNameLabel ( this, ModuleRes(FT_USERNAME)) 701*cdf0e10cSrcweir ,m_aUserName ( this, ModuleRes(ET_USERNAME)) 702*cdf0e10cSrcweir ,m_aPasswordRequired ( this, ModuleRes(CB_PASSWORD_REQUIRED)) 703*cdf0e10cSrcweir { 704*cdf0e10cSrcweir m_aUserName.SetModifyHdl(getControlModifiedLink()); 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir Window* pWindows[] = { &m_aMySQLSettings, &m_aSeparator2, &m_aUserNameLabel, &m_aUserName, 707*cdf0e10cSrcweir &m_aPasswordRequired, m_pCharsetLabel, m_pCharset}; 708*cdf0e10cSrcweir sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); 709*cdf0e10cSrcweir for (sal_Int32 i=1; i < nCount; ++i) 710*cdf0e10cSrcweir pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND); 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir LayoutHelper::positionBelow( m_aSeparator1, m_aMySQLSettings, RelatedControls, 3 ); 713*cdf0e10cSrcweir m_aMySQLSettings.Show(); 714*cdf0e10cSrcweir 715*cdf0e10cSrcweir FreeResource(); 716*cdf0e10cSrcweir } 717*cdf0e10cSrcweir 718*cdf0e10cSrcweir // ----------------------------------------------------------------------- 719*cdf0e10cSrcweir void MySQLNativePage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) 720*cdf0e10cSrcweir { 721*cdf0e10cSrcweir OCommonBehaviourTabPage::fillControls( _rControlList ); 722*cdf0e10cSrcweir m_aMySQLSettings.fillControls( _rControlList ); 723*cdf0e10cSrcweir 724*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aUserName)); 725*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aPasswordRequired)); 726*cdf0e10cSrcweir } 727*cdf0e10cSrcweir // ----------------------------------------------------------------------- 728*cdf0e10cSrcweir void MySQLNativePage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) 729*cdf0e10cSrcweir { 730*cdf0e10cSrcweir OCommonBehaviourTabPage::fillWindows( _rControlList ); 731*cdf0e10cSrcweir m_aMySQLSettings.fillWindows( _rControlList); 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator1)); 734*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator2)); 735*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aUserNameLabel)); 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir // ----------------------------------------------------------------------- 739*cdf0e10cSrcweir sal_Bool MySQLNativePage::FillItemSet( SfxItemSet& _rSet ) 740*cdf0e10cSrcweir { 741*cdf0e10cSrcweir sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet( _rSet ); 742*cdf0e10cSrcweir 743*cdf0e10cSrcweir bChangedSomething |= m_aMySQLSettings.FillItemSet( _rSet ); 744*cdf0e10cSrcweir 745*cdf0e10cSrcweir if ( m_aUserName.GetText() != m_aUserName.GetSavedValue() ) 746*cdf0e10cSrcweir { 747*cdf0e10cSrcweir _rSet.Put( SfxStringItem( DSID_USER, m_aUserName.GetText() ) ); 748*cdf0e10cSrcweir _rSet.Put( SfxStringItem( DSID_PASSWORD, String())); 749*cdf0e10cSrcweir bChangedSomething = sal_True; 750*cdf0e10cSrcweir } 751*cdf0e10cSrcweir fillBool(_rSet,&m_aPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething); 752*cdf0e10cSrcweir 753*cdf0e10cSrcweir return bChangedSomething; 754*cdf0e10cSrcweir } 755*cdf0e10cSrcweir // ----------------------------------------------------------------------- 756*cdf0e10cSrcweir void MySQLNativePage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue) 757*cdf0e10cSrcweir { 758*cdf0e10cSrcweir // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa) 759*cdf0e10cSrcweir sal_Bool bValid, bReadonly; 760*cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly); 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir m_aMySQLSettings.implInitControls( _rSet ); 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pUidItem, SfxStringItem, DSID_USER, sal_True); 765*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True); 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir if ( bValid ) 768*cdf0e10cSrcweir { 769*cdf0e10cSrcweir m_aUserName.SetText(pUidItem->GetValue()); 770*cdf0e10cSrcweir m_aUserName.ClearModifyFlag(); 771*cdf0e10cSrcweir m_aPasswordRequired.Check(pAllowEmptyPwd->GetValue()); 772*cdf0e10cSrcweir } 773*cdf0e10cSrcweir 774*cdf0e10cSrcweir OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue); 775*cdf0e10cSrcweir } 776*cdf0e10cSrcweir 777*cdf0e10cSrcweir // ----------------------------------------------------------------------- 778*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateMySQLJDBC( Window* pParent, const SfxItemSet& _rAttrSet ) 779*cdf0e10cSrcweir { 780*cdf0e10cSrcweir return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_MYSQL_JDBC, _rAttrSet,DSID_MYSQL_PORTNUMBER ) ); 781*cdf0e10cSrcweir } 782*cdf0e10cSrcweir // ----------------------------------------------------------------------- 783*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateMySQLNATIVE( Window* pParent, const SfxItemSet& _rAttrSet ) 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir return ( new MySQLNativePage( pParent, _rAttrSet ) ); 786*cdf0e10cSrcweir } 787*cdf0e10cSrcweir 788*cdf0e10cSrcweir // ----------------------------------------------------------------------- 789*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateOracleJDBC( Window* pParent, const SfxItemSet& _rAttrSet ) 790*cdf0e10cSrcweir { 791*cdf0e10cSrcweir return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_ORACLE_JDBC, _rAttrSet,DSID_ORACLE_PORTNUMBER) ); 792*cdf0e10cSrcweir } 793*cdf0e10cSrcweir 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir //======================================================================== 796*cdf0e10cSrcweir //= OAdabasDetailsPage 797*cdf0e10cSrcweir //======================================================================== 798*cdf0e10cSrcweir OAdabasDetailsPage::OAdabasDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs ) 799*cdf0e10cSrcweir :OCommonBehaviourTabPage(pParent, PAGE_ADABAS, _rCoreAttrs, CBTP_USE_CHARSET ,false) 800*cdf0e10cSrcweir ,m_aFTHostname (this, ModuleRes(FT_HOSTNAME)) 801*cdf0e10cSrcweir ,m_aEDHostname (this, ModuleRes(ET_HOSTNAME)) 802*cdf0e10cSrcweir ,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) ) 803*cdf0e10cSrcweir ,m_FT_CACHE_SIZE( this, ModuleRes( FT_CACHE_SIZE ) ) 804*cdf0e10cSrcweir ,m_NF_CACHE_SIZE( this, ModuleRes( NF_CACHE_SIZE ) ) 805*cdf0e10cSrcweir ,m_FT_DATA_INCREMENT( this, ModuleRes( FT_DATA_INCREMENT ) ) 806*cdf0e10cSrcweir ,m_NF_DATA_INCREMENT( this, ModuleRes( NF_DATA_INCREMENT ) ) 807*cdf0e10cSrcweir ,m_aFL_2( this, ModuleRes( FL_SEPARATOR2 ) ) 808*cdf0e10cSrcweir ,m_FT_CTRLUSERNAME( this, ModuleRes( FT_CTRLUSERNAME ) ) 809*cdf0e10cSrcweir ,m_ET_CTRLUSERNAME( this, ModuleRes( ET_CTRLUSERNAME ) ) 810*cdf0e10cSrcweir ,m_FT_CTRLPASSWORD( this, ModuleRes( FT_CTRLPASSWORD ) ) 811*cdf0e10cSrcweir ,m_ET_CTRLPASSWORD( this, ModuleRes( ET_CTRLPASSWORD ) ) 812*cdf0e10cSrcweir ,m_CB_SHUTDB( this, ModuleRes( CB_SHUTDB ) ) 813*cdf0e10cSrcweir ,m_PB_STAT( this, ModuleRes( PB_STAT ) ) 814*cdf0e10cSrcweir { 815*cdf0e10cSrcweir m_aEDHostname.SetModifyHdl(getControlModifiedLink()); 816*cdf0e10cSrcweir 817*cdf0e10cSrcweir FreeResource(); 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir m_PB_STAT.SetClickHdl( LINK(this,OAdabasDetailsPage,PBClickHdl)); 820*cdf0e10cSrcweir 821*cdf0e10cSrcweir m_CB_SHUTDB.SetClickHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl)); 822*cdf0e10cSrcweir m_NF_CACHE_SIZE.SetModifyHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl)); 823*cdf0e10cSrcweir m_NF_DATA_INCREMENT.SetModifyHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl)); 824*cdf0e10cSrcweir m_ET_CTRLUSERNAME.SetModifyHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl)); 825*cdf0e10cSrcweir m_ET_CTRLPASSWORD.SetModifyHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl)); 826*cdf0e10cSrcweir 827*cdf0e10cSrcweir m_ET_CTRLUSERNAME.SetLoseFocusHdl( LINK(this,OAdabasDetailsPage,LoseFocusHdl)); 828*cdf0e10cSrcweir m_ET_CTRLPASSWORD.SetLoseFocusHdl( LINK(this,OAdabasDetailsPage,LoseFocusHdl)); 829*cdf0e10cSrcweir 830*cdf0e10cSrcweir m_NF_DATA_INCREMENT.SetMin(20); 831*cdf0e10cSrcweir m_NF_DATA_INCREMENT.SetMax(LONG_MAX); 832*cdf0e10cSrcweir m_NF_DATA_INCREMENT.SetValue(20); 833*cdf0e10cSrcweir m_NF_DATA_INCREMENT.SetDecimalDigits(0); 834*cdf0e10cSrcweir 835*cdf0e10cSrcweir m_NF_CACHE_SIZE.SetMin(4); 836*cdf0e10cSrcweir m_NF_CACHE_SIZE.SetMax(LONG_MAX); 837*cdf0e10cSrcweir m_NF_CACHE_SIZE.SetValue(4); 838*cdf0e10cSrcweir m_NF_CACHE_SIZE.SetDecimalDigits(0); 839*cdf0e10cSrcweir 840*cdf0e10cSrcweir Window* pWindows[] = { &m_aFTHostname,&m_aEDHostname 841*cdf0e10cSrcweir ,&m_FT_CACHE_SIZE,&m_NF_CACHE_SIZE 842*cdf0e10cSrcweir ,&m_FT_DATA_INCREMENT,&m_NF_DATA_INCREMENT 843*cdf0e10cSrcweir ,&m_FT_CTRLUSERNAME,&m_ET_CTRLUSERNAME 844*cdf0e10cSrcweir ,&m_FT_CTRLPASSWORD,&m_ET_CTRLPASSWORD 845*cdf0e10cSrcweir ,&m_CB_SHUTDB 846*cdf0e10cSrcweir ,m_pCharsetLabel, m_pCharset,&m_PB_STAT}; 847*cdf0e10cSrcweir 848*cdf0e10cSrcweir sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); 849*cdf0e10cSrcweir for (sal_Int32 i=1; i < nCount; ++i) 850*cdf0e10cSrcweir pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND); 851*cdf0e10cSrcweir } 852*cdf0e10cSrcweir 853*cdf0e10cSrcweir // ----------------------------------------------------------------------- 854*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateAdabas( Window* pParent, const SfxItemSet& _rAttrSet ) 855*cdf0e10cSrcweir { 856*cdf0e10cSrcweir return ( new OAdabasDetailsPage( pParent, _rAttrSet ) ); 857*cdf0e10cSrcweir } 858*cdf0e10cSrcweir 859*cdf0e10cSrcweir // ----------------------------------------------------------------------- 860*cdf0e10cSrcweir void OAdabasDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) 861*cdf0e10cSrcweir { 862*cdf0e10cSrcweir OCommonBehaviourTabPage::fillControls(_rControlList); 863*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname)); 864*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_NF_CACHE_SIZE)); 865*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_NF_DATA_INCREMENT)); 866*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_ET_CTRLUSERNAME)); 867*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_ET_CTRLPASSWORD)); 868*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_CB_SHUTDB)); 869*cdf0e10cSrcweir } 870*cdf0e10cSrcweir // ----------------------------------------------------------------------- 871*cdf0e10cSrcweir void OAdabasDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) 872*cdf0e10cSrcweir { 873*cdf0e10cSrcweir OCommonBehaviourTabPage::fillWindows(_rControlList); 874*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname)); 875*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1)); 876*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_CACHE_SIZE)); 877*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_DATA_INCREMENT)); 878*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_2)); 879*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_CTRLUSERNAME)); 880*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_CTRLPASSWORD)); 881*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<PushButton>(&m_PB_STAT)); 882*cdf0e10cSrcweir } 883*cdf0e10cSrcweir // ----------------------------------------------------------------------- 884*cdf0e10cSrcweir void OAdabasDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue) 885*cdf0e10cSrcweir { 886*cdf0e10cSrcweir // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa) 887*cdf0e10cSrcweir sal_Bool bValid, bReadonly; 888*cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly); 889*cdf0e10cSrcweir 890*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True); 891*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pCtrlUserItem, SfxStringItem, DSID_CONN_CTRLUSER, sal_True); 892*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pCtrlPwdItem, SfxStringItem, DSID_CONN_CTRLPWD, sal_True); 893*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pShutItem, SfxBoolItem, DSID_CONN_SHUTSERVICE, sal_True); 894*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pIncItem, SfxInt32Item, DSID_CONN_DATAINC, sal_True); 895*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pCacheItem, SfxInt32Item, DSID_CONN_CACHESIZE, sal_True); 896*cdf0e10cSrcweir if ( bValid ) 897*cdf0e10cSrcweir { 898*cdf0e10cSrcweir m_aEDHostname.SetText(pHostName->GetValue()); 899*cdf0e10cSrcweir m_aEDHostname.ClearModifyFlag(); 900*cdf0e10cSrcweir m_CB_SHUTDB.Check( pShutItem->GetValue() ); 901*cdf0e10cSrcweir m_NF_DATA_INCREMENT.SetValue( pIncItem->GetValue() ); 902*cdf0e10cSrcweir m_NF_CACHE_SIZE.SetValue( pCacheItem->GetValue() ); 903*cdf0e10cSrcweir m_ET_CTRLUSERNAME.SetText(pCtrlUserItem->GetValue()); 904*cdf0e10cSrcweir m_ET_CTRLPASSWORD.SetText(pCtrlPwdItem->GetValue()); 905*cdf0e10cSrcweir m_CB_SHUTDB.Enable(m_ET_CTRLUSERNAME.GetText().Len() && m_ET_CTRLPASSWORD.GetText().Len()); 906*cdf0e10cSrcweir } 907*cdf0e10cSrcweir 908*cdf0e10cSrcweir OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue); 909*cdf0e10cSrcweir } 910*cdf0e10cSrcweir // ----------------------------------------------------------------------- 911*cdf0e10cSrcweir sal_Bool OAdabasDetailsPage::FillItemSet( SfxItemSet& _rSet ) 912*cdf0e10cSrcweir { 913*cdf0e10cSrcweir sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet); 914*cdf0e10cSrcweir 915*cdf0e10cSrcweir fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething); 916*cdf0e10cSrcweir fillBool(_rSet,&m_CB_SHUTDB,DSID_CONN_SHUTSERVICE,bChangedSomething); 917*cdf0e10cSrcweir fillInt32(_rSet,&m_NF_DATA_INCREMENT,DSID_CONN_DATAINC,bChangedSomething ); 918*cdf0e10cSrcweir fillInt32(_rSet,&m_NF_CACHE_SIZE,DSID_CONN_CACHESIZE,bChangedSomething ); 919*cdf0e10cSrcweir fillString(_rSet,&m_ET_CTRLUSERNAME,DSID_CONN_CTRLUSER,bChangedSomething ); 920*cdf0e10cSrcweir fillString(_rSet,&m_ET_CTRLPASSWORD,DSID_CONN_CTRLPWD,bChangedSomething ); 921*cdf0e10cSrcweir 922*cdf0e10cSrcweir return bChangedSomething; 923*cdf0e10cSrcweir } 924*cdf0e10cSrcweir //------------------------------------------------------------------------ 925*cdf0e10cSrcweir IMPL_LINK( OAdabasDetailsPage, AttributesChangedHdl, void *, EMPTYARG ) 926*cdf0e10cSrcweir { 927*cdf0e10cSrcweir m_CB_SHUTDB.Enable(m_ET_CTRLUSERNAME.GetText().Len() && m_ET_CTRLPASSWORD.GetText().Len()); 928*cdf0e10cSrcweir bAttrsChanged = sal_True; 929*cdf0e10cSrcweir callModifiedHdl(); 930*cdf0e10cSrcweir return 0; 931*cdf0e10cSrcweir } 932*cdf0e10cSrcweir //------------------------------------------------------------------------ 933*cdf0e10cSrcweir IMPL_LINK( OAdabasDetailsPage, LoseFocusHdl, Edit *, /*pEdit*/ ) 934*cdf0e10cSrcweir { 935*cdf0e10cSrcweir m_CB_SHUTDB.Enable(m_ET_CTRLUSERNAME.GetText().Len() && m_ET_CTRLPASSWORD.GetText().Len()); 936*cdf0e10cSrcweir return 0; 937*cdf0e10cSrcweir } 938*cdf0e10cSrcweir //------------------------------------------------------------------------ 939*cdf0e10cSrcweir IMPL_LINK( OAdabasDetailsPage, PBClickHdl, Button *, /*pButton*/ ) 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF"); 942*cdf0e10cSrcweir if ( m_pAdminDialog ) 943*cdf0e10cSrcweir { 944*cdf0e10cSrcweir m_pAdminDialog->saveDatasource(); 945*cdf0e10cSrcweir try 946*cdf0e10cSrcweir { 947*cdf0e10cSrcweir Reference< XConnection > xConnection = m_pAdminDialog->createConnection().first; 948*cdf0e10cSrcweir if ( xConnection.is() ) 949*cdf0e10cSrcweir { 950*cdf0e10cSrcweir OAdabasStatistics aDlg(this,m_sUser,xConnection,m_pAdminDialog->getORB()); 951*cdf0e10cSrcweir aDlg.Execute(); 952*cdf0e10cSrcweir ::comphelper::disposeComponent(xConnection); 953*cdf0e10cSrcweir } 954*cdf0e10cSrcweir } 955*cdf0e10cSrcweir catch(Exception&) 956*cdf0e10cSrcweir { 957*cdf0e10cSrcweir } 958*cdf0e10cSrcweir } 959*cdf0e10cSrcweir 960*cdf0e10cSrcweir return 0; 961*cdf0e10cSrcweir } 962*cdf0e10cSrcweir 963*cdf0e10cSrcweir 964*cdf0e10cSrcweir //======================================================================== 965*cdf0e10cSrcweir //= OLDAPDetailsPage 966*cdf0e10cSrcweir //======================================================================== 967*cdf0e10cSrcweir OLDAPDetailsPage::OLDAPDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs ) 968*cdf0e10cSrcweir :OCommonBehaviourTabPage(pParent, PAGE_LDAP, _rCoreAttrs,0,false) 969*cdf0e10cSrcweir ,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) ) 970*cdf0e10cSrcweir ,m_aBaseDN (this, ModuleRes(FT_BASEDN)) 971*cdf0e10cSrcweir ,m_aETBaseDN (this, ModuleRes(ET_BASEDN)) 972*cdf0e10cSrcweir ,m_aCBUseSSL (this, ModuleRes(CB_USESSL)) 973*cdf0e10cSrcweir ,m_aPortNumber (this, ModuleRes(FT_PORTNUMBER)) 974*cdf0e10cSrcweir ,m_aNFPortNumber (this, ModuleRes(NF_PORTNUMBER)) 975*cdf0e10cSrcweir ,m_aFTRowCount (this, ModuleRes(FT_LDAPROWCOUNT)) 976*cdf0e10cSrcweir ,m_aNFRowCount (this, ModuleRes(NF_LDAPROWCOUNT)) 977*cdf0e10cSrcweir { 978*cdf0e10cSrcweir m_aETBaseDN.SetModifyHdl(getControlModifiedLink()); 979*cdf0e10cSrcweir m_aCBUseSSL.SetToggleHdl(getControlModifiedLink()); 980*cdf0e10cSrcweir m_aNFPortNumber.SetModifyHdl(getControlModifiedLink()); 981*cdf0e10cSrcweir m_aNFRowCount.SetModifyHdl(getControlModifiedLink()); 982*cdf0e10cSrcweir 983*cdf0e10cSrcweir m_aNFRowCount.SetUseThousandSep(sal_False); 984*cdf0e10cSrcweir m_iNormalPort = 389; 985*cdf0e10cSrcweir m_iSSLPort = 636; 986*cdf0e10cSrcweir m_aCBUseSSL.SetClickHdl(LINK(this, OLDAPDetailsPage,OnCheckBoxClick)); 987*cdf0e10cSrcweir FreeResource(); 988*cdf0e10cSrcweir } 989*cdf0e10cSrcweir 990*cdf0e10cSrcweir // ----------------------------------------------------------------------- 991*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateLDAP( Window* pParent, const SfxItemSet& _rAttrSet ) 992*cdf0e10cSrcweir { 993*cdf0e10cSrcweir return ( new OLDAPDetailsPage( pParent, _rAttrSet ) ); 994*cdf0e10cSrcweir } 995*cdf0e10cSrcweir 996*cdf0e10cSrcweir // ----------------------------------------------------------------------- 997*cdf0e10cSrcweir sal_Bool OLDAPDetailsPage::FillItemSet( SfxItemSet& _rSet ) 998*cdf0e10cSrcweir { 999*cdf0e10cSrcweir sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet); 1000*cdf0e10cSrcweir 1001*cdf0e10cSrcweir fillString(_rSet,&m_aETBaseDN,DSID_CONN_LDAP_BASEDN,bChangedSomething); 1002*cdf0e10cSrcweir fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_LDAP_PORTNUMBER,bChangedSomething); 1003*cdf0e10cSrcweir fillInt32(_rSet,&m_aNFRowCount,DSID_CONN_LDAP_ROWCOUNT,bChangedSomething); 1004*cdf0e10cSrcweir fillBool(_rSet,&m_aCBUseSSL,DSID_CONN_LDAP_USESSL,bChangedSomething); 1005*cdf0e10cSrcweir return bChangedSomething; 1006*cdf0e10cSrcweir } 1007*cdf0e10cSrcweir //------------------------------------------------------------------------ 1008*cdf0e10cSrcweir IMPL_LINK( OLDAPDetailsPage, OnCheckBoxClick, CheckBox*, pCheckBox ) 1009*cdf0e10cSrcweir { 1010*cdf0e10cSrcweir callModifiedHdl(); 1011*cdf0e10cSrcweir if ( pCheckBox == &m_aCBUseSSL) 1012*cdf0e10cSrcweir { 1013*cdf0e10cSrcweir if ( m_aCBUseSSL.IsChecked() ) 1014*cdf0e10cSrcweir { 1015*cdf0e10cSrcweir m_iNormalPort = static_cast<sal_Int32>(m_aNFPortNumber.GetValue()); 1016*cdf0e10cSrcweir m_aNFPortNumber.SetValue(m_iSSLPort); 1017*cdf0e10cSrcweir } 1018*cdf0e10cSrcweir else 1019*cdf0e10cSrcweir { 1020*cdf0e10cSrcweir m_iSSLPort = static_cast<sal_Int32>(m_aNFPortNumber.GetValue()); 1021*cdf0e10cSrcweir m_aNFPortNumber.SetValue(m_iNormalPort); 1022*cdf0e10cSrcweir } 1023*cdf0e10cSrcweir } 1024*cdf0e10cSrcweir return 0; 1025*cdf0e10cSrcweir } 1026*cdf0e10cSrcweir 1027*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1028*cdf0e10cSrcweir void OLDAPDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) 1029*cdf0e10cSrcweir { 1030*cdf0e10cSrcweir OCommonBehaviourTabPage::fillControls(_rControlList); 1031*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETBaseDN)); 1032*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBUseSSL)); 1033*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber)); 1034*cdf0e10cSrcweir _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFRowCount)); 1035*cdf0e10cSrcweir } 1036*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1037*cdf0e10cSrcweir void OLDAPDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) 1038*cdf0e10cSrcweir { 1039*cdf0e10cSrcweir OCommonBehaviourTabPage::fillWindows(_rControlList); 1040*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aBaseDN)); 1041*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber)); 1042*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTRowCount)); 1043*cdf0e10cSrcweir _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1)); 1044*cdf0e10cSrcweir } 1045*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1046*cdf0e10cSrcweir void OLDAPDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue) 1047*cdf0e10cSrcweir { 1048*cdf0e10cSrcweir // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa) 1049*cdf0e10cSrcweir sal_Bool bValid, bReadonly; 1050*cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly); 1051*cdf0e10cSrcweir 1052*cdf0e10cSrcweir 1053*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pBaseDN, SfxStringItem, DSID_CONN_LDAP_BASEDN, sal_True); 1054*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pUseSSL, SfxBoolItem, DSID_CONN_LDAP_USESSL, sal_True); 1055*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_LDAP_PORTNUMBER, sal_True); 1056*cdf0e10cSrcweir SFX_ITEMSET_GET(_rSet, pRowCount, SfxInt32Item, DSID_CONN_LDAP_ROWCOUNT, sal_True); 1057*cdf0e10cSrcweir 1058*cdf0e10cSrcweir if ( bValid ) 1059*cdf0e10cSrcweir { 1060*cdf0e10cSrcweir m_aETBaseDN.SetText(pBaseDN->GetValue()); 1061*cdf0e10cSrcweir m_aNFPortNumber.SetValue(pPortNumber->GetValue()); 1062*cdf0e10cSrcweir m_aNFRowCount.SetValue(pRowCount->GetValue()); 1063*cdf0e10cSrcweir m_aCBUseSSL.Check(pUseSSL->GetValue()); 1064*cdf0e10cSrcweir } 1065*cdf0e10cSrcweir 1066*cdf0e10cSrcweir OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue); 1067*cdf0e10cSrcweir } 1068*cdf0e10cSrcweir 1069*cdf0e10cSrcweir 1070*cdf0e10cSrcweir //======================================================================== 1071*cdf0e10cSrcweir //= OTextDetailsPage 1072*cdf0e10cSrcweir //======================================================================== 1073*cdf0e10cSrcweir DBG_NAME(OTextDetailsPage) 1074*cdf0e10cSrcweir //------------------------------------------------------------------------ 1075*cdf0e10cSrcweir OTextDetailsPage::OTextDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs ) 1076*cdf0e10cSrcweir :OCommonBehaviourTabPage(pParent, PAGE_TEXT, _rCoreAttrs, 0, false ) 1077*cdf0e10cSrcweir { 1078*cdf0e10cSrcweir DBG_CTOR(OTextDetailsPage,NULL); 1079*cdf0e10cSrcweir 1080*cdf0e10cSrcweir m_pTextConnectionHelper = new OTextConnectionHelper( this, TC_EXTENSION | TC_HEADER | TC_SEPARATORS | TC_CHARSET ); 1081*cdf0e10cSrcweir FreeResource(); 1082*cdf0e10cSrcweir } 1083*cdf0e10cSrcweir 1084*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1085*cdf0e10cSrcweir OTextDetailsPage::~OTextDetailsPage() 1086*cdf0e10cSrcweir { 1087*cdf0e10cSrcweir DELETEZ(m_pTextConnectionHelper); 1088*cdf0e10cSrcweir 1089*cdf0e10cSrcweir DBG_DTOR(OTextDetailsPage,NULL); 1090*cdf0e10cSrcweir } 1091*cdf0e10cSrcweir 1092*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1093*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateText( Window* pParent, const SfxItemSet& _rAttrSet ) 1094*cdf0e10cSrcweir { 1095*cdf0e10cSrcweir return ( new OTextDetailsPage( pParent, _rAttrSet ) ); 1096*cdf0e10cSrcweir } 1097*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1098*cdf0e10cSrcweir void OTextDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) 1099*cdf0e10cSrcweir { 1100*cdf0e10cSrcweir OCommonBehaviourTabPage::fillControls(_rControlList); 1101*cdf0e10cSrcweir m_pTextConnectionHelper->fillControls(_rControlList); 1102*cdf0e10cSrcweir 1103*cdf0e10cSrcweir } 1104*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1105*cdf0e10cSrcweir void OTextDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList) 1106*cdf0e10cSrcweir { 1107*cdf0e10cSrcweir OCommonBehaviourTabPage::fillWindows(_rControlList); 1108*cdf0e10cSrcweir m_pTextConnectionHelper->fillWindows(_rControlList); 1109*cdf0e10cSrcweir 1110*cdf0e10cSrcweir } 1111*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1112*cdf0e10cSrcweir void OTextDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue) 1113*cdf0e10cSrcweir { 1114*cdf0e10cSrcweir // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa) 1115*cdf0e10cSrcweir sal_Bool bValid, bReadonly; 1116*cdf0e10cSrcweir getFlags(_rSet, bValid, bReadonly); 1117*cdf0e10cSrcweir 1118*cdf0e10cSrcweir m_pTextConnectionHelper->implInitControls(_rSet, bValid); 1119*cdf0e10cSrcweir OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue); 1120*cdf0e10cSrcweir } 1121*cdf0e10cSrcweir 1122*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1123*cdf0e10cSrcweir sal_Bool OTextDetailsPage::FillItemSet( SfxItemSet& rSet ) 1124*cdf0e10cSrcweir { 1125*cdf0e10cSrcweir sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(rSet); 1126*cdf0e10cSrcweir bChangedSomething = m_pTextConnectionHelper->FillItemSet(rSet, bChangedSomething); 1127*cdf0e10cSrcweir return bChangedSomething; 1128*cdf0e10cSrcweir } 1129*cdf0e10cSrcweir 1130*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1131*cdf0e10cSrcweir sal_Bool OTextDetailsPage::prepareLeave() 1132*cdf0e10cSrcweir { 1133*cdf0e10cSrcweir return m_pTextConnectionHelper->prepareLeave(); 1134*cdf0e10cSrcweir } 1135*cdf0e10cSrcweir 1136*cdf0e10cSrcweir //------------------------------------------------------------------------ 1137*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateGeneratedValuesPage( Window* _pParent, const SfxItemSet& _rAttrSet ) 1138*cdf0e10cSrcweir { 1139*cdf0e10cSrcweir return new GeneratedValuesPage( _pParent, _rAttrSet ); 1140*cdf0e10cSrcweir } 1141*cdf0e10cSrcweir 1142*cdf0e10cSrcweir //------------------------------------------------------------------------ 1143*cdf0e10cSrcweir SfxTabPage* ODriversSettings::CreateSpecialSettingsPage( Window* _pParent, const SfxItemSet& _rAttrSet ) 1144*cdf0e10cSrcweir { 1145*cdf0e10cSrcweir ::rtl::OUString eType = ODbDataSourceAdministrationHelper::getDatasourceType( _rAttrSet ); 1146*cdf0e10cSrcweir DataSourceMetaData aMetaData( eType ); 1147*cdf0e10cSrcweir return new SpecialSettingsPage( _pParent, _rAttrSet, aMetaData ); 1148*cdf0e10cSrcweir } 1149*cdf0e10cSrcweir //......................................................................... 1150*cdf0e10cSrcweir } // namespace dbaui 1151*cdf0e10cSrcweir //......................................................................... 1152