Bump for 3.6-28
[LibreOffice.git] / ucb / source / core / ucb.hxx
bloba7b373cd9e3eea9070bebfe7c9b55888db231a24
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _UCB_HXX
30 #define _UCB_HXX
32 #include <com/sun/star/ucb/XCommandProcessor.hpp>
33 #include <com/sun/star/ucb/XContentProvider.hpp>
34 #include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
35 #include <com/sun/star/ucb/XContentProviderManager.hpp>
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/lang/XComponent.hpp>
38 #include <com/sun/star/lang/XInitialization.hpp>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include <com/sun/star/lang/XTypeProvider.hpp>
41 #include <com/sun/star/util/XChangesListener.hpp>
42 #include <com/sun/star/util/XChangesNotifier.hpp>
43 #include <com/sun/star/container/XContainer.hpp>
45 #include <rtl/ustrbuf.hxx>
46 #include <cppuhelper/weak.hxx>
47 #include <osl/mutex.hxx>
48 #include <osl/interlck.h>
49 #include <ucbhelper/macros.hxx>
50 #include "providermap.hxx"
51 #include <ucbhelper/registerucb.hxx>
53 #include <vector>
54 //=========================================================================
56 #define UCB_SERVICE_NAME "com.sun.star.ucb.UniversalContentBroker"
58 //=========================================================================
60 namespace cppu { class OInterfaceContainerHelper; }
62 namespace com { namespace sun { namespace star { namespace ucb {
63 class XCommandInfo;
64 struct GlobalTransferCommandArgument;
65 } } } }
67 class UniversalContentBroker :
68 public cppu::OWeakObject,
69 public com::sun::star::lang::XTypeProvider,
70 public com::sun::star::lang::XComponent,
71 public com::sun::star::lang::XServiceInfo,
72 public com::sun::star::lang::XInitialization,
73 public com::sun::star::ucb::XContentProviderManager,
74 public com::sun::star::ucb::XContentProvider,
75 public com::sun::star::ucb::XContentIdentifierFactory,
76 public com::sun::star::ucb::XCommandProcessor,
77 public com::sun::star::util::XChangesListener
79 public:
80 UniversalContentBroker( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
81 virtual ~UniversalContentBroker();
83 // XInterface
84 XINTERFACE_DECL()
86 // XTypeProvider
87 XTYPEPROVIDER_DECL()
89 // XServiceInfo
90 XSERVICEINFO_DECL()
92 // XComponent
93 virtual void SAL_CALL
94 dispose()
95 throw( com::sun::star::uno::RuntimeException );
96 virtual void SAL_CALL
97 addEventListener( const com::sun::star::uno::Reference<
98 com::sun::star::lang::XEventListener >& Listener )
99 throw( com::sun::star::uno::RuntimeException );
100 virtual void SAL_CALL
101 removeEventListener( const com::sun::star::uno::Reference<
102 com::sun::star::lang::XEventListener >& Listener )
103 throw( com::sun::star::uno::RuntimeException );
105 // XInitialization
106 virtual void SAL_CALL
107 initialize( const com::sun::star::uno::Sequence<
108 com::sun::star::uno::Any >& aArguments )
109 throw( com::sun::star::uno::Exception,
110 com::sun::star::uno::RuntimeException );
112 // XContentProviderManager
113 virtual com::sun::star::uno::Reference<
114 com::sun::star::ucb::XContentProvider > SAL_CALL
115 registerContentProvider( const com::sun::star::uno::Reference<
116 com::sun::star::ucb::XContentProvider >&
117 Provider,
118 const rtl::OUString& Scheme,
119 sal_Bool ReplaceExisting )
120 throw( com::sun::star::ucb::DuplicateProviderException,
121 com::sun::star::uno::RuntimeException );
122 virtual void SAL_CALL
123 deregisterContentProvider( const com::sun::star::uno::Reference<
124 com::sun::star::ucb::XContentProvider >&
125 Provider,
126 const rtl::OUString& Scheme )
127 throw( com::sun::star::uno::RuntimeException );
128 virtual com::sun::star::uno::Sequence<
129 com::sun::star::ucb::ContentProviderInfo > SAL_CALL
130 queryContentProviders()
131 throw( com::sun::star::uno::RuntimeException );
132 virtual com::sun::star::uno::Reference<
133 com::sun::star::ucb::XContentProvider > SAL_CALL
134 queryContentProvider( const rtl::OUString& Identifier )
135 throw( com::sun::star::uno::RuntimeException );
137 // XContentProvider
138 virtual com::sun::star::uno::Reference<
139 com::sun::star::ucb::XContent > SAL_CALL
140 queryContent( const com::sun::star::uno::Reference<
141 com::sun::star::ucb::XContentIdentifier >& Identifier )
142 throw( com::sun::star::ucb::IllegalIdentifierException,
143 com::sun::star::uno::RuntimeException );
144 virtual sal_Int32 SAL_CALL
145 compareContentIds( const com::sun::star::uno::Reference<
146 com::sun::star::ucb::XContentIdentifier >& Id1,
147 const com::sun::star::uno::Reference<
148 com::sun::star::ucb::XContentIdentifier >& Id2 )
149 throw( com::sun::star::uno::RuntimeException );
151 // XContentIdentifierFactory
152 virtual com::sun::star::uno::Reference<
153 com::sun::star::ucb::XContentIdentifier > SAL_CALL
154 createContentIdentifier( const rtl::OUString& ContentId )
155 throw( com::sun::star::uno::RuntimeException );
157 // XCommandProcessor
158 virtual sal_Int32 SAL_CALL
159 createCommandIdentifier()
160 throw( com::sun::star::uno::RuntimeException );
161 virtual com::sun::star::uno::Any SAL_CALL
162 execute( const com::sun::star::ucb::Command& aCommand,
163 sal_Int32 CommandId,
164 const com::sun::star::uno::Reference<
165 com::sun::star::ucb::XCommandEnvironment >& Environment )
166 throw( com::sun::star::uno::Exception,
167 com::sun::star::ucb::CommandAbortedException,
168 com::sun::star::uno::RuntimeException );
169 virtual void SAL_CALL
170 abort( sal_Int32 CommandId )
171 throw( com::sun::star::uno::RuntimeException );
173 // XChangesListener
174 virtual void SAL_CALL changesOccurred( const com::sun::star::util::ChangesEvent& Event )
175 throw( com::sun::star::uno::RuntimeException );
177 // XEventListener ( base of XChangesLisetenr )
178 virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source )
179 throw( com::sun::star::uno::RuntimeException );
181 private:
182 com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
183 queryContentProvider( const rtl::OUString& Identifier,
184 sal_Bool bResolved );
186 com::sun::star::uno::Reference< com::sun::star::ucb::XCommandInfo >
187 getCommandInfo();
189 void
190 globalTransfer(
191 const com::sun::star::ucb::GlobalTransferCommandArgument & rArg,
192 const com::sun::star::uno::Reference<
193 com::sun::star::ucb::XCommandEnvironment >& xEnv )
194 throw( com::sun::star::uno::Exception );
197 bool configureUcb()
198 throw ( com::sun::star::uno::RuntimeException);
200 bool getContentProviderData(
201 const rtl::OUString & rKey1,
202 const rtl::OUString & rKey2,
203 ucbhelper::ContentProviderDataList & rListToFill);
205 void prepareAndRegister( const ucbhelper::ContentProviderDataList& rData);
207 com::sun::star::uno::Reference<
208 com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
210 com::sun::star::uno::Reference<
211 com::sun::star::util::XChangesNotifier > m_xNotifier;
213 com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_aArguments;
214 ProviderMap_Impl m_aProviders;
215 osl::Mutex m_aMutex;
216 cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
217 oslInterlockedCount m_nInitCount; //@@@ see initialize() method
218 sal_Int32 m_nCommandId;
221 #endif /* !_UCB_HXX */
223 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */