1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: biff.cxx,v $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 #include <sal/config.h>
36 #include <sfx2/docfile.hxx>
39 #include "scerrors.hxx"
40 #include "docpool.hxx"
41 #include "patattr.hxx"
43 #include "document.hxx"
47 ScBiffReader::ScBiffReader( SfxMedium
& rMedium
) :
52 mpStream
= rMedium
.GetInStream();
55 mpStream
->SetBufferSize( 65535 );
56 mpStream
->SetStreamCharSet( RTL_TEXTENCODING_MS_1252
);
60 ScBiffReader::~ScBiffReader()
63 mpStream
->SetBufferSize( 0 );
66 bool ScBiffReader::nextRecord()
74 sal_uInt32 nPos
= mpStream
->Tell();
75 if( nPos
!= mnOffset
+ mnLength
)
76 mpStream
->Seek( mnOffset
+ mnLength
);
79 *mpStream
>> mnId
>> mnLength
;
81 mnOffset
= mpStream
->Tell();
83 fprintf( stderr
, "Read record 0x%x length 0x%x at offset 0x%x\n",
84 (unsigned)mnId
, (unsigned)mnLength
, (unsigned)mnOffset
);
86 #if 1 // rather verbose
89 int i
, chunk
= len
< 16 ? len
: 16;
90 unsigned char data
[16];
91 mpStream
->Read( data
, chunk
);
93 for (i
= 0; i
< chunk
; i
++)
94 fprintf( stderr
, "%.2x ", data
[i
] );
95 fprintf( stderr
, "| " );
96 for (i
= 0; i
< chunk
; i
++)
97 fprintf( stderr
, "%c", data
[i
] < 127 && data
[i
] > 30 ? data
[i
] : '.' );
98 fprintf( stderr
, "\n" );
102 mpStream
->Seek( mnOffset
);