LibreOffice Module dbaccess (master) 1
ConnectionHelper.hxx
Go to the documentation of this file.
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#pragma once
21
22#include "adminpages.hxx"
23#include <curledit.hxx>
25
26namespace dbaui
27{
28
30 {
34 };
35
37 {
39
40 public:
41 OConnectionHelper(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OUString& _rId, const SfxItemSet& _rCoreAttrs);
42 virtual ~OConnectionHelper() override;
43
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
48
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;
53
54 public:
55
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;
61
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 );
66
67 OUString getURLNoPrefix( ) const;
68 void setURLNoPrefix( std::u16string_view _rURL );
69
74 sal_Int32 checkPathExistence(const OUString& _rURL);
75
76 IS_PATH_EXIST pathExists(const OUString& _rURL, bool bIsFile) const;
77 bool createDirectoryDeep(std::u16string_view _rPathNormalized);
78 bool commitURL();
79
85
86 protected:
87 void setURL( std::u16string_view _rURL );
88 virtual bool checkTestConnection();
89
90 private:
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 );
98 };
99
100
101} // namespace dbaui
102
103/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void fillControls(std::vector< std::unique_ptr< ISaveValueWrapper > > &_rControlList) override
will be called inside <method>implInitControls</method> to save the value if necessary
DECL_LINK(GetFocusHdl, weld::Widget &, void)
virtual void fillWindows(std::vector< std::unique_ptr< ISaveValueWrapper > > &_rControlList) override
will be called inside <method>implInitControls</method> to disable if necessary
virtual void implInitControls(const SfxItemSet &_rSet, bool _bSaveValue) override
called from within Reset and ActivatePage, use to initialize the controls with the items from the giv...
IS_PATH_EXIST pathExists(const OUString &_rURL, bool bIsFile) const
virtual ~OConnectionHelper() override
DECL_LINK(OnCreateDatabase, weld::Button &, void)
std::unique_ptr< weld::Label > m_xFT_Connection
the DSN type collection instance
OUString getURLNoPrefix() const
std::unique_ptr< weld::Button > m_xPB_CreateDB
DECL_LINK(OnBrowseConnections, weld::Button &, void)
OConnectionHelper(weld::Container *pPage, weld::DialogController *pController, const OUString &_rUIXMLDescription, const OUString &_rId, const SfxItemSet &_rCoreAttrs)
DECL_LINK(LoseFocusHdl, weld::Widget &, void)
void impl_setURL(std::u16string_view _rURL, bool _bPrefix)
virtual bool checkTestConnection()
void askForFileName(::sfx2::FileDialogHelper &_aFileOpen)
opens the FileOpen dialog and asks for a FileName
bool createDirectoryDeep(std::u16string_view _rPathNormalized)
std::unique_ptr< OConnectionURLEdit > m_xConnectionURL
void implUpdateURLDependentStates() const
void setURLNoPrefix(std::u16string_view _rURL)
::dbaccess::ODsnTypeCollection * m_pCollection
sal_Int32 checkPathExistence(const OUString &_rURL)
checks if the path is existence
std::unique_ptr< weld::Button > m_xPB_Connection
void setURL(std::u16string_view _rURL)