Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / ucb / source / ucp / ftp / ftpcontentprovider.hxx
blob042ed99fe0fdde687f3f160503e19b692769c767
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_UCB_SOURCE_UCP_FTP_FTPCONTENTPROVIDER_HXX
21 #define INCLUDED_UCB_SOURCE_UCP_FTP_FTPCONTENTPROVIDER_HXX
23 #include <vector>
24 #include <ucbhelper/proxydecider.hxx>
25 #include <ucbhelper/providerhelper.hxx>
26 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include "curl.hxx"
30 // UNO service name for the provider. This name will be used by the UCB to
31 // create instances of the provider.
33 #define FTP_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.FTPContentProvider"
34 #define FTP_CONTENT_TYPE "application/ftp-content"
36 /**
37 * Definition of ftpcontentprovider
39 namespace ftp
41 class FTPLoaderThread;
43 class FTPContentProvider:
44 public ::ucbhelper::ContentProviderImplHelper
46 public:
48 explicit FTPContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
50 virtual ~FTPContentProvider() override;
52 // XInterface
53 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
54 virtual void SAL_CALL acquire()
55 throw() override;
56 virtual void SAL_CALL release()
57 throw() override;
59 // XTypeProvider
60 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
61 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
63 // XServiceInfo
64 virtual OUString SAL_CALL getImplementationName() override;
65 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
66 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
68 static OUString getImplementationName_Static();
69 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
71 static css::uno::Reference< css::lang::XSingleServiceFactory >
72 createServiceFactory( const css::uno::Reference<
73 css::lang::XMultiServiceFactory >& rxServiceMgr );
75 // XContentProvider
76 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
77 queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
79 CURL* handle();
81 /** host is in the form host:port.
84 void forHost(const OUString& host,
85 const OUString& port,
86 const OUString& username,
87 OUString& password,
88 OUString& account);
90 bool setHost(const OUString& host,
91 const OUString& port,
92 const OUString& username,
93 const OUString& password,
94 const OUString& account);
96 struct ServerInfo
98 OUString host;
99 OUString port;
100 OUString username;
101 OUString password;
102 OUString account;
105 private:
106 std::unique_ptr<FTPLoaderThread> m_ftpLoaderThread;
107 std::unique_ptr<ucbhelper::InternetProxyDecider> m_pProxyDecider;
108 std::vector<ServerInfo> m_ServerInfo;
110 void init();
111 }; // end class FTPContentProvider
113 } // end namespace ftp
115 #endif
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */