xref: /AOO41X/main/ucb/source/ucp/webdav/webdavprovider.hxx (revision 59ddfc10bd384e83978dcd8c83c4a7ba8f8fdec1)
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 _WEBDAV_UCP_PROVIDER_HXX
25 #define _WEBDAV_UCP_PROVIDER_HXX
26 
27 #include <rtl/ref.hxx>
28 #include <com/sun/star/beans/Property.hpp>
29 #include "DAVSessionFactory.hxx"
30 #include <ucbhelper/providerhelper.hxx>
31 #include "PropertyMap.hxx"
32 
33 namespace http_dav_ucp {
34 
35 //=========================================================================
36 
37 // UNO service name for the provider. This name will be used by the UCB to
38 // create instances of the provider.
39 #define WEBDAV_CONTENT_PROVIDER_SERVICE_NAME \
40                 "com.sun.star.ucb.WebDAVContentProvider"
41 #define WEBDAV_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 38
42 
43 // URL scheme. This is the scheme the provider will be able to create
44 // contents for. The UCB will select the provider ( i.e. in order to create
45 // contents ) according to this scheme.
46 #define WEBDAV_URL_SCHEME \
47                 "vnd.sun.star.webdav"
48 #define WEBDAV_URL_SCHEME_LENGTH    19
49 
50 #define HTTP_URL_SCHEME         "http"
51 #define HTTP_URL_SCHEME_LENGTH  4
52 
53 #define HTTPS_URL_SCHEME        "https"
54 #define HTTPS_URL_SCHEME_LENGTH 5
55 
56 #define DAV_URL_SCHEME          "dav"
57 #define DAV_URL_SCHEME_LENGTH   3
58 
59 #define DAVS_URL_SCHEME     "davs"
60 #define DAVS_URL_SCHEME_LENGTH  4
61 
62 #define HTTP_CONTENT_TYPE \
63                 "application/" HTTP_URL_SCHEME "-content"
64 
65 #define WEBDAV_CONTENT_TYPE    HTTP_CONTENT_TYPE
66 #define WEBDAV_COLLECTION_TYPE \
67                 "application/" WEBDAV_URL_SCHEME "-collection"
68 
69 //=========================================================================
70 
71 class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
72 {
73     rtl::Reference< DAVSessionFactory > m_xDAVSessionFactory;
74     PropertyMap * m_pProps;
75 
76 public:
77     ContentProvider( const ::com::sun::star::uno::Reference<
78                         ::com::sun::star::lang::XMultiServiceFactory >& rSMgr );
79     virtual ~ContentProvider();
80 
81     // XInterface
82     XINTERFACE_DECL()
83 
84     // XTypeProvider
85     XTYPEPROVIDER_DECL()
86 
87     // XServiceInfo
88     XSERVICEINFO_DECL()
89 
90     // XContentProvider
91     virtual ::com::sun::star::uno::Reference<
92                 ::com::sun::star::ucb::XContent > SAL_CALL
93     queryContent( const ::com::sun::star::uno::Reference<
94                     ::com::sun::star::ucb::XContentIdentifier >& Identifier )
95         throw( ::com::sun::star::ucb::IllegalIdentifierException,
96                ::com::sun::star::uno::RuntimeException );
97 
98     //////////////////////////////////////////////////////////////////////
99     // Additional interfaces
100     //////////////////////////////////////////////////////////////////////
101 
102     //////////////////////////////////////////////////////////////////////
103     // Non-interface methods.
104     //////////////////////////////////////////////////////////////////////
105 
getDAVSessionFactory()106     rtl::Reference< DAVSessionFactory > getDAVSessionFactory()
107     { return m_xDAVSessionFactory; }
108 
109     bool getProperty( const ::rtl::OUString & rPropName,
110                       ::com::sun::star::beans::Property & rProp,
111                       bool bStrict = false );
112 };
113 
114 }
115 
116 #endif
117