xref: /aoo42x/main/ucb/source/ucp/file/shell.hxx (revision fb0b81f5)
16df1ea1fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
36df1ea1fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
46df1ea1fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
56df1ea1fSAndrew Rist  * distributed with this work for additional information
66df1ea1fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
76df1ea1fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
86df1ea1fSAndrew Rist  * "License"); you may not use this file except in compliance
96df1ea1fSAndrew Rist  * with the License.  You may obtain a copy of the License at
106df1ea1fSAndrew Rist  *
116df1ea1fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
126df1ea1fSAndrew Rist  *
136df1ea1fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
146df1ea1fSAndrew Rist  * software distributed under the License is distributed on an
156df1ea1fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
166df1ea1fSAndrew Rist  * KIND, either express or implied.  See the License for the
176df1ea1fSAndrew Rist  * specific language governing permissions and limitations
186df1ea1fSAndrew Rist  * under the License.
196df1ea1fSAndrew Rist  *
206df1ea1fSAndrew Rist  *************************************************************/
216df1ea1fSAndrew Rist 
226df1ea1fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #ifndef _SHELL_HXX_
26cdf0e10cSrcweir #define _SHELL_HXX_
27cdf0e10cSrcweir 
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
30cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
31cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
32cdf0e10cSrcweir #include <vector>
33cdf0e10cSrcweir #include <hash_map>
34cdf0e10cSrcweir #include <hash_set>
35cdf0e10cSrcweir #include <list>
36cdf0e10cSrcweir #include <osl/file.hxx>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include "osl/mutex.hxx"
39cdf0e10cSrcweir #include <rtl/ustring.hxx>
40cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
41cdf0e10cSrcweir #include <com/sun/star/beans/PropertyChangeEvent.hpp>
42cdf0e10cSrcweir #include <com/sun/star/ucb/XCommandInfo.hpp>
43cdf0e10cSrcweir #include <com/sun/star/beans/Property.hpp>
44cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
45cdf0e10cSrcweir #include <com/sun/star/io/XStream.hpp>
46cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp>
47cdf0e10cSrcweir #include <com/sun/star/ucb/XCommandProcessor.hpp>
48cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp>
49cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp>
50cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfo.hpp>
51cdf0e10cSrcweir #include <com/sun/star/beans/XPropertiesChangeNotifier.hpp>
52cdf0e10cSrcweir #include <com/sun/star/ucb/NumberedSortingInfo.hpp>
53cdf0e10cSrcweir #include <com/sun/star/sdbc/XRow.hpp>
54cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
55cdf0e10cSrcweir #include <com/sun/star/ucb/XContentProvider.hpp>
56cdf0e10cSrcweir #include <com/sun/star/ucb/XDynamicResultSet.hpp>
57cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyContainer.hpp>
58cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyAccess.hpp>
59cdf0e10cSrcweir #include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp>
60cdf0e10cSrcweir #include <com/sun/star/ucb/TransferInfo.hpp>
61cdf0e10cSrcweir #include <com/sun/star/ucb/ContentInfo.hpp>
62cdf0e10cSrcweir #include "filtask.hxx"
63cdf0e10cSrcweir #include "filnot.hxx"
64cdf0e10cSrcweir 
65cdf0e10cSrcweir namespace fileaccess {
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     class FileProvider;
68cdf0e10cSrcweir     class XPropertySetInfo_impl;
69cdf0e10cSrcweir     class XCommandInfo_impl;
70cdf0e10cSrcweir     class XResultSet_impl;
71cdf0e10cSrcweir     class BaseContent;
72cdf0e10cSrcweir     class shell;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     class shell
75cdf0e10cSrcweir         : public virtual TaskManager
76cdf0e10cSrcweir     {
77cdf0e10cSrcweir         friend class XPropertySetInfo_impl;
78cdf0e10cSrcweir         friend class XResultSet_impl;
79cdf0e10cSrcweir         friend class XCommandInfo_impl;
80cdf0e10cSrcweir     public:
81cdf0e10cSrcweir         // Type definitions
82cdf0e10cSrcweir 
83cdf0e10cSrcweir         typedef rtl::OUString UniquePath;
84cdf0e10cSrcweir         typedef equalOUString eUniquePath;
85cdf0e10cSrcweir         typedef hashOUString hUniquePath;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir         class MyProperty
88cdf0e10cSrcweir         {
89cdf0e10cSrcweir         private:
90cdf0e10cSrcweir             rtl::OUString                          PropertyName;
91cdf0e10cSrcweir             sal_Int32                              Handle;
92cdf0e10cSrcweir             sal_Bool                               isNative;
93cdf0e10cSrcweir             com::sun::star::uno::Type              Typ;        // Duplicates information in Value
94cdf0e10cSrcweir             com::sun::star::uno::Any               Value;
95cdf0e10cSrcweir             com::sun::star::beans::PropertyState   State;
96cdf0e10cSrcweir             sal_Int16                              Attributes;
97cdf0e10cSrcweir         public:
98cdf0e10cSrcweir             MyProperty();
99cdf0e10cSrcweir             MyProperty( const rtl::OUString&                         __PropertyName );
100cdf0e10cSrcweir             MyProperty( const sal_Bool&                              __isNative,
101cdf0e10cSrcweir                         const rtl::OUString&                         __PropertyName,
102cdf0e10cSrcweir                         const sal_Int32&                             __Handle,
103cdf0e10cSrcweir                         const com::sun::star::uno::Type&             __Typ,
104cdf0e10cSrcweir                         const com::sun::star::uno::Any&              __Value,
105cdf0e10cSrcweir                         const com::sun::star::beans::PropertyState&  __State,
106cdf0e10cSrcweir                         const sal_Int16&                             __Attributes );
107cdf0e10cSrcweir 
108cdf0e10cSrcweir             ~MyProperty();
109cdf0e10cSrcweir             inline const sal_Bool& SAL_CALL IsNative() const;
getPropertyName() const110cdf0e10cSrcweir             inline const rtl::OUString& SAL_CALL getPropertyName() const { return PropertyName; }
111cdf0e10cSrcweir             inline const sal_Int32& SAL_CALL getHandle() const;
112cdf0e10cSrcweir             inline const com::sun::star::uno::Type& SAL_CALL getType() const;
113cdf0e10cSrcweir             inline const com::sun::star::uno::Any& SAL_CALL getValue() const;
114cdf0e10cSrcweir             inline const com::sun::star::beans::PropertyState& SAL_CALL getState() const;
115cdf0e10cSrcweir             inline const sal_Int16& SAL_CALL getAttributes() const;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir             // The set* functions are declared const, because the key of "this" stays intact
118cdf0e10cSrcweir             inline void SAL_CALL setHandle( const sal_Int32&  __Handle ) const;
119cdf0e10cSrcweir             inline void SAL_CALL setType( const com::sun::star::uno::Type& __Type ) const;
120cdf0e10cSrcweir             inline void SAL_CALL setValue( const com::sun::star::uno::Any& __Value ) const;
121cdf0e10cSrcweir             inline void SAL_CALL setState( const com::sun::star::beans::PropertyState& __State ) const;
122cdf0e10cSrcweir             inline void SAL_CALL setAttributes( const sal_Int16& __Attributes ) const;
123cdf0e10cSrcweir         };
124cdf0e10cSrcweir 
125cdf0e10cSrcweir         struct eMyProperty
126cdf0e10cSrcweir         {
operator ()fileaccess::shell::eMyProperty127cdf0e10cSrcweir             bool operator()( const MyProperty& rKey1, const MyProperty& rKey2 ) const
128cdf0e10cSrcweir             {
129cdf0e10cSrcweir                 return !!(  rKey1.getPropertyName() == rKey2.getPropertyName() );
130cdf0e10cSrcweir             }
131cdf0e10cSrcweir         };
132cdf0e10cSrcweir 
133cdf0e10cSrcweir         struct hMyProperty
134cdf0e10cSrcweir         {
operator ()fileaccess::shell::hMyProperty135cdf0e10cSrcweir             size_t operator()( const MyProperty& rName ) const
136cdf0e10cSrcweir             {
137cdf0e10cSrcweir                 return rName.getPropertyName().hashCode();
138cdf0e10cSrcweir             }
139cdf0e10cSrcweir         };
140cdf0e10cSrcweir 
141cdf0e10cSrcweir         typedef std::hash_set< MyProperty,hMyProperty,eMyProperty > PropertySet;
142cdf0e10cSrcweir         typedef std::list< Notifier* >                              NotifierList;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 
145cdf0e10cSrcweir         class UnqPathData
146cdf0e10cSrcweir         {
147cdf0e10cSrcweir         public:
148cdf0e10cSrcweir             UnqPathData();
149cdf0e10cSrcweir             ~UnqPathData();
150cdf0e10cSrcweir             UnqPathData( const UnqPathData& );
151cdf0e10cSrcweir             UnqPathData& operator=( UnqPathData& );
152cdf0e10cSrcweir 
153cdf0e10cSrcweir             PropertySet*               properties;
154cdf0e10cSrcweir             NotifierList*              notifier;
155cdf0e10cSrcweir 
156cdf0e10cSrcweir             // Three views on the PersistentPropertySet
157cdf0e10cSrcweir             com::sun::star::uno::Reference< com::sun::star::ucb::XPersistentPropertySet >   xS;
158cdf0e10cSrcweir             com::sun::star::uno::Reference< com::sun::star::beans::XPropertyContainer >     xC;
159cdf0e10cSrcweir             com::sun::star::uno::Reference< com::sun::star::beans::XPropertyAccess >        xA;
160cdf0e10cSrcweir         };
161cdf0e10cSrcweir 
162cdf0e10cSrcweir         typedef std::hash_map< UniquePath,UnqPathData,hUniquePath,eUniquePath > ContentMap;
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     public:
165cdf0e10cSrcweir 
166cdf0e10cSrcweir         // MethodenDefinitionen
167cdf0e10cSrcweir         shell( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMultiServiceFactory,
168cdf0e10cSrcweir                FileProvider* pProvider,sal_Bool bWithConfig );
169cdf0e10cSrcweir 
170cdf0e10cSrcweir         virtual ~shell();
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 
174cdf0e10cSrcweir         /**
175cdf0e10cSrcweir          *  This two methods register and deregister a change listener for the content belonging
176cdf0e10cSrcweir          *  to URL aUnqPath
177cdf0e10cSrcweir          */
178cdf0e10cSrcweir 
179cdf0e10cSrcweir         void SAL_CALL registerNotifier( const rtl::OUString& aUnqPath,Notifier* pNotifier );
180cdf0e10cSrcweir 
181cdf0e10cSrcweir         void SAL_CALL deregisterNotifier( const rtl::OUString& aUnqPath,Notifier* pNotifier );
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 
185cdf0e10cSrcweir         /**
186cdf0e10cSrcweir          *  Used to associate and deassociate a new property with
187cdf0e10cSrcweir          *  the content belonging to URL UnqPath.
188*fb0b81f5Smseidel          *  The default value and the attributes are input
189cdf0e10cSrcweir          */
190cdf0e10cSrcweir 
191cdf0e10cSrcweir         void SAL_CALL associate( const rtl::OUString& UnqPath,
192cdf0e10cSrcweir                                  const rtl::OUString& PropertyName,
193cdf0e10cSrcweir                                  const com::sun::star::uno::Any& DefaultValue,
194cdf0e10cSrcweir                                  const sal_Int16 Attributes )
195cdf0e10cSrcweir             throw( com::sun::star::beans::PropertyExistException,
196cdf0e10cSrcweir                    com::sun::star::beans::IllegalTypeException,
197cdf0e10cSrcweir                    com::sun::star::uno::RuntimeException);
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 
200cdf0e10cSrcweir         void SAL_CALL deassociate( const rtl::OUString& UnqPath,
201cdf0e10cSrcweir                                    const rtl::OUString& PropertyName )
202cdf0e10cSrcweir             throw( com::sun::star::beans::UnknownPropertyException,
203cdf0e10cSrcweir                    com::sun::star::beans::NotRemoveableException,
204cdf0e10cSrcweir                    com::sun::star::uno::RuntimeException);
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 
208cdf0e10cSrcweir         //
209cdf0e10cSrcweir         //  Every method having a command id is not allowed to throw anything,
210cdf0e10cSrcweir         //  but instead must install every error code in the task handler
211cdf0e10cSrcweir         //
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 
214cdf0e10cSrcweir         /**
215cdf0e10cSrcweir          *  Given an xOutputStream, this method writes the content of the file belonging to
216cdf0e10cSrcweir          *  URL aUnqPath into the XOutputStream
217cdf0e10cSrcweir          */
218cdf0e10cSrcweir 
219cdf0e10cSrcweir         void SAL_CALL page( sal_Int32 CommandId,
220cdf0e10cSrcweir                             const rtl::OUString& aUnqPath,
221cdf0e10cSrcweir                             const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream )
222cdf0e10cSrcweir             throw();
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 
225cdf0e10cSrcweir         /**
226cdf0e10cSrcweir          *  Given a file URL aUnqPath, this methods returns a XInputStream which reads from the open file.
227cdf0e10cSrcweir          */
228cdf0e10cSrcweir 
229cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL
230cdf0e10cSrcweir         open( sal_Int32 CommandId,
231cdf0e10cSrcweir               const rtl::OUString& aUnqPath,
232cdf0e10cSrcweir               sal_Bool bLock )
233cdf0e10cSrcweir             throw();
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 
236cdf0e10cSrcweir         /**
237cdf0e10cSrcweir          *  Given a file URL aUnqPath, this methods returns a XStream which can be used
238cdf0e10cSrcweir          *  to read and write from/to the file.
239cdf0e10cSrcweir          */
240cdf0e10cSrcweir 
241cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::io::XStream > SAL_CALL
242cdf0e10cSrcweir         open_rw( sal_Int32 CommandId,
243cdf0e10cSrcweir                  const rtl::OUString& aUnqPath,
244cdf0e10cSrcweir                  sal_Bool bLock )
245cdf0e10cSrcweir             throw();
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 
248cdf0e10cSrcweir         /**
249*fb0b81f5Smseidel          *  This method returns the result set containing the children of the directory belonging
250cdf0e10cSrcweir          *  to file URL aUnqPath
251cdf0e10cSrcweir          */
252cdf0e10cSrcweir 
253cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::ucb::XDynamicResultSet > SAL_CALL
254cdf0e10cSrcweir         ls( sal_Int32 CommandId,
255cdf0e10cSrcweir             const rtl::OUString& aUnqPath,
256cdf0e10cSrcweir             const sal_Int32 OpenMode,
257cdf0e10cSrcweir             const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& sProperty,
258cdf0e10cSrcweir             const com::sun::star::uno::Sequence< com::sun::star::ucb::NumberedSortingInfo > & sSortingInfo )
259cdf0e10cSrcweir             throw();
260cdf0e10cSrcweir 
261cdf0e10cSrcweir 
262cdf0e10cSrcweir         /**
263cdf0e10cSrcweir          *  Info methods
264cdf0e10cSrcweir          */
265cdf0e10cSrcweir 
266cdf0e10cSrcweir         // Info for commands
267cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::ucb::XCommandInfo > SAL_CALL
268cdf0e10cSrcweir         info_c()
269cdf0e10cSrcweir             throw();
270cdf0e10cSrcweir 
271cdf0e10cSrcweir         // Info for the properties
272cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL
273cdf0e10cSrcweir         info_p( const rtl::OUString& aUnqPath )
274cdf0e10cSrcweir             throw();
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 
277cdf0e10cSrcweir         /**
278cdf0e10cSrcweir          *  Sets the values of the properties belonging to fileURL aUnqPath
279cdf0e10cSrcweir          */
280cdf0e10cSrcweir 
281cdf0e10cSrcweir         com::sun::star::uno::Sequence< com::sun::star::uno::Any > SAL_CALL
282cdf0e10cSrcweir         setv( const rtl::OUString& aUnqPath,
283cdf0e10cSrcweir               const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& values )
284cdf0e10cSrcweir             throw();
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 
287cdf0e10cSrcweir         /**
288cdf0e10cSrcweir          *  Reads the values of the properties belonging to fileURL aUnqPath;
289cdf0e10cSrcweir          *  Returns an XRow object containing the values in the requested order.
290cdf0e10cSrcweir          */
291cdf0e10cSrcweir 
292cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > SAL_CALL
293cdf0e10cSrcweir         getv( sal_Int32 CommandId,
294cdf0e10cSrcweir               const rtl::OUString& aUnqPath,
295cdf0e10cSrcweir               const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& properties )
296cdf0e10cSrcweir             throw();
297cdf0e10cSrcweir 
298cdf0e10cSrcweir 
299cdf0e10cSrcweir         /********************************************************************************/
300cdf0e10cSrcweir         /*                         transfer-commands                                    */
301cdf0e10cSrcweir         /********************************************************************************/
302cdf0e10cSrcweir 
303cdf0e10cSrcweir         /**
304cdf0e10cSrcweir          *  Moves the content belonging to fileURL srcUnqPath to fileURL dstUnqPath( files and directories )
305cdf0e10cSrcweir          */
306cdf0e10cSrcweir 
307cdf0e10cSrcweir         void SAL_CALL
308cdf0e10cSrcweir         move( sal_Int32 CommandId,
309cdf0e10cSrcweir               const rtl::OUString srcUnqPath,   // Full file(folder)-path
310cdf0e10cSrcweir               const rtl::OUString dstUnqPath,   // Path to the destination-directory
311cdf0e10cSrcweir               const sal_Int32 NameClash )
312cdf0e10cSrcweir             throw();
313cdf0e10cSrcweir 
314cdf0e10cSrcweir         /**
315cdf0e10cSrcweir          *  Copies the content belonging to fileURL srcUnqPath to fileURL dstUnqPath ( files and directories )
316cdf0e10cSrcweir          */
317cdf0e10cSrcweir 
318cdf0e10cSrcweir         void SAL_CALL
319cdf0e10cSrcweir         copy( sal_Int32 CommandId,               // See "move"
320cdf0e10cSrcweir               const rtl::OUString srcUnqPath,
321cdf0e10cSrcweir               const rtl::OUString dstUnqPath,
322cdf0e10cSrcweir               sal_Int32 NameClash )
323cdf0e10cSrcweir             throw();
324cdf0e10cSrcweir 
325cdf0e10cSrcweir #define RemoveFolder   1
326cdf0e10cSrcweir #define RemoveFile    -1
327cdf0e10cSrcweir #define RemoveUnknown  0
328cdf0e10cSrcweir 
329cdf0e10cSrcweir         /**
330cdf0e10cSrcweir          *  Deletes the content belonging to fileURL aUnqPath( recursively in case of directory )
331cdf0e10cSrcweir          */
332cdf0e10cSrcweir 
333cdf0e10cSrcweir         sal_Bool SAL_CALL
334cdf0e10cSrcweir         remove( sal_Int32 CommandId,
335cdf0e10cSrcweir                 const rtl::OUString& aUnqPath,
336cdf0e10cSrcweir                 sal_Int32 TypeToMove = RemoveUnknown,
337cdf0e10cSrcweir                 sal_Bool  MustExist  = sal_True )
338cdf0e10cSrcweir             throw();
339cdf0e10cSrcweir 
340cdf0e10cSrcweir #undef RemoveUnknown
341cdf0e10cSrcweir #undef RemoveFile
342cdf0e10cSrcweir #undef RemoveFolder
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 
345cdf0e10cSrcweir         /********************************************************************************/
346cdf0e10cSrcweir         /*                         write and create - commandos                         */
347cdf0e10cSrcweir         /********************************************************************************/
348cdf0e10cSrcweir 
349cdf0e10cSrcweir         /**
350cdf0e10cSrcweir          *  Creates new directory with given URL, recursively if necessary
351cdf0e10cSrcweir          *  Return:: success of operation
352cdf0e10cSrcweir          */
353cdf0e10cSrcweir 
354cdf0e10cSrcweir         sal_Bool SAL_CALL
355cdf0e10cSrcweir         mkdir( sal_Int32 CommandId,
356cdf0e10cSrcweir                const rtl::OUString& aDirectoryName,
357cdf0e10cSrcweir                sal_Bool OverWrite )
358cdf0e10cSrcweir             throw();
359cdf0e10cSrcweir 
360cdf0e10cSrcweir 
361cdf0e10cSrcweir         /**
362cdf0e10cSrcweir          *  Creates new file with given URL.
363cdf0e10cSrcweir          *  The content of aInputStream becomes the content of the file
364cdf0e10cSrcweir          *  Return:: success of operation
365cdf0e10cSrcweir          */
366cdf0e10cSrcweir 
367cdf0e10cSrcweir         sal_Bool SAL_CALL
368cdf0e10cSrcweir         mkfil( sal_Int32 CommandId,
369cdf0e10cSrcweir                const rtl::OUString& aFileName,
370cdf0e10cSrcweir                sal_Bool OverWrite,
371cdf0e10cSrcweir                const com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& aInputStream )
372cdf0e10cSrcweir             throw();
373cdf0e10cSrcweir 
374cdf0e10cSrcweir 
375cdf0e10cSrcweir         /**
376cdf0e10cSrcweir          *  writes to the file with given URL.
377cdf0e10cSrcweir          *  The content of aInputStream becomes the content of the file
378cdf0e10cSrcweir          *  Return:: success of operation
379cdf0e10cSrcweir          */
380cdf0e10cSrcweir         sal_Bool SAL_CALL
381cdf0e10cSrcweir         write( sal_Int32 CommandId,
382cdf0e10cSrcweir                const rtl::OUString& aUnqPath,
383cdf0e10cSrcweir                sal_Bool OverWrite,
384cdf0e10cSrcweir                const com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& aInputStream )
385cdf0e10cSrcweir             throw();
386cdf0e10cSrcweir 
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 
389cdf0e10cSrcweir         void SAL_CALL insertDefaultProperties( const rtl::OUString& aUnqPath );
390cdf0e10cSrcweir 
391cdf0e10cSrcweir         com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
392cdf0e10cSrcweir         queryCreatableContentsInfo();
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 
395cdf0e10cSrcweir         /******************************************************************************/
396cdf0e10cSrcweir         /*                                                                            */
397cdf0e10cSrcweir         /*                          mapping of file urls                              */
398cdf0e10cSrcweir         /*                          to uncpath and vice versa                         */
399cdf0e10cSrcweir         /*                                                                            */
400cdf0e10cSrcweir         /******************************************************************************/
401cdf0e10cSrcweir 
402cdf0e10cSrcweir         sal_Bool SAL_CALL getUnqFromUrl( const rtl::OUString& Url, rtl::OUString& Unq );
403cdf0e10cSrcweir 
404cdf0e10cSrcweir         sal_Bool SAL_CALL getUrlFromUnq( const rtl::OUString& Unq, rtl::OUString& Url );
405cdf0e10cSrcweir 
406cdf0e10cSrcweir 
407cdf0e10cSrcweir         sal_Bool m_bWithConfig;
408cdf0e10cSrcweir         FileProvider*                                                                   m_pProvider;
409cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >    m_xMultiServiceFactory;
410cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::ucb::XPropertySetRegistry >     m_xFileRegistry;
411cdf0e10cSrcweir 
412cdf0e10cSrcweir     private:
413cdf0e10cSrcweir 
414cdf0e10cSrcweir         /********************************************************************************/
415cdf0e10cSrcweir         /*                              get eventListeners                              */
416cdf0e10cSrcweir         /********************************************************************************/
417cdf0e10cSrcweir 
418cdf0e10cSrcweir         std::list< ContentEventNotifier* >* SAL_CALL
419cdf0e10cSrcweir         getContentEventListeners( const rtl::OUString& aName );
420cdf0e10cSrcweir 
421cdf0e10cSrcweir         std::list< ContentEventNotifier* >* SAL_CALL
422cdf0e10cSrcweir         getContentDeletedEventListeners( const rtl::OUString& aName );
423cdf0e10cSrcweir 
424cdf0e10cSrcweir         std::vector< std::list< ContentEventNotifier* >* >* SAL_CALL
425cdf0e10cSrcweir         getContentExchangedEventListeners( const rtl::OUString aOldPrefix,
426cdf0e10cSrcweir                                            const rtl::OUString aNewPrefix,
427cdf0e10cSrcweir                                            sal_Bool withChilds );
428cdf0e10cSrcweir 
429cdf0e10cSrcweir         std::list< PropertyChangeNotifier* >* SAL_CALL
430cdf0e10cSrcweir         getPropertyChangeNotifier( const rtl::OUString& aName );
431cdf0e10cSrcweir 
432cdf0e10cSrcweir         std::list< PropertySetInfoChangeNotifier* >* SAL_CALL
433cdf0e10cSrcweir         getPropertySetListeners( const rtl::OUString& aName );
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 
436cdf0e10cSrcweir         /********************************************************************************/
437cdf0e10cSrcweir         /*                              notify eventListeners                           */
438cdf0e10cSrcweir         /********************************************************************************/
439cdf0e10cSrcweir 
440cdf0e10cSrcweir         void SAL_CALL notifyPropertyChanges(
441cdf0e10cSrcweir             std::list< PropertyChangeNotifier* >* listeners,
442cdf0e10cSrcweir             const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyChangeEvent >& seqChanged );
443cdf0e10cSrcweir 
444cdf0e10cSrcweir         void SAL_CALL notifyContentExchanged(
445cdf0e10cSrcweir             std::vector< std::list< ContentEventNotifier* >* >* listeners_vec );
446cdf0e10cSrcweir 
447cdf0e10cSrcweir         void SAL_CALL notifyInsert(
448cdf0e10cSrcweir             std::list< ContentEventNotifier* >* listeners,const rtl::OUString& aChildName );
449cdf0e10cSrcweir 
450cdf0e10cSrcweir         void SAL_CALL notifyContentDeleted(
451cdf0e10cSrcweir             std::list< ContentEventNotifier* >* listeners );
452cdf0e10cSrcweir 
453cdf0e10cSrcweir         void SAL_CALL notifyContentRemoved(
454cdf0e10cSrcweir             std::list< ContentEventNotifier* >* listeners,
455cdf0e10cSrcweir             const rtl::OUString& aChildName );
456cdf0e10cSrcweir 
457cdf0e10cSrcweir         void SAL_CALL notifyPropertyAdded(
458cdf0e10cSrcweir             std::list< PropertySetInfoChangeNotifier* >* listeners,
459cdf0e10cSrcweir             const rtl::OUString& aPropertyName );
460cdf0e10cSrcweir 
461cdf0e10cSrcweir         void SAL_CALL notifyPropertyRemoved(
462cdf0e10cSrcweir             std::list< PropertySetInfoChangeNotifier* >* listeners,
463cdf0e10cSrcweir             const rtl::OUString& aPropertyName );
464cdf0e10cSrcweir 
465cdf0e10cSrcweir 
466cdf0e10cSrcweir         /********************************************************************************/
467cdf0e10cSrcweir         /*                       remove persistent propertyset                          */
468cdf0e10cSrcweir         /********************************************************************************/
469cdf0e10cSrcweir 
470cdf0e10cSrcweir         void SAL_CALL erasePersistentSet( const rtl::OUString& aUnqPath,
471cdf0e10cSrcweir                                           sal_Bool withChilds = false );
472cdf0e10cSrcweir 
473cdf0e10cSrcweir         /********************************************************************************/
474cdf0e10cSrcweir         /*                       copy persistent propertyset                            */
475cdf0e10cSrcweir         /*                       from srcUnqPath to dstUnqPath                          */
476cdf0e10cSrcweir         /********************************************************************************/
477cdf0e10cSrcweir 
478cdf0e10cSrcweir         void SAL_CALL copyPersistentSet( const rtl::OUString& srcUnqPath,
479cdf0e10cSrcweir                                          const rtl::OUString& dstUnqPath,
480cdf0e10cSrcweir                                          sal_Bool withChilds = false );
481cdf0e10cSrcweir 
482cdf0e10cSrcweir 
483cdf0e10cSrcweir         // Special optimized method for getting the properties of a directoryitem, which
484cdf0e10cSrcweir         // is returned by osl::DirectoryItem::getNextItem()
485cdf0e10cSrcweir 
486cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > SAL_CALL
487cdf0e10cSrcweir         getv( Notifier* pNotifier,
488cdf0e10cSrcweir               const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& properties,
489cdf0e10cSrcweir               osl::DirectoryItem& DirItem,
490cdf0e10cSrcweir               rtl::OUString& aUnqPath,
491cdf0e10cSrcweir               sal_Bool&      bIsRegular );
492cdf0e10cSrcweir 
493cdf0e10cSrcweir 
494cdf0e10cSrcweir         /**
495cdf0e10cSrcweir          *  Load the properties from configuration, if create == true create them.
496cdf0e10cSrcweir          *  The Properties are stored under the url belonging to it->first.
497cdf0e10cSrcweir          */
498cdf0e10cSrcweir 
499cdf0e10cSrcweir         void SAL_CALL load( const shell::ContentMap::iterator& it,
500cdf0e10cSrcweir                             sal_Bool create );
501cdf0e10cSrcweir 
502cdf0e10cSrcweir         /**
503cdf0e10cSrcweir          *  Commit inserts the determined properties in the filestatus object into
504cdf0e10cSrcweir          *  the internal map, so that is possible to determine on a subsequent
505cdf0e10cSrcweir          *  setting of file properties which properties have changed without filestat
506cdf0e10cSrcweir          */
507cdf0e10cSrcweir 
508cdf0e10cSrcweir         void SAL_CALL
509cdf0e10cSrcweir         commit(
510cdf0e10cSrcweir             const shell::ContentMap::iterator& it,
511cdf0e10cSrcweir             const osl::FileStatus& aFileStatus );
512cdf0e10cSrcweir 
513cdf0e10cSrcweir         /**
514cdf0e10cSrcweir          *  Given a Sequence of properties seq, this method determines the mask
515cdf0e10cSrcweir          *  used to instantiate a osl::FileStatus, so that a call to
516cdf0e10cSrcweir          *  osl::DirectoryItem::getFileStatus fills the required fields.
517cdf0e10cSrcweir          */
518cdf0e10cSrcweir 
519cdf0e10cSrcweir         void SAL_CALL
520cdf0e10cSrcweir         getMaskFromProperties(
521cdf0e10cSrcweir             sal_Int32& n_Mask,
522cdf0e10cSrcweir             const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& seq );
523cdf0e10cSrcweir 
524cdf0e10cSrcweir 
525cdf0e10cSrcweir         void SAL_CALL
526cdf0e10cSrcweir         setFileProperties(
527cdf0e10cSrcweir             const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& values,
528cdf0e10cSrcweir             sal_Int32 numberOfValues )
529cdf0e10cSrcweir             throw();
530cdf0e10cSrcweir 
531cdf0e10cSrcweir 
532cdf0e10cSrcweir         // Helper function for public copy
533cdf0e10cSrcweir 
534cdf0e10cSrcweir         osl::FileBase::RC SAL_CALL
535cdf0e10cSrcweir         copy_recursive(
536cdf0e10cSrcweir             const rtl::OUString& srcUnqPath,
537cdf0e10cSrcweir             const rtl::OUString& dstUnqPath,
538cdf0e10cSrcweir             sal_Int32 TypeToCopy,
539cdf0e10cSrcweir             sal_Bool  testExistence )
540cdf0e10cSrcweir             throw();
541cdf0e10cSrcweir 
542cdf0e10cSrcweir 
543cdf0e10cSrcweir         // Helper function for mkfil,mkdir and write
544cdf0e10cSrcweir         // Creates whole path
545cdf0e10cSrcweir         // returns success of the operation
546cdf0e10cSrcweir         // The calle determines the errorCode, which should be used to install
547cdf0e10cSrcweir         // any error
548cdf0e10cSrcweir 
549cdf0e10cSrcweir         sal_Bool SAL_CALL
550cdf0e10cSrcweir         ensuredir( sal_Int32 CommandId,
551cdf0e10cSrcweir                    const rtl::OUString& aDirectoryName,
552cdf0e10cSrcweir                    sal_Int32 errorCode )
553cdf0e10cSrcweir             throw();
554cdf0e10cSrcweir 
555cdf0e10cSrcweir         // General
556cdf0e10cSrcweir         osl::Mutex m_aMutex;
557cdf0e10cSrcweir         ContentMap  m_aContent;
558cdf0e10cSrcweir 
559cdf0e10cSrcweir         // Default properties
560cdf0e10cSrcweir 
561cdf0e10cSrcweir         const rtl::OUString Title;
562cdf0e10cSrcweir         const rtl::OUString CasePreservingURL;
563cdf0e10cSrcweir         const rtl::OUString IsDocument;
564cdf0e10cSrcweir         const rtl::OUString IsFolder;
565cdf0e10cSrcweir         const rtl::OUString DateModified;
566cdf0e10cSrcweir         const rtl::OUString Size;
567cdf0e10cSrcweir         const rtl::OUString IsVolume;
568cdf0e10cSrcweir         const rtl::OUString IsRemoveable;
569cdf0e10cSrcweir         const rtl::OUString IsRemote;
570cdf0e10cSrcweir         const rtl::OUString IsCompactDisc;
571cdf0e10cSrcweir         const rtl::OUString IsFloppy;
572cdf0e10cSrcweir         const rtl::OUString IsHidden;
573cdf0e10cSrcweir         const rtl::OUString ContentType;
574cdf0e10cSrcweir         const rtl::OUString IsReadOnly;
575cdf0e10cSrcweir         const rtl::OUString CreatableContentsInfo;
576cdf0e10cSrcweir 
577cdf0e10cSrcweir     public:
578cdf0e10cSrcweir 
579cdf0e10cSrcweir         const rtl::OUString FolderContentType;
580cdf0e10cSrcweir         const rtl::OUString FileContentType;
581cdf0e10cSrcweir 
582cdf0e10cSrcweir 
583cdf0e10cSrcweir     private:
584cdf0e10cSrcweir 
585cdf0e10cSrcweir         PropertySet                                                         m_aDefaultProperties;
586cdf0e10cSrcweir         com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >   m_sCommandInfo;
587cdf0e10cSrcweir 
588cdf0e10cSrcweir     public:
589cdf0e10cSrcweir         // Misceancellous:
590cdf0e10cSrcweir         // Methods for "writeComponentInfo" and "createComponentFactory"
591cdf0e10cSrcweir 
592cdf0e10cSrcweir         static void SAL_CALL getScheme( rtl::OUString& Scheme );
593cdf0e10cSrcweir 
594cdf0e10cSrcweir         static rtl::OUString SAL_CALL getImplementationName_static( void );
595cdf0e10cSrcweir 
596cdf0e10cSrcweir         static com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames_static( void );
597cdf0e10cSrcweir 
598cdf0e10cSrcweir     };    // end class shell
599cdf0e10cSrcweir 
600cdf0e10cSrcweir }             // end namespace fileaccess
601cdf0e10cSrcweir 
602cdf0e10cSrcweir #endif
603cdf0e10cSrcweir 
604