Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / ucb / source / ucp / file / prov.hxx
blob845ab416d8bc36937b899126270941be23a1555f
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 #ifndef INCLUDED_UCB_SOURCE_UCP_FILE_PROV_HXX
21 #define INCLUDED_UCB_SOURCE_UCP_FILE_PROV_HXX
23 #include <osl/mutex.hxx>
24 #include <com/sun/star/uno/XInterface.hpp>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <com/sun/star/lang/XInitialization.hpp>
27 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/ucb/XContentProvider.hpp>
31 #include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
32 #include <com/sun/star/beans/XPropertySet.hpp>
33 #include <com/sun/star/ucb/XFileIdentifierConverter.hpp>
34 #include <cppuhelper/implbase.hxx>
35 #include <memory>
37 // FileProvider
40 namespace fileaccess {
42 // Forward declaration
44 class BaseContent;
45 class TaskManager;
47 class FileProvider: public cppu::WeakImplHelper <
48 css::lang::XServiceInfo,
49 css::lang::XInitialization,
50 css::ucb::XContentProvider,
51 css::ucb::XContentIdentifierFactory,
52 css::beans::XPropertySet,
53 css::ucb::XFileIdentifierConverter >
55 friend class BaseContent;
56 public:
58 explicit FileProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
59 virtual ~FileProvider() override;
61 // XServiceInfo
62 virtual OUString SAL_CALL
63 getImplementationName() override;
65 virtual sal_Bool SAL_CALL
66 supportsService( const OUString& ServiceName ) override;
68 virtual css::uno::Sequence< OUString > SAL_CALL
69 getSupportedServiceNames() override;
72 static css::uno::Reference< css::lang::XSingleServiceFactory >
73 createServiceFactory(
74 const css::uno::Reference< css::lang::XMultiServiceFactory >& rxServiceMgr );
76 static css::uno::Reference< css::uno::XInterface > SAL_CALL
77 CreateInstance(
78 const css::uno::Reference< css::lang::XMultiServiceFactory >& xMultiServiceFactory );
80 // XInitialization
81 virtual void SAL_CALL
82 initialize(
83 const css::uno::Sequence< css::uno::Any >& aArguments ) override;
86 // XContentProvider
87 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
88 queryContent(
89 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
91 // XContentIdentifierFactory
93 virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
94 createContentIdentifier(
95 const OUString& ContentId ) override;
98 virtual sal_Int32 SAL_CALL
99 compareContentIds(
100 const css::uno::Reference< css::ucb::XContentIdentifier >& Id1,
101 const css::uno::Reference< css::ucb::XContentIdentifier >& Id2 ) override;
103 // XPropertySet
105 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
106 getPropertySetInfo( ) override;
108 virtual void SAL_CALL
109 setPropertyValue(
110 const OUString& aPropertyName,
111 const css::uno::Any& aValue ) override;
113 virtual css::uno::Any SAL_CALL
114 getPropertyValue(
115 const OUString& PropertyName ) override;
117 virtual void SAL_CALL
118 addPropertyChangeListener(
119 const OUString& aPropertyName,
120 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
122 virtual void SAL_CALL
123 removePropertyChangeListener(
124 const OUString& aPropertyName,
125 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
127 virtual void SAL_CALL
128 addVetoableChangeListener(
129 const OUString& PropertyName,
130 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
132 virtual void SAL_CALL
133 removeVetoableChangeListener(
134 const OUString& PropertyName,
135 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
138 // XFileIdentifierConverter
140 virtual sal_Int32 SAL_CALL
141 getFileProviderLocality( const OUString& BaseURL ) override;
143 virtual OUString SAL_CALL getFileURLFromSystemPath( const OUString& BaseURL,
144 const OUString& SystemPath ) override;
146 virtual OUString SAL_CALL getSystemPathFromFileURL( const OUString& URL ) override;
149 private:
150 // methods
151 void init();
153 // Members
154 css::uno::Reference< css::uno::XComponentContext > m_xContext;
156 void initProperties();
157 osl::Mutex m_aMutex;
158 OUString m_HostName;
159 OUString m_HomeDirectory;
160 sal_Int32 m_FileSystemNotation;
162 css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo;
164 std::unique_ptr<TaskManager> m_pMyShell;
167 } // end namespace fileaccess
169 #endif
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */