Debian Codegraph @

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