xref: /trunk/main/ucb/source/ucp/webdav/webdavprovider.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _WEBDAV_UCP_PROVIDER_HXX
29 #define _WEBDAV_UCP_PROVIDER_HXX
30 
31 #include <rtl/ref.hxx>
32 #include <com/sun/star/beans/Property.hpp>
33 #include "DAVSessionFactory.hxx"
34 #include <ucbhelper/providerhelper.hxx>
35 #include "PropertyMap.hxx"
36 
37 namespace webdav_ucp {
38 
39 //=========================================================================
40 
41 // UNO service name for the provider. This name will be used by the UCB to
42 // create instances of the provider.
43 #define WEBDAV_CONTENT_PROVIDER_SERVICE_NAME \
44                 "com.sun.star.ucb.WebDAVContentProvider"
45 #define WEBDAV_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 38
46 
47 // URL scheme. This is the scheme the provider will be able to create
48 // contents for. The UCB will select the provider ( i.e. in order to create
49 // contents ) according to this scheme.
50 #define WEBDAV_URL_SCHEME \
51                 "vnd.sun.star.webdav"
52 #define WEBDAV_URL_SCHEME_LENGTH    19
53 
54 #define HTTP_URL_SCHEME         "http"
55 #define HTTP_URL_SCHEME_LENGTH  4
56 
57 #define HTTPS_URL_SCHEME        "https"
58 #define HTTPS_URL_SCHEME_LENGTH 5
59 
60 #define DAV_URL_SCHEME          "dav"
61 #define DAV_URL_SCHEME_LENGTH   3
62 
63 #define DAVS_URL_SCHEME     "davs"
64 #define DAVS_URL_SCHEME_LENGTH  4
65 
66 
67 
68 #define FTP_URL_SCHEME "ftp"
69 
70 #define HTTP_CONTENT_TYPE \
71                 "application/" HTTP_URL_SCHEME "-content"
72 
73 #define WEBDAV_CONTENT_TYPE    HTTP_CONTENT_TYPE
74 #define WEBDAV_COLLECTION_TYPE \
75                 "application/" WEBDAV_URL_SCHEME "-collection"
76 
77 //=========================================================================
78 
79 class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
80 {
81     rtl::Reference< DAVSessionFactory > m_xDAVSessionFactory;
82     PropertyMap * m_pProps;
83 
84 public:
85     ContentProvider( const ::com::sun::star::uno::Reference<
86                         ::com::sun::star::lang::XMultiServiceFactory >& rSMgr );
87     virtual ~ContentProvider();
88 
89     // XInterface
90     XINTERFACE_DECL()
91 
92     // XTypeProvider
93     XTYPEPROVIDER_DECL()
94 
95     // XServiceInfo
96     XSERVICEINFO_DECL()
97 
98     // XContentProvider
99     virtual ::com::sun::star::uno::Reference<
100                 ::com::sun::star::ucb::XContent > SAL_CALL
101     queryContent( const ::com::sun::star::uno::Reference<
102                     ::com::sun::star::ucb::XContentIdentifier >& Identifier )
103         throw( ::com::sun::star::ucb::IllegalIdentifierException,
104                ::com::sun::star::uno::RuntimeException );
105 
106     //////////////////////////////////////////////////////////////////////
107     // Additional interfaces
108     //////////////////////////////////////////////////////////////////////
109 
110     //////////////////////////////////////////////////////////////////////
111     // Non-interface methods.
112     //////////////////////////////////////////////////////////////////////
113 
114     rtl::Reference< DAVSessionFactory > getDAVSessionFactory()
115     { return m_xDAVSessionFactory; }
116 
117     bool getProperty( const ::rtl::OUString & rPropName,
118                       ::com::sun::star::beans::Property & rProp,
119                       bool bStrict = false );
120 };
121 
122 }
123 
124 #endif
125