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
#include "
MWAWPageSpan.hxx
"
51
#include "
MWAWSubDocument.hxx
"
52
53
#include "
MWAWParser.hxx
"
54
56
struct
FWEntry
:
public
MWAWEntry
{
57
FWEntry
(
MWAWInputStreamPtr
input);
58
~FWEntry
();
59
61
friend
std::ostream &
operator<<
(std::ostream &o,
FWEntry
const
&entry);
62
64
void
update
();
66
void
closeDebugFile
();
67
69
libmwaw::DebugFile
&
getAsciiFile
();
71
bool
operator==
(
const
FWEntry
&a)
const
;
73
bool
operator!=
(
const
FWEntry
&a)
const
{
74
return
!
operator==
(a);
75
}
76
78
MWAWInputStreamPtr
m_input
;
80
int
m_nextId
;
82
int
m_type
;
84
int
m_typeId
;
86
int
m_values
[3];
88
WPXBinaryData
m_data
;
90
shared_ptr<libmwaw::DebugFile>
m_asciiFile
;
91
private
:
92
FWEntry
(
FWEntry
const
&);
93
FWEntry
&
operator=
(
FWEntry
const
&);
94
};
95
96
namespace
FWParserInternal
97
{
98
struct
DocZoneData;
99
struct
State;
100
class
SubDocument;
101
}
102
103
class
FWText
;
104
110
class
FWParser
:
public
MWAWParser
111
{
112
friend
class
FWText
;
113
friend
class
FWParserInternal::SubDocument
;
114
115
public
:
117
FWParser
(
MWAWInputStreamPtr
input,
MWAWRSRCParserPtr
rsrcParser,
MWAWHeader
*header);
119
virtual
~FWParser
();
120
122
bool
checkHeader
(
MWAWHeader
*header,
bool
strict=
false
);
123
124
// the main parse function
125
void
parse
(WPXDocumentInterface *documentInterface);
126
127
protected
:
129
void
init
();
130
132
void
createDocument
(WPXDocumentInterface *documentInterface);
133
135
bool
createZones
();
136
138
bool
createFileZones
();
139
141
void
flushExtra
();
142
144
float
pageHeight
()
const
;
146
float
pageWidth
()
const
;
147
149
void
newPage
(
int
number);
150
152
bool
readDocPosition
();
153
155
bool
readFileZoneFlags
(shared_ptr<FWEntry> zone);
156
158
bool
readFileZonePos
(shared_ptr<FWEntry> zone);
159
161
bool
readDocZoneData
(shared_ptr<FWEntry> zone);
162
164
bool
readDocZoneStruct
(shared_ptr<FWEntry> zone);
166
int
getNumDocZoneStruct
()
const
;
168
bool
readGraphic
(shared_ptr<FWEntry> zone);
169
171
bool
sendGraphic
(shared_ptr<FWEntry> zone);
172
174
bool
readDocInfo
(shared_ptr<FWEntry> zone);
175
177
bool
readEndDocInfo
(shared_ptr<FWEntry> zone);
178
180
bool
readCitationDocInfo
(shared_ptr<FWEntry> zone);
181
183
bool
readPrintInfo
(shared_ptr<FWEntry> zone);
184
185
//
186
// interface to the text parser
187
//
188
190
void
sendText
(
int
docId,
libmwaw::SubDocumentType
type,
int
which=0);
192
void
sendGraphic
(
int
docId);
194
void
sendVariable
(
int
docId);
196
void
sendReference
(
int
docId);
198
bool
send
(
int
fileId);
199
200
//
201
// low level
202
//
203
205
bool
readDoc1314Data
(shared_ptr<FWEntry> zone,
FWParserInternal::DocZoneData
&doc);
207
bool
readGraphicData
(shared_ptr<FWEntry> zone,
FWParserInternal::DocZoneData
&doc);
209
bool
readReferenceData
(shared_ptr<FWEntry> zone);
211
bool
readDocDataHeader
(shared_ptr<FWEntry> zone,
FWParserInternal::DocZoneData
&doc);
213
bool
readGenericDocData
(shared_ptr<FWEntry> zone,
FWParserInternal::DocZoneData
&doc);
214
215
protected
:
216
//
217
// data
218
//
220
shared_ptr<FWParserInternal::State>
m_state
;
221
223
MWAWPageSpan
m_pageSpan
;
224
226
shared_ptr<FWText>
m_textParser
;
227
};
228
#endif
229
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Generated on Sat May 4 2013 11:47:10 for libmwaw by
doxygen
1.8.3.1