1
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3
* Version: MPL 1.1 / GPLv2+ / LGPLv2+
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/
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
15
* Major Contributor(s):
16
* Copyright (C) 2012 Brennan Vincent <brennanv@email.arizona.edu>
17
* Copyright (C) 2012 Fridrich Strba <fridrich.strba@bluewin.ch>
19
* All Rights Reserved.
21
* For minor contributions see the git repository.
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.
3
* This file is part of the libmspub project.
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/.
30
10
#ifndef __MSPUBPARSER_H__
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);
120
MSPUBBlockInfo parseBlock(WPXInputStream *input, bool skipHierarchicalData = false);
121
EscherContainerInfo parseEscherContainer(WPXInputStream *input);
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);
98
MSPUBBlockInfo parseBlock(librevenge::RVNGInputStream *input, bool skipHierarchicalData = false);
99
EscherContainerInfo parseEscherContainer(librevenge::RVNGInputStream *input);
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>
150
128
std::vector<Vertex> parseVertices(const std::vector<unsigned char>
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);
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;