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