1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_UCB_SOURCE_CORE_UCB_HXX
21 #define INCLUDED_UCB_SOURCE_CORE_UCB_HXX
24 #include <com/sun/star/ucb/CheckinArgument.hpp>
25 #include <com/sun/star/ucb/XUniversalContentBroker.hpp>
26 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
27 #include <com/sun/star/lang/XInitialization.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 #include <com/sun/star/util/XChangesListener.hpp>
31 #include <com/sun/star/util/XChangesNotifier.hpp>
33 #include <cppuhelper/implbase.hxx>
34 #include <osl/mutex.hxx>
35 #include "providermap.hxx"
36 #include <ucbhelper/registerucb.hxx>
41 namespace comphelper
{ class OInterfaceContainerHelper2
; }
43 namespace com::sun::star::ucb
{
45 struct GlobalTransferCommandArgument2
;
48 class UniversalContentBroker
:
49 public cppu::WeakImplHelper
<
50 css::ucb::XUniversalContentBroker
,
51 css::lang::XServiceInfo
,
52 css::lang::XInitialization
,
53 css::util::XChangesListener
>
56 explicit UniversalContentBroker( const css::uno::Reference
< css::uno::XComponentContext
>& xContext
);
57 virtual ~UniversalContentBroker() override
;
60 virtual OUString SAL_CALL
getImplementationName() override
;
61 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
62 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
68 addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& Listener
) override
;
70 removeEventListener( const css::uno::Reference
<
71 css::lang::XEventListener
>& Listener
) override
;
75 initialize( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
77 // XContentProviderManager
78 virtual css::uno::Reference
< css::ucb::XContentProvider
> SAL_CALL
79 registerContentProvider( const css::uno::Reference
< css::ucb::XContentProvider
>& Provider
,
80 const OUString
& Scheme
,
81 sal_Bool ReplaceExisting
) override
;
83 deregisterContentProvider( const css::uno::Reference
< css::ucb::XContentProvider
>& Provider
,
84 const OUString
& Scheme
) override
;
85 virtual css::uno::Sequence
< css::ucb::ContentProviderInfo
> SAL_CALL
86 queryContentProviders() override
;
87 virtual css::uno::Reference
< css::ucb::XContentProvider
> SAL_CALL
88 queryContentProvider( const OUString
& Identifier
) override
;
91 virtual css::uno::Reference
< css::ucb::XContent
> SAL_CALL
92 queryContent( const css::uno::Reference
< css::ucb::XContentIdentifier
>& Identifier
) override
;
93 virtual sal_Int32 SAL_CALL
94 compareContentIds( const css::uno::Reference
< css::ucb::XContentIdentifier
>& Id1
,
95 const css::uno::Reference
< css::ucb::XContentIdentifier
>& Id2
) override
;
97 // XContentIdentifierFactory
98 virtual css::uno::Reference
< css::ucb::XContentIdentifier
> SAL_CALL
99 createContentIdentifier( const OUString
& ContentId
) override
;
102 virtual sal_Int32 SAL_CALL
103 createCommandIdentifier() override
;
104 virtual css::uno::Any SAL_CALL
105 execute( const css::ucb::Command
& aCommand
,
107 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& Environment
) override
;
108 virtual void SAL_CALL
109 abort( sal_Int32 CommandId
) override
;
111 // XCommandProcessor2
112 virtual void SAL_CALL
releaseCommandIdentifier(sal_Int32 aCommandId
) override
;
115 virtual void SAL_CALL
changesOccurred( const css::util::ChangesEvent
& Event
) override
;
117 // XEventListener ( base of XChangesLisetenr )
118 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
121 css::uno::Reference
< css::ucb::XContentProvider
>
122 queryContentProvider( const OUString
& Identifier
,
125 static css::uno::Reference
< css::ucb::XCommandInfo
>
128 /// @throws css::uno::Exception
131 const css::ucb::GlobalTransferCommandArgument2
& rArg
,
132 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& xEnv
);
134 /// @throws css::uno::Exception
135 css::uno::Any
checkIn( const css::ucb::CheckinArgument
& rArg
,
136 const css::uno::Reference
< css::ucb::XCommandEnvironment
>& xEnv
);
139 /// @throws css::uno::RuntimeException
142 bool getContentProviderData(
143 const OUString
& rKey1
,
144 const OUString
& rKey2
,
145 ucbhelper::ContentProviderDataList
& rListToFill
);
147 void prepareAndRegister( const ucbhelper::ContentProviderDataList
& rData
);
150 css::uno::XComponentContext
> m_xContext
;
153 css::util::XChangesNotifier
> m_xNotifier
;
155 css::uno::Sequence
< css::uno::Any
> m_aArguments
;
156 ProviderMap_Impl m_aProviders
;
158 std::unique_ptr
<comphelper::OInterfaceContainerHelper2
> m_pDisposeEventListeners
;
159 sal_Int32 m_nCommandId
;
162 #endif // INCLUDED_UCB_SOURCE_CORE_UCB_HXX
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */