bump product version to 5.0.4.1
[LibreOffice.git] / ucb / source / ucp / ftp / ftpcontentprovider.hxx
blobd700e855a0494fc6722e2917ed45cef2e794e9a0
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 <osl/mutex.hxx>
25 #include <ucbhelper/proxydecider.hxx>
26 #include <ucbhelper/providerhelper.hxx>
27 #include <com/sun/star/ucb/XContentProviderManager.hpp>
28 #include "ftphandleprovider.hxx"
29 #include "ftpurl.hxx"
31 // UNO service name for the provider. This name will be used by the UCB to
32 // create instances of the provider.
34 #define FTP_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.FTPContentProvider"
35 #define FTP_CONTENT_TYPE "application/ftp-content"
37 /**
38 * Definition of ftpcontentprovider
40 namespace ftp
42 class FTPLoaderThread;
44 class FTPContentProvider:
45 public ::ucbhelper::ContentProviderImplHelper,
46 public FTPHandleProvider
48 public:
50 FTPContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
52 virtual ~FTPContentProvider();
54 // XInterface
55 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
56 throw( css::uno::RuntimeException,
57 std::exception ) SAL_OVERRIDE;
58 virtual void SAL_CALL acquire()
59 throw() SAL_OVERRIDE;
60 virtual void SAL_CALL release()
61 throw() SAL_OVERRIDE;
63 // XTypeProvider
64 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
65 throw( css::uno::RuntimeException,
66 std::exception ) SAL_OVERRIDE;
67 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
68 throw( css::uno::RuntimeException,
69 std::exception ) SAL_OVERRIDE;
71 // XServiceInfo
72 virtual OUString SAL_CALL getImplementationName()
73 throw( css::uno::RuntimeException,
74 std::exception ) SAL_OVERRIDE;
75 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
76 throw( css::uno::RuntimeException,
77 std::exception ) SAL_OVERRIDE;
78 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
79 throw( css::uno::RuntimeException,
80 std::exception ) SAL_OVERRIDE;
82 static OUString getImplementationName_Static();
83 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
85 static css::uno::Reference< css::lang::XSingleServiceFactory >
86 createServiceFactory( const css::uno::Reference<
87 css::lang::XMultiServiceFactory >& rxServiceMgr );
89 // XContentProvider
90 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
91 queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier )
92 throw( css::ucb::IllegalIdentifierException,
93 css::uno::RuntimeException,
94 std::exception ) SAL_OVERRIDE;
96 // FTPHandleProvider.
98 virtual CURL* handle() SAL_OVERRIDE;
100 virtual bool forHost(const OUString& host,
101 const OUString& port,
102 const OUString& username,
103 OUString& password,
104 OUString& account) SAL_OVERRIDE;
106 virtual bool setHost(const OUString& host,
107 const OUString& port,
108 const OUString& username,
109 const OUString& password,
110 const OUString& account) SAL_OVERRIDE;
112 struct ServerInfo
114 OUString host;
115 OUString port;
116 OUString username;
117 OUString password;
118 OUString account;
121 private:
123 osl::Mutex m_aMutex;
124 FTPLoaderThread *m_ftpLoaderThread;
125 ucbhelper::InternetProxyDecider *m_pProxyDecider;
126 std::vector<ServerInfo> m_ServerInfo;
128 void init();
130 css::uno::Reference<css::ucb::XContentProvider> getHttpProvider()
131 throw(css::uno::RuntimeException);
133 }; // end class FTPContentProvider
135 } // end namespace ftp
137 #endif
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */