sync master with lastest vba changes
[ooovba.git] / binfilter / inc / bf_svtools / strmadpt.hxx
blob4dd72fc23ae62e82a88cafe415d982c1affd860c
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: strmadpt.hxx,v $
10 * $Revision: 1.3 $
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 SVTOOLS_STRMADPT_HXX
32 #define SVTOOLS_STRMADPT_HXX
34 #ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
35 #include <com/sun/star/io/XInputStream.hpp>
36 #endif
37 #ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
38 #include <com/sun/star/io/XOutputStream.hpp>
39 #endif
40 #ifndef _COM_SUN_STAR_IO_XSEEKABLE_HPP_
41 #include <com/sun/star/io/XSeekable.hpp>
42 #endif
43 #ifndef _CPPUHELPER_WEAK_HXX_
44 #include <cppuhelper/weak.hxx>
45 #endif
46 #ifndef _STREAM_HXX
47 #include <tools/stream.hxx>
48 #endif
49 namespace binfilter
53 //============================================================================
54 class SvOutputStreamOpenLockBytes: public SvOpenLockBytes
56 com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >
57 m_xOutputStream;
58 sal_uInt32 m_nPosition;
60 public:
61 TYPEINFO();
63 SvOutputStreamOpenLockBytes(
64 const com::sun::star::uno::Reference<
65 com::sun::star::io::XOutputStream > &
66 rTheOutputStream):
67 m_xOutputStream(rTheOutputStream), m_nPosition(0) {}
69 virtual ErrCode ReadAt(ULONG, void *, ULONG, ULONG *) const;
71 virtual ErrCode WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount,
72 ULONG * pWritten);
74 virtual ErrCode Flush() const;
76 virtual ErrCode SetSize(ULONG);
78 virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const;
80 virtual ErrCode FillAppend(const void * pBuffer, ULONG nCount,
81 ULONG * pWritten);
83 virtual ULONG Tell() const;
85 virtual ULONG Seek(ULONG);
87 virtual void Terminate();
90 //============================================================================
91 class SvLockBytesInputStream: public cppu::OWeakObject,
92 public com::sun::star::io::XInputStream,
93 public com::sun::star::io::XSeekable
95 SvLockBytesRef m_xLockBytes;
96 sal_Int64 m_nPosition;
97 bool m_bDone;
99 public:
100 SvLockBytesInputStream(SvLockBytes * pTheLockBytes):
101 m_xLockBytes(pTheLockBytes), m_nPosition(0), m_bDone(false) {}
103 virtual com::sun::star::uno::Any SAL_CALL
104 queryInterface(const com::sun::star::uno::Type & rType)
105 throw (com::sun::star::uno::RuntimeException);
107 virtual void SAL_CALL acquire() throw();
109 virtual void SAL_CALL release() throw();
111 virtual sal_Int32 SAL_CALL
112 readBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData,
113 sal_Int32 nBytesToRead)
114 throw (com::sun::star::io::IOException,
115 com::sun::star::uno::RuntimeException);
117 virtual sal_Int32 SAL_CALL
118 readSomeBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData,
119 sal_Int32 nMaxBytesToRead)
120 throw (com::sun::star::io::IOException,
121 com::sun::star::uno::RuntimeException);
123 virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip)
124 throw (com::sun::star::io::IOException,
125 com::sun::star::uno::RuntimeException);
127 virtual sal_Int32 SAL_CALL available()
128 throw (com::sun::star::io::IOException,
129 com::sun::star::uno::RuntimeException);
131 virtual void SAL_CALL closeInput()
132 throw (com::sun::star::io::IOException,
133 com::sun::star::uno::RuntimeException);
135 virtual void SAL_CALL seek(sal_Int64 nLocation)
136 throw (com::sun::star::lang::IllegalArgumentException,
137 com::sun::star::io::IOException,
138 com::sun::star::uno::RuntimeException);
140 virtual sal_Int64 SAL_CALL getPosition()
141 throw (com::sun::star::io::IOException,
142 com::sun::star::uno::RuntimeException);
144 virtual sal_Int64 SAL_CALL getLength()
145 throw (com::sun::star::io::IOException,
146 com::sun::star::uno::RuntimeException);
151 #endif // SVTOOLS_STRMADPT_HXX