MWParser.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
#ifndef MW_PARSER
# define MW_PARSER
#include <vector>
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
class WPXBinaryData;
namespace MWParserInternal
{
struct State;
struct Information;
class SubDocument;
}
class MWParser : public MWAWParser
{
friend class MWParserInternal::SubDocument;
public:
MWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
virtual ~MWParser();
bool checkHeader(MWAWHeader *header, bool strict=false);
// the main parse function
void parse(WPXDocumentInterface *documentInterface);
protected:
void init();
void setListener(MWAWContentListenerPtr listen);
void createDocument(WPXDocumentInterface *documentInterface);
bool sendWindow(int zone);
bool createZones();
bool createZonesV3();
bool readPrintInfo();
bool readWindowsInfo(int wh);
bool readLinesHeight(MWAWEntry const &entry, std::vector<int> &firstParagLine,
std::vector<int> &linesHeight);
bool readInformationsV3(int numInfo,
std::vector<MWParserInternal::Information> &informations);
bool readInformations(MWAWEntry const &entry,
std::vector<MWParserInternal::Information> &informations);
bool readParagraph(MWParserInternal::Information const &info);
bool readGraphic(MWParserInternal::Information const &info);
static bool isMagicPic(WPXBinaryData const &dt);
bool readText(MWParserInternal::Information const &info, std::vector<int> const &lineHeight);
bool readPageBreak(MWParserInternal::Information const &info);
bool checkFreeList();
void newPage(int number);
protected:
//
// data
//
shared_ptr<MWParserInternal::State> m_state;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWParser::setListener
void setListener(MWAWContentListenerPtr listen)
sets the listener in this class and in the helper classes
Definition: MWParser.cxx:358
MWAWHeader
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:47
MWParser::isMagicPic
static bool isMagicPic(WPXBinaryData const &dt)
test if a graphic is empty.
Definition: MWParser.cxx:1590
MWParser::readGraphic
bool readGraphic(MWParserInternal::Information const &info)
read a graphics
Definition: MWParser.cxx:1514
MWParser::checkFreeList
bool checkFreeList()
check the free list
Definition: MWParser.cxx:1605
MWParser::MWParser
MWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: MWParser.cxx:337
MWAWParser.hxx
MWParser::createZones
bool createZones()
finds the different objects zones
Definition: MWParser.cxx:467
MWParserInternal::Information
the paragraph... information
Definition: MWParser.cxx:113
MWParser::readInformationsV3
bool readInformationsV3(int numInfo, std::vector< MWParserInternal::Information > &informations)
read the information ( version <= 3)
Definition: MWParser.cxx:1027
MWParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: MWParser.cxx:688
MWParser::newPage
void newPage(int number)
adds a new page
Definition: MWParser.cxx:366
MWParser::sendWindow
bool sendWindow(int zone)
send a zone ( 0: MAIN ZONE, 1 : HEADER, 2 : FOOTER )
Definition: MWParser.cxx:622
MWParser::parse
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: MWParser.cxx:382
MWParserInternal::SubDocument
Internal: the subdocument of a MWParser.
Definition: MWParser.cxx:281
MWParser::init
void init()
inits all internal variables
Definition: MWParser.cxx:347
MWParser::readParagraph
bool readParagraph(MWParserInternal::Information const &info)
read a paragraph
Definition: MWParser.cxx:1375
MWParser::readInformations
bool readInformations(MWAWEntry const &entry, std::vector< MWParserInternal::Information > &informations)
read the information
Definition: MWParser.cxx:1073
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:340
MWParser::createZonesV3
bool createZonesV3()
finds the different objects zones (version <= 3)
Definition: MWParser.cxx:519
MWParser::m_state
shared_ptr< MWParserInternal::State > m_state
the state
Definition: MWParser.hxx:137
MWParser::readLinesHeight
bool readLinesHeight(MWAWEntry const &entry, std::vector< int > &firstParagLine, std::vector< int > &linesHeight)
read the line height
Definition: MWParser.cxx:956
MWParser::createDocument
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MWParser.cxx:422
MWParser::readPrintInfo
bool readPrintInfo()
read the print info zone
Definition: MWParser.cxx:795
MWParser::readPageBreak
bool readPageBreak(MWParserInternal::Information const &info)
read a page break zone ( version <= 3)
Definition: MWParser.cxx:1466
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:336
MWParser::readWindowsInfo
bool readWindowsInfo(int wh)
read the windows zone
Definition: MWParser.cxx:848
MWAWInputStream.hxx
MWAWDebug.hxx
MWAWContentListenerPtr
shared_ptr< MWAWContentListener > MWAWContentListenerPtr
a smart pointer of MWAWContentListener
Definition: libmwaw_internal.hxx:330
MWParser::~MWParser
virtual ~MWParser()
destructor
Definition: MWParser.cxx:343
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:87
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
MWParser
the main class to read a MacWrite file
Definition: MWParser.hxx:58
MWParser::readText
bool readText(MWParserInternal::Information const &info, std::vector< int > const &lineHeight)
read a text zone
Definition: MWParser.cxx:1204