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 "
MWAWDebug.hxx
"
46
#include "
MWAWEntry.hxx
"
47
#include "
MWAWInputStream.hxx
"
48
#include "
MWAWPosition.hxx
"
49
50
#include "
MWAWParser.hxx
"
51
52
namespace
MSWParserInternal
53
{
54
struct
Object;
55
struct
State;
56
class
SubDocument;
57
}
58
59
class
MSWText
;
60
class
MSWTextStyles
;
61
63
struct
MSWEntry
:
public
MWAWEntry
{
64
MSWEntry
() :
MWAWEntry
(),
m_pictType
(-1) {
65
}
70
int
pictType
()
const
{
71
return
m_pictType
;
72
}
74
void
setPictType
(
int
newId) {
75
m_pictType
= newId;
76
}
78
friend
std::ostream &
operator<<
(std::ostream &o,
MSWEntry
const
&entry);
80
int
m_pictType
;
81
};
82
88
class
MSWParser
:
public
MWAWParser
89
{
90
friend
class
MSWText
;
91
friend
class
MSWTextStyles
;
92
friend
class
MSWParserInternal::SubDocument
;
93
94
public
:
96
MSWParser
(
MWAWInputStreamPtr
input,
MWAWRSRCParserPtr
rsrcParser,
MWAWHeader
*header);
98
virtual
~MSWParser
();
99
101
bool
checkHeader
(
MWAWHeader
*header,
bool
strict=
false
);
102
104
void
parse
(WPXDocumentInterface *documentInterface);
105
106
protected
:
108
void
init
();
109
111
void
createDocument
(WPXDocumentInterface *documentInterface);
112
114
bool
createZones
();
115
117
bool
readHeaderEndV3
();
118
120
bool
readZoneList
();
121
123
bool
readPrintInfo
(
MSWEntry
&entry);
124
126
bool
readPrinter
(
MSWEntry
&entry);
127
129
bool
readDocSum
(
MSWEntry
&entry);
130
132
bool
readStringsZone
(
MSWEntry
&entry, std::vector<std::string> &list);
133
135
bool
readObjects
();
136
138
bool
readObjectList
(
MSWEntry
&entry);
139
141
bool
readObjectFlags
(
MSWEntry
&entry);
142
144
bool
readObject
(
MSWParserInternal::Object
&obj);
145
147
bool
readDocumentInfo
(
MSWEntry
&entry);
148
150
bool
readZone17
(
MSWEntry
&entry);
151
153
bool
checkPicturePos
(
long
pos,
int
type);
154
156
bool
readPicture
(
MSWEntry
&entry);
158
void
sendPicture
(
long
fPos,
int
cPos,
MWAWPosition::AnchorTo
anchor=
MWAWPosition::Char
);
159
161
bool
getColor
(
int
id
,
MWAWColor
&col)
const
;
162
164
void
newPage
(
int
number);
165
166
/*
167
* interface with subdocument
168
*/
170
void
sendFootnote
(
int
id
);
171
173
void
sendFieldComment
(
int
id
);
174
176
void
send
(
int
id
,
libmwaw::SubDocumentType
type);
178
void
send
(
MWAWEntry
const
&entry);
179
180
//
181
// low level
182
//
183
185
MSWEntry
readEntry
(std::string type,
int
id
=-1);
186
187
protected
:
188
//
189
// data
190
//
192
shared_ptr<MSWParserInternal::State>
m_state
;
193
195
std::multimap<std::string, MSWEntry>
m_entryMap
;
196
198
shared_ptr<MSWText>
m_textParser
;
199
};
200
#endif
201
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Generated on Wed Jul 10 2013 18:02:03 for libmwaw by
doxygen
1.8.4