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 webdav_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 63 64 #define FTP_URL_SCHEME "ftp" 65 66 #define HTTP_CONTENT_TYPE \ 67 "application/" HTTP_URL_SCHEME "-content" 68 69 #define WEBDAV_CONTENT_TYPE HTTP_CONTENT_TYPE 70 #define WEBDAV_COLLECTION_TYPE \ 71 "application/" WEBDAV_URL_SCHEME "-collection" 72 73 //========================================================================= 74 75 class ContentProvider : public ::ucbhelper::ContentProviderImplHelper 76 { 77 rtl::Reference< DAVSessionFactory > m_xDAVSessionFactory; 78 PropertyMap * m_pProps; 79 80 public: 81 ContentProvider( const ::com::sun::star::uno::Reference< 82 ::com::sun::star::lang::XMultiServiceFactory >& rSMgr ); 83 virtual ~ContentProvider(); 84 85 // XInterface 86 XINTERFACE_DECL() 87 88 // XTypeProvider 89 XTYPEPROVIDER_DECL() 90 91 // XServiceInfo 92 XSERVICEINFO_DECL() 93 94 // XContentProvider 95 virtual ::com::sun::star::uno::Reference< 96 ::com::sun::star::ucb::XContent > SAL_CALL 97 queryContent( const ::com::sun::star::uno::Reference< 98 ::com::sun::star::ucb::XContentIdentifier >& Identifier ) 99 throw( ::com::sun::star::ucb::IllegalIdentifierException, 100 ::com::sun::star::uno::RuntimeException ); 101 102 ////////////////////////////////////////////////////////////////////// 103 // Additional interfaces 104 ////////////////////////////////////////////////////////////////////// 105 106 ////////////////////////////////////////////////////////////////////// 107 // Non-interface methods. 108 ////////////////////////////////////////////////////////////////////// 109 110 rtl::Reference< DAVSessionFactory > getDAVSessionFactory() 111 { return m_xDAVSessionFactory; } 112 113 bool getProperty( const ::rtl::OUString & rPropName, 114 ::com::sun::star::beans::Property & rProp, 115 bool bStrict = false ); 116 }; 117 118 } 119 120 #endif 121