Update ooo320-m1
[ooovba.git] / ucb / source / ucp / ftp / ftpcontentprovider.hxx
blob1ab2f8dd54f44922a5b64d528c0ab990d716e6f1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ftpcontentprovider.hxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _FTP_FTPCONTENTPROVIDER_HXX_
32 #define _FTP_FTPCONTENTPROVIDER_HXX_
34 #include <vector>
35 #include <osl/mutex.hxx>
36 #include <ucbhelper/macros.hxx>
37 #include <ucbhelper/proxydecider.hxx>
38 #include <ucbhelper/providerhelper.hxx>
39 #include <com/sun/star/ucb/XContentProviderManager.hpp>
40 #include "ftphandleprovider.hxx"
41 #include "ftpurl.hxx"
43 // UNO service name for the provider. This name will be used by the UCB to
44 // create instances of the provider.
46 #define FTP_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.FTPContentProvider"
47 #define FTP_CONTENT_TYPE "application/ftp-content"
50 /**
51 * Definition of ftpcontentprovider
56 namespace ftp {
59 class FTPLoaderThread;
62 class FTPContentProvider:
63 public ::ucbhelper::ContentProviderImplHelper,
64 public FTPHandleProvider
66 public:
68 FTPContentProvider(
69 const com::sun::star::uno::Reference<
70 com::sun::star::lang::XMultiServiceFactory>& xMSF );
72 ~FTPContentProvider();
74 // XInterface
75 XINTERFACE_DECL()
77 // XTypeProvider
78 XTYPEPROVIDER_DECL()
80 // XServiceInfo
81 XSERVICEINFO_DECL()
83 // XContentProvider
84 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
85 queryContent(
86 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier )
87 throw( com::sun::star::ucb::IllegalIdentifierException,
88 com::sun::star::uno::RuntimeException );
90 // FTPHandleProvider.
92 virtual CURL* handle();
94 virtual bool forHost(const rtl::OUString& host,
95 const rtl::OUString& port,
96 const rtl::OUString& username,
97 rtl::OUString& password,
98 rtl::OUString& account);
100 virtual bool setHost(const rtl::OUString& host,
101 const rtl::OUString& port,
102 const rtl::OUString& username,
103 const rtl::OUString& password,
104 const rtl::OUString& account);
107 struct ServerInfo {
108 rtl::OUString host;
109 rtl::OUString port;
110 rtl::OUString username;
111 rtl::OUString password;
112 rtl::OUString account;
115 private:
117 osl::Mutex m_aMutex;
118 FTPLoaderThread *m_ftpLoaderThread;
119 ucbhelper::InternetProxyDecider *m_pProxyDecider;
120 std::vector<ServerInfo> m_ServerInfo;
122 void init();
124 com::sun::star::uno::Reference<com::sun::star::ucb::XContentProvider>
125 getHttpProvider()
126 throw(com::sun::star::uno::RuntimeException);
128 }; // end class FTPContentProvider
130 } // end namespace ftp
132 #endif