tdf#119209: Windows share has inappropriate server suggestion
[LibreOffice.git] / include / svtools / ServerDetailsControls.hxx
blob7e1a302c421b2c88ad824a48110e2a49dd92c410
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
9 #ifndef INCLUDED_SVTOOLS_SERVERDETAILSCONTROLS_HXX
10 #define INCLUDED_SVTOOLS_SERVERDETAILSCONTROLS_HXX
12 #include <map>
14 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
15 #include <com/sun/star/task/PasswordContainer.hpp>
16 #include <com/sun/star/task/XPasswordContainer2.hpp>
18 #include <tools/urlobj.hxx>
19 #include <vcl/weld.hxx>
21 class PlaceEditDialog;
23 class DetailsContainer
25 protected:
26 PlaceEditDialog* m_pDialog;
27 Link<DetailsContainer*,void> m_aChangeHdl;
29 public:
30 DetailsContainer(PlaceEditDialog* pDialog);
31 virtual ~DetailsContainer( );
33 void setChangeHdl( const Link<DetailsContainer*,void>& rLink ) { m_aChangeHdl = rLink; }
35 virtual void show( bool bShow = true );
36 virtual INetURLObject getUrl( );
38 /** Try to split the URL in the controls of that container.
40 \param sUrl the URL to split
41 \return true if the split worked, false otherwise.
43 virtual bool setUrl( const INetURLObject& rUrl );
45 virtual void setUsername( const OUString& /*rUsername*/ ) { };
46 virtual void setPassword( const OUString& ) { };
48 virtual bool enableUserCredentials( ) { return true; };
50 protected:
51 void notifyChange( );
52 DECL_LINK(ValueChangeHdl, weld::Entry&, void);
53 DECL_LINK(FormatPortHdl, weld::SpinButton&, void);
56 class HostDetailsContainer : public DetailsContainer
58 private:
59 sal_uInt16 const m_nDefaultPort;
60 OUString m_sScheme;
61 OUString m_sHost;
63 public:
64 HostDetailsContainer(PlaceEditDialog* pDialog, sal_uInt16 nPort, const OUString& sScheme);
66 virtual void show( bool bShow = true ) override;
67 virtual INetURLObject getUrl( ) override;
68 virtual bool setUrl( const INetURLObject& rUrl ) override;
70 protected:
71 void setScheme( const OUString& sScheme ) { m_sScheme = sScheme; }
73 /** Verifies that the scheme split from the URL can be handled by
74 the container and set the proper controls accordingly if needed.
76 virtual bool verifyScheme( const OUString& rScheme );
79 class DavDetailsContainer : public HostDetailsContainer
81 public:
82 DavDetailsContainer(PlaceEditDialog* pDialog);
84 virtual void show( bool bShow = true ) override;
85 virtual bool enableUserCredentials( ) override { return false; };
87 protected:
88 virtual bool verifyScheme( const OUString& rScheme ) override;
90 private:
91 DECL_LINK(ToggledDavsHdl, weld::ToggleButton&, void);
94 class SmbDetailsContainer : public DetailsContainer
96 private:
97 OUString m_sHost;
99 public:
100 SmbDetailsContainer(PlaceEditDialog* pDialog);
102 virtual INetURLObject getUrl( ) override;
103 virtual bool setUrl( const INetURLObject& rUrl ) override;
104 virtual void show( bool bShow = true ) override;
107 class CmisDetailsContainer : public DetailsContainer
109 private:
110 OUString m_sUsername;
111 OUString m_sPassword;
112 css::uno::Reference< css::ucb::XCommandEnvironment > m_xCmdEnv;
113 std::vector< OUString > m_aRepoIds;
114 OUString m_sRepoId;
115 OUString m_sBinding;
116 css::uno::Reference< css::awt::XWindow > m_xParentDialog;
118 public:
119 CmisDetailsContainer(PlaceEditDialog* pDialog, OUString const & sBinding);
121 virtual void show( bool bShow = true ) override;
122 virtual INetURLObject getUrl( ) override;
123 virtual bool setUrl( const INetURLObject& rUrl ) override;
124 virtual void setUsername( const OUString& rUsername ) override;
125 virtual void setPassword( const OUString& rPass ) override;
127 private:
128 void selectRepository( );
129 DECL_LINK ( RefreshReposHdl, weld::Button&, void );
130 DECL_LINK ( SelectRepoHdl, weld::ComboBox&, void );
133 #endif
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */