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 : #ifndef INCLUDED_SVTOOLS_SERVERDETAILSCONTROLS_HXX
10 : #define INCLUDED_SVTOOLS_SERVERDETAILSCONTROLS_HXX
11 :
12 : #include <map>
13 :
14 : #include <com/sun/star/ucb/XCommandEnvironment.hpp>
15 :
16 : #include <tools/urlobj.hxx>
17 : #include <vcl/builder.hxx>
18 : #include <vcl/button.hxx>
19 : #include <vcl/edit.hxx>
20 : #include <vcl/field.hxx>
21 : #include <vcl/fixed.hxx>
22 : #include <vcl/layout.hxx>
23 :
24 : class DetailsContainer
25 : {
26 : private:
27 : Link<> m_aChangeHdl;
28 : VclPtr<VclFrame> m_pFrame;
29 :
30 : public:
31 : DetailsContainer( VclBuilderContainer* pBuilder, const OString& rFrame );
32 : virtual ~DetailsContainer( );
33 :
34 0 : void setChangeHdl( const Link<>& rLink ) { m_aChangeHdl = rLink; }
35 :
36 : virtual void show( bool bShow = true );
37 : virtual INetURLObject getUrl( );
38 :
39 : /** Try to split the URL in the controls of that container.
40 :
41 : \param sUrl the URL to split
42 : \return true if the split worked, false otherwise.
43 : */
44 : virtual bool setUrl( const INetURLObject& rUrl );
45 :
46 0 : virtual void setUsername( const OUString& /*rUsername*/ ) { };
47 :
48 : protected:
49 : void notifyChange( );
50 : DECL_LINK ( ValueChangeHdl, void * );
51 : };
52 :
53 : class HostDetailsContainer : public DetailsContainer
54 : {
55 : private:
56 : sal_uInt16 m_nDefaultPort;
57 : OUString m_sScheme;
58 :
59 : protected:
60 : VclPtr<Edit> m_pEDHost;
61 : VclPtr<NumericField> m_pEDPort;
62 : VclPtr<Edit> m_pEDPath;
63 :
64 : public:
65 : HostDetailsContainer( VclBuilderContainer* pBuilder, sal_uInt16 nPort, const OUString& sScheme );
66 0 : virtual ~HostDetailsContainer( ) { };
67 :
68 : virtual void show( bool bShow = true ) SAL_OVERRIDE;
69 : virtual INetURLObject getUrl( ) SAL_OVERRIDE;
70 : virtual bool setUrl( const INetURLObject& rUrl ) SAL_OVERRIDE;
71 :
72 : protected:
73 0 : void setScheme( const OUString& sScheme ) { m_sScheme = sScheme; }
74 :
75 : /** Verifies that the schement split from the URL can be handled by
76 : the container and set the proper controls accordingly if needed.
77 : */
78 : virtual bool verifyScheme( const OUString& rScheme );
79 : };
80 :
81 : class DavDetailsContainer : public HostDetailsContainer
82 : {
83 : private:
84 : VclPtr<CheckBox> m_pCBDavs;
85 :
86 : public:
87 : DavDetailsContainer( VclBuilderContainer* pBuilder );
88 0 : virtual ~DavDetailsContainer( ) { };
89 :
90 : virtual void show( bool bShow = true ) SAL_OVERRIDE;
91 :
92 : protected:
93 : virtual bool verifyScheme( const OUString& rScheme ) SAL_OVERRIDE;
94 :
95 : private:
96 : DECL_LINK ( ToggledDavsHdl, CheckBox * pCheckBox );
97 : };
98 :
99 : class SmbDetailsContainer : public DetailsContainer
100 : {
101 : private:
102 : VclPtr<Edit> m_pEDHost;
103 : VclPtr<Edit> m_pEDShare;
104 : VclPtr<Edit> m_pEDPath;
105 :
106 : public:
107 : SmbDetailsContainer( VclBuilderContainer* pBuilder );
108 0 : virtual ~SmbDetailsContainer( ) { };
109 :
110 : virtual INetURLObject getUrl( ) SAL_OVERRIDE;
111 : virtual bool setUrl( const INetURLObject& rUrl ) SAL_OVERRIDE;
112 : };
113 :
114 : class CmisDetailsContainer : public DetailsContainer
115 : {
116 : private:
117 : OUString m_sUsername;
118 : com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv;
119 : std::vector< OUString > m_aServerTypesURLs;
120 : std::vector< OUString > m_aRepoIds;
121 : OUString m_sRepoId;
122 :
123 : VclPtr<Edit> m_pEDBinding;
124 : VclPtr<ListBox> m_pLBRepository;
125 : VclPtr<Button> m_pBTRepoRefresh;
126 : VclPtr<ListBox> m_pLBServerType;
127 : VclPtr<Edit> m_pEDPath;
128 :
129 : public:
130 : CmisDetailsContainer( VclBuilderContainer* pBuilder );
131 0 : virtual ~CmisDetailsContainer( ) { };
132 :
133 : virtual INetURLObject getUrl( ) SAL_OVERRIDE;
134 : virtual bool setUrl( const INetURLObject& rUrl ) SAL_OVERRIDE;
135 : virtual void setUsername( const OUString& rUsername ) SAL_OVERRIDE;
136 :
137 : private:
138 : void selectRepository( );
139 : DECL_LINK ( SelectServerTypeHdl, void * );
140 : DECL_LINK ( RefreshReposHdl, void * );
141 : DECL_LINK ( SelectRepoHdl, void * );
142 : };
143 :
144 : #endif
145 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|