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 ************************************************************************/
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>
64 namespace fileaccess
{
66 class PropertyListeners
;
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
86 // A special creator for inserted contents; Creates an ugly object
87 BaseContent( shell
* pMyShell
,
88 const rtl::OUString
& parentName
,
94 const com::sun::star::uno::Reference
< com::sun::star::ucb::XContentIdentifier
>& xContentIdentifier
,
95 const rtl::OUString
& aUnqPath
);
97 virtual ~BaseContent();
100 virtual com::sun::star::uno::Any SAL_CALL
102 const com::sun::star::uno::Type
& aType
)
103 throw( com::sun::star::uno::RuntimeException
);
105 virtual void SAL_CALL
110 virtual void SAL_CALL
117 virtual void SAL_CALL
120 throw( com::sun::star::uno::RuntimeException
);
122 virtual void SAL_CALL
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
);
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
);
152 virtual sal_Int32 SAL_CALL
153 createCommandIdentifier(
155 throw( com::sun::star::uno::RuntimeException
);
157 virtual com::sun::star::uno::Any SAL_CALL
159 const com::sun::star::ucb::Command
& aCommand
,
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
168 sal_Int32 CommandId
)
169 throw( com::sun::star::uno::RuntimeException
);
173 virtual com::sun::star::uno::Reference
< com::sun::star::ucb::XContentIdentifier
> SAL_CALL
176 throw( com::sun::star::uno::RuntimeException
);
178 virtual rtl::OUString SAL_CALL
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
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
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
);
244 virtual com::sun::star::uno::Sequence
< com::sun::star::ucb::ContentInfo
> SAL_CALL
245 queryCreatableContentsInfo(
247 throw( com::sun::star::uno::RuntimeException
);
249 virtual com::sun::star::uno::Reference
< com::sun::star::ucb::XContent
> SAL_CALL
251 const com::sun::star::ucb::ContentInfo
& Info
)
252 throw( com::sun::star::uno::RuntimeException
);
256 virtual com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
> SAL_CALL
258 void ) throw( com::sun::star::uno::RuntimeException
);
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
);
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 );
279 com::sun::star::uno::Reference
< com::sun::star::ucb::XContentIdentifier
> m_xContentIdentifier
;
280 rtl::OUString m_aUncPath
;
282 enum state
{ NameForInsertionSet
= 1,
292 osl::Mutex m_aEventListenerMutex
;
293 cppu::OInterfaceContainerHelper
* m_pDisposeEventListeners
;
294 cppu::OInterfaceContainerHelper
* m_pContentEventListeners
;
295 cppu::OInterfaceContainerHelper
* m_pPropertySetInfoChangeListeners
;
296 PropertyListeners
* m_pPropertyListener
;
300 com::sun::star::uno::Reference
< com::sun::star::ucb::XCommandInfo
> SAL_CALL
302 throw( com::sun::star::uno::RuntimeException
);
304 virtual com::sun::star::uno::Reference
< com::sun::star::beans::XPropertySetInfo
> SAL_CALL
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
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
317 sal_Int32 nMyCommandIdentifier
,
318 const com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>& Values
)
321 com::sun::star::uno::Reference
< com::sun::star::ucb::XDynamicResultSet
> SAL_CALL
323 sal_Int32 nMyCommandIdentifier
,
324 const com::sun::star::ucb::OpenCommandArgument2
& aCommandArgument
)
328 deleteContent( sal_Int32 nMyCommandIdentifier
)
333 transfer( sal_Int32 nMyCommandIdentifier
,
334 const com::sun::star::ucb::TransferInfo
& aTransferInfo
)
338 insert( sal_Int32 nMyCommandIdentifier
,
339 const com::sun::star::ucb::InsertCommandArgument
& aInsertArgument
)
342 void SAL_CALL
endTask( sal_Int32 CommandId
);
344 friend class ContentEventNotifier
;
347 } // end namespace fileaccess
351 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */