Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / ucb / source / ucp / file / filstr.hxx
blobb44769c389980705db547505fc2cde2544b04fa1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _FILSTR_HXX_
20 #define _FILSTR_HXX_
22 #include <osl/mutex.hxx>
23 #include <rtl/ustring.hxx>
24 #include <cppuhelper/weak.hxx>
25 #include <ucbhelper/macros.hxx>
26 #include <com/sun/star/uno/XInterface.hpp>
27 #include <com/sun/star/lang/XTypeProvider.hpp>
28 #include <com/sun/star/io/XSeekable.hpp>
29 #include <com/sun/star/io/XTruncate.hpp>
30 #include <com/sun/star/io/XInputStream.hpp>
31 #include <com/sun/star/io/XOutputStream.hpp>
32 #include <com/sun/star/io/XStream.hpp>
33 #include "com/sun/star/io/XAsyncOutputMonitor.hpp"
34 #include <com/sun/star/ucb/XContentProvider.hpp>
36 #include "filrec.hxx"
38 namespace fileaccess {
40 // forward:
41 class shell;
43 class XStream_impl
44 : public cppu::OWeakObject,
45 public com::sun::star::lang::XTypeProvider,
46 public com::sun::star::io::XStream,
47 public com::sun::star::io::XSeekable,
48 public com::sun::star::io::XInputStream,
49 public com::sun::star::io::XOutputStream,
50 public com::sun::star::io::XTruncate,
51 public com::sun::star::io::XAsyncOutputMonitor
54 public:
56 XStream_impl( shell* pMyShell,const rtl::OUString& aUncPath, sal_Bool bLock );
58 /**
59 * Returns an error code as given by filerror.hxx
62 sal_Int32 SAL_CALL CtorSuccess();
63 sal_Int32 SAL_CALL getMinorError();
65 virtual ~XStream_impl();
68 // OWeakObject
70 virtual com::sun::star::uno::Any SAL_CALL
71 queryInterface(
72 const com::sun::star::uno::Type& rType )
73 throw( com::sun::star::uno::RuntimeException);
75 virtual void SAL_CALL
76 acquire(
77 void )
78 throw();
80 virtual void SAL_CALL
81 release(
82 void )
83 throw();
86 // XTypeProvider
88 XTYPEPROVIDER_DECL()
91 // XStream
93 virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL
94 getInputStream( )
95 throw( com::sun::star::uno::RuntimeException );
97 virtual com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > SAL_CALL
98 getOutputStream( )
99 throw( com::sun::star::uno::RuntimeException );
102 // XTruncate
104 virtual void SAL_CALL truncate( void )
105 throw( com::sun::star::io::IOException,
106 com::sun::star::uno::RuntimeException );
109 // XInputStream
111 sal_Int32 SAL_CALL
112 readBytes(
113 com::sun::star::uno::Sequence< sal_Int8 >& aData,
114 sal_Int32 nBytesToRead )
115 throw( com::sun::star::io::NotConnectedException,
116 com::sun::star::io::BufferSizeExceededException,
117 com::sun::star::io::IOException,
118 com::sun::star::uno::RuntimeException);
120 sal_Int32 SAL_CALL
121 readSomeBytes(
122 com::sun::star::uno::Sequence< sal_Int8 >& aData,
123 sal_Int32 nMaxBytesToRead )
124 throw( com::sun::star::io::NotConnectedException,
125 com::sun::star::io::BufferSizeExceededException,
126 com::sun::star::io::IOException,
127 com::sun::star::uno::RuntimeException);
130 void SAL_CALL
131 skipBytes(
132 sal_Int32 nBytesToSkip )
133 throw( com::sun::star::io::NotConnectedException,
134 com::sun::star::io::BufferSizeExceededException,
135 com::sun::star::io::IOException,
136 com::sun::star::uno::RuntimeException );
138 sal_Int32 SAL_CALL
139 available(
140 void )
141 throw( com::sun::star::io::NotConnectedException,
142 com::sun::star::io::IOException,
143 com::sun::star::uno::RuntimeException );
145 void SAL_CALL
146 closeInput(
147 void )
148 throw( com::sun::star::io::NotConnectedException,
149 com::sun::star::io::IOException,
150 com::sun::star::uno::RuntimeException );
152 // XSeekable
154 void SAL_CALL
155 seek(
156 sal_Int64 location )
157 throw( com::sun::star::lang::IllegalArgumentException,
158 com::sun::star::io::IOException,
159 com::sun::star::uno::RuntimeException );
161 sal_Int64 SAL_CALL
162 getPosition(
163 void )
164 throw( com::sun::star::io::IOException,
165 com::sun::star::uno::RuntimeException );
167 sal_Int64 SAL_CALL
168 getLength(
169 void )
170 throw( com::sun::star::io::IOException,
171 com::sun::star::uno::RuntimeException );
174 // XOutputStream
176 void SAL_CALL
177 writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData )
178 throw( com::sun::star::io::NotConnectedException,
179 com::sun::star::io::BufferSizeExceededException,
180 com::sun::star::io::IOException,
181 com::sun::star::uno::RuntimeException);
185 void SAL_CALL
186 flush()
187 throw( com::sun::star::io::NotConnectedException,
188 com::sun::star::io::BufferSizeExceededException,
189 com::sun::star::io::IOException,
190 com::sun::star::uno::RuntimeException);
193 void SAL_CALL
194 closeOutput(
195 void )
196 throw( com::sun::star::io::NotConnectedException,
197 com::sun::star::io::IOException,
198 com::sun::star::uno::RuntimeException );
200 virtual void SAL_CALL waitForCompletion()
201 throw (
202 com::sun::star::io::IOException,
203 com::sun::star::uno::RuntimeException);
205 private:
207 osl::Mutex m_aMutex;
208 bool m_bInputStreamCalled,m_bOutputStreamCalled;
210 shell* m_pMyShell;
211 com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider > m_xProvider;
212 sal_Bool m_nIsOpen;
214 ReconnectingFile m_aFile;
216 sal_Int32 m_nErrorCode;
217 sal_Int32 m_nMinorErrorCode;
219 // Implementation methods
221 void SAL_CALL
222 closeStream(
223 void )
224 throw( com::sun::star::io::NotConnectedException,
225 com::sun::star::io::IOException,
226 com::sun::star::uno::RuntimeException );
230 } // end namespace XStream_impl
232 #endif
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */