Main Page
Namespaces
Classes
Files
File List
File Members
MSWParser.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 for Microsoft Word ( version 3.0-5.1 )
36
*/
37
#ifndef MSW_MWAW_PARSER
38
# define MSW_MWAW_PARSER
39
40
#include <list>
41
#include <map>
42
#include <string>
43
#include <vector>
44
45
#include "
MWAWPageSpan.hxx
"
46
47
#include "
MWAWPosition.hxx
"
48
49
#include "
MWAWEntry.hxx
"
50
#include "
MWAWSubDocument.hxx
"
51
52
#include "
MWAWDebug.hxx
"
53
#include "
MWAWInputStream.hxx
"
54
55
#include "
MWAWParser.hxx
"
56
57
namespace
MSWParserInternal
58
{
59
struct
Object;
60
struct
State;
61
class
SubDocument;
62
}
63
64
class
MSWText
;
65
class
MSWTextStyles
;
66
68
struct
MSWEntry
:
public
MWAWEntry
{
69
MSWEntry
() :
MWAWEntry
(),
m_pictType
(-1) {
70
}
75
int
pictType
()
const
{
76
return
m_pictType
;
77
}
79
void
setPictType
(
int
newId) {
80
m_pictType
= newId;
81
}
83
friend
std::ostream &
operator<<
(std::ostream &o,
MSWEntry
const
&entry);
85
int
m_pictType
;
86
};
87
93
class
MSWParser
:
public
MWAWParser
94
{
95
friend
class
MSWText
;
96
friend
class
MSWTextStyles
;
97
friend
class
MSWParserInternal::SubDocument
;
98
99
public
:
101
MSWParser
(
MWAWInputStreamPtr
input,
MWAWRSRCParserPtr
rsrcParser,
MWAWHeader
*header);
103
virtual
~MSWParser
();
104
106
bool
checkHeader
(
MWAWHeader
*header,
bool
strict=
false
);
107
109
void
parse
(WPXDocumentInterface *documentInterface);
110
111
protected
:
113
void
init
();
114
116
void
createDocument
(WPXDocumentInterface *documentInterface);
117
119
bool
createZones
();
120
122
bool
readHeaderEndV3
();
123
125
bool
readZoneList
();
126
128
bool
readPrintInfo
(
MSWEntry
&entry);
129
131
bool
readPrinter
(
MSWEntry
&entry);
132
134
bool
readDocSum
(
MSWEntry
&entry);
135
137
bool
readStringsZone
(
MSWEntry
&entry, std::vector<std::string> &list);
138
140
bool
readObjects
();
141
143
bool
readObjectList
(
MSWEntry
&entry);
144
146
bool
readObjectFlags
(
MSWEntry
&entry);
147
149
bool
readObject
(
MSWParserInternal::Object
&obj);
150
152
bool
readDocumentInfo
(
MSWEntry
&entry);
153
155
bool
readZone17
(
MSWEntry
&entry);
156
158
bool
checkPicturePos
(
long
pos,
int
type);
159
161
bool
readPicture
(
MSWEntry
&entry);
163
void
sendPicture
(
long
fPos,
int
cPos,
MWAWPosition::AnchorTo
anchor=
MWAWPosition::Char
);
164
166
float
pageHeight
()
const
;
168
float
pageWidth
()
const
;
170
bool
getColor
(
int
id
,
MWAWColor
&col)
const
;
171
173
void
newPage
(
int
number);
174
175
/*
176
* interface with subdocument
177
*/
179
void
sendFootnote
(
int
id
);
180
182
void
sendFieldComment
(
int
id
);
183
185
void
send
(
int
id
,
libmwaw::SubDocumentType
type);
187
void
send
(
MWAWEntry
const
&entry);
188
189
//
190
// low level
191
//
192
194
bool
isFilePos
(
long
pos);
195
197
MSWEntry
readEntry
(std::string type,
int
id
=-1);
198
199
protected
:
200
//
201
// data
202
//
204
shared_ptr<MSWParserInternal::State>
m_state
;
205
207
std::multimap<std::string, MSWEntry>
m_entryMap
;
208
210
MWAWPageSpan
m_pageSpan
;
211
213
shared_ptr<MSWText>
m_textParser
;
214
};
215
#endif
216
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Generated on Sat May 4 2013 11:47:11 for libmwaw by
doxygen
1.8.3.1