update dev300-m57
[ooovba.git] / svtools / inc / strmadpt.hxx
blob5e99cc7d51e37732221057463c5fb1bc9c6f0583
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.5 $
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 #include "svtools/svldllapi.h"
35 #include <com/sun/star/io/XInputStream.hpp>
36 #include <com/sun/star/io/XOutputStream.hpp>
37 #include <com/sun/star/io/XSeekable.hpp>
38 #include <cppuhelper/weak.hxx>
39 #include <tools/stream.hxx>
41 //============================================================================
42 class SVL_DLLPUBLIC SvOutputStreamOpenLockBytes: public SvOpenLockBytes
44 com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >
45 m_xOutputStream;
46 sal_uInt32 m_nPosition;
48 public:
49 TYPEINFO();
51 SvOutputStreamOpenLockBytes(
52 const com::sun::star::uno::Reference<
53 com::sun::star::io::XOutputStream > &
54 rTheOutputStream):
55 m_xOutputStream(rTheOutputStream), m_nPosition(0) {}
57 virtual ErrCode ReadAt(ULONG, void *, ULONG, ULONG *) const;
59 virtual ErrCode WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount,
60 ULONG * pWritten);
62 virtual ErrCode Flush() const;
64 virtual ErrCode SetSize(ULONG);
66 virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const;
68 virtual ErrCode FillAppend(const void * pBuffer, ULONG nCount,
69 ULONG * pWritten);
71 virtual ULONG Tell() const;
73 virtual ULONG Seek(ULONG);
75 virtual void Terminate();
78 //============================================================================
79 class SVL_DLLPUBLIC SvLockBytesInputStream: public cppu::OWeakObject,
80 public com::sun::star::io::XInputStream,
81 public com::sun::star::io::XSeekable
83 SvLockBytesRef m_xLockBytes;
84 sal_Int64 m_nPosition;
85 bool m_bDone;
87 public:
88 SvLockBytesInputStream(SvLockBytes * pTheLockBytes):
89 m_xLockBytes(pTheLockBytes), m_nPosition(0), m_bDone(false) {}
91 virtual com::sun::star::uno::Any SAL_CALL
92 queryInterface(const com::sun::star::uno::Type & rType)
93 throw (com::sun::star::uno::RuntimeException);
95 virtual void SAL_CALL acquire() throw();
97 virtual void SAL_CALL release() throw();
99 virtual sal_Int32 SAL_CALL
100 readBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData,
101 sal_Int32 nBytesToRead)
102 throw (com::sun::star::io::IOException,
103 com::sun::star::uno::RuntimeException);
105 virtual sal_Int32 SAL_CALL
106 readSomeBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData,
107 sal_Int32 nMaxBytesToRead)
108 throw (com::sun::star::io::IOException,
109 com::sun::star::uno::RuntimeException);
111 virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip)
112 throw (com::sun::star::io::IOException,
113 com::sun::star::uno::RuntimeException);
115 virtual sal_Int32 SAL_CALL available()
116 throw (com::sun::star::io::IOException,
117 com::sun::star::uno::RuntimeException);
119 virtual void SAL_CALL closeInput()
120 throw (com::sun::star::io::IOException,
121 com::sun::star::uno::RuntimeException);
123 virtual void SAL_CALL seek(sal_Int64 nLocation)
124 throw (com::sun::star::lang::IllegalArgumentException,
125 com::sun::star::io::IOException,
126 com::sun::star::uno::RuntimeException);
128 virtual sal_Int64 SAL_CALL getPosition()
129 throw (com::sun::star::io::IOException,
130 com::sun::star::uno::RuntimeException);
132 virtual sal_Int64 SAL_CALL getLength()
133 throw (com::sun::star::io::IOException,
134 com::sun::star::uno::RuntimeException);
137 #endif // SVTOOLS_STRMADPT_HXX