1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef DBAUI_CONNECTIONHELPER_HXX
30 #define DBAUI_CONNECTIONHELPER_HXX
32 #include "adminpages.hxx"
33 #include <ucbhelper/content.hxx>
34 #include "curledit.hxx"
35 #include <sfx2/filedlghelper.hxx>
38 #define FILL_STRING_ITEM(editcontrol, itemset, itemid, modifiedflag) \
39 if (editcontrol.GetText() != editcontrol.GetSavedValue()) \
41 itemset.Put(SfxStringItem(itemid, editcontrol.GetText())); \
42 modifiedflag = sal_True; \
45 //.........................................................................
48 //.........................................................................
57 class IDatabaseSettingsDialog
;
59 class OConnectionHelper
: public OGenericAdministrationPage
61 sal_Bool m_bUserGrabFocus
: 1;
64 OConnectionHelper( Window
* pParent
, const ResId
& _rId
, const SfxItemSet
& _rCoreAttrs
);
65 virtual ~OConnectionHelper();
66 FixedText m_aFT_Connection
;
67 OConnectionURLEdit m_aConnectionURL
;
68 PushButton m_aPB_Connection
;
69 ::rtl::OUString m_eType
; // the type can't be changed in this class, so we hold it as member.
73 // setting/retrieving the current connection URL
74 // necessary because for some types, the URL must be decoded for display purposes
75 ::dbaccess::ODsnTypeCollection
* m_pCollection
; /// the DSN type collection instance
76 virtual long PreNotify( NotifyEvent
& _rNEvt
);
78 // <method>OGenericAdministrationPage::fillControls</method>
79 virtual void fillControls(::std::vector
< ISaveValueWrapper
* >& _rControlList
);
80 // <method>OGenericAdministrationPage::fillWindows</method>
81 virtual void fillWindows(::std::vector
< ISaveValueWrapper
* >& _rControlList
);
82 virtual void implInitControls(const SfxItemSet
& _rSet
, sal_Bool _bSaveValue
);
85 // setting/retrieving the current connection URL
86 // necessary because for some types, the URL must be decoded for display purposes
87 //String getURL( OConnectionURLEdit* _m_pConnection ) const;
88 //void setURL( const String& _rURL, OConnectionURLEdit* _m_pConnection );
90 String
getURLNoPrefix( ) const;
91 void setURLNoPrefix( const String
& _rURL
);
93 /** checks if the path is existence
97 sal_Int32
checkPathExistence(const String
& _rURL
);
100 IS_PATH_EXIST
pathExists(const ::rtl::OUString
& _rURL
, sal_Bool bIsFile
) const;
101 sal_Bool
createDirectoryDeep(const String
& _rPathNormalized
);
102 sal_Bool
commitURL();
104 /** opens the FileOpen dialog and asks for a FileName
106 Executes the file open dialog, which must be filled from caller.
108 void askForFileName(::sfx2::FileDialogHelper
& _aFileOpen
);
110 virtual void SetServiceFactory(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> _rxORB
)
112 OGenericAdministrationPage::SetServiceFactory(_rxORB
);
116 void setURL( const String
& _rURL
);
117 virtual bool checkTestConnection();
120 DECL_LINK(OnBrowseConnections
, PushButton
*);
121 String
impl_getURL( sal_Bool _bPrefix
) const;
122 void impl_setURL( const String
& _rURL
, sal_Bool _bPrefix
);
123 void implUpdateURLDependentStates() const;
126 //.........................................................................
128 //.........................................................................
130 #endif // DBAUI_CONNECTIONHELPER_HXX
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */