merge the formfield patch from ooo-build
[ooovba.git] / ucb / source / ucp / file / bc.hxx
blob8a99cba1d09066372fdc43acf13b8cdc7dfe5ae6
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: bc.hxx,v $
10 * $Revision: 1.14 $
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 _BC_HXX_
32 #define _BC_HXX_
34 #include "osl/mutex.hxx"
35 #include "rtl/ustring.hxx"
36 #include <cppuhelper/weak.hxx>
37 #include <ucbhelper/macros.hxx>
38 #include <cppuhelper/interfacecontainer.h>
39 #include <com/sun/star/uno/XInterface.hpp>
40 #include <com/sun/star/lang/XTypeProvider.hpp>
41 #include <com/sun/star/lang/XComponent.hpp>
42 #include <com/sun/star/ucb/XCommandProcessor.hpp>
43 #include <com/sun/star/beans/XPropertiesChangeNotifier.hpp>
44 #include <com/sun/star/ucb/XContent.hpp>
45 #include <com/sun/star/ucb/XContentProvider.hpp>
46 #ifndef _COM_SUN_STAR_UCB_XRESULTSET_HPP_
47 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
48 #endif
49 #include <com/sun/star/lang/XServiceInfo.hpp>
50 #include <com/sun/star/sdbc/XRow.hpp>
51 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
52 #include <com/sun/star/beans/Property.hpp>
53 #include <com/sun/star/beans/PropertyValue.hpp>
54 #include <com/sun/star/ucb/XCommandInfo.hpp>
55 #include <com/sun/star/ucb/InsertCommandArgument.hpp>
56 #include <com/sun/star/beans/XPropertySetInfo.hpp>
57 #include <com/sun/star/beans/XPropertyContainer.hpp>
58 #include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp>
59 #include <com/sun/star/beans/XPropertySetInfoChangeListener.hpp>
60 #include <com/sun/star/container/XChild.hpp>
61 #include <com/sun/star/ucb/XContentCreator.hpp>
62 #include <com/sun/star/io/XInputStream.hpp>
63 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
64 #include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp>
65 #ifndef _COM_SUN_STAR_UCB_SHELL_HXX_
66 #include "shell.hxx"
67 #endif
70 namespace fileaccess {
72 class PropertyListeners;
73 class shell;
74 class FileProvider;
76 class BaseContent:
77 public cppu::OWeakObject,
78 public com::sun::star::lang::XComponent,
79 public com::sun::star::lang::XServiceInfo,
80 public com::sun::star::lang::XTypeProvider,
81 public com::sun::star::ucb::XCommandProcessor,
82 public com::sun::star::beans::XPropertiesChangeNotifier,
83 public com::sun::star::beans::XPropertyContainer,
84 public com::sun::star::beans::XPropertySetInfoChangeNotifier,
85 public com::sun::star::ucb::XContentCreator,
86 public com::sun::star::container::XChild,
87 public com::sun::star::ucb::XContent,
88 public fileaccess::Notifier // implementation class
90 private:
92 // A special creator for inserted contents; Creates an ugly object
93 BaseContent( shell* pMyShell,
94 const rtl::OUString& parentName,
95 sal_Bool bFolder );
97 public:
98 BaseContent(
99 shell* pMyShell,
100 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xContentIdentifier,
101 const rtl::OUString& aUnqPath );
103 virtual ~BaseContent();
105 // XInterface
106 virtual com::sun::star::uno::Any SAL_CALL
107 queryInterface(
108 const com::sun::star::uno::Type& aType )
109 throw( com::sun::star::uno::RuntimeException);
111 virtual void SAL_CALL
112 acquire(
113 void )
114 throw();
116 virtual void SAL_CALL
117 release(
118 void )
119 throw();
122 // XComponent
123 virtual void SAL_CALL
124 dispose(
125 void )
126 throw( com::sun::star::uno::RuntimeException );
128 virtual void SAL_CALL
129 addEventListener(
130 const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& xListener )
131 throw( com::sun::star::uno::RuntimeException );
133 virtual void SAL_CALL
134 removeEventListener( const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& aListener )
135 throw( com::sun::star::uno::RuntimeException );
138 // XTypeProvider
140 XTYPEPROVIDER_DECL()
143 // XServiceInfo
144 virtual rtl::OUString SAL_CALL
145 getImplementationName()
146 throw( com::sun::star::uno::RuntimeException);
148 virtual sal_Bool SAL_CALL
149 supportsService( const rtl::OUString& ServiceName )
150 throw( com::sun::star::uno::RuntimeException);
152 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
153 getSupportedServiceNames()
154 throw( com::sun::star::uno::RuntimeException );
157 // XCommandProcessor
158 virtual sal_Int32 SAL_CALL
159 createCommandIdentifier(
160 void )
161 throw( com::sun::star::uno::RuntimeException );
163 virtual com::sun::star::uno::Any SAL_CALL
164 execute(
165 const com::sun::star::ucb::Command& aCommand,
166 sal_Int32 CommandId,
167 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment )
168 throw( com::sun::star::uno::Exception,
169 com::sun::star::ucb::CommandAbortedException,
170 com::sun::star::uno::RuntimeException );
172 virtual void SAL_CALL
173 abort(
174 sal_Int32 CommandId )
175 throw( com::sun::star::uno::RuntimeException );
178 // XContent
179 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > SAL_CALL
180 getIdentifier(
181 void )
182 throw( com::sun::star::uno::RuntimeException );
184 virtual rtl::OUString SAL_CALL
185 getContentType(
186 void )
187 throw( com::sun::star::uno::RuntimeException );
189 virtual void SAL_CALL
190 addContentEventListener(
191 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentEventListener >& Listener )
192 throw( com::sun::star::uno::RuntimeException );
194 virtual void SAL_CALL
195 removeContentEventListener(
196 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentEventListener >& Listener )
197 throw( com::sun::star::uno::RuntimeException );
199 // XPropertiesChangeNotifier
201 virtual void SAL_CALL
202 addPropertiesChangeListener(
203 const com::sun::star::uno::Sequence< rtl::OUString >& PropertyNames,
204 const com::sun::star::uno::Reference<
205 com::sun::star::beans::XPropertiesChangeListener >& Listener )
206 throw( com::sun::star::uno::RuntimeException );
208 virtual void SAL_CALL
209 removePropertiesChangeListener( const com::sun::star::uno::Sequence< rtl::OUString >& PropertyNames,
210 const com::sun::star::uno::Reference<
211 com::sun::star::beans::XPropertiesChangeListener >& Listener )
212 throw( com::sun::star::uno::RuntimeException );
214 // XPropertyContainer
216 virtual void SAL_CALL
217 addProperty(
218 const rtl::OUString& Name,
219 sal_Int16 Attributes,
220 const com::sun::star::uno::Any& DefaultValue )
221 throw( com::sun::star::beans::PropertyExistException,
222 com::sun::star::beans::IllegalTypeException,
223 com::sun::star::lang::IllegalArgumentException,
224 com::sun::star::uno::RuntimeException);
226 virtual void SAL_CALL
227 removeProperty(
228 const rtl::OUString& Name )
229 throw( com::sun::star::beans::UnknownPropertyException,
230 com::sun::star::beans::NotRemoveableException,
231 com::sun::star::uno::RuntimeException );
233 // XPropertySetInfoChangeNotifier
235 virtual void SAL_CALL
236 addPropertySetInfoChangeListener(
237 const com::sun::star::uno::Reference<
238 com::sun::star::beans::XPropertySetInfoChangeListener >& Listener )
239 throw( com::sun::star::uno::RuntimeException );
241 virtual void SAL_CALL
242 removePropertySetInfoChangeListener(
243 const com::sun::star::uno::Reference<
244 com::sun::star::beans::XPropertySetInfoChangeListener >& Listener )
245 throw( com::sun::star::uno::RuntimeException );
248 // XContentCreator
250 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > SAL_CALL
251 queryCreatableContentsInfo(
252 void )
253 throw( com::sun::star::uno::RuntimeException );
255 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
256 createNewContent(
257 const com::sun::star::ucb::ContentInfo& Info )
258 throw( com::sun::star::uno::RuntimeException );
261 // XChild
262 virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
263 getParent(
264 void ) throw( com::sun::star::uno::RuntimeException );
266 // Not supported
267 virtual void SAL_CALL
268 setParent( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& Parent )
269 throw( com::sun::star::lang::NoSupportException,
270 com::sun::star::uno::RuntimeException);
273 // Notifier
275 ContentEventNotifier* cDEL( void );
276 ContentEventNotifier* cEXC( const rtl::OUString aNewName );
277 ContentEventNotifier* cCEL( void );
278 PropertySetInfoChangeNotifier* cPSL( void );
279 PropertyChangeNotifier* cPCL( void );
280 rtl::OUString getKey( void );
282 private:
283 // Data members
284 shell* m_pMyShell;
285 com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xContentIdentifier;
286 rtl::OUString m_aUncPath;
288 enum state { NameForInsertionSet = 1,
289 JustInserted = 2,
290 Deleted = 4,
291 FullFeatured = 8,
292 Connected = 16 };
293 sal_Bool m_bFolder;
294 sal_uInt16 m_nState;
296 osl::Mutex m_aMutex;
298 osl::Mutex m_aEventListenerMutex;
299 cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
300 cppu::OInterfaceContainerHelper* m_pContentEventListeners;
301 cppu::OInterfaceContainerHelper* m_pPropertySetInfoChangeListeners;
302 PropertyListeners* m_pPropertyListener;
305 // Private Methods
306 com::sun::star::uno::Reference< com::sun::star::ucb::XCommandInfo > SAL_CALL
307 getCommandInfo()
308 throw( com::sun::star::uno::RuntimeException );
310 virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL
311 getPropertySetInfo(
312 sal_Int32 nMyCommandIdentifier )
313 throw( com::sun::star::uno::RuntimeException );
315 virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > SAL_CALL
316 getPropertyValues(
317 sal_Int32 nMyCommandIdentifier,
318 const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& PropertySet )
319 throw( com::sun::star::uno::RuntimeException );
321 com::sun::star::uno::Sequence< com::sun::star::uno::Any > SAL_CALL
322 setPropertyValues(
323 sal_Int32 nMyCommandIdentifier,
324 const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Values )
325 throw( );
327 com::sun::star::uno::Reference< com::sun::star::ucb::XDynamicResultSet > SAL_CALL
328 open(
329 sal_Int32 nMyCommandIdentifier,
330 const com::sun::star::ucb::OpenCommandArgument2& aCommandArgument )
331 throw();
333 void SAL_CALL
334 deleteContent( sal_Int32 nMyCommandIdentifier )
335 throw();
338 void SAL_CALL
339 transfer( sal_Int32 nMyCommandIdentifier,
340 const com::sun::star::ucb::TransferInfo& aTransferInfo )
341 throw();
343 void SAL_CALL
344 insert( sal_Int32 nMyCommandIdentifier,
345 const com::sun::star::ucb::InsertCommandArgument& aInsertArgument )
346 throw();
348 void SAL_CALL endTask( sal_Int32 CommandId );
350 friend class ContentEventNotifier;
353 } // end namespace fileaccess
355 #endif