merge the formfield patch from ooo-build
[ooovba.git] / ucb / source / core / ucb.hxx
blob8febff42abeea0b327f88ce081eeb2daafac468d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ucb.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _UCB_HXX
32 #define _UCB_HXX
34 #include <com/sun/star/ucb/XCommandProcessor.hpp>
35 #include <com/sun/star/ucb/XContentProvider.hpp>
36 #include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
37 #include <com/sun/star/ucb/XContentProviderManager.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/lang/XComponent.hpp>
40 #include <com/sun/star/lang/XInitialization.hpp>
41 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
42 #include <com/sun/star/lang/XTypeProvider.hpp>
43 #include <rtl/ustrbuf.hxx>
44 #include <cppuhelper/weak.hxx>
45 #include <osl/mutex.hxx>
46 #include <osl/interlck.h>
47 #include <ucbhelper/macros.hxx>
48 #include "providermap.hxx"
50 //=========================================================================
52 #define UCB_SERVICE_NAME "com.sun.star.ucb.UniversalContentBroker"
54 //=========================================================================
56 namespace cppu { class OInterfaceContainerHelper; }
58 namespace com { namespace sun { namespace star { namespace ucb {
59 class XCommandInfo;
60 struct GlobalTransferCommandArgument;
61 } } } }
63 class UniversalContentBroker :
64 public cppu::OWeakObject,
65 public com::sun::star::lang::XTypeProvider,
66 public com::sun::star::lang::XComponent,
67 public com::sun::star::lang::XServiceInfo,
68 public com::sun::star::lang::XInitialization,
69 public com::sun::star::ucb::XContentProviderManager,
70 public com::sun::star::ucb::XContentProvider,
71 public com::sun::star::ucb::XContentIdentifierFactory,
72 public com::sun::star::ucb::XCommandProcessor
74 public:
75 UniversalContentBroker( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
76 virtual ~UniversalContentBroker();
78 // XInterface
79 XINTERFACE_DECL()
81 // XTypeProvider
82 XTYPEPROVIDER_DECL()
84 // XServiceInfo
85 XSERVICEINFO_DECL()
87 // XComponent
88 virtual void SAL_CALL
89 dispose()
90 throw( com::sun::star::uno::RuntimeException );
91 virtual void SAL_CALL
92 addEventListener( const com::sun::star::uno::Reference<
93 com::sun::star::lang::XEventListener >& Listener )
94 throw( com::sun::star::uno::RuntimeException );
95 virtual void SAL_CALL
96 removeEventListener( const com::sun::star::uno::Reference<
97 com::sun::star::lang::XEventListener >& Listener )
98 throw( com::sun::star::uno::RuntimeException );
100 // XInitialization
101 virtual void SAL_CALL
102 initialize( const com::sun::star::uno::Sequence<
103 com::sun::star::uno::Any >& aArguments )
104 throw( com::sun::star::uno::Exception,
105 com::sun::star::uno::RuntimeException );
107 // XContentProviderManager
108 virtual com::sun::star::uno::Reference<
109 com::sun::star::ucb::XContentProvider > SAL_CALL
110 registerContentProvider( const com::sun::star::uno::Reference<
111 com::sun::star::ucb::XContentProvider >&
112 Provider,
113 const rtl::OUString& Scheme,
114 sal_Bool ReplaceExisting )
115 throw( com::sun::star::ucb::DuplicateProviderException,
116 com::sun::star::uno::RuntimeException );
117 virtual void SAL_CALL
118 deregisterContentProvider( const com::sun::star::uno::Reference<
119 com::sun::star::ucb::XContentProvider >&
120 Provider,
121 const rtl::OUString& Scheme )
122 throw( com::sun::star::uno::RuntimeException );
123 virtual com::sun::star::uno::Sequence<
124 com::sun::star::ucb::ContentProviderInfo > SAL_CALL
125 queryContentProviders()
126 throw( com::sun::star::uno::RuntimeException );
127 virtual com::sun::star::uno::Reference<
128 com::sun::star::ucb::XContentProvider > SAL_CALL
129 queryContentProvider( const rtl::OUString& Identifier )
130 throw( com::sun::star::uno::RuntimeException );
132 // XContentProvider
133 virtual com::sun::star::uno::Reference<
134 com::sun::star::ucb::XContent > SAL_CALL
135 queryContent( const com::sun::star::uno::Reference<
136 com::sun::star::ucb::XContentIdentifier >& Identifier )
137 throw( com::sun::star::ucb::IllegalIdentifierException,
138 com::sun::star::uno::RuntimeException );
139 virtual sal_Int32 SAL_CALL
140 compareContentIds( const com::sun::star::uno::Reference<
141 com::sun::star::ucb::XContentIdentifier >& Id1,
142 const com::sun::star::uno::Reference<
143 com::sun::star::ucb::XContentIdentifier >& Id2 )
144 throw( com::sun::star::uno::RuntimeException );
146 // XContentIdentifierFactory
147 virtual com::sun::star::uno::Reference<
148 com::sun::star::ucb::XContentIdentifier > SAL_CALL
149 createContentIdentifier( const rtl::OUString& ContentId )
150 throw( com::sun::star::uno::RuntimeException );
152 // XCommandProcessor
153 virtual sal_Int32 SAL_CALL
154 createCommandIdentifier()
155 throw( com::sun::star::uno::RuntimeException );
156 virtual com::sun::star::uno::Any SAL_CALL
157 execute( const com::sun::star::ucb::Command& aCommand,
158 sal_Int32 CommandId,
159 const com::sun::star::uno::Reference<
160 com::sun::star::ucb::XCommandEnvironment >& Environment )
161 throw( com::sun::star::uno::Exception,
162 com::sun::star::ucb::CommandAbortedException,
163 com::sun::star::uno::RuntimeException );
164 virtual void SAL_CALL
165 abort( sal_Int32 CommandId )
166 throw( com::sun::star::uno::RuntimeException );
168 private:
169 com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
170 queryContentProvider( const rtl::OUString& Identifier,
171 sal_Bool bResolved );
173 com::sun::star::uno::Reference< com::sun::star::ucb::XCommandInfo >
174 getCommandInfo();
176 void
177 globalTransfer(
178 const com::sun::star::ucb::GlobalTransferCommandArgument & rArg,
179 const com::sun::star::uno::Reference<
180 com::sun::star::ucb::XCommandEnvironment >& xEnv )
181 throw( com::sun::star::uno::Exception );
183 com::sun::star::uno::Reference<
184 com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
185 ProviderMap_Impl m_aProviders;
186 osl::Mutex m_aMutex;
187 cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
188 oslInterlockedCount m_nInitCount; //@@@ see initialize() method
189 sal_Int32 m_nCommandId;
192 #endif /* !_UCB_HXX */