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 _OSL_FILE_WRAPPER_HXX_
24 #define _OSL_FILE_WRAPPER_HXX_
25 
26 #include <osl/mutex.hxx>
27 #include <com/sun/star/io/XOutputStream.hpp>
28 #include <com/sun/star/io/XInputStream.hpp>
29 #include <com/sun/star/io/XSeekable.hpp>
30 #include <cppuhelper/implbase1.hxx>
31 
32 #define DECLARE_UNO3_AGG_DEFAULTS(classname, baseclass) \
33 virtual void            SAL_CALL acquire() throw() { baseclass::acquire(); } \
34 virtual void            SAL_CALL release() throw() { baseclass::release(); }    \
35 virtual ::com::sun::star::uno::Any  SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException) \
36 { return baseclass::queryInterface(_rType); } \
37 void            SAL_CALL PUT_SEMICOLON_AT_THE_END()
38 
39 namespace osl
40 {
41 	class File;
42 }
43 
44 namespace foo
45 {
46 	namespace stario	= ::com::sun::star::io;
47 	namespace staruno	= ::com::sun::star::uno;
48 
49 //==================================================================
50 //= OOutputStreamWrapper
51 //==================================================================
52 typedef ::cppu::WeakImplHelper1<stario::XOutputStream> OutputStreamWrapper_Base;
53 	// needed for some compilers
54 class OOutputStreamWrapper : public OutputStreamWrapper_Base
55 {
56 	::osl::File&		rStream;
57 
58 public:
OOutputStreamWrapper(::osl::File & _rStream)59 	OOutputStreamWrapper(::osl::File& _rStream) :rStream(_rStream) { }
60 
61 // UNO Anbindung
62 	DECLARE_UNO3_AGG_DEFAULTS(OOutputStreamWrapper, OutputStreamWrapper_Base);
63 
64 // stario::XOutputStream
65 	virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
66 	virtual void SAL_CALL flush() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
67 	virtual void SAL_CALL closeOutput() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
68 };
69 
70 }	// namespace utl
71 
72 
73 #endif // _UTL_STREAM_WRAPPER_HXX_
74 
75