| 1 |
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 |
/* |
| 3 |
* This file is part of the libqxp 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 |
|
| 10 |
#include "QXP33Header.h" |
| 11 |
|
| 12 |
#include "QXP33Parser.h" |
| 13 |
|
| 14 |
namespace libqxp |
| 15 |
{ |
| 16 |
|
| 17 |
QXP33Header::QXP33Header(const boost::optional<QXPDocument::Type> &fileType) |
| 18 |
: QXP3HeaderBase(fileType) |
| 19 |
, m_pagesCount(0) |
| 20 |
, m_masterPagesCount(0) |
| 21 |
, m_seed(0) |
| 22 |
, m_increment() |
| 23 |
, m_documentProperties() |
| 24 |
{ |
| 25 |
} |
| 26 |
|
| 27 |
bool QXP33Header::load(const std::shared_ptr<librevenge::RVNGInputStream> &input) |
| 28 |
{ |
| 29 |
QXP3HeaderBase::load(input); |
| 30 |
|
| 31 |
seek(input, 0x40); |
| 32 |
m_pagesCount = readU16(input, isBigEndian()); |
| 33 |
skip(input, 51); |
| 34 |
m_masterPagesCount = readU8(input); |
| 35 |
|
| 36 |
skip(input, 6); |
| 37 |
m_documentProperties.setAutoLeading(readFraction(input, isBigEndian())); |
| 38 |
|
| 39 |
skip(input, 84); |
| 40 |
m_documentProperties.superscriptOffset = readFraction(input, isBigEndian()); |
| 41 |
m_documentProperties.superscriptHScale = readFraction(input, isBigEndian()); |
| 42 |
m_documentProperties.superscriptVScale = readFraction(input, isBigEndian()); |
| 43 |
m_documentProperties.subscriptOffset = -readFraction(input, isBigEndian()); |
| 44 |
m_documentProperties.subscriptHScale = readFraction(input, isBigEndian()); |
| 45 |
m_documentProperties.subscriptVScale = readFraction(input, isBigEndian()); |
| 46 |
m_documentProperties.superiorHScale = readFraction(input, isBigEndian()); |
| 47 |
m_documentProperties.superiorVScale = readFraction(input, isBigEndian()); |
| 48 |
|
| 49 |
seekRelative(input, 28); |
| 50 |
m_seed = readU16(input, !isLittleEndian()); |
| 51 |
m_increment = readU16(input, !isLittleEndian()); |
| 52 |
|
| 53 |
seek(input, 512); |
| 54 |
|
| 55 |
return true; |
| 56 |
} |
| 57 |
|
| 58 |
QXPDocument::Type QXP33Header::getType() const |
| 59 |
{ |
| 60 |
return m_fileType ? get(m_fileType) : QXPDocument::TYPE_DOCUMENT; |
| 61 |
} |
| 62 |
|
| 63 |
std::unique_ptr<QXPParser> QXP33Header::createParser(const std::shared_ptr<librevenge::RVNGInputStream> &input, librevenge::RVNGDrawingInterface *painter) |
| 64 |
{ |
| 65 |
return std::unique_ptr<QXPParser>(new QXP33Parser(input, painter, shared_from_this())); |
| 66 |
} |
| 67 |
|
| 68 |
uint16_t QXP33Header::pagesCount() const |
| 69 |
{ |
| 70 |
return m_pagesCount; |
| 71 |
} |
| 72 |
|
| 73 |
uint16_t QXP33Header::masterPagesCount() const |
| 74 |
{ |
| 75 |
return m_masterPagesCount; |
| 76 |
} |
| 77 |
|
| 78 |
uint16_t QXP33Header::seed() const |
| 79 |
{ |
| 80 |
return m_seed; |
| 81 |
} |
| 82 |
|
| 83 |
uint16_t QXP33Header::increment() const |
| 84 |
{ |
| 85 |
return m_increment; |
| 86 |
} |
| 87 |
|
| 88 |
const QXPDocumentProperties &QXP33Header::documentProperties() const |
| 89 |
{ |
| 90 |
return m_documentProperties; |
| 91 |
} |
| 92 |
|
| 93 |
} |
| 94 |
|
| 95 |
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |