LibreOffice Module ucbhelper (master)  1
providerhelper.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_UCBHELPER_PROVIDERHELPER_HXX
21 #define INCLUDED_UCBHELPER_PROVIDERHELPER_HXX
22 
23 #include <vector>
24 #include <memory>
25 #include <com/sun/star/ucb/XContentProvider.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <cppuhelper/implbase.hxx>
28 
29 #include <rtl/ref.hxx>
31 
32 
33 namespace com::sun::star::ucb {
34  class XPropertySetRegistry;
35  class XPersistentPropertySet;
36 }
37 
38 namespace com::sun::star::uno { class XComponentContext; }
39 
40 namespace ucbhelper_impl { struct ContentProviderImplHelper_Impl; }
41 
42 namespace ucbhelper {
43 
44 
47 typedef std::vector< ContentImplHelperRef > ContentRefList;
48 
64  public cppu::WeakImplHelper<
65  css::lang::XServiceInfo,
66  css::ucb::XContentProvider>
67 {
68  friend class ContentImplHelper;
69 
70  std::unique_ptr<ucbhelper_impl::ContentProviderImplHelper_Impl> m_pImpl;
71 
72 protected:
73  osl::Mutex m_aMutex;
74  css::uno::Reference< css::uno::XComponentContext > m_xContext;
75 
76 private:
77  UCBHELPER_DLLPRIVATE void removeContent( ContentImplHelper* pContent );
78 
79  UCBHELPER_DLLPRIVATE css::uno::Reference< css::ucb::XPropertySetRegistry >
80  getAdditionalPropertySetRegistry();
81 
82  UCBHELPER_DLLPRIVATE void cleanupRegisteredContents();
83 
84 protected:
96  queryExistingContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier );
97 
107  queryExistingContent( const OUString& rURL );
108 
123  void registerNewContent(
124  const css::uno::Reference< css::ucb::XContent > & xContent );
125 
126 public:
127 
128 
129  // Construction/Destruction
130 
131 
133  const css::uno::Reference< css::uno::XComponentContext >& rxContext );
134  virtual ~ContentProviderImplHelper() override;
135 
136 
137  // XServiceInfo
138 
139 
140  virtual OUString SAL_CALL
141  getImplementationName() override = 0;
142  virtual sal_Bool SAL_CALL
143  supportsService( const OUString& ServiceName ) override;
144  virtual css::uno::Sequence< OUString > SAL_CALL
145  getSupportedServiceNames() override = 0;
146 
147 
148  // XContentProvider
149 
150 
162  virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
163  queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override = 0;
164  virtual sal_Int32 SAL_CALL
165  compareContentIds( const css::uno::Reference< css::ucb::XContentIdentifier >& Id1,
166  const css::uno::Reference< css::ucb::XContentIdentifier >& Id2 ) override;
167 
168 
169  // Non-interface methods.
170 
171 
178  osl::Mutex& getContentListMutex() { return m_aMutex; }
179 
187  void queryExistingContents( ContentRefList& rContents );
188 
198  css::uno::Reference< css::ucb::XPersistentPropertySet >
199  getAdditionalPropertySet( const OUString& rKey, bool bCreate );
200 
211  bool renameAdditionalPropertySet( const OUString& rOldKey,
212  const OUString& rNewKey,
213  bool bRecursive );
214 
225  bool copyAdditionalPropertySet( const OUString& rSourceKey,
226  const OUString& rTargetKey,
227  bool bRecursive );
228 
238  bool removeAdditionalPropertySet( const OUString& rKey,
239  bool bRecursive );
240 };
241 
242 } // namespace ucbhelper
243 
244 #endif /* ! INCLUDED_UCBHELPER_PROVIDERHELPER_HXX */
245 
246 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define UCBHELPER_DLLPRIVATE
std::vector< ContentImplHelperRef > ContentRefList
osl::Mutex & getContentListMutex()
This method returns a mutex, which protects the content list of the provider.
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
This is an abstract base class for implementations of the service com.sun.star.ucb.ContentProvider.
This is an abstract base class for implementations of the service com.sun.star.ucb.Content.
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::unique_ptr< ucbhelper_impl::ContentProviderImplHelper_Impl > m_pImpl
unsigned char sal_Bool
css::uno::Reference< css::uno::XComponentContext > m_xContext
#define UCBHELPER_DLLPUBLIC
rtl::Reference< ContentImplHelper > ContentImplHelperRef