LibreOffice Module ucb (master) 1
ucb.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
23#include <com/sun/star/ucb/CheckinArgument.hpp>
24#include <com/sun/star/ucb/XUniversalContentBroker.hpp>
25#include <com/sun/star/lang/XInitialization.hpp>
26#include <com/sun/star/lang/XServiceInfo.hpp>
27#include <com/sun/star/util/XChangesListener.hpp>
28#include <com/sun/star/util/XChangesNotifier.hpp>
29
32#include <osl/mutex.hxx>
33#include "providermap.hxx"
35
36#include <memory>
37
38
39namespace com::sun::star::ucb {
40 class XCommandInfo;
41 struct GlobalTransferCommandArgument2;
42}
43
45 public cppu::WeakImplHelper<
46 css::ucb::XUniversalContentBroker,
47 css::lang::XServiceInfo,
48 css::lang::XInitialization,
49 css::util::XChangesListener>
50{
51public:
52 explicit UniversalContentBroker( const css::uno::Reference< css::uno::XComponentContext >& xContext );
53 virtual ~UniversalContentBroker() override;
54
55 // XServiceInfo
56 virtual OUString SAL_CALL getImplementationName() override;
57 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
58 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
59
60 // XComponent
61 virtual void SAL_CALL
62 dispose() override;
63 virtual void SAL_CALL
64 addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
65 virtual void SAL_CALL
66 removeEventListener( const css::uno::Reference<
67 css::lang::XEventListener >& Listener ) override;
68
69 // XInitialization
70 virtual void SAL_CALL
71 initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
72
73 // XContentProviderManager
74 virtual css::uno::Reference< css::ucb::XContentProvider > SAL_CALL
75 registerContentProvider( const css::uno::Reference< css::ucb::XContentProvider >& Provider,
76 const OUString& Scheme,
77 sal_Bool ReplaceExisting ) override;
78 virtual void SAL_CALL
79 deregisterContentProvider( const css::uno::Reference< css::ucb::XContentProvider >& Provider,
80 const OUString& Scheme ) override;
81 virtual css::uno::Sequence< css::ucb::ContentProviderInfo > SAL_CALL
82 queryContentProviders() override;
83 virtual css::uno::Reference< css::ucb::XContentProvider > SAL_CALL
84 queryContentProvider( const OUString& Identifier ) override;
85
86 // XContentProvider
87 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
88 queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
89 virtual sal_Int32 SAL_CALL
90 compareContentIds( const css::uno::Reference< css::ucb::XContentIdentifier >& Id1,
91 const css::uno::Reference< css::ucb::XContentIdentifier >& Id2 ) override;
92
93 // XContentIdentifierFactory
94 virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
95 createContentIdentifier( const OUString& ContentId ) override;
96
97 // XCommandProcessor
98 virtual sal_Int32 SAL_CALL
99 createCommandIdentifier() override;
100 virtual css::uno::Any SAL_CALL
101 execute( const css::ucb::Command& aCommand,
102 sal_Int32 CommandId,
103 const css::uno::Reference< css::ucb::XCommandEnvironment >& Environment ) override;
104 virtual void SAL_CALL
105 abort( sal_Int32 CommandId ) override;
106
107 // XCommandProcessor2
108 virtual void SAL_CALL releaseCommandIdentifier(sal_Int32 aCommandId) override;
109
110 // XChangesListener
111 virtual void SAL_CALL changesOccurred( const css::util::ChangesEvent& Event ) override;
112
113 // XEventListener ( base of XChangesLisetenr )
114 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
115
116private:
117 css::uno::Reference< css::ucb::XContentProvider >
118 queryContentProvider( const OUString& Identifier,
119 bool bResolved );
120
121 static css::uno::Reference< css::ucb::XCommandInfo >
123
125 void
127 const css::ucb::GlobalTransferCommandArgument2 & rArg,
128 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
129
131 css::uno::Any checkIn( const css::ucb::CheckinArgument& rArg,
132 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
133
134
136 void configureUcb();
137
139 std::u16string_view rKey1,
140 std::u16string_view rKey2,
142
144
145 css::uno::Reference<
146 css::uno::XComponentContext > m_xContext;
147
148 css::uno::Reference<
149 css::util::XChangesNotifier > m_xNotifier;
150
151 css::uno::Sequence< css::uno::Any > m_aArguments;
153 osl::Mutex m_aMutex;
154 std::unique_ptr<comphelper::OInterfaceContainerHelper3<css::lang::XEventListener>> m_pDisposeEventListeners;
155 sal_Int32 m_nCommandId;
156};
157
158/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL deregisterContentProvider(const css::uno::Reference< css::ucb::XContentProvider > &Provider, const OUString &Scheme) override
Definition: ucb.cxx:390
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
Definition: ucb.cxx:270
UniversalContentBroker(const css::uno::Reference< css::uno::XComponentContext > &xContext)
Definition: ucb.cxx:224
virtual ~UniversalContentBroker() override
Definition: ucb.cxx:235
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
Definition: ucb.cxx:259
static css::uno::Reference< css::ucb::XCommandInfo > getCommandInfo()
Definition: ucbcmds.cxx:1526
css::uno::Reference< css::util::XChangesNotifier > m_xNotifier
Definition: ucb.hxx:149
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: ucb.hxx:146
sal_Int32 m_nCommandId
Definition: ucb.hxx:155
virtual void SAL_CALL releaseCommandIdentifier(sal_Int32 aCommandId) override
Definition: ucb.cxx:637
virtual OUString SAL_CALL getImplementationName() override
Definition: ucb.cxx:282
void globalTransfer(const css::ucb::GlobalTransferCommandArgument2 &rArg, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
Definition: ucbcmds.cxx:1532
virtual sal_Int32 SAL_CALL createCommandIdentifier() override
Definition: ucb.cxx:539
virtual css::uno::Reference< css::ucb::XContentProvider > SAL_CALL registerContentProvider(const css::uno::Reference< css::ucb::XContentProvider > &Provider, const OUString &Scheme, sal_Bool ReplaceExisting) override
Definition: ucb.cxx:344
ProviderMap_Impl m_aProviders
Definition: ucb.hxx:152
virtual void SAL_CALL abort(sal_Int32 CommandId) override
Definition: ucb.cxx:644
virtual void SAL_CALL dispose() override
Definition: ucb.cxx:244
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: ucb.cxx:290
virtual void SAL_CALL changesOccurred(const css::util::ChangesEvent &Event) override
Definition: ucb.cxx:654
std::unique_ptr< comphelper::OInterfaceContainerHelper3< css::lang::XEventListener > > m_pDisposeEventListeners
Definition: ucb.hxx:154
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: ucb.cxx:308
bool getContentProviderData(std::u16string_view rKey1, std::u16string_view rKey2, ucbhelper::ContentProviderDataList &rListToFill)
Definition: ucb.cxx:765
void prepareAndRegister(const ucbhelper::ContentProviderDataList &rData)
Definition: ucb.cxx:742
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override
Definition: ucb.cxx:459
virtual css::uno::Sequence< css::ucb::ContentProviderInfo > SAL_CALL queryContentProviders() override
Definition: ucb.cxx:423
css::uno::Any checkIn(const css::ucb::CheckinArgument &rArg, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
Definition: ucbcmds.cxx:1846
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
Definition: ucb.cxx:694
osl::Mutex m_aMutex
Definition: ucb.hxx:153
virtual sal_Int32 SAL_CALL compareContentIds(const css::uno::Reference< css::ucb::XContentIdentifier > &Id1, const css::uno::Reference< css::ucb::XContentIdentifier > &Id2) override
Definition: ucb.cxx:480
virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL createContentIdentifier(const OUString &ContentId) override
Definition: ucb.cxx:507
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: ucb.cxx:286
virtual css::uno::Any SAL_CALL execute(const css::ucb::Command &aCommand, sal_Int32 CommandId, const css::uno::Reference< css::ucb::XCommandEnvironment > &Environment) override
Definition: ucb.cxx:549
css::uno::Sequence< css::uno::Any > m_aArguments
Definition: ucb.hxx:151
virtual css::uno::Reference< css::ucb::XContentProvider > SAL_CALL queryContentProvider(const OUString &Identifier) override
Definition: ucb.cxx:448
Sequence< PropertyValue > aArguments
std::vector< ContentProviderData > ContentProviderDataList
OUString aCommand
unsigned char sal_Bool