LibreOffice Module ucbhelper (master) 1
contenthelper.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_CONTENTHELPER_HXX
21#define INCLUDED_UCBHELPER_CONTENTHELPER_HXX
22
23#include <com/sun/star/beans/XPropertyContainer.hpp>
24#include <com/sun/star/beans/XPropertiesChangeNotifier.hpp>
25#include <com/sun/star/ucb/XCommandProcessor.hpp>
26#include <com/sun/star/ucb/XContent.hpp>
27#include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp>
28#include <com/sun/star/ucb/XCommandInfoChangeNotifier.hpp>
29#include <com/sun/star/container/XChild.hpp>
30#include <com/sun/star/lang/XTypeProvider.hpp>
31#include <com/sun/star/lang/XServiceInfo.hpp>
32#include <com/sun/star/lang/XComponent.hpp>
33#include <cppuhelper/weak.hxx>
34
35#include <rtl/ref.hxx>
37#include <memory>
38
39namespace com::sun::star::ucb {
40 struct CommandInfo;
41 class XCommandEnvironment;
42 class XCommandInfo;
43 class XPersistentPropertySet;
44}
45
46namespace com::sun::star::beans {
47 struct Property;
48 class XPropertySetInfo;
49}
50
51namespace com::sun::star::uno { class XComponentContext; }
52
53namespace ucbhelper_impl { struct ContentImplHelper_Impl; }
54
55namespace ucbhelper
56{
57
58
59class ContentProviderImplHelper;
60
82 public cppu::OWeakObject,
83 public css::lang::XTypeProvider,
84 public css::lang::XServiceInfo,
85 public css::lang::XComponent,
86 public css::ucb::XContent,
87 public css::ucb::XCommandProcessor,
88 public css::beans::XPropertiesChangeNotifier,
89 public css::beans::XPropertyContainer,
90 public css::beans::XPropertySetInfoChangeNotifier,
91 public css::ucb::XCommandInfoChangeNotifier,
92 public css::container::XChild
93{
94 friend class PropertySetInfo;
96
97 std::unique_ptr<ucbhelper_impl::ContentImplHelper_Impl> m_pImpl;
98
99protected:
100 osl::Mutex m_aMutex;
101 css::uno::Reference< css::uno::XComponentContext >
103 css::uno::Reference< css::ucb::XContentIdentifier >
107 sal_uInt32 m_nCommandId;
108
109private:
123 virtual css::uno::Sequence< css::beans::Property >
124 getProperties( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) = 0;
125
134 virtual css::uno::Sequence< css::ucb::CommandInfo >
135 getCommands( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv ) = 0;
136
147 UCBHELPER_DLLPRIVATE virtual OUString getParentURL() = 0;
148
149protected:
162 css::uno::Reference< css::beans::XPropertySetInfo >
163 getPropertySetInfo( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv,
164 bool bCache = true );
165
177 css::uno::Reference< css::ucb::XCommandInfo >
178 getCommandInfo( const css::uno::Reference< css::ucb::XCommandEnvironment > & xEnv,
179 bool bCache = true );
180
186 void notifyPropertiesChange(
187 const css::uno::Sequence< css::beans::PropertyChangeEvent >& evt ) const;
188
199 void notifyPropertySetInfoChange(
200 const css::beans::PropertySetInfoChangeEvent& evt ) const;
201
207 void notifyContentEvent(
208 const css::ucb::ContentEvent& evt ) const;
209
215 void inserted();
216
224 void deleted();
225
234 bool exchange( const css::uno::Reference< css::ucb::XContentIdentifier >& rNewId );
235
247 css::uno::Reference< css::ucb::XPersistentPropertySet >
248 getAdditionalPropertySet( bool bCreate );
249
258 bool renameAdditionalPropertySet( const OUString& rOldKey,
259 const OUString& rNewKey );
260
269 bool copyAdditionalPropertySet( const OUString& rSourceKey,
270 const OUString& rTargetKey );
271
280 bool removeAdditionalPropertySet();
281
282public:
296 css::uno::Reference< css::uno::XComponentContext > xContext,
298 css::uno::Reference< css::ucb::XContentIdentifier > Identifier );
299
307 virtual ~ContentImplHelper() override;
308
309 // XInterface
310 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
311 virtual void SAL_CALL acquire() noexcept override
313 virtual void SAL_CALL release() noexcept override;
314
315 // XTypeProvider
316 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
317 getImplementationId() override;
318 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
319 getTypes() override;
320
321 // XServiceInfo
322 virtual OUString SAL_CALL
323 getImplementationName() override = 0;
324 virtual sal_Bool SAL_CALL
325 supportsService( const OUString& ServiceName ) override;
326 virtual css::uno::Sequence< OUString > SAL_CALL
327 getSupportedServiceNames() override = 0;
328
329 // XComponent
330 virtual void SAL_CALL
331 dispose() override;
332 virtual void SAL_CALL
333 addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
334 virtual void SAL_CALL
335 removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
336
337 // XContent
338 virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
339 getIdentifier() override;
340 virtual OUString SAL_CALL
341 getContentType() override = 0;
342 virtual void SAL_CALL
343 addContentEventListener(
344 const css::uno::Reference< css::ucb::XContentEventListener >& Listener ) override;
345 virtual void SAL_CALL
346 removeContentEventListener(
347 const css::uno::Reference< css::ucb::XContentEventListener >& Listener ) override;
348
349 // XCommandProcessor
350 virtual sal_Int32 SAL_CALL
351 createCommandIdentifier() override;
352 virtual css::uno::Any SAL_CALL
353 execute( const css::ucb::Command& aCommand,
354 sal_Int32 CommandId,
355 const css::uno::Reference< css::ucb::XCommandEnvironment >& Environment ) override = 0;
356 virtual void SAL_CALL
357 abort( sal_Int32 CommandId ) override = 0;
358
359 // XPropertiesChangeNotifier
360 virtual void SAL_CALL
361 addPropertiesChangeListener(
362 const css::uno::Sequence< OUString >& PropertyNames,
363 const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) override;
364 virtual void SAL_CALL
365 removePropertiesChangeListener(
366 const css::uno::Sequence< OUString >& PropertyNames,
367 const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) override;
368
369 // XCommandInfoChangeNotifier
370 virtual void SAL_CALL
371 addCommandInfoChangeListener(
372 const css::uno::Reference< css::ucb::XCommandInfoChangeListener >& Listener ) override;
373 virtual void SAL_CALL
374 removeCommandInfoChangeListener(
375 const css::uno::Reference< css::ucb::XCommandInfoChangeListener >& Listener ) override;
376
377 // XPropertyContainer
378
389 virtual void SAL_CALL
390 addProperty( const OUString& Name,
391 sal_Int16 Attributes,
392 const css::uno::Any& DefaultValue ) override;
393
404 virtual void SAL_CALL
405 removeProperty( const OUString& Name ) override;
406
407 // XPropertySetInfoChangeNotifier
408 virtual void SAL_CALL
409 addPropertySetInfoChangeListener(
410 const css::uno::Reference< css::beans::XPropertySetInfoChangeListener >& Listener ) override;
411 virtual void SAL_CALL
412 removePropertySetInfoChangeListener(
413 const css::uno::Reference< css::beans::XPropertySetInfoChangeListener >& Listener ) override;
414
415 // XChild
416
422 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
423 getParent() override;
424
428 virtual void SAL_CALL
429 setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
430
431
432 // Non-interface methods.
433
434
440 const rtl::Reference< ContentProviderImplHelper >& getProvider() const
441 { return m_xProvider; }
442};
443
444} // namespace ucbhelper
445
446#endif /* ! INCLUDED_UCBHELPER_CONTENTHELPER_HXX */
447
448/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
This class provides a command info ( the complete implementation of the interface XCommandInfo ) for ...
Definition: contentinfo.hxx:84
This is an abstract base class for implementations of the service com.sun.star.ucb....
virtual UCBHELPER_DLLPRIVATE OUString getParentURL()=0
The implementation of this method shall return the URL of the parent of your content.
virtual UCBHELPER_DLLPRIVATE css::uno::Sequence< css::beans::Property > getProperties(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)=0
Your implementation of this method must return a sequence containing the meta data of the properties ...
virtual UCBHELPER_DLLPRIVATE css::uno::Sequence< css::ucb::CommandInfo > getCommands(const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)=0
Your implementation of this method must return a sequence containing the meta data of the commands su...
rtl::Reference< ContentProviderImplHelper > m_xProvider
std::unique_ptr< ucbhelper_impl::ContentImplHelper_Impl > m_pImpl
virtual void SAL_CALL acquire() noexcept override
css::uno::Reference< css::ucb::XContentIdentifier > m_xIdentifier
css::uno::Reference< css::uno::XComponentContext > m_xContext
This is an abstract base class for implementations of the service com.sun.star.ucb....
This class provides a propertyset info ( the complete implementation of the interface XPropertySetInf...
Definition: contentinfo.hxx:47
DECL_LISTENERMULTIPLEXER_END void SAL_CALL inserted(::sal_Int32 ID) override
Type
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
unsigned char sal_Bool
signed char sal_Int8
#define UCBHELPER_DLLPUBLIC
#define UCBHELPER_DLLPRIVATE