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:

Generated on Thu Apr 24 2014 14:47:41 for libmwaw by doxygen 1.8.3.1