Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License or as specified alternatively below. You may obtain a copy of
8 : * the License at http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * Major Contributor(s):
16 : * [ Copyright (C) 2012 SUSE <cbosdonnat@suse.com> (initial developer) ]
17 : *
18 : * All Rights Reserved.
19 : *
20 : * For minor contributions see the git repository.
21 : *
22 : * Alternatively, the contents of this file may be used under the terms of
23 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 : * instead of those above.
27 : */
28 : #ifndef _SERVERDETAILSCONTROLS_HXX
29 : #define _SERVERDETAILSCONTROLS_HXX
30 :
31 : #include <map>
32 :
33 : #include <com/sun/star/ucb/XCommandEnvironment.hpp>
34 :
35 : #include <tools/urlobj.hxx>
36 : #include <vcl/builder.hxx>
37 : #include <vcl/button.hxx>
38 : #include <vcl/edit.hxx>
39 : #include <vcl/field.hxx>
40 : #include <vcl/fixed.hxx>
41 : #include <vcl/layout.hxx>
42 :
43 : class DetailsContainer
44 : {
45 : private:
46 : Link m_aChangeHdl;
47 : VclFrame* m_pFrame;
48 :
49 : public:
50 : DetailsContainer( VclBuilderContainer* pBuilder, const rtl::OString& rFrame );
51 : virtual ~DetailsContainer( );
52 :
53 : void setChangeHdl( const Link& rLink ) { m_aChangeHdl = rLink; }
54 :
55 : virtual void show( bool bShow = true );
56 : virtual INetURLObject getUrl( );
57 :
58 : /** Try to split the URL in the controls of that container.
59 :
60 : \param sUrl the URL to split
61 : \return true if the split worked, false otherwise.
62 : */
63 : virtual bool setUrl( const INetURLObject& rUrl );
64 :
65 : virtual void setUsername( const rtl::OUString& /*rUsername*/ ) { };
66 :
67 : protected:
68 : void notifyChange( );
69 : DECL_LINK ( ValueChangeHdl, void * );
70 : };
71 :
72 : class HostDetailsContainer : public DetailsContainer
73 : {
74 : private:
75 : sal_uInt16 m_nDefaultPort;
76 : rtl::OUString m_sScheme;
77 :
78 : protected:
79 : Edit* m_pEDHost;
80 : NumericField* m_pEDPort;
81 : Edit* m_pEDPath;
82 :
83 : public:
84 : HostDetailsContainer( VclBuilderContainer* pBuilder, sal_uInt16 nPort, rtl::OUString sScheme );
85 0 : virtual ~HostDetailsContainer( ) { };
86 :
87 : virtual void show( bool bShow = true );
88 : virtual INetURLObject getUrl( );
89 : virtual bool setUrl( const INetURLObject& rUrl );
90 :
91 : protected:
92 : void setScheme( rtl::OUString sScheme ) { m_sScheme = sScheme; }
93 :
94 : /** Verifies that the schement split from the URL can be handled by
95 : the container and set the proper controls accordingly if needed.
96 : */
97 : virtual bool verifyScheme( const rtl::OUString& rScheme );
98 : };
99 :
100 : class DavDetailsContainer : public HostDetailsContainer
101 : {
102 : private:
103 : CheckBox* m_pCBDavs;
104 :
105 : public:
106 : DavDetailsContainer( VclBuilderContainer* pBuilder );
107 0 : ~DavDetailsContainer( ) { };
108 :
109 : virtual void show( bool bShow = true );
110 :
111 : protected:
112 : virtual bool verifyScheme( const rtl::OUString& rScheme );
113 :
114 : private:
115 : DECL_LINK ( ToggledDavsHdl, CheckBox * pCheckBox );
116 : };
117 :
118 : class SmbDetailsContainer : public DetailsContainer
119 : {
120 : private:
121 : Edit* m_pEDHost;
122 : Edit* m_pEDShare;
123 : Edit* m_pEDPath;
124 :
125 : public:
126 : SmbDetailsContainer( VclBuilderContainer* pBuilder );
127 0 : ~SmbDetailsContainer( ) { };
128 :
129 : virtual INetURLObject getUrl( );
130 : virtual bool setUrl( const INetURLObject& rUrl );
131 : };
132 :
133 : class CmisDetailsContainer : public DetailsContainer
134 : {
135 : private:
136 : rtl::OUString m_sUsername;
137 : com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv;
138 : std::vector< rtl::OUString > m_aServerTypesURLs;
139 : std::vector< rtl::OUString > m_aRepoIds;
140 : rtl::OUString m_sRepoId;
141 :
142 : Edit* m_pEDBinding;
143 : ListBox* m_pLBRepository;
144 : Button* m_pBTRepoRefresh;
145 : ListBox* m_pLBServerType;
146 : Edit* m_pEDPath;
147 :
148 : public:
149 : CmisDetailsContainer( VclBuilderContainer* pBuilder );
150 0 : ~CmisDetailsContainer( ) { };
151 :
152 : virtual INetURLObject getUrl( );
153 : virtual bool setUrl( const INetURLObject& rUrl );
154 : virtual void setUsername( const rtl::OUString& rUsername );
155 :
156 : private:
157 : void selectRepository( );
158 : DECL_LINK ( SelectServerTypeHdl, void * );
159 : DECL_LINK ( RefreshReposHdl, void * );
160 : DECL_LINK ( SelectRepoHdl, void * );
161 : };
162 :
163 : #endif
164 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|