1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include "adminpages.hxx"
23 #include <curledit.hxx>
24 #include <sfx2/filedlghelper.hxx>
36 class OConnectionHelper
: public OGenericAdministrationPage
38 bool m_bUserGrabFocus
;
41 OConnectionHelper(weld::Container
* pPage
, weld::DialogController
* pController
, const OUString
& _rUIXMLDescription
, const OUString
& _rId
, const SfxItemSet
& _rCoreAttrs
);
42 virtual ~OConnectionHelper() override
;
44 OUString m_eType
; // the type can't be changed in this class, so we hold it as member.
45 // setting/retrieving the current connection URL
46 // necessary because for some types, the URL must be decoded for display purposes
47 ::dbaccess::ODsnTypeCollection
* m_pCollection
; /// the DSN type collection instance
49 std::unique_ptr
<weld::Label
> m_xFT_Connection
;
50 std::unique_ptr
<weld::Button
> m_xPB_Connection
;
51 std::unique_ptr
<weld::Button
> m_xPB_CreateDB
;
52 std::unique_ptr
<OConnectionURLEdit
> m_xConnectionURL
;
56 // <method>OGenericAdministrationPage::fillControls</method>
57 virtual void fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
58 // <method>OGenericAdministrationPage::fillWindows</method>
59 virtual void fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
60 virtual void implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
) override
;
62 // setting/retrieving the current connection URL
63 // necessary because for some types, the URL must be decoded for display purposes
64 //String getURL( OConnectionURLEdit* _m_pConnection ) const;
65 //void setURL( const OUString& _rURL, OConnectionURLEdit* _m_pConnection );
67 OUString
getURLNoPrefix( ) const;
68 void setURLNoPrefix( std::u16string_view _rURL
);
70 /** checks if the path is existence
74 sal_Int32
checkPathExistence(const OUString
& _rURL
);
76 IS_PATH_EXIST
pathExists(const OUString
& _rURL
, bool bIsFile
) const;
77 bool createDirectoryDeep(std::u16string_view _rPathNormalized
);
80 /** opens the FileOpen dialog and asks for a FileName
82 Executes the file open dialog, which must be filled from caller.
84 void askForFileName(::sfx2::FileDialogHelper
& _aFileOpen
);
87 void setURL( std::u16string_view _rURL
);
88 virtual bool checkTestConnection();
91 DECL_LINK(OnBrowseConnections
, weld::Button
&, void);
92 DECL_LINK(OnCreateDatabase
, weld::Button
&, void);
93 DECL_LINK(GetFocusHdl
, weld::Widget
&, void);
94 DECL_LINK(LoseFocusHdl
, weld::Widget
&, void);
95 OUString
impl_getURL() const;
96 void impl_setURL( std::u16string_view _rURL
, bool _bPrefix
);
97 void implUpdateURLDependentStates() const;
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */