Bump for 3.6-28
[LibreOffice.git] / ucb / source / ucp / file / bc.hxx
blob9b2571beeaf78213a19f64adb8c3ce6753cd81e5
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 _BC_HXX_
30 #define _BC_HXX_
32 #include "osl/mutex.hxx"
33 #include "rtl/ustring.hxx"
34 #include <cppuhelper/weak.hxx>
35 #include <ucbhelper/macros.hxx>
36 #include <cppuhelper/interfacecontainer.h>
37 #include <com/sun/star/uno/XInterface.hpp>
38 #include <com/sun/star/lang/XTypeProvider.hpp>
39 #include <com/sun/star/lang/XComponent.hpp>
40 #include <com/sun/star/ucb/XCommandProcessor.hpp>
41 #include <com/sun/star/beans/XPropertiesChangeNotifier.hpp>
42 #include <com/sun/star/ucb/XContent.hpp>
43 #include <com/sun/star/ucb/XContentProvider.hpp>
44 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
45 #include <com/sun/star/lang/XServiceInfo.hpp>
46 #include <com/sun/star/sdbc/XRow.hpp>
47 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
48 #include <com/sun/star/beans/Property.hpp>
49 #include <com/sun/star/beans/PropertyValue.hpp>
50 #include <com/sun/star/ucb/XCommandInfo.hpp>
51 #include <com/sun/star/ucb/InsertCommandArgument.hpp>
52 #include <com/sun/star/beans/XPropertySetInfo.hpp>
53 #include <com/sun/star/beans/XPropertyContainer.hpp>
54 #include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp>
55 #include <com/sun/star/beans/XPropertySetInfoChangeListener.hpp>
56 #include <com/sun/star/container/XChild.hpp>
57 #include <com/sun/star/ucb/XContentCreator.hpp>
58 #include <com/sun/star/io/XInputStream.hpp>
59 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
60 #include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp>
61 #include "shell.hxx"
64 namespace fileaccess {
66 class PropertyListeners;
67 class shell;
68 class FileProvider;
70 class BaseContent:
71 public cppu::OWeakObject,
72 public com::sun::star::lang::XComponent,
73 public com::sun::star::lang::XServiceInfo,
74 public com::sun::star::lang::XTypeProvider,
75 public com::sun::star::ucb::XCommandProcessor,
76 public com::sun::star::beans::XPropertiesChangeNotifier,
77 public com::sun::star::beans::XPropertyContainer,
78 public com::sun::star::beans::XPropertySetInfoChangeNotifier,
79 public com::sun::star::ucb::XContentCreator,
80 public com::sun::star::container::XChild,
81 public com::sun::star::ucb::XContent,
82 public fileaccess::Notifier // implementation class
84 private:
86 // A special creator for inserted contents; Creates an ugly object
87 BaseContent( shell* pMyShell,
88 const rtl::OUString& parentName,
89 sal_Bool bFolder );
91 public:
92 BaseContent(
93 shell* pMyShell,
94 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xContentIdentifier,
95 const rtl::OUString& aUnqPath );
97 virtual ~BaseContent();
99 // XInterface
100 virtual com::sun::star::uno::Any SAL_CALL
101 queryInterface(
102 const com::sun::star::uno::Type& aType )
103 throw( com::sun::star::uno::RuntimeException);
105 virtual void SAL_CALL
106 acquire(
107 void )
108 throw();
110 virtual void SAL_CALL
111 release(
112 void )
113 throw();
116 // XComponent
117 virtual void SAL_CALL
118 dispose(
119 void )
120 throw( com::sun::star::uno::RuntimeException );
122 virtual void SAL_CALL
123 addEventListener(
124 const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& xListener )
125 throw( com::sun::star::uno::RuntimeException );
127 virtual void SAL_CALL
128 removeEventListener( const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& aListener )
129 throw( com::sun::star::uno::RuntimeException );
132 // XTypeProvider
134 XTYPEPROVIDER_DECL()
137 // XServiceInfo
138 virtual rtl::OUString SAL_CALL
139 getImplementationName()
140 throw( com::sun::star::uno::RuntimeException);
142 virtual sal_Bool SAL_CALL
143 supportsService( const rtl::OUString& ServiceName )
144 throw( com::sun::star::uno::RuntimeException);
146 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
147 getSupportedServiceNames()
148 throw( com::sun::star::uno::RuntimeException );
151 // XCommandProcessor
152 virtual sal_Int32 SAL_CALL
153 createCommandIdentifier(
154 void )
155 throw( com::sun::star::uno::RuntimeException );
157 virtual com::sun::star::uno::Any SAL_CALL
158 execute(
159 const com::sun::star::ucb::Command& aCommand,
160 sal_Int32 CommandId,
161 const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& Environment )
162 throw( com::sun::star::uno::Exception,
163 com::sun::star::ucb::CommandAbortedException,
164 com::sun::star::uno::RuntimeException );
166 virtual void SAL_CALL
167 abort(
168 sal_Int32 CommandId )
169 throw( com::sun::star::uno::RuntimeException );
172 // XContent
173 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > SAL_CALL
174 getIdentifier(
175 void )
176 throw( com::sun::star::uno::RuntimeException );
178 virtual rtl::OUString SAL_CALL
179 getContentType(
180 void )
181 throw( com::sun::star::uno::RuntimeException );
183 virtual void SAL_CALL
184 addContentEventListener(
185 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentEventListener >& Listener )
186 throw( com::sun::star::uno::RuntimeException );
188 virtual void SAL_CALL
189 removeContentEventListener(
190 const com::sun::star::uno::Reference< com::sun::star::ucb::XContentEventListener >& Listener )
191 throw( com::sun::star::uno::RuntimeException );
193 // XPropertiesChangeNotifier
195 virtual void SAL_CALL
196 addPropertiesChangeListener(
197 const com::sun::star::uno::Sequence< rtl::OUString >& PropertyNames,
198 const com::sun::star::uno::Reference<
199 com::sun::star::beans::XPropertiesChangeListener >& Listener )
200 throw( com::sun::star::uno::RuntimeException );
202 virtual void SAL_CALL
203 removePropertiesChangeListener( 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 // XPropertyContainer
210 virtual void SAL_CALL
211 addProperty(
212 const rtl::OUString& Name,
213 sal_Int16 Attributes,
214 const com::sun::star::uno::Any& DefaultValue )
215 throw( com::sun::star::beans::PropertyExistException,
216 com::sun::star::beans::IllegalTypeException,
217 com::sun::star::lang::IllegalArgumentException,
218 com::sun::star::uno::RuntimeException);
220 virtual void SAL_CALL
221 removeProperty(
222 const rtl::OUString& Name )
223 throw( com::sun::star::beans::UnknownPropertyException,
224 com::sun::star::beans::NotRemoveableException,
225 com::sun::star::uno::RuntimeException );
227 // XPropertySetInfoChangeNotifier
229 virtual void SAL_CALL
230 addPropertySetInfoChangeListener(
231 const com::sun::star::uno::Reference<
232 com::sun::star::beans::XPropertySetInfoChangeListener >& Listener )
233 throw( com::sun::star::uno::RuntimeException );
235 virtual void SAL_CALL
236 removePropertySetInfoChangeListener(
237 const com::sun::star::uno::Reference<
238 com::sun::star::beans::XPropertySetInfoChangeListener >& Listener )
239 throw( com::sun::star::uno::RuntimeException );
242 // XContentCreator
244 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > SAL_CALL
245 queryCreatableContentsInfo(
246 void )
247 throw( com::sun::star::uno::RuntimeException );
249 virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
250 createNewContent(
251 const com::sun::star::ucb::ContentInfo& Info )
252 throw( com::sun::star::uno::RuntimeException );
255 // XChild
256 virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
257 getParent(
258 void ) throw( com::sun::star::uno::RuntimeException );
260 // Not supported
261 virtual void SAL_CALL
262 setParent( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& Parent )
263 throw( com::sun::star::lang::NoSupportException,
264 com::sun::star::uno::RuntimeException);
267 // Notifier
269 ContentEventNotifier* cDEL( void );
270 ContentEventNotifier* cEXC( const rtl::OUString aNewName );
271 ContentEventNotifier* cCEL( void );
272 PropertySetInfoChangeNotifier* cPSL( void );
273 PropertyChangeNotifier* cPCL( void );
274 rtl::OUString getKey( void );
276 private:
277 // Data members
278 shell* m_pMyShell;
279 com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > m_xContentIdentifier;
280 rtl::OUString m_aUncPath;
282 enum state { NameForInsertionSet = 1,
283 JustInserted = 2,
284 Deleted = 4,
285 FullFeatured = 8,
286 Connected = 16 };
287 sal_Bool m_bFolder;
288 sal_uInt16 m_nState;
290 osl::Mutex m_aMutex;
292 osl::Mutex m_aEventListenerMutex;
293 cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
294 cppu::OInterfaceContainerHelper* m_pContentEventListeners;
295 cppu::OInterfaceContainerHelper* m_pPropertySetInfoChangeListeners;
296 PropertyListeners* m_pPropertyListener;
299 // Private Methods
300 com::sun::star::uno::Reference< com::sun::star::ucb::XCommandInfo > SAL_CALL
301 getCommandInfo()
302 throw( com::sun::star::uno::RuntimeException );
304 virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL
305 getPropertySetInfo(
306 sal_Int32 nMyCommandIdentifier )
307 throw( com::sun::star::uno::RuntimeException );
309 virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > SAL_CALL
310 getPropertyValues(
311 sal_Int32 nMyCommandIdentifier,
312 const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& PropertySet )
313 throw( com::sun::star::uno::RuntimeException );
315 com::sun::star::uno::Sequence< com::sun::star::uno::Any > SAL_CALL
316 setPropertyValues(
317 sal_Int32 nMyCommandIdentifier,
318 const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Values )
319 throw( );
321 com::sun::star::uno::Reference< com::sun::star::ucb::XDynamicResultSet > SAL_CALL
322 open(
323 sal_Int32 nMyCommandIdentifier,
324 const com::sun::star::ucb::OpenCommandArgument2& aCommandArgument )
325 throw();
327 void SAL_CALL
328 deleteContent( sal_Int32 nMyCommandIdentifier )
329 throw();
332 void SAL_CALL
333 transfer( sal_Int32 nMyCommandIdentifier,
334 const com::sun::star::ucb::TransferInfo& aTransferInfo )
335 throw();
337 void SAL_CALL
338 insert( sal_Int32 nMyCommandIdentifier,
339 const com::sun::star::ucb::InsertCommandArgument& aInsertArgument )
340 throw();
342 void SAL_CALL endTask( sal_Int32 CommandId );
344 friend class ContentEventNotifier;
347 } // end namespace fileaccess
349 #endif
351 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */