Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef DBAUI_CONNECTIONHELPER_HXX
21 : #define DBAUI_CONNECTIONHELPER_HXX
22 :
23 : #include "adminpages.hxx"
24 : #include <ucbhelper/content.hxx>
25 : #include "curledit.hxx"
26 : #include <sfx2/filedlghelper.hxx>
27 :
28 : //.........................................................................
29 : namespace dbaui
30 : {
31 : //.........................................................................
32 :
33 : enum IS_PATH_EXIST
34 : {
35 : PATH_NOT_EXIST = 0,
36 : PATH_EXIST,
37 : PATH_NOT_KNOWN
38 : };
39 :
40 : class OConnectionHelper : public OGenericAdministrationPage
41 : {
42 : sal_Bool m_bUserGrabFocus : 1;
43 :
44 : public:
45 : OConnectionHelper( Window* pParent, const ResId& _rId, const SfxItemSet& _rCoreAttrs);
46 : virtual ~OConnectionHelper();
47 : FixedText m_aFT_Connection;
48 : OConnectionURLEdit m_aConnectionURL;
49 : PushButton m_aPB_Connection;
50 : ::rtl::OUString m_eType; // the type can't be changed in this class, so we hold it as member.
51 :
52 : public:
53 :
54 : // setting/retrieving the current connection URL
55 : // necessary because for some types, the URL must be decoded for display purposes
56 : ::dbaccess::ODsnTypeCollection* m_pCollection; /// the DSN type collection instance
57 : virtual long PreNotify( NotifyEvent& _rNEvt );
58 :
59 : // <method>OGenericAdministrationPage::fillControls</method>
60 : virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
61 : // <method>OGenericAdministrationPage::fillWindows</method>
62 : virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
63 : virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
64 :
65 :
66 : // setting/retrieving the current connection URL
67 : // necessary because for some types, the URL must be decoded for display purposes
68 : //String getURL( OConnectionURLEdit* _m_pConnection ) const;
69 : //void setURL( const String& _rURL, OConnectionURLEdit* _m_pConnection );
70 :
71 : String getURLNoPrefix( ) const;
72 : void setURLNoPrefix( const String& _rURL );
73 :
74 : /** checks if the path is existence
75 : @param _rURL
76 : The URL to check.
77 : */
78 : sal_Int32 checkPathExistence(const String& _rURL);
79 :
80 :
81 : IS_PATH_EXIST pathExists(const ::rtl::OUString& _rURL, sal_Bool bIsFile) const;
82 : sal_Bool createDirectoryDeep(const String& _rPathNormalized);
83 : sal_Bool commitURL();
84 :
85 : /** opens the FileOpen dialog and asks for a FileName
86 : @param _aFileOpen
87 : Executes the file open dialog, which must be filled from caller.
88 : */
89 : void askForFileName(::sfx2::FileDialogHelper& _aFileOpen);
90 :
91 0 : virtual void SetServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB)
92 : {
93 0 : OGenericAdministrationPage::SetServiceFactory(_rxORB);
94 0 : }
95 :
96 : protected:
97 : void setURL( const String& _rURL );
98 : virtual bool checkTestConnection();
99 :
100 : private:
101 : DECL_LINK(OnBrowseConnections, PushButton*);
102 : String impl_getURL( sal_Bool _bPrefix ) const;
103 : void impl_setURL( const String& _rURL, sal_Bool _bPrefix );
104 : void implUpdateURLDependentStates() const;
105 : };
106 :
107 : //.........................................................................
108 : } // namespace dbaui
109 : //.........................................................................
110 :
111 : #endif // DBAUI_CONNECTIONHELPER_HXX
112 :
113 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|