WordMakerParser.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 some WordMaker 1.0 text document
36  *
37  */
38 #ifndef WORD_MAKER_PARSER
39 # define WORD_MAKER_PARSER
40 
41 #include <vector>
42 
43 #include "MWAWDebug.hxx"
44 #include "MWAWEntry.hxx"
45 #include "MWAWInputStream.hxx"
46 
47 #include "MWAWParser.hxx"
48 
50 {
51 struct State;
52 struct Zone;
53 
54 class SubDocument;
55 }
56 
62 class WordMakerParser final : public MWAWTextParser
63 {
65 
66 public:
68  WordMakerParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
70  ~WordMakerParser() final;
71 
73  bool checkHeader(MWAWHeader *header, bool strict=false) final;
74 
75  // the main parse function
76  void parse(librevenge::RVNGTextInterface *documentInterface) final;
77 
78 protected:
80  void createDocument(librevenge::RVNGTextInterface *documentInterface);
81 
83  bool createZones();
84 
86  void newPage();
87 
89  bool sendZone(WordMakerParserInternal::Zone const &zone);
91  bool sendPicture(MWAWEntry const &entry);
92 protected:
93  //
94  // data
95  //
97  bool readFont(long len, MWAWFont &font);
99  bool readFontNames(long len);
101  bool readParagraph(long len, MWAWParagraph &para, MWAWFont &font);
103  bool readPicture(long len, MWAWEmbeddedObject &object, MWAWBox2f &bdbox, int &page);
105  bool readTabulations(long len, MWAWParagraph &para);
107  bool readPrintInfo(long len);
108 
110  std::shared_ptr<WordMakerParserInternal::State> m_state;
111 };
112 #endif
113 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
bool createZones()
finds the different objects zones
Definition: WordMakerParser.cxx:282
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
bool readParagraph(long len, MWAWParagraph &para, MWAWFont &font)
try to read a paragraph (and its default font)
Definition: WordMakerParser.cxx:658
~WordMakerParser() final
destructor
Definition: WordMakerParser.cxx:191
void newPage()
adds a new page
Definition: WordMakerParser.cxx:820
Definition: MWAWDocument.hxx:56
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: WordMakerParser.cxx:235
bool readPicture(long len, MWAWEmbeddedObject &object, MWAWBox2f &bdbox, int &page)
try to read a picture (and its size)
Definition: WordMakerParser.cxx:775
bool readPrintInfo(long len)
try to read the printer information
Definition: WordMakerParser.cxx:517
bool readFont(long len, MWAWFont &font)
try to read a font and its beginning position
Definition: WordMakerParser.cxx:600
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition: WordMakerParser.cxx:481
WordMakerParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition: WordMakerParser.cxx:179
bool sendPicture(MWAWEntry const &entry)
try to send a picture
Definition: WordMakerParser.cxx:831
void parse(librevenge::RVNGTextInterface *documentInterface) final
virtual function used to parse the input
Definition: WordMakerParser.cxx:198
bool sendZone(WordMakerParserInternal::Zone const &zone)
try to send the content of a zone
Definition: WordMakerParser.cxx:859
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:561
Class to store font.
Definition: MWAWFont.hxx:43
bool readTabulations(long len, MWAWParagraph &para)
try to read a list of tabulations
Definition: WordMakerParser.cxx:726
Internal: the subdocument of a WordMakerParser.
Definition: WordMakerParser.cxx:129
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:298
bool readFontNames(long len)
try to read the fonts names
Definition: WordMakerParser.cxx:571
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
the main class to read a WordMaker file
Definition: WordMakerParser.hxx:62
class to store the paragraph properties
Definition: MWAWParagraph.hxx:84
std::shared_ptr< WordMakerParserInternal::State > m_state
the state
Definition: WordMakerParser.hxx:110
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
Internal: the structures of a WordMakerParser.
Definition: WordMakerParser.cxx:58

Generated for libmwaw by doxygen 1.8.14