Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _DFFRECORDHEADER_HXX
21 : #define _DFFRECORDHEADER_HXX
22 :
23 : #include <tools/solar.h>
24 : #include <tools/stream.hxx>
25 : #include <filter/msfilter/msfilterdllapi.h>
26 : #include <svx/msdffdef.hxx>
27 :
28 : class MSFILTER_DLLPUBLIC DffRecordHeader
29 : {
30 : public:
31 : sal_uInt8 nRecVer; // may be DFF_PSFLAG_CONTAINER
32 : sal_uInt16 nRecInstance;
33 : sal_uInt16 nImpVerInst;
34 : sal_uInt16 nRecType;
35 : sal_uInt32 nRecLen;
36 : sal_uLong nFilePos;
37 :
38 37284 : DffRecordHeader() : nRecVer(0), nRecInstance(0), nImpVerInst(0),
39 37284 : nRecType(0), nRecLen(0), nFilePos(0) {}
40 0 : bool IsContainer() const { return nRecVer == DFF_PSFLAG_CONTAINER; }
41 396 : sal_uLong GetRecBegFilePos() const { return nFilePos; }
42 21536 : sal_uLong GetRecEndFilePos() const
43 21536 : { return nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; }
44 29590 : bool SeekToEndOfRecord(SvStream& rIn) const
45 : {
46 29590 : sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen;
47 29590 : return nPos == rIn.Seek(nPos);
48 : }
49 8976 : bool SeekToContent(SvStream& rIn) const
50 : {
51 8976 : sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE;
52 8976 : return nPos == rIn.Seek(nPos);
53 : }
54 7025 : bool SeekToBegOfRecord(SvStream& rIn) const
55 : {
56 7025 : return nFilePos == rIn.Seek(nFilePos);
57 : }
58 :
59 : MSFILTER_DLLPUBLIC friend SvStream& operator>>(SvStream& rIn, DffRecordHeader& rRec);
60 : };
61 :
62 : #endif
63 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|