tdf#158198 sw: prevent xBookmark.getAnchor().setString("") from deleting
[LibreOffice.git] / ucb / source / ucp / file / prov.hxx
blob3d1f9d7f63a02dea57fe8b0466f56dbcf433d662
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
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>
34 // FileProvider
37 namespace fileaccess {
39 // Forward declaration
41 class BaseContent;
42 class TaskManager;
43 class XPropertySetInfoImpl2;
45 class FileProvider: public cppu::WeakImplHelper <
46 css::lang::XServiceInfo,
47 css::lang::XInitialization,
48 css::ucb::XContentProvider,
49 css::ucb::XContentIdentifierFactory,
50 css::beans::XPropertySet,
51 css::ucb::XFileIdentifierConverter >
53 friend class BaseContent;
54 public:
56 explicit FileProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
57 virtual ~FileProvider() override;
59 // XServiceInfo
60 virtual OUString SAL_CALL
61 getImplementationName() override;
63 virtual sal_Bool SAL_CALL
64 supportsService( const OUString& ServiceName ) override;
66 virtual css::uno::Sequence< OUString > SAL_CALL
67 getSupportedServiceNames() override;
70 // XInitialization
71 virtual void SAL_CALL
72 initialize(
73 const css::uno::Sequence< css::uno::Any >& aArguments ) override;
76 // XContentProvider
77 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
78 queryContent(
79 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
81 // XContentIdentifierFactory
83 virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
84 createContentIdentifier(
85 const OUString& ContentId ) override;
88 virtual sal_Int32 SAL_CALL
89 compareContentIds(
90 const css::uno::Reference< css::ucb::XContentIdentifier >& Id1,
91 const css::uno::Reference< css::ucb::XContentIdentifier >& Id2 ) override;
93 // XPropertySet
95 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
96 getPropertySetInfo( ) override;
98 virtual void SAL_CALL
99 setPropertyValue(
100 const OUString& aPropertyName,
101 const css::uno::Any& aValue ) override;
103 virtual css::uno::Any SAL_CALL
104 getPropertyValue(
105 const OUString& PropertyName ) override;
107 virtual void SAL_CALL
108 addPropertyChangeListener(
109 const OUString& aPropertyName,
110 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
112 virtual void SAL_CALL
113 removePropertyChangeListener(
114 const OUString& aPropertyName,
115 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
117 virtual void SAL_CALL
118 addVetoableChangeListener(
119 const OUString& PropertyName,
120 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
122 virtual void SAL_CALL
123 removeVetoableChangeListener(
124 const OUString& PropertyName,
125 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
128 // XFileIdentifierConverter
130 virtual sal_Int32 SAL_CALL
131 getFileProviderLocality( const OUString& BaseURL ) override;
133 virtual OUString SAL_CALL getFileURLFromSystemPath( const OUString& BaseURL,
134 const OUString& SystemPath ) override;
136 virtual OUString SAL_CALL getSystemPathFromFileURL( const OUString& URL ) override;
139 private:
140 // methods
141 void init();
143 // Members
144 css::uno::Reference< css::uno::XComponentContext > m_xContext;
146 void initProperties(std::unique_lock<std::mutex>& rGuard);
147 std::mutex m_aMutex;
148 OUString m_HostName;
149 OUString m_HomeDirectory;
150 sal_Int32 m_FileSystemNotation;
152 rtl::Reference< XPropertySetInfoImpl2 > m_xPropertySetInfo;
154 std::unique_ptr<TaskManager> m_pMyShell;
157 } // end namespace fileaccess
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */