~ubuntu-branches/ubuntu/vivid/libmspub/vivid-proposed

« back to all changes in this revision

Viewing changes to src/lib/MSPUBParser.h

  • Committer: Package Import Robot
  • Author(s): Rene Engelhard
  • Date: 2014-07-01 19:27:01 UTC
  • mfrom: (3.2.2 experimental)
  • Revision ID: package-import@ubuntu.com-20140701192701-2gim3435sk0u7mld
Tags: 0.1.1-1
* New upstream release

* fix description (closes: #712168) 
* fix copyright after relicensing (closes: #750802)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
 
/* libmspub
3
 
 * Version: MPL 1.1 / GPLv2+ / LGPLv2+
4
 
 *
5
 
 * The contents of this file are subject to the Mozilla Public License Version
6
 
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 
 * the License or as specified alternatively below. You may obtain a copy of
8
 
 * the License at http://www.mozilla.org/MPL/
9
 
 *
10
 
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 
 * for the specific language governing rights and limitations under the
13
 
 * License.
14
 
 *
15
 
 * Major Contributor(s):
16
 
 * Copyright (C) 2012 Brennan Vincent <brennanv@email.arizona.edu>
17
 
 * Copyright (C) 2012 Fridrich Strba <fridrich.strba@bluewin.ch>
18
 
 *
19
 
 * All Rights Reserved.
20
 
 *
21
 
 * For minor contributions see the git repository.
22
 
 *
23
 
 * Alternatively, the contents of this file may be used under the terms of
24
 
 * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
25
 
 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
26
 
 * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
27
 
 * instead of those above.
 
2
/*
 
3
 * This file is part of the libmspub 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/.
28
8
 */
29
9
 
30
10
#ifndef __MSPUBPARSER_H__
38
18
#include <boost/shared_ptr.hpp>
39
19
#include <boost/optional.hpp>
40
20
 
41
 
#include <libwpd/libwpd.h>
42
 
#include <libwpg/libwpg.h>
 
21
#include <librevenge/librevenge.h>
 
22
#include <librevenge/librevenge.h>
43
23
 
44
24
#include "MSPUBTypes.h"
45
25
#include "Fill.h"
46
26
#include "Coordinate.h"
47
27
#include "PolygonUtils.h"
48
28
 
49
 
class WPXInputStream;
50
 
 
51
29
namespace libmspub
52
30
{
53
31
class MSPUBCollector;
85
63
class MSPUBParser
86
64
{
87
65
public:
88
 
  explicit MSPUBParser(WPXInputStream *input, MSPUBCollector *collector);
 
66
  explicit MSPUBParser(librevenge::RVNGInputStream *input, MSPUBCollector *collector);
89
67
  virtual ~MSPUBParser();
90
68
  virtual bool parse();
91
69
protected:
112
90
  MSPUBParser();
113
91
  MSPUBParser(const MSPUBParser &);
114
92
  MSPUBParser &operator=(const MSPUBParser &);
115
 
  virtual bool parseContents(WPXInputStream *input);
116
 
  bool parseQuill(WPXInputStream *input);
117
 
  bool parseEscher(WPXInputStream *input);
118
 
  bool parseEscherDelay(WPXInputStream *input);
119
 
 
120
 
  MSPUBBlockInfo parseBlock(WPXInputStream *input, bool skipHierarchicalData = false);
121
 
  EscherContainerInfo parseEscherContainer(WPXInputStream *input);
122
 
 
123
 
  bool parseContentChunkReference(WPXInputStream *input, MSPUBBlockInfo block);
124
 
  QuillChunkReference parseQuillChunkReference(WPXInputStream *input);
125
 
  bool parseDocumentChunk(WPXInputStream *input, const ContentChunkReference &chunk);
126
 
  bool parsePageChunk(WPXInputStream *input, const ContentChunkReference &chunk);
127
 
  bool parsePaletteChunk(WPXInputStream *input, const ContentChunkReference &chunk);
128
 
  bool parsePageShapeList(WPXInputStream *input, MSPUBBlockInfo block, unsigned pageSeqNum);
129
 
  bool parseShape(WPXInputStream *input, const ContentChunkReference &chunk);
130
 
  bool parseBorderArtChunk(WPXInputStream *input,
 
93
  virtual bool parseContents(librevenge::RVNGInputStream *input);
 
94
  bool parseQuill(librevenge::RVNGInputStream *input);
 
95
  bool parseEscher(librevenge::RVNGInputStream *input);
 
96
  bool parseEscherDelay(librevenge::RVNGInputStream *input);
 
97
 
 
98
  MSPUBBlockInfo parseBlock(librevenge::RVNGInputStream *input, bool skipHierarchicalData = false);
 
99
  EscherContainerInfo parseEscherContainer(librevenge::RVNGInputStream *input);
 
100
 
 
101
  bool parseContentChunkReference(librevenge::RVNGInputStream *input, MSPUBBlockInfo block);
 
102
  QuillChunkReference parseQuillChunkReference(librevenge::RVNGInputStream *input);
 
103
  bool parseDocumentChunk(librevenge::RVNGInputStream *input, const ContentChunkReference &chunk);
 
104
  bool parsePageChunk(librevenge::RVNGInputStream *input, const ContentChunkReference &chunk);
 
105
  bool parsePaletteChunk(librevenge::RVNGInputStream *input, const ContentChunkReference &chunk);
 
106
  bool parsePageShapeList(librevenge::RVNGInputStream *input, MSPUBBlockInfo block, unsigned pageSeqNum);
 
107
  bool parseShape(librevenge::RVNGInputStream *input, const ContentChunkReference &chunk);
 
108
  bool parseBorderArtChunk(librevenge::RVNGInputStream *input,
131
109
                           const ContentChunkReference &chunk);
132
 
  bool parseFontChunk(WPXInputStream *input,
 
110
  bool parseFontChunk(librevenge::RVNGInputStream *input,
133
111
                      const ContentChunkReference &chunk);
134
 
  void parsePaletteEntry(WPXInputStream *input, MSPUBBlockInfo block);
135
 
  void parseColors(WPXInputStream *input, const QuillChunkReference &chunk);
136
 
  void parseFonts(WPXInputStream *input, const QuillChunkReference &chunk);
137
 
  void parseDefaultStyle(WPXInputStream *input, const QuillChunkReference &chunk);
138
 
  void parseShapeGroup(WPXInputStream *input, const EscherContainerInfo &spgr, Coordinate parentCoordinateSystem, Coordinate parentGroupAbsoluteCoord);
139
 
  void skipBlock(WPXInputStream *input, MSPUBBlockInfo block);
140
 
  void parseEscherShape(WPXInputStream *input, const EscherContainerInfo &sp, Coordinate &parentCoordinateSystem, Coordinate &parentGroupAbsoluteCoord);
141
 
  bool findEscherContainer(WPXInputStream *input, const EscherContainerInfo &parent, EscherContainerInfo &out, unsigned short type);
142
 
  bool findEscherContainerWithTypeInSet(WPXInputStream *input, const EscherContainerInfo &parent, EscherContainerInfo &out, std::set<unsigned short> types);
143
 
  std::map<unsigned short, unsigned> extractEscherValues(WPXInputStream *input, const EscherContainerInfo &record);
144
 
  FOPTValues extractFOPTValues(WPXInputStream *input,
 
112
  void parsePaletteEntry(librevenge::RVNGInputStream *input, MSPUBBlockInfo block);
 
113
  void parseColors(librevenge::RVNGInputStream *input, const QuillChunkReference &chunk);
 
114
  void parseFonts(librevenge::RVNGInputStream *input, const QuillChunkReference &chunk);
 
115
  void parseDefaultStyle(librevenge::RVNGInputStream *input, const QuillChunkReference &chunk);
 
116
  void parseShapeGroup(librevenge::RVNGInputStream *input, const EscherContainerInfo &spgr, Coordinate parentCoordinateSystem, Coordinate parentGroupAbsoluteCoord);
 
117
  void skipBlock(librevenge::RVNGInputStream *input, MSPUBBlockInfo block);
 
118
  void parseEscherShape(librevenge::RVNGInputStream *input, const EscherContainerInfo &sp, Coordinate &parentCoordinateSystem, Coordinate &parentGroupAbsoluteCoord);
 
119
  bool findEscherContainer(librevenge::RVNGInputStream *input, const EscherContainerInfo &parent, EscherContainerInfo &out, unsigned short type);
 
120
  bool findEscherContainerWithTypeInSet(librevenge::RVNGInputStream *input, const EscherContainerInfo &parent, EscherContainerInfo &out, std::set<unsigned short> types);
 
121
  std::map<unsigned short, unsigned> extractEscherValues(librevenge::RVNGInputStream *input, const EscherContainerInfo &record);
 
122
  FOPTValues extractFOPTValues(librevenge::RVNGInputStream *input,
145
123
                               const libmspub::EscherContainerInfo &record);
146
 
  std::vector<TextSpanReference> parseCharacterStyles(WPXInputStream *input, const QuillChunkReference &chunk);
147
 
  std::vector<TextParagraphReference> parseParagraphStyles(WPXInputStream *input, const QuillChunkReference &chunk);
 
124
  std::vector<TextSpanReference> parseCharacterStyles(librevenge::RVNGInputStream *input, const QuillChunkReference &chunk);
 
125
  std::vector<TextParagraphReference> parseParagraphStyles(librevenge::RVNGInputStream *input, const QuillChunkReference &chunk);
148
126
  std::vector<Calculation> parseGuides(const std::vector<unsigned char>
149
127
                                       &guideData);
150
128
  std::vector<Vertex> parseVertices(const std::vector<unsigned char>
151
129
                                    &vertexData);
152
 
  std::vector<unsigned> parseTableCellDefinitions(WPXInputStream *input,
153
 
      const QuillChunkReference &chunk);
 
130
  std::vector<unsigned> parseTableCellDefinitions(librevenge::RVNGInputStream *input,
 
131
                                                  const QuillChunkReference &chunk);
154
132
  std::vector<unsigned short> parseSegments(
155
133
    const std::vector<unsigned char> &segmentData);
156
134
  DynamicCustomShape getDynamicCustomShape(
158
136
    const std::vector<unsigned char> &segmentData,
159
137
    const std::vector<unsigned char> &guideData,
160
138
    unsigned geoWidth, unsigned geoHeight);
161
 
  int getColorIndex(WPXInputStream *input, const MSPUBBlockInfo &info);
162
 
  unsigned getFontIndex(WPXInputStream *input, const MSPUBBlockInfo &info);
163
 
  CharacterStyle getCharacterStyle(WPXInputStream *input);
164
 
  ParagraphStyle getParagraphStyle(WPXInputStream *input);
 
139
  int getColorIndex(librevenge::RVNGInputStream *input, const MSPUBBlockInfo &info);
 
140
  unsigned getFontIndex(librevenge::RVNGInputStream *input, const MSPUBBlockInfo &info);
 
141
  CharacterStyle getCharacterStyle(librevenge::RVNGInputStream *input);
 
142
  ParagraphStyle getParagraphStyle(librevenge::RVNGInputStream *input);
165
143
  boost::shared_ptr<Fill> getNewFill(const std::map<unsigned short, unsigned> &foptValues, bool &skipIfNotBg, std::map<unsigned short, std::vector<unsigned char> > &foptVal);
166
144
 
167
 
  WPXInputStream *m_input;
 
145
  librevenge::RVNGInputStream *m_input;
168
146
  MSPUBCollector *m_collector;
169
147
  std::vector<MSPUBBlockInfo> m_blockInfo;
170
148
  std::vector<ContentChunkReference> m_contentChunks;