1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include "oox/helper/binaryinputstream.hxx"
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp>
31*cdf0e10cSrcweir #include <com/sun/star/io/XSeekable.hpp>
32*cdf0e10cSrcweir #include <string.h>
33*cdf0e10cSrcweir #include <vector>
34*cdf0e10cSrcweir #include <rtl/strbuf.hxx>
35*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
36*cdf0e10cSrcweir #include "oox/helper/binaryoutputstream.hxx"
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir namespace oox {
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir // ============================================================================
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir using namespace ::com::sun::star::io;
43*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir using ::rtl::OString;
46*cdf0e10cSrcweir using ::rtl::OStringBuffer;
47*cdf0e10cSrcweir using ::rtl::OStringToOUString;
48*cdf0e10cSrcweir using ::rtl::OUString;
49*cdf0e10cSrcweir using ::rtl::OUStringBuffer;
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir namespace {
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir const sal_Int32 INPUTSTREAM_BUFFERSIZE      = 0x8000;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir } // namespace
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir // ============================================================================
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir OString BinaryInputStream::readNulCharArray()
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir     OStringBuffer aBuffer;
62*cdf0e10cSrcweir     for( sal_uInt8 nChar = readuInt8(); !mbEof && (nChar > 0); readValue( nChar ) )
63*cdf0e10cSrcweir         aBuffer.append( static_cast< sal_Char >( nChar ) );
64*cdf0e10cSrcweir     return aBuffer.makeStringAndClear();
65*cdf0e10cSrcweir }
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir OUString BinaryInputStream::readNulCharArrayUC( rtl_TextEncoding eTextEnc )
68*cdf0e10cSrcweir {
69*cdf0e10cSrcweir     return OStringToOUString( readNulCharArray(), eTextEnc );
70*cdf0e10cSrcweir }
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir OUString BinaryInputStream::readNulUnicodeArray()
73*cdf0e10cSrcweir {
74*cdf0e10cSrcweir     OUStringBuffer aBuffer;
75*cdf0e10cSrcweir     for( sal_uInt16 nChar = readuInt16(); !mbEof && (nChar > 0); readValue( nChar ) )
76*cdf0e10cSrcweir         aBuffer.append( static_cast< sal_Unicode >( nChar ) );
77*cdf0e10cSrcweir     return aBuffer.makeStringAndClear();
78*cdf0e10cSrcweir }
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir OString BinaryInputStream::readCharArray( sal_Int32 nChars, bool bAllowNulChars )
81*cdf0e10cSrcweir {
82*cdf0e10cSrcweir     if( nChars <= 0 )
83*cdf0e10cSrcweir         return OString();
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir     ::std::vector< sal_uInt8 > aBuffer;
86*cdf0e10cSrcweir     sal_Int32 nCharsRead = readArray( aBuffer, nChars );
87*cdf0e10cSrcweir     if( nCharsRead <= 0 )
88*cdf0e10cSrcweir         return OString();
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir     aBuffer.resize( static_cast< size_t >( nCharsRead ) );
91*cdf0e10cSrcweir     if( !bAllowNulChars )
92*cdf0e10cSrcweir         ::std::replace( aBuffer.begin(), aBuffer.end(), '\0', '?' );
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir     return OString( reinterpret_cast< sal_Char* >( &aBuffer.front() ), nCharsRead );
95*cdf0e10cSrcweir }
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir OUString BinaryInputStream::readCharArrayUC( sal_Int32 nChars, rtl_TextEncoding eTextEnc, bool bAllowNulChars )
98*cdf0e10cSrcweir {
99*cdf0e10cSrcweir     return OStringToOUString( readCharArray( nChars, bAllowNulChars ), eTextEnc );
100*cdf0e10cSrcweir }
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir OUString BinaryInputStream::readUnicodeArray( sal_Int32 nChars, bool bAllowNulChars )
103*cdf0e10cSrcweir {
104*cdf0e10cSrcweir     if( nChars <= 0 )
105*cdf0e10cSrcweir         return OUString();
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     ::std::vector< sal_uInt16 > aBuffer;
108*cdf0e10cSrcweir     sal_Int32 nCharsRead = readArray( aBuffer, nChars );
109*cdf0e10cSrcweir     if( nCharsRead <= 0 )
110*cdf0e10cSrcweir         return OUString();
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     aBuffer.resize( static_cast< size_t >( nCharsRead ) );
113*cdf0e10cSrcweir     if( !bAllowNulChars )
114*cdf0e10cSrcweir         ::std::replace( aBuffer.begin(), aBuffer.begin() + nCharsRead, '\0', '?' );
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir     OUStringBuffer aStringBuffer;
117*cdf0e10cSrcweir     aStringBuffer.ensureCapacity( nCharsRead );
118*cdf0e10cSrcweir     for( ::std::vector< sal_uInt16 >::iterator aIt = aBuffer.begin(), aEnd = aBuffer.end(); aIt != aEnd; ++aIt )
119*cdf0e10cSrcweir         aStringBuffer.append( static_cast< sal_Unicode >( *aIt ) );
120*cdf0e10cSrcweir     return aStringBuffer.makeStringAndClear();
121*cdf0e10cSrcweir }
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir OUString BinaryInputStream::readCompressedUnicodeArray( sal_Int32 nChars, bool bCompressed, bool bAllowNulChars )
124*cdf0e10cSrcweir {
125*cdf0e10cSrcweir     return bCompressed ?
126*cdf0e10cSrcweir          // ISO-8859-1 maps all byte values 0xHH to the same Unicode code point U+00HH
127*cdf0e10cSrcweir         readCharArrayUC( nChars, RTL_TEXTENCODING_ISO_8859_1, bAllowNulChars ) :
128*cdf0e10cSrcweir         readUnicodeArray( nChars, bAllowNulChars );
129*cdf0e10cSrcweir }
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir void BinaryInputStream::copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes, sal_Int32 nAtomSize )
132*cdf0e10cSrcweir {
133*cdf0e10cSrcweir     if( nBytes > 0 )
134*cdf0e10cSrcweir     {
135*cdf0e10cSrcweir         // make buffer size a multiple of the passed atom size
136*cdf0e10cSrcweir         sal_Int32 nBufferSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, (INPUTSTREAM_BUFFERSIZE / nAtomSize) * nAtomSize );
137*cdf0e10cSrcweir         StreamDataSequence aBuffer( nBufferSize );
138*cdf0e10cSrcweir         while( nBytes > 0 )
139*cdf0e10cSrcweir         {
140*cdf0e10cSrcweir             sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, nBufferSize );
141*cdf0e10cSrcweir             sal_Int32 nBytesRead = readData( aBuffer, nReadSize, nAtomSize );
142*cdf0e10cSrcweir             rOutStrm.writeData( aBuffer );
143*cdf0e10cSrcweir             if( nReadSize == nBytesRead )
144*cdf0e10cSrcweir                 nBytes -= nReadSize;
145*cdf0e10cSrcweir             else
146*cdf0e10cSrcweir                 nBytes = 0;
147*cdf0e10cSrcweir         }
148*cdf0e10cSrcweir     }
149*cdf0e10cSrcweir }
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir // ============================================================================
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir BinaryXInputStream::BinaryXInputStream( const Reference< XInputStream >& rxInStrm, bool bAutoClose ) :
154*cdf0e10cSrcweir     BinaryStreamBase( Reference< XSeekable >( rxInStrm, UNO_QUERY ).is() ),
155*cdf0e10cSrcweir     BinaryXSeekableStream( Reference< XSeekable >( rxInStrm, UNO_QUERY ) ),
156*cdf0e10cSrcweir     maBuffer( INPUTSTREAM_BUFFERSIZE ),
157*cdf0e10cSrcweir     mxInStrm( rxInStrm ),
158*cdf0e10cSrcweir     mbAutoClose( bAutoClose && rxInStrm.is() )
159*cdf0e10cSrcweir {
160*cdf0e10cSrcweir     mbEof = !mxInStrm.is();
161*cdf0e10cSrcweir }
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir BinaryXInputStream::~BinaryXInputStream()
164*cdf0e10cSrcweir {
165*cdf0e10cSrcweir     close();
166*cdf0e10cSrcweir }
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir void BinaryXInputStream::close()
169*cdf0e10cSrcweir {
170*cdf0e10cSrcweir     OSL_ENSURE( !mbAutoClose || mxInStrm.is(), "BinaryXInputStream::close - invalid call" );
171*cdf0e10cSrcweir     if( mbAutoClose && mxInStrm.is() ) try
172*cdf0e10cSrcweir     {
173*cdf0e10cSrcweir         mxInStrm->closeInput();
174*cdf0e10cSrcweir     }
175*cdf0e10cSrcweir     catch( Exception& )
176*cdf0e10cSrcweir     {
177*cdf0e10cSrcweir         OSL_ENSURE( false, "BinaryXInputStream::close - closing input stream failed" );
178*cdf0e10cSrcweir     }
179*cdf0e10cSrcweir     mxInStrm.clear();
180*cdf0e10cSrcweir     mbAutoClose = false;
181*cdf0e10cSrcweir     BinaryXSeekableStream::close();
182*cdf0e10cSrcweir }
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir sal_Int32 BinaryXInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t /*nAtomSize*/ )
185*cdf0e10cSrcweir {
186*cdf0e10cSrcweir     sal_Int32 nRet = 0;
187*cdf0e10cSrcweir     if( !mbEof && (nBytes > 0) ) try
188*cdf0e10cSrcweir     {
189*cdf0e10cSrcweir         nRet = mxInStrm->readBytes( orData, nBytes );
190*cdf0e10cSrcweir         mbEof = nRet != nBytes;
191*cdf0e10cSrcweir     }
192*cdf0e10cSrcweir     catch( Exception& )
193*cdf0e10cSrcweir     {
194*cdf0e10cSrcweir         mbEof = true;
195*cdf0e10cSrcweir     }
196*cdf0e10cSrcweir     return nRet;
197*cdf0e10cSrcweir }
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir sal_Int32 BinaryXInputStream::readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize )
200*cdf0e10cSrcweir {
201*cdf0e10cSrcweir     sal_Int32 nRet = 0;
202*cdf0e10cSrcweir     if( !mbEof && (nBytes > 0) )
203*cdf0e10cSrcweir     {
204*cdf0e10cSrcweir         sal_Int32 nBufferSize = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, INPUTSTREAM_BUFFERSIZE );
205*cdf0e10cSrcweir         sal_uInt8* opnMem = reinterpret_cast< sal_uInt8* >( opMem );
206*cdf0e10cSrcweir         while( !mbEof && (nBytes > 0) )
207*cdf0e10cSrcweir         {
208*cdf0e10cSrcweir             sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, nBufferSize );
209*cdf0e10cSrcweir             sal_Int32 nBytesRead = readData( maBuffer, nReadSize, nAtomSize );
210*cdf0e10cSrcweir             if( nBytesRead > 0 )
211*cdf0e10cSrcweir                 memcpy( opnMem, maBuffer.getConstArray(), static_cast< size_t >( nBytesRead ) );
212*cdf0e10cSrcweir             opnMem += nBytesRead;
213*cdf0e10cSrcweir             nBytes -= nBytesRead;
214*cdf0e10cSrcweir             nRet += nBytesRead;
215*cdf0e10cSrcweir         }
216*cdf0e10cSrcweir     }
217*cdf0e10cSrcweir     return nRet;
218*cdf0e10cSrcweir }
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir void BinaryXInputStream::skip( sal_Int32 nBytes, size_t /*nAtomSize*/ )
221*cdf0e10cSrcweir {
222*cdf0e10cSrcweir     if( !mbEof ) try
223*cdf0e10cSrcweir     {
224*cdf0e10cSrcweir         mxInStrm->skipBytes( nBytes );
225*cdf0e10cSrcweir     }
226*cdf0e10cSrcweir     catch( Exception& )
227*cdf0e10cSrcweir     {
228*cdf0e10cSrcweir         mbEof = true;
229*cdf0e10cSrcweir     }
230*cdf0e10cSrcweir }
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir // ============================================================================
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir SequenceInputStream::SequenceInputStream( const StreamDataSequence& rData ) :
235*cdf0e10cSrcweir     BinaryStreamBase( true ),
236*cdf0e10cSrcweir     SequenceSeekableStream( rData )
237*cdf0e10cSrcweir {
238*cdf0e10cSrcweir }
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir sal_Int32 SequenceInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t /*nAtomSize*/ )
241*cdf0e10cSrcweir {
242*cdf0e10cSrcweir     sal_Int32 nReadBytes = 0;
243*cdf0e10cSrcweir     if( !mbEof )
244*cdf0e10cSrcweir     {
245*cdf0e10cSrcweir         nReadBytes = getMaxBytes( nBytes );
246*cdf0e10cSrcweir         orData.realloc( nReadBytes );
247*cdf0e10cSrcweir         if( nReadBytes > 0 )
248*cdf0e10cSrcweir             memcpy( orData.getArray(), mpData->getConstArray() + mnPos, static_cast< size_t >( nReadBytes ) );
249*cdf0e10cSrcweir         mnPos += nReadBytes;
250*cdf0e10cSrcweir         mbEof = nReadBytes < nBytes;
251*cdf0e10cSrcweir     }
252*cdf0e10cSrcweir     return nReadBytes;
253*cdf0e10cSrcweir }
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir sal_Int32 SequenceInputStream::readMemory( void* opMem, sal_Int32 nBytes, size_t /*nAtomSize*/ )
256*cdf0e10cSrcweir {
257*cdf0e10cSrcweir     sal_Int32 nReadBytes = 0;
258*cdf0e10cSrcweir     if( !mbEof )
259*cdf0e10cSrcweir     {
260*cdf0e10cSrcweir         nReadBytes = getMaxBytes( nBytes );
261*cdf0e10cSrcweir         if( nReadBytes > 0 )
262*cdf0e10cSrcweir             memcpy( opMem, mpData->getConstArray() + mnPos, static_cast< size_t >( nReadBytes ) );
263*cdf0e10cSrcweir         mnPos += nReadBytes;
264*cdf0e10cSrcweir         mbEof = nReadBytes < nBytes;
265*cdf0e10cSrcweir     }
266*cdf0e10cSrcweir     return nReadBytes;
267*cdf0e10cSrcweir }
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir void SequenceInputStream::skip( sal_Int32 nBytes, size_t /*nAtomSize*/ )
270*cdf0e10cSrcweir {
271*cdf0e10cSrcweir     if( !mbEof )
272*cdf0e10cSrcweir     {
273*cdf0e10cSrcweir         sal_Int32 nSkipBytes = getMaxBytes( nBytes );
274*cdf0e10cSrcweir         mnPos += nSkipBytes;
275*cdf0e10cSrcweir         mbEof = nSkipBytes < nBytes;
276*cdf0e10cSrcweir     }
277*cdf0e10cSrcweir }
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir // ============================================================================
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir RelativeInputStream::RelativeInputStream( BinaryInputStream& rInStrm, sal_Int64 nSize ) :
282*cdf0e10cSrcweir     BinaryStreamBase( rInStrm.isSeekable() ),
283*cdf0e10cSrcweir     mpInStrm( &rInStrm ),
284*cdf0e10cSrcweir     mnStartPos( rInStrm.tell() ),
285*cdf0e10cSrcweir     mnRelPos( 0 )
286*cdf0e10cSrcweir {
287*cdf0e10cSrcweir     sal_Int64 nRemaining = rInStrm.getRemaining();
288*cdf0e10cSrcweir     mnSize = (nRemaining >= 0) ? ::std::min( nSize, nRemaining ) : nSize;
289*cdf0e10cSrcweir     mbEof = mbEof || rInStrm.isEof() || (mnSize < 0);
290*cdf0e10cSrcweir }
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir sal_Int64 RelativeInputStream::size() const
293*cdf0e10cSrcweir {
294*cdf0e10cSrcweir     return mpInStrm ? mnSize : -1;
295*cdf0e10cSrcweir }
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir sal_Int64 RelativeInputStream::tell() const
298*cdf0e10cSrcweir {
299*cdf0e10cSrcweir     return mpInStrm ? mnRelPos : -1;
300*cdf0e10cSrcweir }
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir void RelativeInputStream::seek( sal_Int64 nPos )
303*cdf0e10cSrcweir {
304*cdf0e10cSrcweir     if( mpInStrm && isSeekable() && (mnStartPos >= 0) )
305*cdf0e10cSrcweir     {
306*cdf0e10cSrcweir         mnRelPos = getLimitedValue< sal_Int64, sal_Int64 >( nPos, 0, mnSize );
307*cdf0e10cSrcweir         mpInStrm->seek( mnStartPos + mnRelPos );
308*cdf0e10cSrcweir         mbEof = (mnRelPos != nPos) || mpInStrm->isEof();
309*cdf0e10cSrcweir     }
310*cdf0e10cSrcweir }
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir void RelativeInputStream::close()
313*cdf0e10cSrcweir {
314*cdf0e10cSrcweir     mpInStrm = 0;
315*cdf0e10cSrcweir     mbEof = true;
316*cdf0e10cSrcweir }
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir sal_Int32 RelativeInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize )
319*cdf0e10cSrcweir {
320*cdf0e10cSrcweir     sal_Int32 nReadBytes = 0;
321*cdf0e10cSrcweir     if( !mbEof )
322*cdf0e10cSrcweir     {
323*cdf0e10cSrcweir         sal_Int32 nMaxBytes = getMaxBytes( nBytes );
324*cdf0e10cSrcweir         nReadBytes = mpInStrm->readData( orData, nMaxBytes, nAtomSize );
325*cdf0e10cSrcweir         mnRelPos += nReadBytes;
326*cdf0e10cSrcweir         mbEof = (nMaxBytes < nBytes) || mpInStrm->isEof();
327*cdf0e10cSrcweir     }
328*cdf0e10cSrcweir     return nReadBytes;
329*cdf0e10cSrcweir }
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir sal_Int32 RelativeInputStream::readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize )
332*cdf0e10cSrcweir {
333*cdf0e10cSrcweir     sal_Int32 nReadBytes = 0;
334*cdf0e10cSrcweir     if( !mbEof )
335*cdf0e10cSrcweir     {
336*cdf0e10cSrcweir         sal_Int32 nMaxBytes = getMaxBytes( nBytes );
337*cdf0e10cSrcweir         nReadBytes = mpInStrm->readMemory( opMem, nMaxBytes, nAtomSize );
338*cdf0e10cSrcweir         mnRelPos += nReadBytes;
339*cdf0e10cSrcweir         mbEof = (nMaxBytes < nBytes) || mpInStrm->isEof();
340*cdf0e10cSrcweir     }
341*cdf0e10cSrcweir     return nReadBytes;
342*cdf0e10cSrcweir }
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir void RelativeInputStream::skip( sal_Int32 nBytes, size_t nAtomSize )
345*cdf0e10cSrcweir {
346*cdf0e10cSrcweir     if( !mbEof )
347*cdf0e10cSrcweir     {
348*cdf0e10cSrcweir         sal_Int32 nSkipBytes = getMaxBytes( nBytes );
349*cdf0e10cSrcweir         mpInStrm->skip( nSkipBytes, nAtomSize );
350*cdf0e10cSrcweir         mnRelPos += nSkipBytes;
351*cdf0e10cSrcweir         mbEof = nSkipBytes < nBytes;
352*cdf0e10cSrcweir     }
353*cdf0e10cSrcweir }
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir // ============================================================================
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir } // namespace oox
358