merge the formfield patch from ooo-build
[ooovba.git] / ucb / source / ucp / file / filstr.hxx
blob815bb52a1091b63452e84e7cbbb117929a1cfb03
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: filstr.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 ************************************************************************/
30 #ifndef _FILSTR_HXX_
31 #define _FILSTR_HXX_
33 #include <osl/mutex.hxx>
34 #include <rtl/ustring.hxx>
35 #include <cppuhelper/weak.hxx>
36 #include <ucbhelper/macros.hxx>
37 #include <com/sun/star/uno/XInterface.hpp>
38 #include <com/sun/star/lang/XTypeProvider.hpp>
39 #include <com/sun/star/io/XSeekable.hpp>
40 #include <com/sun/star/io/XTruncate.hpp>
41 #include <com/sun/star/io/XInputStream.hpp>
42 #include <com/sun/star/io/XOutputStream.hpp>
43 #include <com/sun/star/io/XStream.hpp>
44 #include "com/sun/star/io/XAsyncOutputMonitor.hpp"
45 #include <com/sun/star/ucb/XContentProvider.hpp>
47 #include "filrec.hxx"
49 namespace fileaccess {
51 // forward:
52 class shell;
53 class XInputStreamForStream;
54 class XOutputStreamForStream;
56 class XStream_impl
57 : public cppu::OWeakObject,
58 public com::sun::star::lang::XTypeProvider,
59 public com::sun::star::io::XStream,
60 public com::sun::star::io::XSeekable,
61 public com::sun::star::io::XInputStream,
62 public com::sun::star::io::XOutputStream,
63 public com::sun::star::io::XTruncate,
64 public com::sun::star::io::XAsyncOutputMonitor
66 friend class XInputStreamForStream;
67 friend class XOutputStreamForStream;
69 public:
71 XStream_impl( shell* pMyShell,const rtl::OUString& aUncPath, sal_Bool bLock );
73 /**
74 * Returns an error code as given by filerror.hxx
77 sal_Int32 SAL_CALL CtorSuccess();
78 sal_Int32 SAL_CALL getMinorError();
80 virtual ~XStream_impl();
83 // OWeakObject
85 virtual com::sun::star::uno::Any SAL_CALL
86 queryInterface(
87 const com::sun::star::uno::Type& rType )
88 throw( com::sun::star::uno::RuntimeException);
90 virtual void SAL_CALL
91 acquire(
92 void )
93 throw();
95 virtual void SAL_CALL
96 release(
97 void )
98 throw();
101 // XTypeProvider
103 XTYPEPROVIDER_DECL()
106 // XStream
108 virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL
109 getInputStream( )
110 throw( com::sun::star::uno::RuntimeException );
112 virtual com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > SAL_CALL
113 getOutputStream( )
114 throw( com::sun::star::uno::RuntimeException );
117 // XTruncate
119 virtual void SAL_CALL truncate( void )
120 throw( com::sun::star::io::IOException,
121 com::sun::star::uno::RuntimeException );
124 // XInputStream
126 sal_Int32 SAL_CALL
127 readBytes(
128 com::sun::star::uno::Sequence< sal_Int8 >& aData,
129 sal_Int32 nBytesToRead )
130 throw( com::sun::star::io::NotConnectedException,
131 com::sun::star::io::BufferSizeExceededException,
132 com::sun::star::io::IOException,
133 com::sun::star::uno::RuntimeException);
135 sal_Int32 SAL_CALL
136 readSomeBytes(
137 com::sun::star::uno::Sequence< sal_Int8 >& aData,
138 sal_Int32 nMaxBytesToRead )
139 throw( com::sun::star::io::NotConnectedException,
140 com::sun::star::io::BufferSizeExceededException,
141 com::sun::star::io::IOException,
142 com::sun::star::uno::RuntimeException);
145 void SAL_CALL
146 skipBytes(
147 sal_Int32 nBytesToSkip )
148 throw( com::sun::star::io::NotConnectedException,
149 com::sun::star::io::BufferSizeExceededException,
150 com::sun::star::io::IOException,
151 com::sun::star::uno::RuntimeException );
153 sal_Int32 SAL_CALL
154 available(
155 void )
156 throw( com::sun::star::io::NotConnectedException,
157 com::sun::star::io::IOException,
158 com::sun::star::uno::RuntimeException );
160 void SAL_CALL
161 closeInput(
162 void )
163 throw( com::sun::star::io::NotConnectedException,
164 com::sun::star::io::IOException,
165 com::sun::star::uno::RuntimeException );
167 // XSeekable
169 void SAL_CALL
170 seek(
171 sal_Int64 location )
172 throw( com::sun::star::lang::IllegalArgumentException,
173 com::sun::star::io::IOException,
174 com::sun::star::uno::RuntimeException );
176 sal_Int64 SAL_CALL
177 getPosition(
178 void )
179 throw( com::sun::star::io::IOException,
180 com::sun::star::uno::RuntimeException );
182 sal_Int64 SAL_CALL
183 getLength(
184 void )
185 throw( com::sun::star::io::IOException,
186 com::sun::star::uno::RuntimeException );
189 // XOutputStream
191 void SAL_CALL
192 writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData )
193 throw( com::sun::star::io::NotConnectedException,
194 com::sun::star::io::BufferSizeExceededException,
195 com::sun::star::io::IOException,
196 com::sun::star::uno::RuntimeException);
200 void SAL_CALL
201 flush()
202 throw( com::sun::star::io::NotConnectedException,
203 com::sun::star::io::BufferSizeExceededException,
204 com::sun::star::io::IOException,
205 com::sun::star::uno::RuntimeException);
208 void SAL_CALL
209 closeOutput(
210 void )
211 throw( com::sun::star::io::NotConnectedException,
212 com::sun::star::io::IOException,
213 com::sun::star::uno::RuntimeException );
215 virtual void SAL_CALL waitForCompletion()
216 throw (
217 com::sun::star::io::IOException,
218 com::sun::star::uno::RuntimeException);
220 private:
222 osl::Mutex m_aMutex;
223 bool m_bInputStreamCalled,m_bOutputStreamCalled;
225 shell* m_pMyShell;
226 com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider > m_xProvider;
227 sal_Bool m_nIsOpen;
229 sal_Bool m_bLock;
231 ReconnectingFile m_aFile;
233 sal_Int32 m_nErrorCode;
234 sal_Int32 m_nMinorErrorCode;
236 // Implementation methods
238 void SAL_CALL
239 closeStream(
240 void )
241 throw( com::sun::star::io::NotConnectedException,
242 com::sun::star::io::IOException,
243 com::sun::star::uno::RuntimeException );
247 } // end namespace XStream_impl
249 #endif