Debian Codegraph @

ucb/source/ucp/webdav-curl/webdavprovider.hxx

raw
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21 #pragma once
22
23 #include <sal/config.h>
24
25 #include <memory>
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 // UNO service name for the provider. This name will be used by the UCB to
37 // create instances of the provider.
38 inline constexpr OUString WEBDAV_CONTENT_PROVIDER_SERVICE_NAME = u"com.sun.star.ucb.WebDAVContentProvider"_ustr;
39
40 // URL scheme. This is the scheme the provider will be able to create
41 // contents for. The UCB will select the provider ( i.e. in order to create
42 // contents ) according to this scheme.
43 #define VNDSUNSTARWEBDAV_URL_SCHEME "vnd.sun.star.webdav"
44 #define VNDSUNSTARWEBDAVS_URL_SCHEME u"vnd.sun.star.webdavs"
45 #define HTTP_URL_SCHEME u"http"
46 #define HTTPS_URL_SCHEME u"https"
47 #define DAV_URL_SCHEME u"dav"
48 #define DAVS_URL_SCHEME u"davs"
49 #define WEBDAV_URL_SCHEME u"webdav"
50 #define WEBDAVS_URL_SCHEME u"webdavs"
51
52 inline constexpr OUString HTTP_CONTENT_TYPE = u"application/" HTTP_URL_SCHEME "-content"_ustr;
53
54 #define WEBDAV_CONTENT_TYPE HTTP_CONTENT_TYPE
55 inline constexpr OUString WEBDAV_COLLECTION_TYPE = u"application/" VNDSUNSTARWEBDAV_URL_SCHEME "-collection"_ustr;
56
57
58 class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
59 {
60 rtl::Reference< DAVSessionFactory > m_xDAVSessionFactory;
61 std::unique_ptr<PropertyMap> m_pProps;
62
63 public:
64 explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rContext );
65 virtual ~ContentProvider() override;
66
67 // XInterface
68 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
69 virtual void SAL_CALL acquire()
70 noexcept override;
71 virtual void SAL_CALL release()
72 noexcept override;
73
74 // XTypeProvider
75 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
76 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
77
78 // XServiceInfo
79 virtual OUString SAL_CALL getImplementationName() override;
80 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
81 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
82
83 // XContentProvider
84 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
85 queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
86
87
88 // Non-interface methods.
89
90 bool getProperty( const OUString & rPropName,
91 css::beans::Property & rProp );
92 };
93
94 }
95
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */