1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _UNTOOLS_UCBSTREAMHELPER_HXX
24 #define _UNTOOLS_UCBSTREAMHELPER_HXX
25 
26 #include <com/sun/star/uno/Reference.hxx>
27 #include <com/sun/star/io/XInputStream.hpp>
28 #include <com/sun/star/io/XStream.hpp>
29 #include "unotools/unotoolsdllapi.h"
30 
31 #include <tools/stream.hxx>
32 
33 namespace com
34 {
35 	namespace sun
36 	{
37 		namespace star
38 		{
39 			namespace task
40 			{
41 				class XInteractionHandler;
42 			}
43 			namespace io
44 			{
45 				class XStream;
46 				class XInputStream;
47 			}
48 		}
49 	}
50 }
51 
52 #define NS_UNO ::com::sun::star::uno
53 #define NS_IO ::com::sun::star::io
54 #define NS_TASK ::com::sun::star::task
55 
56 class String;
57 namespace utl
58 {
59     class UcbLockBytesHandler;
60 
61     class UNOTOOLS_DLLPUBLIC UcbStreamHelper : public SvStream
62     {
63     public:
64         static SvStream*    CreateStream( const String& rFileName, StreamMode eOpenMode,
65 								UcbLockBytesHandler* pHandler=0, sal_Bool bForceSynchron=sal_True );
66         static SvStream*    CreateStream( const String& rFileName, StreamMode eOpenMode,
67 								NS_UNO::Reference < NS_TASK::XInteractionHandler >,
68 								UcbLockBytesHandler* pHandler=0, sal_Bool bForceSynchron=sal_True );
69         static SvStream*    CreateStream( const String& rFileName, StreamMode eOpenMode,
70                                 sal_Bool bFileExists,
71                                 UcbLockBytesHandler* pHandler=0, sal_Bool bForceSynchron=sal_True );
72         static SvStream*    CreateStream( NS_UNO::Reference < NS_IO::XInputStream > xStream );
73         static SvStream*    CreateStream( NS_UNO::Reference < NS_IO::XStream > xStream );
74         static SvStream*    CreateStream( NS_UNO::Reference < NS_IO::XInputStream > xStream, sal_Bool bCloseStream );
75         static SvStream*    CreateStream( NS_UNO::Reference < NS_IO::XStream > xStream, sal_Bool bCloseStream );
76     };
77 }
78 
79 #endif
80