Main Page
Namespaces
Classes
Files
File List
File Members
MSPUBParser2k.h
Go to the documentation of this file.
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
*
18
* All Rights Reserved.
19
*
20
* For minor contributions see the git repository.
21
*
22
* Alternatively, the contents of this file may be used under the terms of
23
* either the GNU General Public License Version 2 or later (the "GPLv2+"), or
24
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
25
* in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
26
* instead of those above.
27
*/
28
29
#ifndef __MSPUBPARSER2K_H__
30
#define __MSPUBPARSER2K_H__
31
32
#include <vector>
33
#include <map>
34
35
#include "
MSPUBParser.h
"
36
#include "
ShapeType.h
"
37
38
namespace
libmspub
39
{
40
41
class
MSPUBParser2k
:
public
MSPUBParser
42
{
43
static
ShapeType
getShapeType
(
unsigned
char
shapeSpecifier);
44
std::vector<unsigned>
m_imageDataChunkIndices
;
45
std::vector<unsigned>
m_quillColorEntries
;
46
std::map<unsigned, std::vector<unsigned> >
m_chunkChildIndicesById
;
47
48
protected
:
49
// helper functions
50
bool
parse2kShapeChunk
(
const
ContentChunkReference
&chunk, WPXInputStream *input,
51
boost::optional<unsigned> pageSeqNum = boost::optional<unsigned>(),
52
bool
topLevelCall =
true
);
53
void
parseShapeLine
(WPXInputStream *input,
bool
isRectangle,
unsigned
offset,
unsigned
seqNum);
54
void
parseShapeType
(WPXInputStream *input,
55
unsigned
seqNum,
unsigned
chunkOffset,
56
bool
&isGroup,
bool
&isLine,
bool
&isImage,
bool
&isRectangle,
57
unsigned
&flagsOffset);
58
void
parseShapeRotation
(WPXInputStream *input,
bool
isGroup,
bool
isLine,
unsigned
seqNum,
59
unsigned
chunkOffset);
60
void
parseShapeFlips
(WPXInputStream *input,
unsigned
flagsOffset,
unsigned
seqNum,
61
unsigned
chunkOffset);
62
void
parseShapeCoordinates
(WPXInputStream *input,
unsigned
seqNum,
unsigned
chunkOffset);
63
bool
parseGroup
(WPXInputStream *input,
unsigned
seqNum,
unsigned
page);
64
void
assignShapeImgIndex
(
unsigned
seqNum);
65
void
parseShapeFill
(WPXInputStream *input,
unsigned
seqNum,
unsigned
chunkOffset);
66
bool
parseContents
(WPXInputStream *input);
67
virtual
bool
parseDocument
(WPXInputStream *input);
68
virtual
unsigned
getColorIndexByQuillEntry
(
unsigned
entry);
69
virtual
int
translateCoordinateIfNecessary
(
int
coordinate)
const
;
70
virtual
unsigned
getFirstLineOffset
()
const
;
71
virtual
unsigned
getSecondLineOffset
()
const
;
72
virtual
unsigned
getShapeFillTypeOffset
()
const
;
73
virtual
unsigned
getShapeFillColorOffset
()
const
;
74
virtual
unsigned
short
getTextMarker
()
const
;
75
virtual
unsigned
getTextIdOffset
()
const
;
76
static
Color
getColorBy2kIndex
(
unsigned
char
index);
77
static
Color
getColorBy2kHex
(
unsigned
hex);
78
static
unsigned
translate2kColorReference
(
unsigned
ref2k);
79
static
PageType
getPageTypeBySeqNum
(
unsigned
seqNum);
80
virtual
void
parseContentsTextIfNecessary
(WPXInputStream *input);
81
public
:
82
explicit
MSPUBParser2k
(WPXInputStream *input,
MSPUBCollector
*collector);
83
virtual
bool
parse
();
84
virtual
~MSPUBParser2k
();
85
};
86
87
}
// namespace libmspub
88
89
#endif // __MSPUBPARSER2K_H__
90
91
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Generated for libmspub by
doxygen
1.8.3.1