LibreOffice Module ucb (master) 1
prov.hxx
Go to the documentation of this file.
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#pragma once
21
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>
30#include <memory>
31#include <mutex>
32
33// FileProvider
34
35
36namespace fileaccess {
37
38 // Forward declaration
39
40 class BaseContent;
41 class TaskManager;
42
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 >
50 {
51 friend class BaseContent;
52 public:
53
54 explicit FileProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
55 virtual ~FileProvider() override;
56
57 // XServiceInfo
58 virtual OUString SAL_CALL
59 getImplementationName() override;
60
61 virtual sal_Bool SAL_CALL
62 supportsService( const OUString& ServiceName ) override;
63
64 virtual css::uno::Sequence< OUString > SAL_CALL
65 getSupportedServiceNames() override;
66
67
68 // XInitialization
69 virtual void SAL_CALL
71 const css::uno::Sequence< css::uno::Any >& aArguments ) override;
72
73
74 // XContentProvider
75 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
77 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
78
79 // XContentIdentifierFactory
80
81 virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
83 const OUString& ContentId ) override;
84
85
86 virtual sal_Int32 SAL_CALL
88 const css::uno::Reference< css::ucb::XContentIdentifier >& Id1,
89 const css::uno::Reference< css::ucb::XContentIdentifier >& Id2 ) override;
90
91 // XPropertySet
92
93 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
94 getPropertySetInfo( ) override;
95
96 virtual void SAL_CALL
98 const OUString& aPropertyName,
99 const css::uno::Any& aValue ) override;
100
101 virtual css::uno::Any SAL_CALL
103 const OUString& PropertyName ) override;
104
105 virtual void SAL_CALL
107 const OUString& aPropertyName,
108 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
109
110 virtual void SAL_CALL
112 const OUString& aPropertyName,
113 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
114
115 virtual void SAL_CALL
117 const OUString& PropertyName,
118 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
119
120 virtual void SAL_CALL
122 const OUString& PropertyName,
123 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
124
125
126 // XFileIdentifierConverter
127
128 virtual sal_Int32 SAL_CALL
129 getFileProviderLocality( const OUString& BaseURL ) override;
130
131 virtual OUString SAL_CALL getFileURLFromSystemPath( const OUString& BaseURL,
132 const OUString& SystemPath ) override;
133
134 virtual OUString SAL_CALL getSystemPathFromFileURL( const OUString& URL ) override;
135
136
137 private:
138 // methods
139 void init();
140
141 // Members
142 css::uno::Reference< css::uno::XComponentContext > m_xContext;
143
144 void initProperties();
145 std::mutex m_aMutex;
146 OUString m_HostName;
149
150 css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo;
151
152 std::unique_ptr<TaskManager> m_pMyShell;
153 };
154
155} // end namespace fileaccess
156
157/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: prov.cxx:353
sal_Int32 m_FileSystemNotation
Definition: prov.hxx:148
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: prov.hxx:142
virtual OUString SAL_CALL getSystemPathFromFileURL(const OUString &URL) override
Definition: prov.cxx:432
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: prov.cxx:76
std::unique_ptr< TaskManager > m_pMyShell
Definition: prov.hxx:152
css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo
Definition: prov.hxx:150
virtual sal_Int32 SAL_CALL compareContentIds(const css::uno::Reference< css::ucb::XContentIdentifier > &Id1, const css::uno::Reference< css::ucb::XContentIdentifier > &Id2) override
Definition: prov.cxx:130
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: prov.cxx:97
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: prov.cxx:103
virtual sal_Int32 SAL_CALL getFileProviderLocality(const OUString &BaseURL) override
Definition: prov.cxx:408
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: prov.cxx:375
virtual OUString SAL_CALL getImplementationName() override
Definition: prov.cxx:92
virtual OUString SAL_CALL getFileURLFromSystemPath(const OUString &BaseURL, const OUString &SystemPath) override
Definition: prov.cxx:422
virtual ~FileProvider() override
Definition: prov.cxx:63
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override
Definition: prov.cxx:112
OUString m_HomeDirectory
Definition: prov.hxx:147
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: prov.cxx:398
std::mutex m_aMutex
Definition: prov.hxx:145
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL createContentIdentifier(const OUString &ContentId) override
Definition: prov.cxx:187
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: prov.cxx:383
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: prov.cxx:342
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: prov.cxx:334
FileProvider(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Definition: prov.cxx:57
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: prov.cxx:390
unsigned char sal_Bool