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 #ifndef DBAUI_CONNECTIONHELPER_HXX 29*cdf0e10cSrcweir #define DBAUI_CONNECTIONHELPER_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifndef _DBAUI_ADMINPAGES_HXX_ 32*cdf0e10cSrcweir #include "adminpages.hxx" 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir #ifndef _UCBHELPER_CONTENT_HXX 35*cdf0e10cSrcweir #include <ucbhelper/content.hxx> 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #ifndef _DBAUI_CURLEDIT_HXX_ 38*cdf0e10cSrcweir #include "curledit.hxx" 39*cdf0e10cSrcweir #endif 40*cdf0e10cSrcweir #ifndef _SFX_FILEDLGHELPER_HXX 41*cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx> 42*cdf0e10cSrcweir #endif 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #define FILL_STRING_ITEM(editcontrol, itemset, itemid, modifiedflag) \ 46*cdf0e10cSrcweir if (editcontrol.GetText() != editcontrol.GetSavedValue()) \ 47*cdf0e10cSrcweir { \ 48*cdf0e10cSrcweir itemset.Put(SfxStringItem(itemid, editcontrol.GetText())); \ 49*cdf0e10cSrcweir modifiedflag = sal_True; \ 50*cdf0e10cSrcweir } 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir //......................................................................... 53*cdf0e10cSrcweir namespace dbaui 54*cdf0e10cSrcweir { 55*cdf0e10cSrcweir //......................................................................... 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir // #106016# -------------- 58*cdf0e10cSrcweir enum IS_PATH_EXIST 59*cdf0e10cSrcweir { 60*cdf0e10cSrcweir PATH_NOT_EXIST = 0, 61*cdf0e10cSrcweir PATH_EXIST, 62*cdf0e10cSrcweir PATH_NOT_KNOWN 63*cdf0e10cSrcweir }; 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir class IDatabaseSettingsDialog; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir class OConnectionHelper : public OGenericAdministrationPage 68*cdf0e10cSrcweir { 69*cdf0e10cSrcweir sal_Bool m_bUserGrabFocus : 1; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir public: 72*cdf0e10cSrcweir OConnectionHelper( Window* pParent, const ResId& _rId, const SfxItemSet& _rCoreAttrs); 73*cdf0e10cSrcweir virtual ~OConnectionHelper(); 74*cdf0e10cSrcweir FixedText m_aFT_Connection; 75*cdf0e10cSrcweir OConnectionURLEdit m_aConnectionURL; 76*cdf0e10cSrcweir PushButton m_aPB_Connection; 77*cdf0e10cSrcweir ::rtl::OUString m_eType; // the type can't be changed in this class, so we hold it as member. 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir public: 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir // setting/retrieving the current connection URL 82*cdf0e10cSrcweir // necessary because for some types, the URL must be decoded for display purposes 83*cdf0e10cSrcweir ::dbaccess::ODsnTypeCollection* m_pCollection; /// the DSN type collection instance 84*cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& _rNEvt ); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir // <method>OGenericAdministrationPage::fillControls</method> 87*cdf0e10cSrcweir virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); 88*cdf0e10cSrcweir // <method>OGenericAdministrationPage::fillWindows</method> 89*cdf0e10cSrcweir virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); 90*cdf0e10cSrcweir virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir // setting/retrieving the current connection URL 94*cdf0e10cSrcweir // necessary because for some types, the URL must be decoded for display purposes 95*cdf0e10cSrcweir //String getURL( OConnectionURLEdit* _m_pConnection ) const; 96*cdf0e10cSrcweir //void setURL( const String& _rURL, OConnectionURLEdit* _m_pConnection ); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir String getURLNoPrefix( ) const; 99*cdf0e10cSrcweir void setURLNoPrefix( const String& _rURL ); 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir /** checks if the path is existence 102*cdf0e10cSrcweir @param _rURL 103*cdf0e10cSrcweir The URL to check. 104*cdf0e10cSrcweir */ 105*cdf0e10cSrcweir sal_Int32 checkPathExistence(const String& _rURL); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir IS_PATH_EXIST pathExists(const ::rtl::OUString& _rURL, sal_Bool bIsFile) const; 109*cdf0e10cSrcweir sal_Bool createDirectoryDeep(const String& _rPathNormalized); 110*cdf0e10cSrcweir sal_Bool commitURL(); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir /** opens the FileOpen dialog and asks for a FileName 113*cdf0e10cSrcweir @param _aFileOpen 114*cdf0e10cSrcweir Executes the file open dialog, which must be filled from caller. 115*cdf0e10cSrcweir */ 116*cdf0e10cSrcweir void askForFileName(::sfx2::FileDialogHelper& _aFileOpen); 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir virtual void SetServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir OGenericAdministrationPage::SetServiceFactory(_rxORB); 121*cdf0e10cSrcweir } 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir protected: 124*cdf0e10cSrcweir void setURL( const String& _rURL ); 125*cdf0e10cSrcweir virtual bool checkTestConnection(); 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir private: 128*cdf0e10cSrcweir DECL_LINK(OnBrowseConnections, PushButton*); 129*cdf0e10cSrcweir StringBag getInstalledAdabasDBDirs(const String &_rPath,const ::ucbhelper::ResultSetInclude& _reResultSetInclude); 130*cdf0e10cSrcweir StringBag getInstalledAdabasDBs(const String &_rConfigDir,const String &_rWorkDir); 131*cdf0e10cSrcweir String impl_getURL( sal_Bool _bPrefix ) const; 132*cdf0e10cSrcweir void impl_setURL( const String& _rURL, sal_Bool _bPrefix ); 133*cdf0e10cSrcweir void implUpdateURLDependentStates() const; 134*cdf0e10cSrcweir }; 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir //......................................................................... 137*cdf0e10cSrcweir } // namespace dbaui 138*cdf0e10cSrcweir //......................................................................... 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir #endif // DBAUI_CONNECTIONHELPER_HXX 141