Main Page
Namespaces
Classes
Files
File List
File Members
WPS8.h
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2
/* libwpd
3
* Copyright (C) 2006, 2007 Andrew Ziem
4
* Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
5
* Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
6
*
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Library General Public
9
* License as published by the Free Software Foundation; either
10
* version 2 of the License, or (at your option) any later version.
11
*
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Library General Public License for more details.
16
*
17
* You should have received a copy of the GNU Library General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20
*
21
*/
22
23
#ifndef WPS8_H
24
#define WPS8_H
25
26
#include <vector>
27
#include <map>
28
29
#include <libwpd/WPXString.h>
30
#include <libwpd-stream/WPXStream.h>
31
32
#include "
libwps_internal.h
"
33
#include "
WPS.h
"
34
#include "
WPSContentListener.h
"
35
#include "
WPSParser.h
"
36
37
typedef
WPSContentListener
WPS8ContentListener
;
38
typedef
shared_ptr<WPS8ContentListener>
WPS8ContentListenerPtr
;
39
40
namespace
WPS8ParserInternal
41
{
42
class
SubDocument;
43
}
44
45
class
WPS8Parser
:
public
WPSParser
46
{
47
friend
class
WPS8ParserInternal::SubDocument
;
48
public
:
49
WPS8Parser
(
WPXInputStreamPtr
&input,
WPSHeaderPtr
&header);
50
~WPS8Parser
();
51
52
void
parse
(WPXDocumentInterface *documentInterface);
53
protected
:
54
struct
Zone
;
55
typedef
std::multimap<std::string, Zone>
IndexMultiMap
;
/* string is name */
56
struct
Note
;
57
struct
Stream
;
58
private
:
59
void
readFontsTable
(
WPXInputStreamPtr
&input);
60
void
readStreams
(
WPXInputStreamPtr
&input);
61
void
readNotes
(std::vector<Note> &dest,
WPXInputStreamPtr
&input,
const
char
*key);
62
void
appendUTF16LE
(
WPXInputStreamPtr
&input);
63
void
readTextRange
(
WPXInputStreamPtr
&input, uint32_t startpos, uint32_t endpos, uint16_t stream);
64
bool
readFODPage
(
WPXInputStreamPtr
&input, std::vector<WPSFOD> &FODs, uint16_t page_size);
65
void
parseHeaderIndexEntry
(
WPXInputStreamPtr
&input);
66
void
parseHeaderIndex
(
WPXInputStreamPtr
&input);
67
void
parsePages
(std::vector<WPSPageSpan> &pageList,
WPXInputStreamPtr
&input);
68
void
parse
(
WPXInputStreamPtr
&stream);
69
void
propertyChangeDelta
(uint32_t newTextAttributeBits);
70
void
propertyChange
(std::string rgchProp, uint16_t &specialCode,
int
&fieldType);
71
void
propertyChangePara
(std::string rgchProp);
72
// interface with subdocument
73
void
sendNote
(
WPXInputStreamPtr
&input,
int
noteId,
bool
is_endnote);
74
76
shared_ptr<WPS8ContentListener>
m_listener
;
77
uint32_t
m_offset_eot
;
/* stream offset to end of text */
78
uint32_t
m_oldTextAttributeBits
;
79
IndexMultiMap
m_headerIndexTable
;
80
std::vector<WPSFOD>
m_CHFODs
;
/* CHaracter FOrmatting Descriptors */
81
std::vector<WPSFOD>
m_PAFODs
;
/* PAragraph FOrmatting Descriptors */
82
std::vector<std::string>
m_fontNames
;
83
std::vector<Stream>
m_streams
;
84
std::vector<Note>
m_footnotes
;
85
int
m_actualFootnote
;
86
std::vector<Note>
m_endnotes
;
87
int
m_actualEndnote
;
88
89
protected
:
92
struct
Zone
93
{
94
Zone
() :
m_offset
(0),
m_length
(0) {}
95
virtual
~Zone
() {}
96
uint32_t
const
&
begin
()
const
97
{
98
return
m_offset
;
99
}
100
uint32_t
end
()
const
101
{
102
return
m_offset
+
m_length
;
103
}
104
uint32_t
const
&
length
()
const
105
{
106
return
m_length
;
107
}
108
void
setBegin
(uint32_t pos)
109
{
110
m_offset
= pos;
111
}
112
void
setLength
(uint32_t _length)
113
{
114
m_length
= _length;
115
}
116
void
setEnd
(uint32_t _end)
117
{
118
m_length
= _end-
m_offset
;
119
}
120
121
bool
valid
()
const
122
{
123
return
m_offset
&&
m_length
;
124
}
125
protected
:
126
uint32_t
m_offset
;
127
uint32_t
m_length
;
128
};
129
130
struct
Note
:
public
Zone
131
{
132
Note
() :
Zone
(),
m_textOffset
(0) {}
133
uint32_t
m_textOffset
;
134
};
135
136
struct
Stream
:
public
Zone
137
{
138
Stream
() :
Zone
(),
m_type
(
Z_Dummy
) {}
139
140
enum
Type
{
Z_Dummy
=0,
Z_Body
=1,
Z_Footnotes
=2,
Z_Endnotes
= 3}
m_type
;
141
};
142
};
143
144
145
#endif
/* WPS8_H */
146
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
Generated on Wed Aug 8 2012 16:07:56 for libwps by
doxygen
1.8.1.2