1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef DBAUI_CONNECTIONHELPER_HXX 25*b1cdbd2cSJim Jagielski #define DBAUI_CONNECTIONHELPER_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #ifndef _DBAUI_ADMINPAGES_HXX_ 28*b1cdbd2cSJim Jagielski #include "adminpages.hxx" 29*b1cdbd2cSJim Jagielski #endif 30*b1cdbd2cSJim Jagielski #ifndef _UCBHELPER_CONTENT_HXX 31*b1cdbd2cSJim Jagielski #include <ucbhelper/content.hxx> 32*b1cdbd2cSJim Jagielski #endif 33*b1cdbd2cSJim Jagielski #ifndef _DBAUI_CURLEDIT_HXX_ 34*b1cdbd2cSJim Jagielski #include "curledit.hxx" 35*b1cdbd2cSJim Jagielski #endif 36*b1cdbd2cSJim Jagielski #ifndef _SFX_FILEDLGHELPER_HXX 37*b1cdbd2cSJim Jagielski #include <sfx2/filedlghelper.hxx> 38*b1cdbd2cSJim Jagielski #endif 39*b1cdbd2cSJim Jagielski 40*b1cdbd2cSJim Jagielski 41*b1cdbd2cSJim Jagielski #define FILL_STRING_ITEM(editcontrol, itemset, itemid, modifiedflag) \ 42*b1cdbd2cSJim Jagielski if (editcontrol.GetText() != editcontrol.GetSavedValue()) \ 43*b1cdbd2cSJim Jagielski { \ 44*b1cdbd2cSJim Jagielski itemset.Put(SfxStringItem(itemid, editcontrol.GetText())); \ 45*b1cdbd2cSJim Jagielski modifiedflag = sal_True; \ 46*b1cdbd2cSJim Jagielski } 47*b1cdbd2cSJim Jagielski 48*b1cdbd2cSJim Jagielski //......................................................................... 49*b1cdbd2cSJim Jagielski namespace dbaui 50*b1cdbd2cSJim Jagielski { 51*b1cdbd2cSJim Jagielski //......................................................................... 52*b1cdbd2cSJim Jagielski 53*b1cdbd2cSJim Jagielski // #106016# -------------- 54*b1cdbd2cSJim Jagielski enum IS_PATH_EXIST 55*b1cdbd2cSJim Jagielski { 56*b1cdbd2cSJim Jagielski PATH_NOT_EXIST = 0, 57*b1cdbd2cSJim Jagielski PATH_EXIST, 58*b1cdbd2cSJim Jagielski PATH_NOT_KNOWN 59*b1cdbd2cSJim Jagielski }; 60*b1cdbd2cSJim Jagielski 61*b1cdbd2cSJim Jagielski class IDatabaseSettingsDialog; 62*b1cdbd2cSJim Jagielski 63*b1cdbd2cSJim Jagielski class OConnectionHelper : public OGenericAdministrationPage 64*b1cdbd2cSJim Jagielski { 65*b1cdbd2cSJim Jagielski sal_Bool m_bUserGrabFocus : 1; 66*b1cdbd2cSJim Jagielski 67*b1cdbd2cSJim Jagielski public: 68*b1cdbd2cSJim Jagielski OConnectionHelper( Window* pParent, const ResId& _rId, const SfxItemSet& _rCoreAttrs); 69*b1cdbd2cSJim Jagielski virtual ~OConnectionHelper(); 70*b1cdbd2cSJim Jagielski FixedText m_aFT_Connection; 71*b1cdbd2cSJim Jagielski OConnectionURLEdit m_aConnectionURL; 72*b1cdbd2cSJim Jagielski PushButton m_aPB_Connection; 73*b1cdbd2cSJim Jagielski ::rtl::OUString m_eType; // the type can't be changed in this class, so we hold it as member. 74*b1cdbd2cSJim Jagielski 75*b1cdbd2cSJim Jagielski public: 76*b1cdbd2cSJim Jagielski 77*b1cdbd2cSJim Jagielski // setting/retrieving the current connection URL 78*b1cdbd2cSJim Jagielski // necessary because for some types, the URL must be decoded for display purposes 79*b1cdbd2cSJim Jagielski ::dbaccess::ODsnTypeCollection* m_pCollection; /// the DSN type collection instance 80*b1cdbd2cSJim Jagielski virtual long PreNotify( NotifyEvent& _rNEvt ); 81*b1cdbd2cSJim Jagielski 82*b1cdbd2cSJim Jagielski // <method>OGenericAdministrationPage::fillControls</method> 83*b1cdbd2cSJim Jagielski virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList); 84*b1cdbd2cSJim Jagielski // <method>OGenericAdministrationPage::fillWindows</method> 85*b1cdbd2cSJim Jagielski virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList); 86*b1cdbd2cSJim Jagielski virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue); 87*b1cdbd2cSJim Jagielski 88*b1cdbd2cSJim Jagielski 89*b1cdbd2cSJim Jagielski // setting/retrieving the current connection URL 90*b1cdbd2cSJim Jagielski // necessary because for some types, the URL must be decoded for display purposes 91*b1cdbd2cSJim Jagielski //String getURL( OConnectionURLEdit* _m_pConnection ) const; 92*b1cdbd2cSJim Jagielski //void setURL( const String& _rURL, OConnectionURLEdit* _m_pConnection ); 93*b1cdbd2cSJim Jagielski 94*b1cdbd2cSJim Jagielski String getURLNoPrefix( ) const; 95*b1cdbd2cSJim Jagielski void setURLNoPrefix( const String& _rURL ); 96*b1cdbd2cSJim Jagielski 97*b1cdbd2cSJim Jagielski /** checks if the path is existence 98*b1cdbd2cSJim Jagielski @param _rURL 99*b1cdbd2cSJim Jagielski The URL to check. 100*b1cdbd2cSJim Jagielski */ 101*b1cdbd2cSJim Jagielski sal_Int32 checkPathExistence(const String& _rURL); 102*b1cdbd2cSJim Jagielski 103*b1cdbd2cSJim Jagielski 104*b1cdbd2cSJim Jagielski IS_PATH_EXIST pathExists(const ::rtl::OUString& _rURL, sal_Bool bIsFile) const; 105*b1cdbd2cSJim Jagielski sal_Bool createDirectoryDeep(const String& _rPathNormalized); 106*b1cdbd2cSJim Jagielski sal_Bool commitURL(); 107*b1cdbd2cSJim Jagielski 108*b1cdbd2cSJim Jagielski /** opens the FileOpen dialog and asks for a FileName 109*b1cdbd2cSJim Jagielski @param _aFileOpen 110*b1cdbd2cSJim Jagielski Executes the file open dialog, which must be filled from caller. 111*b1cdbd2cSJim Jagielski */ 112*b1cdbd2cSJim Jagielski void askForFileName(::sfx2::FileDialogHelper& _aFileOpen); 113*b1cdbd2cSJim Jagielski SetServiceFactory(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> _rxORB)114*b1cdbd2cSJim Jagielski virtual void SetServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB) 115*b1cdbd2cSJim Jagielski { 116*b1cdbd2cSJim Jagielski OGenericAdministrationPage::SetServiceFactory(_rxORB); 117*b1cdbd2cSJim Jagielski } 118*b1cdbd2cSJim Jagielski 119*b1cdbd2cSJim Jagielski protected: 120*b1cdbd2cSJim Jagielski void setURL( const String& _rURL ); 121*b1cdbd2cSJim Jagielski virtual bool checkTestConnection(); 122*b1cdbd2cSJim Jagielski 123*b1cdbd2cSJim Jagielski private: 124*b1cdbd2cSJim Jagielski DECL_LINK(OnBrowseConnections, PushButton*); 125*b1cdbd2cSJim Jagielski StringBag getInstalledAdabasDBDirs(const String &_rPath,const ::ucbhelper::ResultSetInclude& _reResultSetInclude); 126*b1cdbd2cSJim Jagielski StringBag getInstalledAdabasDBs(const String &_rConfigDir,const String &_rWorkDir); 127*b1cdbd2cSJim Jagielski String impl_getURL( sal_Bool _bPrefix ) const; 128*b1cdbd2cSJim Jagielski void impl_setURL( const String& _rURL, sal_Bool _bPrefix ); 129*b1cdbd2cSJim Jagielski void implUpdateURLDependentStates() const; 130*b1cdbd2cSJim Jagielski }; 131*b1cdbd2cSJim Jagielski 132*b1cdbd2cSJim Jagielski //......................................................................... 133*b1cdbd2cSJim Jagielski } // namespace dbaui 134*b1cdbd2cSJim Jagielski //......................................................................... 135*b1cdbd2cSJim Jagielski 136*b1cdbd2cSJim Jagielski #endif // DBAUI_CONNECTIONHELPER_HXX 137