sw a11y: clang-format SidebarWinAccessible code
[LibreOffice.git] / ucb / source / core / ucb.hxx
blob001987ed54c447ddbacf913caf374d5a041aba9e
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
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>
30 #include <comphelper/interfacecontainer3.hxx>
31 #include <cppuhelper/implbase.hxx>
32 #include <osl/mutex.hxx>
33 #include "providermap.hxx"
34 #include <ucbhelper/registerucb.hxx>
36 #include <memory>
39 namespace com::sun::star::ucb {
40 class XCommandInfo;
41 struct GlobalTransferCommandArgument2;
44 class UniversalContentBroker :
45 public cppu::WeakImplHelper<
46 css::ucb::XUniversalContentBroker,
47 css::lang::XServiceInfo,
48 css::lang::XInitialization,
49 css::util::XChangesListener>
51 public:
52 explicit UniversalContentBroker( const css::uno::Reference< css::uno::XComponentContext >& xContext );
53 virtual ~UniversalContentBroker() override;
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;
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;
69 // XInitialization
70 virtual void SAL_CALL
71 initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
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;
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;
93 // XContentIdentifierFactory
94 virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
95 createContentIdentifier( const OUString& ContentId ) override;
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;
107 // XCommandProcessor2
108 virtual void SAL_CALL releaseCommandIdentifier(sal_Int32 aCommandId) override;
110 // XChangesListener
111 virtual void SAL_CALL changesOccurred( const css::util::ChangesEvent& Event ) override;
113 // XEventListener ( base of XChangesLisetenr )
114 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
116 private:
117 css::uno::Reference< css::ucb::XContentProvider >
118 queryContentProvider( const OUString& Identifier,
119 bool bResolved );
121 static css::uno::Reference< css::ucb::XCommandInfo >
122 getCommandInfo();
124 /// @throws css::uno::Exception
125 void
126 globalTransfer(
127 const css::ucb::GlobalTransferCommandArgument2 & rArg,
128 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
130 /// @throws css::uno::Exception
131 css::uno::Any checkIn( const css::ucb::CheckinArgument& rArg,
132 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
135 /// @throws css::uno::RuntimeException
136 void configureUcb();
138 bool getContentProviderData(
139 std::u16string_view rKey1,
140 std::u16string_view rKey2,
141 ucbhelper::ContentProviderDataList & rListToFill);
143 void prepareAndRegister( const ucbhelper::ContentProviderDataList& rData);
145 css::uno::Reference<
146 css::uno::XComponentContext > m_xContext;
148 css::uno::Reference<
149 css::util::XChangesNotifier > m_xNotifier;
151 css::uno::Sequence< css::uno::Any > m_aArguments;
152 ProviderMap_Impl m_aProviders;
153 osl::Mutex m_aMutex;
154 std::unique_ptr<comphelper::OInterfaceContainerHelper3<css::lang::XEventListener>> m_pDisposeEventListeners;
155 sal_Int32 m_nCommandId;
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */