MWParser.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 #ifndef MW_PARSER
35 # define MW_PARSER
36 
37 #include <vector>
38 
39 #include "MWAWDebug.hxx"
40 #include "MWAWInputStream.hxx"
41 
42 #include "MWAWParser.hxx"
43 
44 class WPXBinaryData;
45 
46 namespace MWParserInternal
47 {
48 struct State;
49 struct Information;
50 class SubDocument;
51 }
52 
58 class MWParser : public MWAWParser
59 {
61 
62 public:
64  MWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
66  virtual ~MWParser();
67 
69  bool checkHeader(MWAWHeader *header, bool strict=false);
70 
71  // the main parse function
72  void parse(WPXDocumentInterface *documentInterface);
73 
74 protected:
76  void init();
77 
80 
82  void createDocument(WPXDocumentInterface *documentInterface);
83 
85  bool sendWindow(int zone);
86 
88  bool createZones();
89 
91  bool createZonesV3();
92 
94  bool readPrintInfo();
95 
97  bool readWindowsInfo(int wh);
98 
100  bool readLinesHeight(MWAWEntry const &entry, std::vector<int> &firstParagLine,
101  std::vector<int> &linesHeight);
102 
104  bool readInformationsV3(int numInfo,
105  std::vector<MWParserInternal::Information> &informations);
106 
108  bool readInformations(MWAWEntry const &entry,
109  std::vector<MWParserInternal::Information> &informations);
110 
113 
115  bool readGraphic(MWParserInternal::Information const &info);
118  static bool isMagicPic(WPXBinaryData const &dt);
119 
121  bool readText(MWParserInternal::Information const &info, std::vector<int> const &lineHeight);
122 
125 
127  bool checkFreeList();
128 
130  void newPage(int number);
131 
132 protected:
133  //
134  // data
135  //
137  shared_ptr<MWParserInternal::State> m_state;
138 };
139 #endif
140 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
void setListener(MWAWContentListenerPtr listen)
sets the listener in this class and in the helper classes
Definition: MWParser.cxx:358
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:47
static bool isMagicPic(WPXBinaryData const &dt)
test if a graphic is empty.
Definition: MWParser.cxx:1593
bool readGraphic(MWParserInternal::Information const &info)
read a graphics
Definition: MWParser.cxx:1517
bool checkFreeList()
check the free list
Definition: MWParser.cxx:1608
MWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: MWParser.cxx:337
bool createZones()
finds the different objects zones
Definition: MWParser.cxx:467
the paragraph... information
Definition: MWParser.cxx:113
bool readInformationsV3(int numInfo, std::vector< MWParserInternal::Information > &informations)
read the information ( version &lt;= 3)
Definition: MWParser.cxx:1030
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: MWParser.cxx:688
void newPage(int number)
adds a new page
Definition: MWParser.cxx:366
bool sendWindow(int zone)
send a zone ( 0: MAIN ZONE, 1 : HEADER, 2 : FOOTER )
Definition: MWParser.cxx:622
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: MWParser.cxx:382
Internal: the subdocument of a MWParser.
Definition: MWParser.cxx:281
void init()
inits all internal variables
Definition: MWParser.cxx:347
bool readParagraph(MWParserInternal::Information const &info)
read a paragraph
Definition: MWParser.cxx:1378
bool readInformations(MWAWEntry const &entry, std::vector< MWParserInternal::Information > &informations)
read the information
Definition: MWParser.cxx:1076
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:354
bool createZonesV3()
finds the different objects zones (version &lt;= 3)
Definition: MWParser.cxx:519
shared_ptr< MWParserInternal::State > m_state
the state
Definition: MWParser.hxx:137
bool readLinesHeight(MWAWEntry const &entry, std::vector< int > &firstParagLine, std::vector< int > &linesHeight)
read the line height
Definition: MWParser.cxx:959
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MWParser.cxx:422
bool readPrintInfo()
read the print info zone
Definition: MWParser.cxx:798
bool readPageBreak(MWParserInternal::Information const &info)
read a page break zone ( version &lt;= 3)
Definition: MWParser.cxx:1469
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:348
bool readWindowsInfo(int wh)
read the windows zone
Definition: MWParser.cxx:851
shared_ptr< MWAWContentListener > MWAWContentListenerPtr
a smart pointer of MWAWContentListener
Definition: libmwaw_internal.hxx:340
virtual ~MWParser()
destructor
Definition: MWParser.cxx:343
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:89
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
the main class to read a MacWrite file
Definition: MWParser.hxx:58
bool readText(MWParserInternal::Information const &info, std::vector< int > const &lineHeight)
read a text zone
Definition: MWParser.cxx:1207

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