Branch data 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 : : * 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 : : #ifndef _FTP_FTPCONTENTPROVIDER_HXX_
21 : : #define _FTP_FTPCONTENTPROVIDER_HXX_
22 : :
23 : : #include <vector>
24 : : #include <osl/mutex.hxx>
25 : : #include <ucbhelper/macros.hxx>
26 : : #include <ucbhelper/proxydecider.hxx>
27 : : #include <ucbhelper/providerhelper.hxx>
28 : : #include <com/sun/star/ucb/XContentProviderManager.hpp>
29 : : #include "ftphandleprovider.hxx"
30 : : #include "ftpurl.hxx"
31 : :
32 : : // UNO service name for the provider. This name will be used by the UCB to
33 : : // create instances of the provider.
34 : :
35 : : #define FTP_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.FTPContentProvider"
36 : : #define FTP_CONTENT_TYPE "application/ftp-content"
37 : :
38 : :
39 : : /**
40 : : * Definition of ftpcontentprovider
41 : : */
42 : :
43 : :
44 : :
45 : : namespace ftp {
46 : :
47 : :
48 : : class FTPLoaderThread;
49 : :
50 : :
51 : : class FTPContentProvider:
52 : : public ::ucbhelper::ContentProviderImplHelper,
53 : : public FTPHandleProvider
54 : : {
55 : : public:
56 : :
57 : : FTPContentProvider(
58 : : const com::sun::star::uno::Reference<
59 : : com::sun::star::lang::XMultiServiceFactory>& xMSF );
60 : :
61 : : ~FTPContentProvider();
62 : :
63 : : // XInterface
64 : : XINTERFACE_DECL()
65 : :
66 : : // XTypeProvider
67 : : XTYPEPROVIDER_DECL()
68 : :
69 : : // XServiceInfo
70 : : XSERVICEINFO_DECL()
71 : :
72 : : // XContentProvider
73 : : virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
74 : : queryContent(
75 : : const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier )
76 : : throw( com::sun::star::ucb::IllegalIdentifierException,
77 : : com::sun::star::uno::RuntimeException );
78 : :
79 : : // FTPHandleProvider.
80 : :
81 : : virtual CURL* handle();
82 : :
83 : : virtual bool forHost(const rtl::OUString& host,
84 : : const rtl::OUString& port,
85 : : const rtl::OUString& username,
86 : : rtl::OUString& password,
87 : : rtl::OUString& account);
88 : :
89 : : virtual bool setHost(const rtl::OUString& host,
90 : : const rtl::OUString& port,
91 : : const rtl::OUString& username,
92 : : const rtl::OUString& password,
93 : : const rtl::OUString& account);
94 : :
95 : :
96 : 8 : struct ServerInfo {
97 : : rtl::OUString host;
98 : : rtl::OUString port;
99 : : rtl::OUString username;
100 : : rtl::OUString password;
101 : : rtl::OUString account;
102 : : };
103 : :
104 : : private:
105 : :
106 : : osl::Mutex m_aMutex;
107 : : FTPLoaderThread *m_ftpLoaderThread;
108 : : ucbhelper::InternetProxyDecider *m_pProxyDecider;
109 : : std::vector<ServerInfo> m_ServerInfo;
110 : :
111 : : void init();
112 : :
113 : : com::sun::star::uno::Reference<com::sun::star::ucb::XContentProvider>
114 : : getHttpProvider()
115 : : throw(com::sun::star::uno::RuntimeException);
116 : :
117 : : }; // end class FTPContentProvider
118 : :
119 : : } // end namespace ftp
120 : :
121 : : #endif
122 : :
123 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|