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:
MDWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: MDWParser.cxx:553
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:49
void sendText(std::string const &text, std::vector< MWAWFont > const &fonts, std::vector< int > const &textPos)
try to send the text
Definition: MDWParser.cxx:2049
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: MDWParser.cxx:1386
void init()
inits all internal variables
Definition: MDWParser.cxx:563
bool readZone8(MWAWEntry &entry)
read the 8th zone ( unknown zone)
Definition: MDWParser.cxx:1869
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
Definition: ACText.hxx:44
shared_ptr< MDWParserInternal::State > m_state
the state
Definition: MDWParser.hxx:158
bool readHeadingFields(MWAWEntry &entry)
read the heading field zone ( zone 12 )
Definition: MDWParser.cxx:1924
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MDWParser.cxx:679
bool readHeadingStates(MWAWEntry &entry)
read the heading state
Definition: MDWParser.cxx:1617
void sendHeaderFooter(bool header)
try to send the header/footer zone
Definition: MDWParser.cxx:1064
MWAWEntry readEntry()
read a file entry
Definition: MDWParser.cxx:609
shared_ptr< MWAWContentListener > MWAWContentListenerPtr
Definition: MWAWContentListener.hxx:260
bool readCompressedText(MDWParserInternal::LineInfo const &line)
try to read a compressed text zone
Definition: MDWParser.cxx:1226
void setListener(MWAWContentListenerPtr listen)
sets the listener in this class and in the helper classes
Definition: MDWParser.cxx:574
bool readHeadingProperties(MWAWEntry &entry)
read the heading property zone
Definition: MDWParser.cxx:1792
Class to store font.
Definition: MWAWFont.hxx:47
bool readHeadingCustom(MWAWEntry &entry)
read the heading custom zone
Definition: MDWParser.cxx:1665
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: MDWParser.cxx:624
bool readFonts(MWAWEntry const &entry, std::vector< MWAWFont > &fonts, std::vector< int > &textPos)
try to read the fonts
Definition: MDWParser.cxx:1324
bool readGraphic(MDWParserInternal::LineInfo const &line)
try to read a graphic
Definition: MDWParser.cxx:926
void sendHeaderFooterFields(bool header)
try to send the header/footer fields as text (in a textbox)
Definition: MDWParser.cxx:1087
bool sendZone(int i)
try to send a zone
Definition: MDWParser.cxx:841
bool isFilePos(long pos)
check if an entry is in file
Definition: MDWParser.cxx:595
bool readPrintInfo(MWAWEntry &entry)
read the print info zone
Definition: MDWParser.cxx:1983
bool readText(MDWParserInternal::LineInfo const &line)
try to read a non compressed text zone
Definition: MDWParser.cxx:1158
bool createZones()
finds the different objects zones
Definition: MDWParser.cxx:724
void newPage(int number)
adds a new page
Definition: MDWParser.cxx:582
class to store the paragraph properties
Definition: MWAWParagraph.hxx:83
the main class to read a MindWrite file
Definition: MDWParser.hxx:64
virtual ~MDWParser()
destructor
Definition: MDWParser.cxx:559
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
bool readRuler(MDWParserInternal::LineInfo &line)
try to read a ruler
Definition: MDWParser.cxx:969
void setProperty(MWAWParagraph const &para)
sends a paragraph property to the listener
Definition: MDWParser.cxx:2079
bool readLinesInfo(MWAWEntry &entry)
read the lines information zone
Definition: MDWParser.cxx:1494
Internal: a line information of a MDWParser.
Definition: MDWParser.cxx:237
bool readLastZone(MWAWEntry &entry)
read the last zone ( pos + 7fffffff )
Definition: MDWParser.cxx:1575
Internal: the subdocument of a MWParser.
Definition: MDWParser.cxx:490
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
Definition: MWAWParser.hxx:56

Generated for libmwaw by doxygen 1.8.5