bump product version to 5.0.4.1
[LibreOffice.git] / ucb / source / core / ucb.hxx
blobfe3dec59a5bebffb28f1efb34fe65e274aa936e0
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 <vector>
45 #define UCB_SERVICE_NAME "com.sun.star.ucb.UniversalContentBroker"
49 namespace cppu { class OInterfaceContainerHelper; }
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 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
64 public:
65 UniversalContentBroker( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext );
66 virtual ~UniversalContentBroker();
68 // XInterface
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()
72 throw() SAL_OVERRIDE;
73 virtual void SAL_CALL release()
74 throw() SAL_OVERRIDE;
76 // XTypeProvider
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;
82 // XServiceInfo
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 );
97 // XComponent
98 virtual void SAL_CALL
99 dispose()
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;
110 // XInitialization
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 >&
122 Provider,
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 >&
130 Provider,
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;
142 // XContentProvider
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;
162 // XCommandProcessor
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,
168 sal_Int32 CommandId,
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;
182 // XChangesListener
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;
190 private:
191 com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
192 queryContentProvider( const OUString& Identifier,
193 bool bResolved );
195 static com::sun::star::uno::Reference< com::sun::star::ucb::XCommandInfo >
196 getCommandInfo();
198 void
199 globalTransfer(
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 );
210 bool configureUcb()
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;
228 osl::Mutex m_aMutex;
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: */