Update ooo320-m1
[ooovba.git] / dbaccess / source / ui / dlg / ConnectionHelper.hxx
blob4cccc270f080c29b8dd92994e9b4ef3875415006
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ConnectionHelper.hxx,v $
10 * $Revision: 1.7.66.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef DBAUI_CONNECTIONHELPER_HXX
32 #define DBAUI_CONNECTIONHELPER_HXX
34 #ifndef _DBAUI_ADMINPAGES_HXX_
35 #include "adminpages.hxx"
36 #endif
37 #ifndef _UCBHELPER_CONTENT_HXX
38 #include <ucbhelper/content.hxx>
39 #endif
40 #ifndef _DBAUI_CURLEDIT_HXX_
41 #include "curledit.hxx"
42 #endif
43 #ifndef _SFX_FILEDLGHELPER_HXX
44 #include <sfx2/filedlghelper.hxx>
45 #endif
48 #define FILL_STRING_ITEM(editcontrol, itemset, itemid, modifiedflag) \
49 if (editcontrol.GetText() != editcontrol.GetSavedValue()) \
50 { \
51 itemset.Put(SfxStringItem(itemid, editcontrol.GetText())); \
52 modifiedflag = sal_True; \
55 //.........................................................................
56 namespace dbaui
58 //.........................................................................
60 // #106016# --------------
61 enum IS_PATH_EXIST
63 PATH_NOT_EXIST = 0,
64 PATH_EXIST,
65 PATH_NOT_KNOWN
68 class IDatabaseSettingsDialog;
70 class OConnectionHelper : public OGenericAdministrationPage
72 sal_Bool m_bUserGrabFocus : 1;
74 public:
75 OConnectionHelper( Window* pParent, const ResId& _rId, const SfxItemSet& _rCoreAttrs);
76 virtual ~OConnectionHelper();
77 FixedText m_aFT_Connection;
78 OConnectionURLEdit m_aConnectionURL;
79 PushButton m_aPB_Connection;
80 ::rtl::OUString m_eType; // the type can't be changed in this class, so we hold it as member.
82 public:
84 // setting/retrieving the current connection URL
85 // necessary because for some types, the URL must be decoded for display purposes
86 ::dbaccess::ODsnTypeCollection* m_pCollection; /// the DSN type collection instance
87 virtual long PreNotify( NotifyEvent& _rNEvt );
89 // <method>OGenericAdministrationPage::fillControls</method>
90 virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
91 // <method>OGenericAdministrationPage::fillWindows</method>
92 virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
93 virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
96 // setting/retrieving the current connection URL
97 // necessary because for some types, the URL must be decoded for display purposes
98 //String getURL( OConnectionURLEdit* _m_pConnection ) const;
99 //void setURL( const String& _rURL, OConnectionURLEdit* _m_pConnection );
101 String getURLNoPrefix( ) const;
102 void setURLNoPrefix( const String& _rURL );
104 /** checks if the path is existence
105 @param _rURL
106 The URL to check.
108 sal_Int32 checkPathExistence(const String& _rURL);
111 IS_PATH_EXIST pathExists(const ::rtl::OUString& _rURL, sal_Bool bIsFile) const;
112 sal_Bool createDirectoryDeep(const String& _rPathNormalized);
113 sal_Bool commitURL();
115 /** opens the FileOpen dialog and asks for a FileName
116 @param _aFileOpen
117 Executes the file open dialog, which must be filled from caller.
119 void askForFileName(::sfx2::FileDialogHelper& _aFileOpen);
121 virtual void SetServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB)
123 OGenericAdministrationPage::SetServiceFactory(_rxORB);
126 protected:
127 void setURL( const String& _rURL );
128 virtual bool checkTestConnection();
130 private:
131 DECL_LINK(OnBrowseConnections, PushButton*);
132 StringBag getInstalledAdabasDBDirs(const String &_rPath,const ::ucbhelper::ResultSetInclude& _reResultSetInclude);
133 StringBag getInstalledAdabasDBs(const String &_rConfigDir,const String &_rWorkDir);
134 String impl_getURL( sal_Bool _bPrefix ) const;
135 void impl_setURL( const String& _rURL, sal_Bool _bPrefix );
136 void implUpdateURLDependentStates() const;
139 //.........................................................................
140 } // namespace dbaui
141 //.........................................................................
143 #endif // DBAUI_CONNECTIONHELPER_HXX