Main Page
Namespaces
Classes
Files
File List
File Members
WPParser.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 some WriterPlus text document ( a french text editor )
36
*
37
*/
38
#ifndef WP_PARSER
39
# define WP_PARSER
40
41
#include <list>
42
#include <string>
43
#include <vector>
44
45
#include "
MWAWPageSpan.hxx
"
46
47
#include "
MWAWEntry.hxx
"
48
49
#include "
MWAWDebug.hxx
"
50
#include "
MWAWInputStream.hxx
"
51
52
#include "
MWAWParser.hxx
"
53
54
class
MWAWParagraph
;
55
56
namespace
WPParserInternal
57
{
58
struct
State;
59
struct
Font;
60
struct
Line;
61
struct
ParagraphData;
62
struct
ParagraphInfo;
63
class
SubDocument;
64
}
65
71
class
WPParser
:
public
MWAWParser
72
{
73
friend
class
WPParserInternal::SubDocument
;
74
75
public
:
77
WPParser
(
MWAWInputStreamPtr
input,
MWAWRSRCParserPtr
rsrcParser,
MWAWHeader
*header);
79
virtual
~WPParser
();
80
82
bool
checkHeader
(
MWAWHeader
*header,
bool
strict=
false
);
83
84
// the main parse function
85
void
parse
(WPXDocumentInterface *documentInterface);
86
87
protected
:
89
void
init
();
90
92
void
setListener
(
MWAWContentListenerPtr
listen);
93
95
void
createDocument
(WPXDocumentInterface *documentInterface);
96
98
bool
createZones
();
99
101
bool
readPrintInfo
();
102
104
bool
readWindowsInfo
(
int
zone);
105
107
bool
sendWindow
(
int
zone,
Vec2i
limits =
Vec2i
(-1,-1));
108
110
bool
readWindowsZone
(
int
zone);
111
113
bool
readPageInfo
(
int
zone);
114
116
bool
readColInfo
(
int
zone);
117
119
bool
readParagraphInfo
(
int
zone);
120
122
bool
findSectionColumns
(
int
zone,
Vec2i
limits, std::vector<int> &colSize);
123
125
bool
readSection
(
WPParserInternal::ParagraphInfo
const
&info,
bool
mainBlock);
126
128
bool
readText
(
WPParserInternal::ParagraphInfo
const
&info);
129
131
bool
readTable
(
WPParserInternal::ParagraphInfo
const
&info);
132
134
bool
readGraphic
(
WPParserInternal::ParagraphInfo
const
&info);
135
137
bool
readUnknown
(
WPParserInternal::ParagraphInfo
const
&info);
138
140
float
pageHeight
()
const
;
142
float
pageWidth
()
const
;
143
145
void
newPage
(
int
number);
146
147
//
148
// low level
149
//
150
152
bool
readParagraphData
(
WPParserInternal::ParagraphInfo
const
&info,
bool
hasFonts,
153
WPParserInternal::ParagraphData
&data);
155
MWAWParagraph
getParagraph
(
WPParserInternal::ParagraphData
const
&data);
157
bool
readFonts
(
int
nFonts,
int
type,
158
std::vector<WPParserInternal::Font> &fonts);
159
161
bool
readLines
(
WPParserInternal::ParagraphInfo
const
&info,
162
int
nLines, std::vector<WPParserInternal::Line> &lines);
163
164
protected
:
165
//
166
// data
167
//
168
170
shared_ptr<WPParserInternal::State>
m_state
;
171
173
MWAWPageSpan
m_pageSpan
;
174
};
175
#endif
176
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Generated on Sat May 4 2013 11:47:12 for libmwaw by
doxygen
1.8.3.1