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/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>
45 #define UCB_SERVICE_NAME "com.sun.star.ucb.UniversalContentBroker"
49 namespace cppu
{ class OInterfaceContainerHelper
; }
51 namespace com
{ namespace sun
{ namespace star
{ namespace ucb
{
53 struct GlobalTransferCommandArgument2
;
56 class UniversalContentBroker
:
57 public cppu::OWeakObject
,
58 public com::sun::star::ucb::XUniversalContentBroker
,
59 public com::sun::star::lang::XTypeProvider
,
60 public com::sun::star::lang::XServiceInfo
,
61 public com::sun::star::lang::XInitialization
,
62 public com::sun::star::util::XChangesListener
65 UniversalContentBroker( const com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>& xContext
);
66 virtual ~UniversalContentBroker();
69 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
)
70 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
71 virtual void SAL_CALL
acquire()
73 virtual void SAL_CALL
release()
77 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
78 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
79 virtual css::uno::Sequence
< com::sun::star::uno::Type
> SAL_CALL
getTypes()
80 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
83 virtual OUString SAL_CALL
getImplementationName()
84 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
85 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
86 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
87 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
88 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 static OUString
getImplementationName_Static();
91 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
93 static css::uno::Reference
< css::lang::XSingleServiceFactory
>
94 createServiceFactory( const css::uno::Reference
<
95 css::lang::XMultiServiceFactory
>& rxServiceMgr
);
100 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual void SAL_CALL
102 addEventListener( const com::sun::star::uno::Reference
<
103 com::sun::star::lang::XEventListener
>& Listener
)
104 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
105 virtual void SAL_CALL
106 removeEventListener( const com::sun::star::uno::Reference
<
107 com::sun::star::lang::XEventListener
>& Listener
)
108 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 virtual void SAL_CALL
112 initialize( const com::sun::star::uno::Sequence
<
113 com::sun::star::uno::Any
>& aArguments
)
114 throw( com::sun::star::uno::Exception
,
115 com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
117 // XContentProviderManager
118 virtual com::sun::star::uno::Reference
<
119 com::sun::star::ucb::XContentProvider
> SAL_CALL
120 registerContentProvider( const com::sun::star::uno::Reference
<
121 com::sun::star::ucb::XContentProvider
>&
123 const OUString
& Scheme
,
124 sal_Bool ReplaceExisting
)
125 throw( com::sun::star::ucb::DuplicateProviderException
,
126 com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
127 virtual void SAL_CALL
128 deregisterContentProvider( const com::sun::star::uno::Reference
<
129 com::sun::star::ucb::XContentProvider
>&
131 const OUString
& Scheme
)
132 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
133 virtual com::sun::star::uno::Sequence
<
134 com::sun::star::ucb::ContentProviderInfo
> SAL_CALL
135 queryContentProviders()
136 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
137 virtual com::sun::star::uno::Reference
<
138 com::sun::star::ucb::XContentProvider
> SAL_CALL
139 queryContentProvider( const OUString
& Identifier
)
140 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
143 virtual com::sun::star::uno::Reference
<
144 com::sun::star::ucb::XContent
> SAL_CALL
145 queryContent( const com::sun::star::uno::Reference
<
146 com::sun::star::ucb::XContentIdentifier
>& Identifier
)
147 throw( com::sun::star::ucb::IllegalIdentifierException
,
148 com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
149 virtual sal_Int32 SAL_CALL
150 compareContentIds( const com::sun::star::uno::Reference
<
151 com::sun::star::ucb::XContentIdentifier
>& Id1
,
152 const com::sun::star::uno::Reference
<
153 com::sun::star::ucb::XContentIdentifier
>& Id2
)
154 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
156 // XContentIdentifierFactory
157 virtual com::sun::star::uno::Reference
<
158 com::sun::star::ucb::XContentIdentifier
> SAL_CALL
159 createContentIdentifier( const OUString
& ContentId
)
160 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
163 virtual sal_Int32 SAL_CALL
164 createCommandIdentifier()
165 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
166 virtual com::sun::star::uno::Any SAL_CALL
167 execute( const com::sun::star::ucb::Command
& aCommand
,
169 const com::sun::star::uno::Reference
<
170 com::sun::star::ucb::XCommandEnvironment
>& Environment
)
171 throw( com::sun::star::uno::Exception
,
172 com::sun::star::ucb::CommandAbortedException
,
173 com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
174 virtual void SAL_CALL
175 abort( sal_Int32 CommandId
)
176 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
178 // XCommandProcessor2
179 virtual void SAL_CALL
releaseCommandIdentifier(sal_Int32 aCommandId
)
180 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
183 virtual void SAL_CALL
changesOccurred( const com::sun::star::util::ChangesEvent
& Event
)
184 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
186 // XEventListener ( base of XChangesLisetenr )
187 virtual void SAL_CALL
disposing( const com::sun::star::lang::EventObject
& Source
)
188 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
191 com::sun::star::uno::Reference
< com::sun::star::ucb::XContentProvider
>
192 queryContentProvider( const OUString
& Identifier
,
195 static com::sun::star::uno::Reference
< com::sun::star::ucb::XCommandInfo
>
200 const com::sun::star::ucb::GlobalTransferCommandArgument2
& rArg
,
201 const com::sun::star::uno::Reference
<
202 com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
203 throw( com::sun::star::uno::Exception
);
205 com::sun::star::uno::Any
checkIn( const com::sun::star::ucb::CheckinArgument
& rArg
,
206 const com::sun::star::uno::Reference
<
207 com::sun::star::ucb::XCommandEnvironment
>& xEnv
) throw( com::sun::star::uno::Exception
);
211 throw ( com::sun::star::uno::RuntimeException
);
213 bool getContentProviderData(
214 const OUString
& rKey1
,
215 const OUString
& rKey2
,
216 ucbhelper::ContentProviderDataList
& rListToFill
);
218 void prepareAndRegister( const ucbhelper::ContentProviderDataList
& rData
);
220 com::sun::star::uno::Reference
<
221 com::sun::star::uno::XComponentContext
> m_xContext
;
223 com::sun::star::uno::Reference
<
224 com::sun::star::util::XChangesNotifier
> m_xNotifier
;
226 com::sun::star::uno::Sequence
< com::sun::star::uno::Any
> m_aArguments
;
227 ProviderMap_Impl m_aProviders
;
229 cppu::OInterfaceContainerHelper
* m_pDisposeEventListeners
;
230 oslInterlockedCount m_nInitCount
; //@@@ see initialize() method
231 sal_Int32 m_nCommandId
;
234 #endif // INCLUDED_UCB_SOURCE_CORE_UCB_HXX
236 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */