bump product version to 4.1.6.2
[LibreOffice.git] / ucb / source / core / ucb.hxx
blob50d5d699cc166ec76856b3c88f7af2a1b32f78b9
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 _UCB_HXX
21 #define _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>
43 //=========================================================================
45 #define UCB_SERVICE_NAME "com.sun.star.ucb.UniversalContentBroker"
47 //=========================================================================
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::lang::XMultiServiceFactory >& rXSMgr );
66 virtual ~UniversalContentBroker();
68 // XInterface
69 XINTERFACE_DECL()
71 // XTypeProvider
72 XTYPEPROVIDER_DECL()
74 // XServiceInfo
75 XSERVICEINFO_DECL()
77 // XComponent
78 virtual void SAL_CALL
79 dispose()
80 throw( com::sun::star::uno::RuntimeException );
81 virtual void SAL_CALL
82 addEventListener( const com::sun::star::uno::Reference<
83 com::sun::star::lang::XEventListener >& Listener )
84 throw( com::sun::star::uno::RuntimeException );
85 virtual void SAL_CALL
86 removeEventListener( const com::sun::star::uno::Reference<
87 com::sun::star::lang::XEventListener >& Listener )
88 throw( com::sun::star::uno::RuntimeException );
90 // XInitialization
91 virtual void SAL_CALL
92 initialize( const com::sun::star::uno::Sequence<
93 com::sun::star::uno::Any >& aArguments )
94 throw( com::sun::star::uno::Exception,
95 com::sun::star::uno::RuntimeException );
97 // XContentProviderManager
98 virtual com::sun::star::uno::Reference<
99 com::sun::star::ucb::XContentProvider > SAL_CALL
100 registerContentProvider( const com::sun::star::uno::Reference<
101 com::sun::star::ucb::XContentProvider >&
102 Provider,
103 const OUString& Scheme,
104 sal_Bool ReplaceExisting )
105 throw( com::sun::star::ucb::DuplicateProviderException,
106 com::sun::star::uno::RuntimeException );
107 virtual void SAL_CALL
108 deregisterContentProvider( const com::sun::star::uno::Reference<
109 com::sun::star::ucb::XContentProvider >&
110 Provider,
111 const OUString& Scheme )
112 throw( com::sun::star::uno::RuntimeException );
113 virtual com::sun::star::uno::Sequence<
114 com::sun::star::ucb::ContentProviderInfo > SAL_CALL
115 queryContentProviders()
116 throw( com::sun::star::uno::RuntimeException );
117 virtual com::sun::star::uno::Reference<
118 com::sun::star::ucb::XContentProvider > SAL_CALL
119 queryContentProvider( const OUString& Identifier )
120 throw( com::sun::star::uno::RuntimeException );
122 // XContentProvider
123 virtual com::sun::star::uno::Reference<
124 com::sun::star::ucb::XContent > SAL_CALL
125 queryContent( const com::sun::star::uno::Reference<
126 com::sun::star::ucb::XContentIdentifier >& Identifier )
127 throw( com::sun::star::ucb::IllegalIdentifierException,
128 com::sun::star::uno::RuntimeException );
129 virtual sal_Int32 SAL_CALL
130 compareContentIds( const com::sun::star::uno::Reference<
131 com::sun::star::ucb::XContentIdentifier >& Id1,
132 const com::sun::star::uno::Reference<
133 com::sun::star::ucb::XContentIdentifier >& Id2 )
134 throw( com::sun::star::uno::RuntimeException );
136 // XContentIdentifierFactory
137 virtual com::sun::star::uno::Reference<
138 com::sun::star::ucb::XContentIdentifier > SAL_CALL
139 createContentIdentifier( const OUString& ContentId )
140 throw( com::sun::star::uno::RuntimeException );
142 // XCommandProcessor
143 virtual sal_Int32 SAL_CALL
144 createCommandIdentifier()
145 throw( com::sun::star::uno::RuntimeException );
146 virtual com::sun::star::uno::Any SAL_CALL
147 execute( const com::sun::star::ucb::Command& aCommand,
148 sal_Int32 CommandId,
149 const com::sun::star::uno::Reference<
150 com::sun::star::ucb::XCommandEnvironment >& Environment )
151 throw( com::sun::star::uno::Exception,
152 com::sun::star::ucb::CommandAbortedException,
153 com::sun::star::uno::RuntimeException );
154 virtual void SAL_CALL
155 abort( sal_Int32 CommandId )
156 throw( com::sun::star::uno::RuntimeException );
158 // XCommandProcessor2
159 virtual void SAL_CALL releaseCommandIdentifier(sal_Int32 aCommandId)
160 throw( com::sun::star::uno::RuntimeException );
162 // XChangesListener
163 virtual void SAL_CALL changesOccurred( const com::sun::star::util::ChangesEvent& Event )
164 throw( com::sun::star::uno::RuntimeException );
166 // XEventListener ( base of XChangesLisetenr )
167 virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source )
168 throw( com::sun::star::uno::RuntimeException );
170 private:
171 com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
172 queryContentProvider( const OUString& Identifier,
173 sal_Bool bResolved );
175 com::sun::star::uno::Reference< com::sun::star::ucb::XCommandInfo >
176 getCommandInfo();
178 void
179 globalTransfer(
180 const com::sun::star::ucb::GlobalTransferCommandArgument2 & rArg,
181 const com::sun::star::uno::Reference<
182 com::sun::star::ucb::XCommandEnvironment >& xEnv )
183 throw( com::sun::star::uno::Exception );
185 com::sun::star::uno::Any checkIn( const com::sun::star::ucb::CheckinArgument& rArg,
186 const com::sun::star::uno::Reference<
187 com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw( com::sun::star::uno::Exception );
190 bool configureUcb()
191 throw ( com::sun::star::uno::RuntimeException);
193 bool getContentProviderData(
194 const OUString & rKey1,
195 const OUString & rKey2,
196 ucbhelper::ContentProviderDataList & rListToFill);
198 void prepareAndRegister( const ucbhelper::ContentProviderDataList& rData);
200 com::sun::star::uno::Reference<
201 com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
203 com::sun::star::uno::Reference<
204 com::sun::star::util::XChangesNotifier > m_xNotifier;
206 com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_aArguments;
207 ProviderMap_Impl m_aProviders;
208 osl::Mutex m_aMutex;
209 cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
210 oslInterlockedCount m_nInitCount; //@@@ see initialize() method
211 sal_Int32 m_nCommandId;
214 #endif /* !_UCB_HXX */
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */