Main Page
Namespaces
Classes
Files
File List
File Members
FWParser.hxx
Go to the documentation of this file.
1
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3
/* libmwaw
4
* Version: MPL 2.0 / LGPLv2+
5
*
6
* The contents of this file are subject to the Mozilla Public License Version
7
* 2.0 (the "License"); you may not use this file except in compliance with
8
* the License or as specified alternatively below. You may obtain a copy of
9
* the License at http://www.mozilla.org/MPL/
10
*
11
* Software distributed under the License is distributed on an "AS IS" basis,
12
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
* for the specific language governing rights and limitations under the
14
* License.
15
*
16
* Major Contributor(s):
17
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20
* Copyright (C) 2006, 2007 Andrew Ziem
21
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22
*
23
*
24
* All Rights Reserved.
25
*
26
* For minor contributions see the git repository.
27
*
28
* Alternatively, the contents of this file may be used under the terms of
29
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30
* in which case the provisions of the LGPLv2+ are applicable
31
* instead of those above.
32
*/
33
34
/*
35
* Parser to convert FullWrite document
36
*
37
*/
38
#ifndef FP_MWAW_PARSER
39
# define FP_MWAW_PARSER
40
41
#include <list>
42
#include <string>
43
#include <vector>
44
45
#include <libwpd/libwpd.h>
46
47
#include "
MWAWDebug.hxx
"
48
#include "
MWAWEntry.hxx
"
49
#include "
MWAWInputStream.hxx
"
50
51
#include "
MWAWParser.hxx
"
52
54
struct
FWEntry
:
public
MWAWEntry
{
55
FWEntry
(
MWAWInputStreamPtr
input);
56
~FWEntry
();
57
59
friend
std::ostream &
operator<<
(std::ostream &o,
FWEntry
const
&entry);
60
62
void
update
();
64
void
closeDebugFile
();
65
67
libmwaw::DebugFile
&
getAsciiFile
();
69
bool
operator==
(
const
FWEntry
&a)
const
;
71
bool
operator!=
(
const
FWEntry
&a)
const
{
72
return
!
operator==
(a);
73
}
74
76
MWAWInputStreamPtr
m_input
;
78
int
m_nextId
;
80
int
m_type
;
82
int
m_typeId
;
84
int
m_values
[3];
86
WPXBinaryData
m_data
;
88
shared_ptr<libmwaw::DebugFile>
m_asciiFile
;
89
private
:
90
FWEntry
(
FWEntry
const
&);
91
FWEntry
&
operator=
(
FWEntry
const
&);
92
};
93
94
namespace
FWParserInternal
95
{
96
struct
DocZoneData;
97
struct
State;
98
class
SubDocument;
99
}
100
101
class
FWText
;
102
108
class
FWParser
:
public
MWAWParser
109
{
110
friend
class
FWText
;
111
friend
class
FWParserInternal::SubDocument
;
112
113
public
:
115
FWParser
(
MWAWInputStreamPtr
input,
MWAWRSRCParserPtr
rsrcParser,
MWAWHeader
*header);
117
virtual
~FWParser
();
118
120
bool
checkHeader
(
MWAWHeader
*header,
bool
strict=
false
);
121
122
// the main parse function
123
void
parse
(WPXDocumentInterface *documentInterface);
124
125
protected
:
127
void
init
();
128
130
void
createDocument
(WPXDocumentInterface *documentInterface);
131
133
bool
createZones
();
134
136
bool
createFileZones
();
137
139
void
flushExtra
();
140
142
void
newPage
(
int
number);
143
145
bool
readDocPosition
();
146
148
bool
readFileZoneFlags
(shared_ptr<FWEntry> zone);
149
151
bool
readFileZonePos
(shared_ptr<FWEntry> zone);
152
154
bool
readDocZoneData
(shared_ptr<FWEntry> zone);
155
157
bool
readDocZoneStruct
(shared_ptr<FWEntry> zone);
159
int
getNumDocZoneStruct
()
const
;
161
bool
readGraphic
(shared_ptr<FWEntry> zone);
162
164
bool
sendGraphic
(shared_ptr<FWEntry> zone);
165
167
bool
readDocInfo
(shared_ptr<FWEntry> zone);
168
170
bool
readEndDocInfo
(shared_ptr<FWEntry> zone);
171
173
bool
readCitationDocInfo
(shared_ptr<FWEntry> zone);
174
176
bool
readPrintInfo
(shared_ptr<FWEntry> zone);
177
178
//
179
// interface to the text parser
180
//
181
183
void
sendText
(
int
docId,
libmwaw::SubDocumentType
type,
MWAWNote::Type
which=
MWAWNote::FootNote
);
185
void
sendGraphic
(
int
docId);
187
void
sendVariable
(
int
docId);
189
void
sendReference
(
int
docId);
191
bool
send
(
int
fileId);
192
193
//
194
// low level
195
//
196
198
bool
readDoc1314Data
(shared_ptr<FWEntry> zone,
FWParserInternal::DocZoneData
&doc);
200
bool
readGraphicData
(shared_ptr<FWEntry> zone,
FWParserInternal::DocZoneData
&doc);
202
bool
readReferenceData
(shared_ptr<FWEntry> zone);
204
bool
readDocDataHeader
(shared_ptr<FWEntry> zone,
FWParserInternal::DocZoneData
&doc);
206
bool
readGenericDocData
(shared_ptr<FWEntry> zone,
FWParserInternal::DocZoneData
&doc);
207
208
protected
:
209
//
210
// data
211
//
213
shared_ptr<FWParserInternal::State>
m_state
;
214
216
shared_ptr<FWText>
m_textParser
;
217
};
218
#endif
219
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Generated on Wed Jul 10 2013 18:15:29 for libmwaw by
doxygen
1.8.4