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 class MWAWEntry;
47 
48 namespace MWParserInternal
49 {
50 struct State;
51 struct Information;
52 struct Paragraph;
53 class SubDocument;
54 }
55 
61 class MWParser : public MWAWParser
62 {
64 
65 public:
67  MWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
69  virtual ~MWParser();
70 
72  bool checkHeader(MWAWHeader *header, bool strict=false);
73 
74  // the main parse function
75  void parse(WPXDocumentInterface *documentInterface);
76 
77 protected:
79  void init();
80 
83 
85  void createDocument(WPXDocumentInterface *documentInterface);
86 
88  bool sendWindow(int zone);
89 
91  bool createZones();
92 
94  bool createZonesV3();
95 
97  bool readPrintInfo();
98 
100  bool readWindowsInfo(int wh);
101 
103  bool readLinesHeight(MWAWEntry const &entry, std::vector<int> &firstParagLine,
104  std::vector<int> &linesHeight);
105 
107  bool readInformationsV3(int numInfo,
108  std::vector<MWParserInternal::Information> &informations);
109 
111  bool readInformations(MWAWEntry const &entry,
112  std::vector<MWParserInternal::Information> &informations);
113 
116 
118  bool readGraphic(MWParserInternal::Information const &info);
121  static bool isMagicPic(WPXBinaryData const &dt);
122 
124  bool readText(MWParserInternal::Information const &info, std::vector<int> const &lineHeight);
125 
128 
130  bool checkFreeList();
131 
133  void newPage(int number);
134 
135 protected:
136  //
137  // data
138  //
140  shared_ptr<MWParserInternal::State> m_state;
141 };
142 #endif
143 // 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:381
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:49
static bool isMagicPic(WPXBinaryData const &dt)
test if a graphic is empty.
Definition: MWParser.cxx:1613
bool readGraphic(MWParserInternal::Information const &info)
read a graphics
Definition: MWParser.cxx:1537
bool checkFreeList()
check the free list
Definition: MWParser.cxx:1628
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
Definition: ACText.hxx:44
MWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: MWParser.cxx:360
bool createZones()
finds the different objects zones
Definition: MWParser.cxx:490
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:1050
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: MWParser.cxx:711
void newPage(int number)
adds a new page
Definition: MWParser.cxx:389
bool sendWindow(int zone)
send a zone ( 0: MAIN ZONE, 1 : HEADER, 2 : FOOTER )
Definition: MWParser.cxx:645
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: MWParser.cxx:405
shared_ptr< MWAWContentListener > MWAWContentListenerPtr
Definition: MWAWContentListener.hxx:260
Internal: the subdocument of a MWParser.
Definition: MWParser.cxx:295
void init()
inits all internal variables
Definition: MWParser.cxx:370
bool readParagraph(MWParserInternal::Information const &info)
read a paragraph
Definition: MWParser.cxx:1398
bool readInformations(MWAWEntry const &entry, std::vector< MWParserInternal::Information > &informations)
read the information
Definition: MWParser.cxx:1096
bool createZonesV3()
finds the different objects zones (version &lt;= 3)
Definition: MWParser.cxx:542
shared_ptr< MWParserInternal::State > m_state
the state
Definition: MWParser.hxx:140
bool readLinesHeight(MWAWEntry const &entry, std::vector< int > &firstParagLine, std::vector< int > &linesHeight)
read the line height
Definition: MWParser.cxx:979
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MWParser.cxx:445
bool readPrintInfo()
read the print info zone
Definition: MWParser.cxx:818
bool readPageBreak(MWParserInternal::Information const &info)
read a page break zone ( version &lt;= 3)
Definition: MWParser.cxx:1489
bool readWindowsInfo(int wh)
read the windows zone
Definition: MWParser.cxx:871
virtual ~MWParser()
destructor
Definition: MWParser.cxx:366
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:98
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:61
bool readText(MWParserInternal::Information const &info, std::vector< int > const &lineHeight)
read a text zone
Definition: MWParser.cxx:1227
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
Definition: MWAWParser.hxx:56

Generated for libmwaw by doxygen 1.8.5