Bump for 3.6-28
[LibreOffice.git] / ucb / source / ucp / file / filstr.hxx
blobaa49830b63cb90dfbaeba960d57d3be407d6dc2f
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 ************************************************************************/
28 #ifndef _FILSTR_HXX_
29 #define _FILSTR_HXX_
31 #include <osl/mutex.hxx>
32 #include <rtl/ustring.hxx>
33 #include <cppuhelper/weak.hxx>
34 #include <ucbhelper/macros.hxx>
35 #include <com/sun/star/uno/XInterface.hpp>
36 #include <com/sun/star/lang/XTypeProvider.hpp>
37 #include <com/sun/star/io/XSeekable.hpp>
38 #include <com/sun/star/io/XTruncate.hpp>
39 #include <com/sun/star/io/XInputStream.hpp>
40 #include <com/sun/star/io/XOutputStream.hpp>
41 #include <com/sun/star/io/XStream.hpp>
42 #include "com/sun/star/io/XAsyncOutputMonitor.hpp"
43 #include <com/sun/star/ucb/XContentProvider.hpp>
45 #include "filrec.hxx"
47 namespace fileaccess {
49 // forward:
50 class shell;
51 class XInputStreamForStream;
52 class XOutputStreamForStream;
54 class XStream_impl
55 : public cppu::OWeakObject,
56 public com::sun::star::lang::XTypeProvider,
57 public com::sun::star::io::XStream,
58 public com::sun::star::io::XSeekable,
59 public com::sun::star::io::XInputStream,
60 public com::sun::star::io::XOutputStream,
61 public com::sun::star::io::XTruncate,
62 public com::sun::star::io::XAsyncOutputMonitor
64 friend class XInputStreamForStream;
65 friend class XOutputStreamForStream;
67 public:
69 XStream_impl( shell* pMyShell,const rtl::OUString& aUncPath, sal_Bool bLock );
71 /**
72 * Returns an error code as given by filerror.hxx
75 sal_Int32 SAL_CALL CtorSuccess();
76 sal_Int32 SAL_CALL getMinorError();
78 virtual ~XStream_impl();
81 // OWeakObject
83 virtual com::sun::star::uno::Any SAL_CALL
84 queryInterface(
85 const com::sun::star::uno::Type& rType )
86 throw( com::sun::star::uno::RuntimeException);
88 virtual void SAL_CALL
89 acquire(
90 void )
91 throw();
93 virtual void SAL_CALL
94 release(
95 void )
96 throw();
99 // XTypeProvider
101 XTYPEPROVIDER_DECL()
104 // XStream
106 virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL
107 getInputStream( )
108 throw( com::sun::star::uno::RuntimeException );
110 virtual com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > SAL_CALL
111 getOutputStream( )
112 throw( com::sun::star::uno::RuntimeException );
115 // XTruncate
117 virtual void SAL_CALL truncate( void )
118 throw( com::sun::star::io::IOException,
119 com::sun::star::uno::RuntimeException );
122 // XInputStream
124 sal_Int32 SAL_CALL
125 readBytes(
126 com::sun::star::uno::Sequence< sal_Int8 >& aData,
127 sal_Int32 nBytesToRead )
128 throw( com::sun::star::io::NotConnectedException,
129 com::sun::star::io::BufferSizeExceededException,
130 com::sun::star::io::IOException,
131 com::sun::star::uno::RuntimeException);
133 sal_Int32 SAL_CALL
134 readSomeBytes(
135 com::sun::star::uno::Sequence< sal_Int8 >& aData,
136 sal_Int32 nMaxBytesToRead )
137 throw( com::sun::star::io::NotConnectedException,
138 com::sun::star::io::BufferSizeExceededException,
139 com::sun::star::io::IOException,
140 com::sun::star::uno::RuntimeException);
143 void SAL_CALL
144 skipBytes(
145 sal_Int32 nBytesToSkip )
146 throw( com::sun::star::io::NotConnectedException,
147 com::sun::star::io::BufferSizeExceededException,
148 com::sun::star::io::IOException,
149 com::sun::star::uno::RuntimeException );
151 sal_Int32 SAL_CALL
152 available(
153 void )
154 throw( com::sun::star::io::NotConnectedException,
155 com::sun::star::io::IOException,
156 com::sun::star::uno::RuntimeException );
158 void SAL_CALL
159 closeInput(
160 void )
161 throw( com::sun::star::io::NotConnectedException,
162 com::sun::star::io::IOException,
163 com::sun::star::uno::RuntimeException );
165 // XSeekable
167 void SAL_CALL
168 seek(
169 sal_Int64 location )
170 throw( com::sun::star::lang::IllegalArgumentException,
171 com::sun::star::io::IOException,
172 com::sun::star::uno::RuntimeException );
174 sal_Int64 SAL_CALL
175 getPosition(
176 void )
177 throw( com::sun::star::io::IOException,
178 com::sun::star::uno::RuntimeException );
180 sal_Int64 SAL_CALL
181 getLength(
182 void )
183 throw( com::sun::star::io::IOException,
184 com::sun::star::uno::RuntimeException );
187 // XOutputStream
189 void SAL_CALL
190 writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData )
191 throw( com::sun::star::io::NotConnectedException,
192 com::sun::star::io::BufferSizeExceededException,
193 com::sun::star::io::IOException,
194 com::sun::star::uno::RuntimeException);
198 void SAL_CALL
199 flush()
200 throw( com::sun::star::io::NotConnectedException,
201 com::sun::star::io::BufferSizeExceededException,
202 com::sun::star::io::IOException,
203 com::sun::star::uno::RuntimeException);
206 void SAL_CALL
207 closeOutput(
208 void )
209 throw( com::sun::star::io::NotConnectedException,
210 com::sun::star::io::IOException,
211 com::sun::star::uno::RuntimeException );
213 virtual void SAL_CALL waitForCompletion()
214 throw (
215 com::sun::star::io::IOException,
216 com::sun::star::uno::RuntimeException);
218 private:
220 osl::Mutex m_aMutex;
221 bool m_bInputStreamCalled,m_bOutputStreamCalled;
223 shell* m_pMyShell;
224 com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider > m_xProvider;
225 sal_Bool m_nIsOpen;
227 sal_Bool m_bLock;
229 ReconnectingFile m_aFile;
231 sal_Int32 m_nErrorCode;
232 sal_Int32 m_nMinorErrorCode;
234 // Implementation methods
236 void SAL_CALL
237 closeStream(
238 void )
239 throw( com::sun::star::io::NotConnectedException,
240 com::sun::star::io::IOException,
241 com::sun::star::uno::RuntimeException );
245 } // end namespace XStream_impl
247 #endif
249 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */