fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / qpro / biff.cxx
bloba23f578f4c9bdb61e1fdceb4d3e959825f122196
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
21 #include <stdio.h>
22 #include <sfx2/docfile.hxx>
24 #include "global.hxx"
25 #include "scerrors.hxx"
26 #include "docpool.hxx"
27 #include "patattr.hxx"
28 #include "filter.hxx"
29 #include "document.hxx"
30 #include "formulacell.hxx"
31 #include "biff.hxx"
33 ScBiffReader::ScBiffReader(SfxMedium& rMedium)
34 : mnId(0)
35 , mnLength(0)
36 , mnOffset(0)
37 , mbEndOfFile(false)
39 mpStream = rMedium.GetInStream();
40 if( mpStream )
42 mpStream->SetBufferSize( 65535 );
43 mpStream->SetStreamCharSet( RTL_TEXTENCODING_MS_1252 );
47 ScBiffReader::~ScBiffReader()
49 if( mpStream )
50 mpStream->SetBufferSize( 0 );
53 bool ScBiffReader::nextRecord()
55 if( !recordsLeft() )
56 return false;
58 if( IsEndOfFile() )
59 return false;
61 sal_uInt32 nPos = mpStream->Tell();
62 if( nPos != mnOffset + mnLength )
63 mpStream->Seek( mnOffset + mnLength );
65 mnLength = mnId = 0;
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
74 int len = mnLength;
75 while (len > 0) {
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" );
87 len -= chunk;
89 mpStream->Seek( mnOffset );
90 #endif
91 #endif
92 return true;
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */