Debian Codegraph @

src/lib/QXP1Header.cpp

raw
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 "QXP1Header.h"
11
12 #include "QXP1Parser.h"
13
14 namespace libqxp
15 {
16
17 QXP1Header::QXP1Header()
18 : m_pages(0)
19 , m_pageHeight(0.0)
20 , m_pageWidth(0.0)
21 {
22 }
23
24 bool QXP1Header::load(const std::shared_ptr<librevenge::RVNGInputStream> &input)
25 {
26 m_proc = 'M';
27 m_version = readU16(input, true);
28 skip(input, 152);
29 m_pages = readU16(input, true);
30
31 m_pageHeight = readU16(input, true);
32 int pageHeightAdj = readU16(input, true);
33 m_pageWidth = readU16(input, true);
34 int pageWidthAdj = readU16(input, true);
35 QXP1Parser::adjust(m_pageHeight, pageHeightAdj);
36 QXP1Parser::adjust(m_pageWidth, pageWidthAdj);
37
38 return true;
39 }
40
41 QXPDocument::Type QXP1Header::getType() const
42 {
43 return QXPDocument::TYPE_DOCUMENT;
44 }
45
46 std::unique_ptr<QXPParser> QXP1Header::createParser(const std::shared_ptr<librevenge::RVNGInputStream> &input, librevenge::RVNGDrawingInterface *painter)
47 {
48 return std::unique_ptr<QXPParser>(new QXP1Parser(input, painter, shared_from_this()));
49 }
50
51 }
52
53 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */