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 #ifndef INCLUDED_UCB_SOURCE_UCP_FILE_PROV_HXX
21 #define INCLUDED_UCB_SOURCE_UCP_FILE_PROV_HXX
22 
23 #include <cppuhelper/weak.hxx>
24 
25 #include <osl/mutex.hxx>
26 #include <ucbhelper/macros.hxx>
27 #include <com/sun/star/uno/XInterface.hpp>
28 #include <com/sun/star/lang/XTypeProvider.hpp>
29 #include <com/sun/star/lang/XInitialization.hpp>
30 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/ucb/XContentProvider.hpp>
34 #include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/ucb/XFileIdentifierConverter.hpp>
37 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
38 #include <cppuhelper/implbase.hxx>
39 #include <memory>
40 
41 // FileProvider
42 
43 
44 namespace fileaccess {
45 
46  // Forward declaration
47 
48  class BaseContent;
49  class TaskManager;
50 
51  class FileProvider: public cppu::WeakImplHelper <
52  css::lang::XServiceInfo,
53  css::lang::XInitialization,
54  css::ucb::XContentProvider,
55  css::ucb::XContentIdentifierFactory,
56  css::beans::XPropertySet,
57  css::ucb::XFileIdentifierConverter >
58  {
59  friend class BaseContent;
60  public:
61 
62  explicit FileProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
63  virtual ~FileProvider() override;
64 
65  // XServiceInfo
66  virtual OUString SAL_CALL
67  getImplementationName() override;
68 
69  virtual sal_Bool SAL_CALL
70  supportsService( const OUString& ServiceName ) override;
71 
72  virtual css::uno::Sequence< OUString > SAL_CALL
73  getSupportedServiceNames() override;
74 
75 
76  static css::uno::Reference< css::lang::XSingleServiceFactory >
78  const css::uno::Reference< css::lang::XMultiServiceFactory >& rxServiceMgr );
79 
80  static css::uno::Reference< css::uno::XInterface > SAL_CALL
82  const css::uno::Reference< css::lang::XMultiServiceFactory >& xMultiServiceFactory );
83 
84  // XInitialization
85  virtual void SAL_CALL
86  initialize(
87  const css::uno::Sequence< css::uno::Any >& aArguments ) override;
88 
89 
90  // XContentProvider
91  virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
93  const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
94 
95  // XContentIdentifierFactory
96 
97  virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
99  const OUString& ContentId ) override;
100 
101 
102  virtual sal_Int32 SAL_CALL
104  const css::uno::Reference< css::ucb::XContentIdentifier >& Id1,
105  const css::uno::Reference< css::ucb::XContentIdentifier >& Id2 ) override;
106 
107  // XPropertySet
108 
109  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
110  getPropertySetInfo( ) override;
111 
112  virtual void SAL_CALL
114  const OUString& aPropertyName,
115  const css::uno::Any& aValue ) override;
116 
117  virtual css::uno::Any SAL_CALL
119  const OUString& PropertyName ) override;
120 
121  virtual void SAL_CALL
123  const OUString& aPropertyName,
124  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
125 
126  virtual void SAL_CALL
128  const OUString& aPropertyName,
129  const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
130 
131  virtual void SAL_CALL
133  const OUString& PropertyName,
134  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
135 
136  virtual void SAL_CALL
138  const OUString& PropertyName,
139  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
140 
141 
142  // XFileIdentifierConverter
143 
144  virtual sal_Int32 SAL_CALL
145  getFileProviderLocality( const OUString& BaseURL ) override;
146 
147  virtual OUString SAL_CALL getFileURLFromSystemPath( const OUString& BaseURL,
148  const OUString& SystemPath ) override;
149 
150  virtual OUString SAL_CALL getSystemPathFromFileURL( const OUString& URL ) override;
151 
152 
153  private:
154  // methods
155  void init();
156 
157  // Members
158  css::uno::Reference< css::uno::XComponentContext > m_xContext;
159 
160  void initProperties();
161  osl::Mutex m_aMutex;
162  OUString m_HostName;
163  OUString m_HomeDirectory;
165 
166  css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo;
167 
168  std::unique_ptr<TaskManager> m_pMyShell;
169  };
170 
171 } // end namespace fileaccess
172 
173 #endif
174 
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString SAL_CALL getFileURLFromSystemPath(const OUString &BaseURL, const OUString &SystemPath) override
Definition: prov.cxx:493
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: prov.cxx:424
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: prov.cxx:461
FileProvider(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Definition: prov.cxx:91
static css::uno::Reference< css::lang::XSingleServiceFactory > createServiceFactory(const css::uno::Reference< css::lang::XMultiServiceFactory > &rxServiceMgr)
Definition: prov.cxx:143
OUString m_HomeDirectory
Definition: prov.hxx:163
virtual OUString SAL_CALL getImplementationName() override
Definition: prov.cxx:126
static css::uno::Reference< css::uno::XInterface > SAL_CALL CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > &xMultiServiceFactory)
Definition: prov.cxx:154
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: prov.cxx:413
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: prov.cxx:469
virtual sal_Int32 SAL_CALL getFileProviderLocality(const OUString &BaseURL) override
Definition: prov.cxx:479
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: prov.cxx:137
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: prov.hxx:158
sal_Int32 m_FileSystemNotation
Definition: prov.hxx:164
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: prov.cxx:110
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL createContentIdentifier(const OUString &ContentId) override
Definition: prov.cxx:256
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:199
unsigned char sal_Bool
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override
Definition: prov.cxx:166
virtual ~FileProvider() override
Definition: prov.cxx:97
osl::Mutex m_aMutex
Definition: prov.hxx:161
std::unique_ptr< TaskManager > m_pMyShell
Definition: prov.hxx:168
css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo
Definition: prov.hxx:166
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: prov.cxx:454
virtual OUString SAL_CALL getSystemPathFromFileURL(const OUString &URL) override
Definition: prov.cxx:503
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: prov.cxx:131
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: prov.cxx:446
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: prov.cxx:405