lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / ucb / source / core / ucb.hxx
blob1cd5ef1a364bbcab4c24da3b8246433aaca8412f
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 #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/XInitialization.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include <com/sun/star/lang/XTypeProvider.hpp>
30 #include <com/sun/star/util/XChangesListener.hpp>
31 #include <com/sun/star/util/XChangesNotifier.hpp>
32 #include <com/sun/star/container/XContainer.hpp>
34 #include <rtl/ustrbuf.hxx>
35 #include <cppuhelper/weak.hxx>
36 #include <osl/mutex.hxx>
37 #include <osl/interlck.h>
38 #include <ucbhelper/macros.hxx>
39 #include "providermap.hxx"
40 #include <ucbhelper/registerucb.hxx>
42 #include <memory>
43 #include <vector>
46 #define UCB_SERVICE_NAME "com.sun.star.ucb.UniversalContentBroker"
49 namespace comphelper { class OInterfaceContainerHelper2; }
51 namespace com { namespace sun { namespace star { namespace ucb {
52 class XCommandInfo;
53 struct GlobalTransferCommandArgument2;
54 } } } }
56 class UniversalContentBroker :
57 public cppu::OWeakObject,
58 public css::ucb::XUniversalContentBroker,
59 public css::lang::XTypeProvider,
60 public css::lang::XServiceInfo,
61 public css::lang::XInitialization,
62 public css::util::XChangesListener
64 public:
65 explicit UniversalContentBroker( const css::uno::Reference< css::uno::XComponentContext >& xContext );
66 virtual ~UniversalContentBroker() override;
68 // XInterface
69 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
70 virtual void SAL_CALL acquire()
71 throw() override;
72 virtual void SAL_CALL release()
73 throw() override;
75 // XTypeProvider
76 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
77 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
79 // XServiceInfo
80 virtual OUString SAL_CALL getImplementationName() override;
81 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
82 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
84 static OUString getImplementationName_Static();
85 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
87 static css::uno::Reference< css::lang::XSingleServiceFactory >
88 createServiceFactory( const css::uno::Reference<
89 css::lang::XMultiServiceFactory >& rxServiceMgr );
91 // XComponent
92 virtual void SAL_CALL
93 dispose() override;
94 virtual void SAL_CALL
95 addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
96 virtual void SAL_CALL
97 removeEventListener( const css::uno::Reference<
98 css::lang::XEventListener >& Listener ) override;
100 // XInitialization
101 virtual void SAL_CALL
102 initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
104 // XContentProviderManager
105 virtual css::uno::Reference< css::ucb::XContentProvider > SAL_CALL
106 registerContentProvider( const css::uno::Reference< css::ucb::XContentProvider >& Provider,
107 const OUString& Scheme,
108 sal_Bool ReplaceExisting ) override;
109 virtual void SAL_CALL
110 deregisterContentProvider( const css::uno::Reference< css::ucb::XContentProvider >& Provider,
111 const OUString& Scheme ) override;
112 virtual css::uno::Sequence< css::ucb::ContentProviderInfo > SAL_CALL
113 queryContentProviders() override;
114 virtual css::uno::Reference< css::ucb::XContentProvider > SAL_CALL
115 queryContentProvider( const OUString& Identifier ) override;
117 // XContentProvider
118 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
119 queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
120 virtual sal_Int32 SAL_CALL
121 compareContentIds( const css::uno::Reference< css::ucb::XContentIdentifier >& Id1,
122 const css::uno::Reference< css::ucb::XContentIdentifier >& Id2 ) override;
124 // XContentIdentifierFactory
125 virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
126 createContentIdentifier( const OUString& ContentId ) override;
128 // XCommandProcessor
129 virtual sal_Int32 SAL_CALL
130 createCommandIdentifier() override;
131 virtual css::uno::Any SAL_CALL
132 execute( const css::ucb::Command& aCommand,
133 sal_Int32 CommandId,
134 const css::uno::Reference< css::ucb::XCommandEnvironment >& Environment ) override;
135 virtual void SAL_CALL
136 abort( sal_Int32 CommandId ) override;
138 // XCommandProcessor2
139 virtual void SAL_CALL releaseCommandIdentifier(sal_Int32 aCommandId) override;
141 // XChangesListener
142 virtual void SAL_CALL changesOccurred( const css::util::ChangesEvent& Event ) override;
144 // XEventListener ( base of XChangesLisetenr )
145 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
147 private:
148 css::uno::Reference< css::ucb::XContentProvider >
149 queryContentProvider( const OUString& Identifier,
150 bool bResolved );
152 static css::uno::Reference< css::ucb::XCommandInfo >
153 getCommandInfo();
155 /// @throws css::uno::Exception
156 void
157 globalTransfer(
158 const css::ucb::GlobalTransferCommandArgument2 & rArg,
159 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
161 /// @throws css::uno::Exception
162 css::uno::Any checkIn( const css::ucb::CheckinArgument& rArg,
163 const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
166 /// @throws css::uno::RuntimeException
167 void configureUcb();
169 bool getContentProviderData(
170 const OUString & rKey1,
171 const OUString & rKey2,
172 ucbhelper::ContentProviderDataList & rListToFill);
174 void prepareAndRegister( const ucbhelper::ContentProviderDataList& rData);
176 css::uno::Reference<
177 css::uno::XComponentContext > m_xContext;
179 css::uno::Reference<
180 css::util::XChangesNotifier > m_xNotifier;
182 css::uno::Sequence< css::uno::Any > m_aArguments;
183 ProviderMap_Impl m_aProviders;
184 osl::Mutex m_aMutex;
185 std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pDisposeEventListeners;
186 sal_Int32 m_nCommandId;
189 #endif // INCLUDED_UCB_SOURCE_CORE_UCB_HXX
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */