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 "MWAWDebug.hxx"
44 #include "MWAWInputStream.hxx"
45 
46 #include "MWAWParser.hxx"
47 
48 class MWAWEntry;
49 class MWAWFont;
50 class MWAWParagraph;
51 
52 namespace MDWParserInternal
53 {
54 struct LineInfo;
55 struct State;
56 class SubDocument;
57 }
58 
64 class MDWParser : public MWAWParser
65 {
67 
68 public:
70  MDWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
72  virtual ~MDWParser();
73 
75  bool checkHeader(MWAWHeader *header, bool strict=false);
76 
77  // the main parse function
78  void parse(WPXDocumentInterface *documentInterface);
79 
80 protected:
82  void init();
83 
86 
88  void createDocument(WPXDocumentInterface *documentInterface);
89 
91  bool createZones();
92 
94  bool sendZone(int i);
95 
97  bool readGraphic(MDWParserInternal::LineInfo const &line);
98 
101 
104 
106  bool readText(MDWParserInternal::LineInfo const &line);
107 
109  void sendText(std::string const &text, std::vector<MWAWFont> const &fonts, std::vector<int> const &textPos);
111  void sendHeaderFooter(bool header);
113  void sendHeaderFooterFields(bool header);
115  bool readFonts(MWAWEntry const &entry, std::vector<MWAWFont> &fonts, std::vector<int> &textPos);
116 
118  bool readPrintInfo(MWAWEntry &entry);
119 
121  bool readLinesInfo(MWAWEntry &entry);
122 
124  bool readLastZone(MWAWEntry &entry);
125 
127  bool readZone8(MWAWEntry &entry);
129  bool readHeadingStates(MWAWEntry &entry);
131  bool readHeadingFields(MWAWEntry &entry);
133  bool readHeadingProperties(MWAWEntry &entry);
135  bool readHeadingCustom(MWAWEntry &entry);
136 
138  void setProperty(MWAWParagraph const &para);
139 
141  void newPage(int number);
142 
143  //
144  // low level
145  //
146 
149 
151  bool isFilePos(long pos);
152 
153 protected:
154  //
155  // data
156  //
158  shared_ptr<MDWParserInternal::State> m_state;
159 };
160 #endif
161 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

Generated on Wed May 22 2013 18:12:37 for libmwaw by doxygen 1.8.1.2