1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
22 #include <sfx2/docfile.hxx>
25 #include "scerrors.hxx"
26 #include "docpool.hxx"
27 #include "patattr.hxx"
29 #include "document.hxx"
30 #include "formulacell.hxx"
33 ScBiffReader::ScBiffReader(SfxMedium
& rMedium
)
39 mpStream
= rMedium
.GetInStream();
42 mpStream
->SetBufferSize( 65535 );
43 mpStream
->SetStreamCharSet( RTL_TEXTENCODING_MS_1252
);
47 ScBiffReader::~ScBiffReader()
50 mpStream
->SetBufferSize( 0 );
53 bool ScBiffReader::nextRecord()
61 sal_uInt32 nPos
= mpStream
->Tell();
62 if( nPos
!= mnOffset
+ mnLength
)
63 mpStream
->Seek( mnOffset
+ mnLength
);
66 mpStream
->ReadUInt16( mnId
).ReadUInt16( mnLength
);
68 mnOffset
= mpStream
->Tell();
69 #if OSL_DEBUG_LEVEL > 1
70 fprintf( stderr
, "Read record 0x%x length 0x%x at offset 0x%x\n",
71 (unsigned)mnId
, (unsigned)mnLength
, (unsigned)mnOffset
);
73 #if 1 // rather verbose
76 int i
, chunk
= len
< 16 ? len
: 16;
77 unsigned char data
[16];
78 mpStream
->Read( data
, chunk
);
80 for (i
= 0; i
< chunk
; i
++)
81 fprintf( stderr
, "%.2x ", data
[i
] );
82 fprintf( stderr
, "| " );
83 for (i
= 0; i
< chunk
; i
++)
84 fprintf( stderr
, "%c", data
[i
] < 127 && data
[i
] > 30 ? data
[i
] : '.' );
85 fprintf( stderr
, "\n" );
89 mpStream
->Seek( mnOffset
);
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */