LibreOffice Module ucb (master)  1
ftpcontentprovider.hxx
Go to the documentation of this file.
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 INCLUDED_UCB_SOURCE_UCP_FTP_FTPCONTENTPROVIDER_HXX
21 #define INCLUDED_UCB_SOURCE_UCP_FTP_FTPCONTENTPROVIDER_HXX
22 
23 #include <vector>
26 #include <com/sun/star/ucb/XContentProviderManager.hpp>
27 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include "ftpurl.hxx"
30 
31 // UNO service name for the provider. This name will be used by the UCB to
32 // create instances of the provider.
33 
34 #define FTP_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.FTPContentProvider"
35 #define FTP_CONTENT_TYPE "application/ftp-content"
36 
40 namespace ftp
41 {
42  class FTPLoaderThread;
43 
46  {
47  public:
48 
49  explicit FTPContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
50 
51  virtual ~FTPContentProvider() override;
52 
53  // XInterface
54  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
55  virtual void SAL_CALL acquire()
56  throw() override;
57  virtual void SAL_CALL release()
58  throw() override;
59 
60  // XTypeProvider
61  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
62  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
63 
64  // XServiceInfo
65  virtual OUString SAL_CALL getImplementationName() override;
66  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
67  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
68 
69  static OUString getImplementationName_Static();
70  static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
71 
72  static css::uno::Reference< css::lang::XSingleServiceFactory >
73  createServiceFactory( const css::uno::Reference<
74  css::lang::XMultiServiceFactory >& rxServiceMgr );
75 
76  // XContentProvider
77  virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
78  queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
79 
80  CURL* handle();
81 
85  void forHost(const OUString& host,
86  const OUString& port,
87  const OUString& username,
88  OUString& password,
89  OUString& account);
90 
91  bool setHost(const OUString& host,
92  const OUString& port,
93  const OUString& username,
94  const OUString& password,
95  const OUString& account);
96 
97  struct ServerInfo
98  {
99  OUString host;
100  OUString port;
101  OUString username;
102  OUString password;
103  OUString account;
104  };
105 
106  private:
107  std::unique_ptr<FTPLoaderThread> m_ftpLoaderThread;
108  std::unique_ptr<ucbhelper::InternetProxyDecider> m_pProxyDecider;
109  std::vector<ServerInfo> m_ServerInfo;
110 
111  void init();
112  }; // end class FTPContentProvider
113 
114 } // end namespace ftp
115 
116 #endif
117 
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual OUString SAL_CALL getImplementationName() override
bool setHost(const OUString &host, const OUString &port, const OUString &username, const OUString &password, const OUString &account)
static css::uno::Sequence< OUString > getSupportedServiceNames_Static()
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
std::unique_ptr< ucbhelper::InternetProxyDecider > m_pProxyDecider
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
static OUString getImplementationName_Static()
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL acquire() override
static css::uno::Reference< css::lang::XSingleServiceFactory > createServiceFactory(const css::uno::Reference< css::lang::XMultiServiceFactory > &rxServiceMgr)
virtual ~FTPContentProvider() override
unsigned char sal_Bool
FTPContentProvider(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual void SAL_CALL release() override
Definition of ftpcontentprovider.
std::vector< ServerInfo > m_ServerInfo
void forHost(const OUString &host, const OUString &port, const OUString &username, OUString &password, OUString &account)
host is in the form host:port.
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
std::unique_ptr< FTPLoaderThread > m_ftpLoaderThread
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override