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 "
MWAWDebug.hxx
"
46
#include "
MWAWEntry.hxx
"
47
#include "
MWAWInputStream.hxx
"
48
49
#include "
MWAWParser.hxx
"
50
51
class
MWAWParagraph
;
52
class
MWAWSection
;
53
54
namespace
WPParserInternal
55
{
56
struct
State;
57
struct
Font;
58
struct
Line;
59
struct
ParagraphData;
60
struct
ParagraphInfo;
61
class
SubDocument;
62
}
63
69
class
WPParser
:
public
MWAWParser
70
{
71
friend
class
WPParserInternal::SubDocument
;
72
73
public
:
75
WPParser
(
MWAWInputStreamPtr
input,
MWAWRSRCParserPtr
rsrcParser,
MWAWHeader
*header);
77
virtual
~WPParser
();
78
80
bool
checkHeader
(
MWAWHeader
*header,
bool
strict=
false
);
81
82
// the main parse function
83
void
parse
(WPXDocumentInterface *documentInterface);
84
85
protected
:
87
void
init
();
88
90
void
setListener
(
MWAWContentListenerPtr
listen);
91
93
void
createDocument
(WPXDocumentInterface *documentInterface);
94
96
bool
createZones
();
97
99
bool
readPrintInfo
();
100
102
bool
readWindowsInfo
(
int
zone);
103
105
bool
sendWindow
(
int
zone,
Vec2i
limits =
Vec2i
(-1,-1));
106
108
bool
readWindowsZone
(
int
zone);
109
111
bool
readPageInfo
(
int
zone);
112
114
bool
readColInfo
(
int
zone);
115
117
bool
readParagraphInfo
(
int
zone);
118
120
bool
findSection
(
int
zone,
Vec2i
limits,
MWAWSection
&sec);
121
123
bool
readSection
(
WPParserInternal::ParagraphInfo
const
&info,
bool
mainBlock);
124
126
bool
readText
(
WPParserInternal::ParagraphInfo
const
&info);
127
129
bool
readTable
(
WPParserInternal::ParagraphInfo
const
&info);
130
132
bool
readGraphic
(
WPParserInternal::ParagraphInfo
const
&info);
133
135
bool
readUnknown
(
WPParserInternal::ParagraphInfo
const
&info);
136
138
double
getTextHeight
()
const
;
139
141
void
newPage
(
int
number);
142
143
//
144
// low level
145
//
146
148
bool
readParagraphData
(
WPParserInternal::ParagraphInfo
const
&info,
bool
hasFonts,
149
WPParserInternal::ParagraphData
&data);
151
MWAWParagraph
getParagraph
(
WPParserInternal::ParagraphData
const
&data);
153
bool
readFonts
(
int
nFonts,
int
type,
154
std::vector<WPParserInternal::Font> &fonts);
155
157
bool
readLines
(
WPParserInternal::ParagraphInfo
const
&info,
158
int
nLines, std::vector<WPParserInternal::Line> &lines);
159
160
protected
:
161
//
162
// data
163
//
164
166
shared_ptr<WPParserInternal::State>
m_state
;
167
};
168
#endif
169
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Generated on Wed May 22 2013 18:12:38 for libmwaw by
doxygen
1.8.1.2