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 <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>
36 
37 // FileProvider
38 
39 
40 namespace fileaccess {
41 
42  // Forward declaration
43 
44  class BaseContent;
45  class TaskManager;
46 
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 >
54  {
55  friend class BaseContent;
56  public:
57 
58  explicit FileProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
59  virtual ~FileProvider() override;
60 
61  // XServiceInfo
62  virtual OUString SAL_CALL
63  getImplementationName() override;
64 
65  virtual sal_Bool SAL_CALL
66  supportsService( const OUString& ServiceName ) override;
67 
68  virtual css::uno::Sequence< OUString > SAL_CALL
69  getSupportedServiceNames() override;
70 
71 
72  static css::uno::Reference< css::lang::XSingleServiceFactory >
74  const css::uno::Reference< css::lang::XMultiServiceFactory >& rxServiceMgr );
75 
76  static css::uno::Reference< css::uno::XInterface > SAL_CALL
78  const css::uno::Reference< css::lang::XMultiServiceFactory >& xMultiServiceFactory );
79 
80  // XInitialization
81  virtual void SAL_CALL
82  initialize(
83  const css::uno::Sequence< css::uno::Any >& aArguments ) override;
84 
85 
86  // XContentProvider
87  virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
89  const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
90 
91  // XContentIdentifierFactory
92 
93  virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
95  const OUString& ContentId ) override;
96 
97 
98  virtual sal_Int32 SAL_CALL
100  const css::uno::Reference< css::ucb::XContentIdentifier >& Id1,
101  const css::uno::Reference< css::ucb::XContentIdentifier >& Id2 ) override;
102 
103  // XPropertySet
104 
105  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
106  getPropertySetInfo( ) override;
107 
108  virtual void SAL_CALL
110  const OUString& aPropertyName,
111  const css::uno::Any& aValue ) override;
112 
113  virtual css::uno::Any SAL_CALL
115  const OUString& PropertyName ) override;
116 
117  virtual void SAL_CALL
119  const OUString& aPropertyName,
120  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
121 
122  virtual void SAL_CALL
124  const OUString& aPropertyName,
125  const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
126 
127  virtual void SAL_CALL
129  const OUString& PropertyName,
130  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
131 
132  virtual void SAL_CALL
134  const OUString& PropertyName,
135  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
136 
137 
138  // XFileIdentifierConverter
139 
140  virtual sal_Int32 SAL_CALL
141  getFileProviderLocality( const OUString& BaseURL ) override;
142 
143  virtual OUString SAL_CALL getFileURLFromSystemPath( const OUString& BaseURL,
144  const OUString& SystemPath ) override;
145 
146  virtual OUString SAL_CALL getSystemPathFromFileURL( const OUString& URL ) override;
147 
148 
149  private:
150  // methods
151  void init();
152 
153  // Members
154  css::uno::Reference< css::uno::XComponentContext > m_xContext;
155 
156  void initProperties();
157  osl::Mutex m_aMutex;
158  OUString m_HostName;
159  OUString m_HomeDirectory;
161 
162  css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo;
163 
164  std::unique_ptr<TaskManager> m_pMyShell;
165  };
166 
167 } // end namespace fileaccess
168 
169 #endif
170 
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString SAL_CALL getFileURLFromSystemPath(const OUString &BaseURL, const OUString &SystemPath) override
Definition: prov.cxx:491
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: prov.cxx:422
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: prov.cxx:459
FileProvider(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Definition: prov.cxx:89
static css::uno::Reference< css::lang::XSingleServiceFactory > createServiceFactory(const css::uno::Reference< css::lang::XMultiServiceFactory > &rxServiceMgr)
Definition: prov.cxx:141
OUString m_HomeDirectory
Definition: prov.hxx:159
virtual OUString SAL_CALL getImplementationName() override
Definition: prov.cxx:124
static css::uno::Reference< css::uno::XInterface > SAL_CALL CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > &xMultiServiceFactory)
Definition: prov.cxx:152
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: prov.cxx:411
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: prov.cxx:467
virtual sal_Int32 SAL_CALL getFileProviderLocality(const OUString &BaseURL) override
Definition: prov.cxx:477
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: prov.cxx:135
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: prov.hxx:154
sal_Int32 m_FileSystemNotation
Definition: prov.hxx:160
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: prov.cxx:108
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL createContentIdentifier(const OUString &ContentId) override
Definition: prov.cxx:254
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:197
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:164
virtual ~FileProvider() override
Definition: prov.cxx:95
osl::Mutex m_aMutex
Definition: prov.hxx:157
std::unique_ptr< TaskManager > m_pMyShell
Definition: prov.hxx:164
css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo
Definition: prov.hxx:162
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: prov.cxx:452
virtual OUString SAL_CALL getSystemPathFromFileURL(const OUString &URL) override
Definition: prov.cxx:501
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: prov.cxx:129
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: prov.cxx:444
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: prov.cxx:403