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< com::sun::star::uno::XComponentContext >& rxContext );
59 :
60 : ~FTPContentProvider();
61 :
62 : // XInterface
63 : XINTERFACE_DECL()
64 :
65 : // XTypeProvider
66 : XTYPEPROVIDER_DECL()
67 :
68 : // XServiceInfo
69 : XSERVICEINFO_DECL()
70 :
71 : // XContentProvider
72 : virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
73 : queryContent(
74 : const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier )
75 : throw( com::sun::star::ucb::IllegalIdentifierException,
76 : com::sun::star::uno::RuntimeException );
77 :
78 : // FTPHandleProvider.
79 :
80 : virtual CURL* handle();
81 :
82 : virtual bool forHost(const rtl::OUString& host,
83 : const rtl::OUString& port,
84 : const rtl::OUString& username,
85 : rtl::OUString& password,
86 : rtl::OUString& account);
87 :
88 : virtual bool setHost(const rtl::OUString& host,
89 : const rtl::OUString& port,
90 : const rtl::OUString& username,
91 : const rtl::OUString& password,
92 : const rtl::OUString& account);
93 :
94 :
95 0 : struct ServerInfo {
96 : rtl::OUString host;
97 : rtl::OUString port;
98 : rtl::OUString username;
99 : rtl::OUString password;
100 : rtl::OUString account;
101 : };
102 :
103 : private:
104 :
105 : osl::Mutex m_aMutex;
106 : FTPLoaderThread *m_ftpLoaderThread;
107 : ucbhelper::InternetProxyDecider *m_pProxyDecider;
108 : std::vector<ServerInfo> m_ServerInfo;
109 :
110 : void init();
111 :
112 : com::sun::star::uno::Reference<com::sun::star::ucb::XContentProvider>
113 : getHttpProvider()
114 : throw(com::sun::star::uno::RuntimeException);
115 :
116 : }; // end class FTPContentProvider
117 :
118 : } // end namespace ftp
119 :
120 : #endif
121 :
122 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|