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
49 namespace WordMakerParserInternal
50{
51 struct State;
52 struct Zone;
53
54 class SubDocument;
55}
56
62 class WordMakerParser final : public MWAWTextParser
63{
64 friend class WordMakerParserInternal::SubDocument;
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
78protected:
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);
92protected:
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:
MWAWDebug.hxx
MWAWEntry.hxx
MWAWInputStream.hxx
MWAWParser.hxx
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWFont
Class to store font.
Definition MWAWFont.hxx:44
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition MWAWHeader.hxx:57
MWAWParagraph
class to store the paragraph properties
Definition MWAWParagraph.hxx:85
MWAWTextParser::MWAWTextParser
MWAWTextParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor (protected)
Definition MWAWParser.hxx:307
WordMakerParserInternal::SubDocument
Internal: the subdocument of a WordMakerParser.
Definition WordMakerParser.cxx:130
WordMakerParser::sendPicture
bool sendPicture(MWAWEntry const &entry)
try to send a picture
Definition WordMakerParser.cxx:831
WordMakerParser::readFont
bool readFont(long len, MWAWFont &font)
try to read a font and its beginning position
Definition WordMakerParser.cxx:600
WordMakerParser::createZones
bool createZones()
finds the different objects zones
Definition WordMakerParser.cxx:282
WordMakerParser::~WordMakerParser
~WordMakerParser() final
destructor
Definition WordMakerParser.cxx:191
WordMakerParser::sendZone
bool sendZone(WordMakerParserInternal::Zone const &zone)
try to send the content of a zone
Definition WordMakerParser.cxx:859
WordMakerParser::WordMakerParser
WordMakerParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition WordMakerParser.cxx:179
WordMakerParser::readParagraph
bool readParagraph(long len, MWAWParagraph &para, MWAWFont &font)
try to read a paragraph (and its default font)
Definition WordMakerParser.cxx:658
WordMakerParser::createDocument
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition WordMakerParser.cxx:235
WordMakerParser::readFontNames
bool readFontNames(long len)
try to read the fonts names
Definition WordMakerParser.cxx:571
WordMakerParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition WordMakerParser.cxx:481
WordMakerParser::readTabulations
bool readTabulations(long len, MWAWParagraph &para)
try to read a list of tabulations
Definition WordMakerParser.cxx:726
WordMakerParser::m_state
std::shared_ptr< WordMakerParserInternal::State > m_state
the state
Definition WordMakerParser.hxx:110
WordMakerParser::readPrintInfo
bool readPrintInfo(long len)
try to read the printer information
Definition WordMakerParser.cxx:517
WordMakerParser::readPicture
bool readPicture(long len, MWAWEmbeddedObject &object, MWAWBox2f &bdbox, int &page)
try to read a picture (and its size)
Definition WordMakerParser.cxx:775
WordMakerParser::parse
void parse(librevenge::RVNGTextInterface *documentInterface) final
virtual function used to parse the input
Definition WordMakerParser.cxx:198
WordMakerParser::newPage
void newPage()
adds a new page
Definition WordMakerParser.cxx:820
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition libmwaw_internal.hxx:1193
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition libmwaw_internal.hxx:561
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
WordMakerParserInternal
Internal: the structures of a WordMakerParser.
Definition WordMakerParser.cxx:59
librevenge
Definition MWAWDocument.hxx:57
MWAWEmbeddedObject
small class use to define a embedded object
Definition libmwaw_internal.hxx:467
WordMakerParserInternal::State
Internal: the state of a WordMakerParser.
Definition WordMakerParser.cxx:99
WordMakerParserInternal::Zone
Internal: small structure used to store a zone of a WordMakerParser.
Definition WordMakerParser.cxx:61