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 "MWAWInputStream.hxx"
48 
49 #include "FWStruct.hxx"
50 #include "MWAWParser.hxx"
51 
52 namespace FWParserInternal
53 {
54 struct State;
55 class SubDocument;
56 }
57 
58 class FWGraph;
59 class FWText;
60 
66 class FWParser : public MWAWParser
67 {
68  friend class FWGraph;
69  friend class FWText;
71 
72 public:
74  FWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
76  virtual ~FWParser();
77 
79  bool checkHeader(MWAWHeader *header, bool strict=false);
80 
81  // the main parse function
82  void parse(WPXDocumentInterface *documentInterface);
83 
84 protected:
86  void init();
87 
89  void createDocument(WPXDocumentInterface *documentInterface);
90 
92  bool createZones();
93 
95  bool createFileZones();
96 
98  void newPage(int number);
99 
101  bool readDocPosition();
102 
105 
108 
111 
114 
116  bool readDocInfo(FWStruct::EntryPtr zone);
117 
120 
123 
126 
127  //
128  // interface to the graph parser
129  //
130 
132  Vec2f getPageLeftTop() const;
134  bool getBorder(int bId, FWStruct::Border &border) const;
135 
136  //
137  // interface to the text parser
138  //
139 
143  void sendGraphic(int docId);
145  void sendVariable(int docId);
147  void sendReference(int docId);
149  bool send(int fileId, MWAWColor fontColor=MWAWColor::black());
150 
151  //
152  // interface ( mainly debugging function)
153  //
154 
156  int getNumDocZoneStruct() const;
158  std::string getDocumentTypeName(int zId) const;
159 
160  //
161  // low level
162  //
163 
168 
169 protected:
170  //
171  // data
172  //
174  shared_ptr<FWParserInternal::State> m_state;
175 
177  shared_ptr<FWGraph> m_graphParser;
179  shared_ptr<FWText> m_textParser;
180 };
181 #endif
182 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Vec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: FWParser.cxx:313
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:47
shared_ptr< Entry > EntryPtr
Definition: FWStruct.hxx:144
the main class to read the graphic part of a FullWrite Text file
Definition: FWGraph.hxx:67
bool createFileZones()
create the file zone ( first step of create zones)
Definition: FWParser.cxx:504
int getNumDocZoneStruct() const
returns the number of zone struct
Definition: FWParser.cxx:324
the main class to read a FullWrite file
Definition: FWParser.hxx:66
bool readCitationDocInfo(FWStruct::EntryPtr zone)
try to read the list of citation (at the end of doc info)
Definition: FWParser.cxx:945
bool readDocZoneData(FWStruct::EntryPtr zone)
try to read the zone containing the data of each doc zone (ie. Zone0)
Definition: FWParser.cxx:1087
bool readDocInfo(FWStruct::EntryPtr zone)
try to read zone2, a zone which stores the document information zone, ...
Definition: FWParser.cxx:649
a structure used to store the data of a zone header in a FullWrite file
Definition: FWStruct.hxx:147
bool readEndDocInfo(FWStruct::EntryPtr zone)
try to read the end of zone2 (only v2) ?
Definition: FWParser.cxx:888
bool createZones()
finds the different objects zones
Definition: FWParser.cxx:537
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:180
SubDocumentType
Definition: libmwaw_internal.hxx:162
void sendGraphic(int docId)
try to send a graphic
Definition: FWParser.cxx:336
the class to store a color
Definition: libmwaw_internal.hxx:166
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: FWParser.cxx:623
Type
enum to define note type
Definition: libmwaw_internal.hxx:306
Internal: the subdocument of a MWParser.
Definition: FWParser.cxx:220
void sendVariable(int docId)
try to send a variable, in pratice do nothing
Definition: FWParser.cxx:1918
shared_ptr< FWText > m_textParser
the text parser
Definition: FWParser.hxx:179
bool readDocPosition()
find the last position of the document and read data
Definition: FWParser.cxx:1816
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:354
void init()
inits all internal variables
Definition: FWParser.cxx:283
void sendReference(int docId)
try to send a reference, in pratice do nothing
Definition: FWParser.cxx:1888
shared_ptr< FWParserInternal::State > m_state
the state
Definition: FWParser.hxx:174
bool readGenericDocData(FWStruct::EntryPtr zone, FWStruct::ZoneHeader &doc)
try to read the data of a zone which begins with a generic header
Definition: FWParser.cxx:1421
void sendText(int docId, libmwaw::SubDocumentType type, MWAWNote::Type which=MWAWNote::FootNote)
try to send a footnote/endnote entry
Definition: FWParser.cxx:1961
bool readPrintInfo(FWStruct::EntryPtr zone)
try read the print info zone
Definition: FWParser.cxx:1010
bool readFileZoneFlags(FWStruct::EntryPtr zone)
try to read the file zones main flags
Definition: FWParser.cxx:1584
bool readDocZoneStruct(FWStruct::EntryPtr zone)
try to read the zone which stores the structure of zone0, ... (ie. Zone1)
Definition: FWParser.cxx:1277
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:348
the main class to read the text part of writenow file
Definition: FWText.hxx:66
Definition: libmwaw_internal.hxx:306
virtual ~FWParser()
destructor
Definition: FWParser.cxx:274
Internal: class to store a border which appear in docInfo.
Definition: FWStruct.hxx:60
bool readFileZonePos(FWStruct::EntryPtr zone)
try to read the file zones position
Definition: FWParser.cxx:1680
shared_ptr< FWGraph > m_graphParser
the graph parser
Definition: FWParser.hxx:177
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:89
bool send(int fileId, MWAWColor fontColor=MWAWColor::black())
ask the text parser to send a zone
Definition: FWParser.cxx:350
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: FWParser.cxx:362
bool getBorder(int bId, FWStruct::Border &border) const
try to return a border corresponding to an id
Definition: FWParser.cxx:319
void newPage(int number)
adds a new page
Definition: FWParser.cxx:300
FWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: FWParser.cxx:268
std::string getDocumentTypeName(int zId) const
returns a the type of a document zone ( mainly used for debugging)
Definition: FWParser.cxx:329
bool readReferenceData(FWStruct::EntryPtr zone)
try to read the reference data
Definition: FWParser.cxx:1520
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: FWParser.cxx:434

Generated on Tue Mar 10 2015 17:32:08 for libmwaw by doxygen 1.8.5