summaryrefslogtreecommitdiff
path: root/src/lib/WinText602Parser.h
blob: 0d69a870ae686399ba0964c7ac1a7be310ebe598 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
 * This file is part of the libsw602 project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef INCLUDED_WINTEXT602PARSER_H
#define INCLUDED_WINTEXT602PARSER_H

#include "SW602Parser.h"
#include "WinText602Header.h"

namespace libsw602
{

enum WinText602Section
{
  WinText602_SECTION_0,
  WinText602_SECTION_1,
  WinText602_SECTION_2,
  WinText602_SECTION_3,
  WinText602_SECTION_4,
  WinText602_SECTION_5,
  WinText602_SECTION_6,
  WinText602_SECTION_7,
  WinText602_SECTION_8,
  WinText602_SECTION_9,
  WinText602_SECTION_USED_FONTS,
  WinText602_SECTION_11,
  WinText602_SECTION_12,
  WinText602_SECTION_13,
  WinText602_SECTION_14,
  WinText602_SECTION_15,
  WinText602_SECTION_16,
  WinText602_SECTION_17,
  WinText602_SECTION_STYLES,
  WinText602_SECTION_19,
  WinText602_SECTION_20,
  WinText602_SECTION_FIELDS,
  WinText602_SECTION_FORMATS,
  WinText602_SECTION_23,
  WinText602_SECTION_24,
  WinText602_SECTION_TEXT_INFO,
  WinText602_SECTION_26,
  WinText602_SECTION_TEXT,
  WinText602_SECTION_28,
  WinText602_SECTION_29,
  WinText602_SECTION_30,
  WinText602_SECTION_31,
  WinText602_SECTION_32,
  WinText602_SECTION_33,
  WinText602_SECTION_34,
  WinText602_SECTION_35,
  WinText602_SECTION_36
};

class WinText602SectionMap;

class WinText602Parser : public SW602TextParser
{
  // disable copying
  WinText602Parser(const WinText602Parser &other);
  WinText602Parser &operator=(const WinText602Parser &other);

public:
  explicit WinText602Parser(boost::shared_ptr<librevenge::RVNGInputStream> input);

  virtual void parse(librevenge::RVNGTextInterface *documentInterface);

private:
  void readText();

  boost::shared_ptr<librevenge::RVNGInputStream> getSection(WinText602Section section) const;

private:
  WinText602Header m_header;
  const boost::shared_ptr<librevenge::RVNGInputStream> m_input;
  librevenge::RVNGTextInterface *m_document;

  boost::shared_ptr<WinText602SectionMap> m_sectionMap;
};

} // namespace libsw602

#endif // INCLUDED_WINTEXT602PARSER_H
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */