MSK3Parser.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 MSK3_PARSER
35 # define MSK3_PARSER
36 
37 #include <list>
38 #include <string>
39 #include <vector>
40 
41 #include "MWAWDebug.hxx"
42 #include "MWAWEntry.hxx"
43 #include "MWAWInputStream.hxx"
44 
45 #include "MSKParser.hxx"
46 
47 namespace MSK3ParserInternal
48 {
49 struct State;
50 struct Zone;
51 class SubDocument;
52 }
53 
54 class MSKGraph;
55 class MSK3Text;
56 
62 class MSK3Parser : public MSKParser
63 {
65  friend class MSKGraph;
66  friend class MSK3Text;
67 public:
69  MSK3Parser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
71  virtual ~MSK3Parser();
72 
74  bool checkHeader(MWAWHeader *header, bool strict=false);
75 
76  // the main parse function
77  void parse(WPXDocumentInterface *documentInterface);
78 
79 protected:
81  void init();
82 
84  void createDocument(WPXDocumentInterface *documentInterface);
85 
87  bool createZones();
88 
90  double getTextHeight() const;
91 
93  Vec2f getPageLeftTop() const;
94 
96  void newPage(int number, bool softBreak=false);
97 
98  //
99  // intermediate level
100  //
101 
105  bool readDocumentInfo();
107  bool readGroup(MSK3ParserInternal::Zone &zone, MWAWEntry &entry, int check);
109  bool readGroupHeaderInfo(bool header, int check);
111  bool sendFootNote(int zoneId, int noteId);
112 
114  void sendText(int id, int noteId=-1);
115 
117  void sendZone(int zoneType);
118 
119  //
120  // low level
121  //
122 
124  bool readPrintInfo();
125 
126 protected:
127  //
128  // data
129  //
131  shared_ptr<MSK3ParserInternal::State> m_state;
132 
134  std::vector<MWAWEntry> m_listZones;
135 
137  shared_ptr<MSKGraph> m_graphParser;
138 
140  shared_ptr<MSK3Text> m_textParser;
141 };
142 #endif
143 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
bool readGroupHeaderInfo(bool header, int check)
try to read a zone information (zone0)
Definition: MSK3Parser.cxx:846
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:47
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MSK3Parser.cxx:308
virtual ~MSK3Parser()
destructor
Definition: MSK3Parser.cxx:193
void sendZone(int zoneType)
try to send a zone
Definition: MSK3Parser.cxx:286
bool readPrintInfo()
read the print info zone
Definition: MSK3Parser.cxx:943
Internal: a zone of a MSK3Parser ( main, header, footer )
Definition: MSK3Parser.cxx:59
shared_ptr< MSK3ParserInternal::State > m_state
the state
Definition: MSK3Parser.hxx:131
the main class to read the graphic of a Microsoft Works file
Definition: MSKGraph.hxx:68
bool readGroup(MSK3ParserInternal::Zone &zone, MWAWEntry &entry, int check)
try to read a group zone (zone3)
Definition: MSK3Parser.cxx:755
Vec2f getPageLeftTop() const
returns the page top left point
Definition: MSK3Parser.cxx:221
the main class to read the text part of Microsoft Works file
Definition: MSK3Text.hxx:64
bool createZones()
finds the different objects zones
Definition: MSK3Parser.cxx:374
void newPage(int number, bool softBreak=false)
adds a new page
Definition: MSK3Parser.cxx:230
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:354
generic parser for Microsoft Works file
Definition: MSKParser.hxx:58
the main class to read a Microsoft Works file
Definition: MSK3Parser.hxx:62
bool readDocumentInfo()
try to read the documentinfo ( zone2)
Definition: MSK3Parser.cxx:645
MSK3Parser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: MSK3Parser.cxx:187
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:348
shared_ptr< MSK3Text > m_textParser
the text parser
Definition: MSK3Parser.hxx:140
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: MSK3Parser.cxx:476
void init()
inits all internal variables
Definition: MSK3Parser.cxx:197
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
Internal: the subdocument of a MSK3Parser.
Definition: MSK3Parser.cxx:108
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: MSK3Parser.cxx:249
shared_ptr< MSKGraph > m_graphParser
the graph parser
Definition: MSK3Parser.hxx:137
void sendText(int id, int noteId=-1)
try to send a text entry
Definition: MSK3Parser.cxx:278
bool sendFootNote(int zoneId, int noteId)
try to send a note
Definition: MSK3Parser.cxx:296
std::vector< MWAWEntry > m_listZones
the list of different Zones
Definition: MSK3Parser.hxx:134
double getTextHeight() const
returns the page height, ie. paper size less margin (in inches) less header/footer size ...
Definition: MSK3Parser.cxx:214
bool readZone(MSK3ParserInternal::Zone &zone)
try to read a generic zone
Definition: MSK3Parser.cxx:432

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