MDWParser.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 MindWrite document
36  */
37 #ifndef MDW_PARSER
38 # define MDW_PARSER
39 
40 #include <string>
41 #include <vector>
42 
43 #include "MWAWPageSpan.hxx"
44 
45 #include "MWAWDebug.hxx"
46 #include "MWAWInputStream.hxx"
47 
48 #include "MWAWParser.hxx"
49 
50 class MWAWEntry;
51 class MWAWFont;
52 class MWAWParagraph;
53 
54 namespace MDWParserInternal
55 {
56 struct LineInfo;
57 struct State;
58 class SubDocument;
59 }
60 
66 class MDWParser : public MWAWParser
67 {
69 
70 public:
72  MDWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
74  virtual ~MDWParser();
75 
77  bool checkHeader(MWAWHeader *header, bool strict=false);
78 
79  // the main parse function
80  void parse(WPXDocumentInterface *documentInterface);
81 
82 protected:
84  void init();
85 
88 
90  void createDocument(WPXDocumentInterface *documentInterface);
91 
93  bool createZones();
94 
96  bool sendZone(int i);
97 
99  bool readGraphic(MDWParserInternal::LineInfo const &line);
100 
103 
106 
108  bool readText(MDWParserInternal::LineInfo const &line);
109 
111  void sendText(std::string const &text, std::vector<MWAWFont> const &fonts, std::vector<int> const &textPos);
112 
114  bool readFonts(MWAWEntry const &entry, std::vector<MWAWFont> &fonts, std::vector<int> &textPos);
115 
117  bool readPrintInfo(MWAWEntry &entry);
118 
120  bool readLinesInfo(MWAWEntry &entry);
121 
123  bool readLastZone(MWAWEntry &entry);
124 
126  bool readZone8(MWAWEntry &entry);
128  bool readHeadingStates(MWAWEntry &entry);
130  bool readZone12(MWAWEntry &entry);
132  bool readHeadingProperties(MWAWEntry &entry);
134  bool readHeadingCustom(MWAWEntry &entry);
135 
137  void setProperty(MWAWParagraph const &para);
138 
140  float pageHeight() const;
142  float pageWidth() const;
143 
145  void newPage(int number);
146 
147  //
148  // low level
149  //
150 
153 
155  bool isFilePos(long pos);
156 
157 protected:
158  //
159  // data
160  //
162  shared_ptr<MDWParserInternal::State> m_state;
163 
166 };
167 #endif
168 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

Generated on Sat May 4 2013 11:47:11 for libmwaw by doxygen 1.8.3.1