1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _FTP_FTPCONTENTPROVIDER_HXX_ 25 #define _FTP_FTPCONTENTPROVIDER_HXX_ 26 27 #include <vector> 28 #include <osl/mutex.hxx> 29 #include <ucbhelper/macros.hxx> 30 #include <ucbhelper/proxydecider.hxx> 31 #include <ucbhelper/providerhelper.hxx> 32 #include <com/sun/star/ucb/XContentProviderManager.hpp> 33 #include "ftphandleprovider.hxx" 34 #include "ftpurl.hxx" 35 36 // UNO service name for the provider. This name will be used by the UCB to 37 // create instances of the provider. 38 39 #define FTP_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.FTPContentProvider" 40 #define FTP_CONTENT_TYPE "application/ftp-content" 41 42 43 /** 44 * Definition of ftpcontentprovider 45 */ 46 47 48 49 namespace ftp { 50 51 52 class FTPLoaderThread; 53 54 55 class FTPContentProvider: 56 public ::ucbhelper::ContentProviderImplHelper, 57 public FTPHandleProvider 58 { 59 public: 60 61 FTPContentProvider( 62 const com::sun::star::uno::Reference< 63 com::sun::star::lang::XMultiServiceFactory>& xMSF ); 64 65 ~FTPContentProvider(); 66 67 // XInterface 68 XINTERFACE_DECL() 69 70 // XTypeProvider 71 XTYPEPROVIDER_DECL() 72 73 // XServiceInfo 74 XSERVICEINFO_DECL() 75 76 // XContentProvider 77 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > SAL_CALL 78 queryContent( 79 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier ); 80 81 // FTPHandleProvider. 82 83 virtual CURL* handle(); 84 85 virtual bool forHost(const rtl::OUString& host, 86 const rtl::OUString& port, 87 const rtl::OUString& username, 88 rtl::OUString& password, 89 rtl::OUString& account); 90 91 virtual bool setHost(const rtl::OUString& host, 92 const rtl::OUString& port, 93 const rtl::OUString& username, 94 const rtl::OUString& password, 95 const rtl::OUString& account); 96 97 98 struct ServerInfo { 99 rtl::OUString host; 100 rtl::OUString port; 101 rtl::OUString username; 102 rtl::OUString password; 103 rtl::OUString account; 104 }; 105 106 private: 107 108 osl::Mutex m_aMutex; 109 FTPLoaderThread *m_ftpLoaderThread; 110 ucbhelper::InternetProxyDecider *m_pProxyDecider; 111 std::vector<ServerInfo> m_ServerInfo; 112 113 void init(); 114 115 com::sun::star::uno::Reference<com::sun::star::ucb::XContentProvider> 116 getHttpProvider(); 117 118 }; // end class FTPContentProvider 119 120 } // end namespace ftp 121 122 #endif 123