Update ooo320-m1
[ooovba.git] / ucb / source / ucp / odma / odma_inputstream.hxx
blob93ae4a066b1e7d857ede772cb1abc33aa2fe802d
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: odma_inputstream.hxx,v $
10 * $Revision: 1.6 $
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 ************************************************************************/
31 #ifndef ODMA_INPUTSTREAM_HXX
32 #define ODMA_INPUTSTREAM_HXX
34 #include <osl/mutex.hxx>
35 #include <com/sun/star/io/XInputStream.hpp>
36 #include <com/sun/star/io/XStream.hpp>
37 #include <com/sun/star/io/XOutputStream.hpp>
38 #include <com/sun/star/io/XTruncate.hpp>
39 #include <com/sun/star/io/XSeekable.hpp>
40 #include <cppuhelper/implbase5.hxx>
42 #include "rtl/ref.hxx"
44 namespace ucbhelper
46 class Content;
48 namespace odma
50 typedef ::cppu::WeakImplHelper5< ::com::sun::star::io::XInputStream,
51 ::com::sun::star::io::XStream,
52 ::com::sun::star::io::XTruncate,
53 ::com::sun::star::io::XSeekable,
54 ::com::sun::star::io::XOutputStream> OOdmaStreamBase;
56 class ContentProvider;
57 class ContentProperties;
58 class OOdmaStream : public OOdmaStreamBase
60 ::osl::Mutex m_aMutex;
61 ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream> m_xOutput;
62 ::com::sun::star::uno::Reference< ::com::sun::star::io::XTruncate> m_xTruncate;
63 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> m_xInput;
64 ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable> m_xInputSeek;
66 ::rtl::Reference<ContentProperties> m_aProp;
67 ::ucbhelper::Content* m_pContent;
68 ContentProvider* m_pProvider;
69 sal_Bool m_bInputStreamCalled;
70 sal_Bool m_bOutputStreamCalled;
71 sal_Bool m_bModified;
73 void ensureInputStream() throw( ::com::sun::star::io::IOException );
74 void ensureOutputStream() throw( ::com::sun::star::io::IOException );
75 void SAL_CALL closeStream() throw( ::com::sun::star::io::NotConnectedException,
76 ::com::sun::star::io::IOException,
77 ::com::sun::star::uno::RuntimeException );
78 public:
79 OOdmaStream(::ucbhelper::Content* _pContent,
80 ContentProvider* _pProvider,
81 const ::rtl::Reference<ContentProperties>& _rProp);
82 virtual ~OOdmaStream();
83 // com::sun::star::io::XInputStream
84 virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence<sal_Int8>& aData, sal_Int32 nBytesToRead )
85 throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
86 ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
88 virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence<sal_Int8>& aData, sal_Int32 nMaxBytesToRead )
89 throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
90 ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
92 virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
93 throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
94 ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
96 virtual sal_Int32 SAL_CALL available( )
97 throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
99 virtual void SAL_CALL closeInput( )
100 throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
102 // com::sun::star::io::XStream
103 virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw( com::sun::star::uno::RuntimeException );
104 virtual com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw( com::sun::star::uno::RuntimeException );
106 // com::sun::star::io::XOutputStream
107 void SAL_CALL writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData )
108 throw( com::sun::star::io::NotConnectedException,
109 com::sun::star::io::BufferSizeExceededException,
110 com::sun::star::io::IOException,
111 com::sun::star::uno::RuntimeException);
113 void SAL_CALL flush()
114 throw( com::sun::star::io::NotConnectedException,
115 com::sun::star::io::BufferSizeExceededException,
116 com::sun::star::io::IOException,
117 com::sun::star::uno::RuntimeException);
118 void SAL_CALL closeOutput()
119 throw( com::sun::star::io::NotConnectedException,
120 com::sun::star::io::IOException,
121 com::sun::star::uno::RuntimeException );
122 // XTruncate
123 virtual void SAL_CALL truncate( void )
124 throw( com::sun::star::io::IOException,
125 com::sun::star::uno::RuntimeException );
126 // XSeekable
127 void SAL_CALL seek(sal_Int64 location )
128 throw( com::sun::star::lang::IllegalArgumentException,
129 com::sun::star::io::IOException,
130 com::sun::star::uno::RuntimeException );
132 sal_Int64 SAL_CALL getPosition()
133 throw( com::sun::star::io::IOException,
134 com::sun::star::uno::RuntimeException );
136 sal_Int64 SAL_CALL getLength()
137 throw( com::sun::star::io::IOException,
138 com::sun::star::uno::RuntimeException );
141 #endif // ODMA_INPUTSTREAM_HXX