Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / ucb / source / ucp / file / prov.hxx
blob530010be1f4dedb550063488acc6041bff3af201
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <com/sun/star/uno/XComponentContext.hpp>
23 #include <com/sun/star/lang/XInitialization.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/ucb/XContentProvider.hpp>
26 #include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/ucb/XFileIdentifierConverter.hpp>
29 #include <cppuhelper/implbase.hxx>
30 #include <memory>
31 #include <mutex>
33 // FileProvider
36 namespace fileaccess {
38 // Forward declaration
40 class BaseContent;
41 class TaskManager;
43 class FileProvider: public cppu::WeakImplHelper <
44 css::lang::XServiceInfo,
45 css::lang::XInitialization,
46 css::ucb::XContentProvider,
47 css::ucb::XContentIdentifierFactory,
48 css::beans::XPropertySet,
49 css::ucb::XFileIdentifierConverter >
51 friend class BaseContent;
52 public:
54 explicit FileProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
55 virtual ~FileProvider() override;
57 // XServiceInfo
58 virtual OUString SAL_CALL
59 getImplementationName() override;
61 virtual sal_Bool SAL_CALL
62 supportsService( const OUString& ServiceName ) override;
64 virtual css::uno::Sequence< OUString > SAL_CALL
65 getSupportedServiceNames() override;
68 // XInitialization
69 virtual void SAL_CALL
70 initialize(
71 const css::uno::Sequence< css::uno::Any >& aArguments ) override;
74 // XContentProvider
75 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
76 queryContent(
77 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
79 // XContentIdentifierFactory
81 virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
82 createContentIdentifier(
83 const OUString& ContentId ) override;
86 virtual sal_Int32 SAL_CALL
87 compareContentIds(
88 const css::uno::Reference< css::ucb::XContentIdentifier >& Id1,
89 const css::uno::Reference< css::ucb::XContentIdentifier >& Id2 ) override;
91 // XPropertySet
93 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
94 getPropertySetInfo( ) override;
96 virtual void SAL_CALL
97 setPropertyValue(
98 const OUString& aPropertyName,
99 const css::uno::Any& aValue ) override;
101 virtual css::uno::Any SAL_CALL
102 getPropertyValue(
103 const OUString& PropertyName ) override;
105 virtual void SAL_CALL
106 addPropertyChangeListener(
107 const OUString& aPropertyName,
108 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
110 virtual void SAL_CALL
111 removePropertyChangeListener(
112 const OUString& aPropertyName,
113 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
115 virtual void SAL_CALL
116 addVetoableChangeListener(
117 const OUString& PropertyName,
118 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
120 virtual void SAL_CALL
121 removeVetoableChangeListener(
122 const OUString& PropertyName,
123 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
126 // XFileIdentifierConverter
128 virtual sal_Int32 SAL_CALL
129 getFileProviderLocality( const OUString& BaseURL ) override;
131 virtual OUString SAL_CALL getFileURLFromSystemPath( const OUString& BaseURL,
132 const OUString& SystemPath ) override;
134 virtual OUString SAL_CALL getSystemPathFromFileURL( const OUString& URL ) override;
137 private:
138 // methods
139 void init();
141 // Members
142 css::uno::Reference< css::uno::XComponentContext > m_xContext;
144 void initProperties();
145 std::mutex m_aMutex;
146 OUString m_HostName;
147 OUString m_HomeDirectory;
148 sal_Int32 m_FileSystemNotation;
150 css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo;
152 std::unique_ptr<TaskManager> m_pMyShell;
155 } // end namespace fileaccess
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */