GWParser.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 GW_PARSER
# define GW_PARSER
#include <string>
#include <vector>
#include <libwpd/libwpd.h>
#include "MWAWDebug.hxx"
#include "MWAWParser.hxx"
namespace GWParserInternal
{
struct State;
class SubDocument;
}
class GWGraph;
class GWText;
class GWParser : public MWAWParser
{
friend class GWParserInternal::SubDocument;
friend class GWGraph;
friend class GWText;
public:
enum DocType { DRAW, TEXT, UNKNOWN };
GWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
virtual ~GWParser();
bool checkHeader(MWAWHeader *header, bool strict=false);
// the main parse function
void parse(WPXDocumentInterface *documentInterface);
protected:
void init();
void createDocument(WPXDocumentInterface *documentInterface);
Vec2f getPageLeftTop() const;
void newPage(int number);
// interface with the text parser
MWAWSection getMainSection() const;
bool sendHF(int id);
bool sendTextbox(MWAWEntry const &entry);
// interface with the graph parser
bool sendPicture(MWAWEntry const &entry, MWAWPosition pos);
// general interface
DocType getDocumentType() const;
protected:
bool createZones();
bool createDrawZones();
bool readRSRCZones();
//
// low level
//
bool readPrintInfo(MWAWEntry const &entry);
bool readWPSN(MWAWEntry const &entry);
bool readDocInfo();
bool readARRs(MWAWEntry const &entry);
bool readDaHS(MWAWEntry const &entry);
bool readGrDS(MWAWEntry const &entry);
bool readNxEd(MWAWEntry const &entry);
MWAWInputStreamPtr rsrcInput();
libmwaw::DebugFile &rsrcAscii();
//
// data
//
shared_ptr<GWParserInternal::State> m_state;
shared_ptr<GWGraph> m_graphParser;
shared_ptr<GWText> m_textParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWHeader
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:47
GWParser::createDrawZones
bool createDrawZones()
finds the different objects zones ( for a draw file)
Definition: GWParser.cxx:404
GWParserInternal::SubDocument
Internal: the subdocument of a GWParser.
Definition: GWParser.cxx:117
GWParser::sendTextbox
bool sendTextbox(MWAWEntry const &entry)
try to textbox's text
Definition: GWParser.cxx:233
GWParser::readPrintInfo
bool readPrintInfo(MWAWEntry const &entry)
read a PrintInfo block ( PRNT resource block )
Definition: GWParser.cxx:545
GWParser::readDocInfo
bool readDocInfo()
read the DocInfo block ( many unknown data )
Definition: GWParser.cxx:739
MWAWParser.hxx
GWParser::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: GWParser.cxx:201
GWParser::readDaHS
bool readDaHS(MWAWEntry const &entry)
read a unknown zone ( DaHS resource block: v2 )
Definition: GWParser.cxx:626
libmwaw::DebugFile
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:67
GWParser::DRAW
Definition: GWParser.hxx:64
GWParser::sendPicture
bool sendPicture(MWAWEntry const &entry, MWAWPosition pos)
try to send a picture
Definition: GWParser.cxx:245
GWParser::m_graphParser
shared_ptr< GWGraph > m_graphParser
the graph parser
Definition: GWParser.hxx:149
GWParser::readARRs
bool readARRs(MWAWEntry const &entry)
read a unknown zone ( ARRs resource block: v2 )
Definition: GWParser.cxx:599
GWParser::UNKNOWN
Definition: GWParser.hxx:64
GWParser::init
void init()
inits all internal variables
Definition: GWParser.cxx:182
GWParser::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: GWParser.cxx:196
GWParser::readNxEd
bool readNxEd(MWAWEntry const &entry)
read a unknown zone ( NxED resource block: v2 )
Definition: GWParser.cxx:707
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:340
GWParser::readGrDS
bool readGrDS(MWAWEntry const &entry)
read a unknown zone ( GrDS resource block: v2 )
Definition: GWParser.cxx:667
GWText
the main class to read the text part of GreatWorks Text file
Definition: GWText.hxx:58
GWGraph
the main class to read the graphic part of a HanMac Word-J file
Definition: GWGraph.hxx:70
GWParser::createDocument
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: GWParser.cxx:306
GWParser::readRSRCZones
bool readRSRCZones()
read the resource fork zone
Definition: GWParser.cxx:430
GWParser::sendHF
bool sendHF(int id)
try to send the i^th header/footer
Definition: GWParser.cxx:228
GWParser::m_textParser
shared_ptr< GWText > m_textParser
the text parser
Definition: GWParser.hxx:151
GWParser::newPage
void newPage(int number)
adds a new page
Definition: GWParser.cxx:257
MWAWSection
a class which stores section properties
Definition: MWAWSection.hxx:45
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:336
GWParser::m_state
shared_ptr< GWParserInternal::State > m_state
the state
Definition: GWParser.hxx:146
GWParser::getPageLeftTop
Vec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: GWParser.cxx:209
GWParser::GWParser
GWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: GWParser.cxx:172
GWParser::createZones
bool createZones()
finds the different objects zones
Definition: GWParser.cxx:370
GWParser::getMainSection
MWAWSection getMainSection() const
return the main section
Definition: GWParser.cxx:223
MWAWDebug.hxx
GWParser::readWPSN
bool readWPSN(MWAWEntry const &entry)
read the windows positions ( WPSN resource block )
Definition: GWParser.cxx:489
GWParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: GWParser.cxx:865
GWParser
the main class to read a GreatWorks text file
Definition: GWParser.hxx:57
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:87
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
GWParser::DocType
DocType
an enum used to defined the document type
Definition: GWParser.hxx:64
Vec2< float >
GWParser::getDocumentType
DocType getDocumentType() const
Definition: GWParser.cxx:215
GWParser::TEXT
Definition: GWParser.hxx:64
GWParser::~GWParser
virtual ~GWParser()
destructor
Definition: GWParser.cxx:178
GWParser::parse
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: GWParser.cxx:273