BWParser.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 BW_PARSER
# define BW_PARSER
#include <string>
#include <vector>
#include <libwpd/libwpd.h>
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
namespace BWParserInternal
{
struct Frame;
struct State;
}
class BWText;
class BWParser : public MWAWParser
{
friend class BWText;
public:
BWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
virtual ~BWParser();
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
bool sendFrame(int pId);
protected:
bool createZones();
bool readRSRCZones();
bool sendPageFrames();
bool sendFrame(BWParserInternal::Frame const &frame);
bool sendPicture(int pId, MWAWPosition const &pos,
WPXPropertyList frameExtras=WPXPropertyList());
//
// low level
//
// data fork
bool readPrintInfo();
bool readFrame(MWAWEntry const &entry);
bool readLastZone();
// resource fork
bool readwPos(MWAWEntry const &entry);
bool readFontStyle(MWAWEntry const &entry);
MWAWInputStreamPtr rsrcInput();
libmwaw::DebugFile &rsrcAscii();
//
// data
//
shared_ptr<BWParserInternal::State> m_state;
shared_ptr<BWText> m_textParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
BWParser::BWParser
BWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: BWParser.cxx:124
MWAWHeader
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:47
BWParser::readwPos
bool readwPos(MWAWEntry const &entry)
read the windows positions ( wPos 1001 resource block )
Definition: BWParser.cxx:800
MWAWParser.hxx
BWParser::init
void init()
inits all internal variables
Definition: BWParser.cxx:134
BWParserInternal::Frame
Internal: a structure use to store a frame of a BWParser.
Definition: BWParser.cxx:61
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
BWParser::m_textParser
shared_ptr< BWText > m_textParser
the text parser
Definition: BWParser.hxx:139
BWParser::m_state
shared_ptr< BWParserInternal::State > m_state
the state
Definition: BWParser.hxx:136
BWParser::sendPageFrames
bool sendPageFrames()
try to send the page graphic
Definition: BWParser.cxx:410
BWParser::readPrintInfo
bool readPrintInfo()
read the print info zone
Definition: BWParser.cxx:638
BWParser::readFontStyle
bool readFontStyle(MWAWEntry const &entry)
read the font style ressource
Definition: BWParser.cxx:886
BWParser::createDocument
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: BWParser.cxx:236
BWParser::newPage
void newPage(int number)
adds a new page
Definition: BWParser.cxx:187
BWParser::sendFrame
bool sendFrame(int pId)
try to insert the pId picture (as char)
Definition: BWParser.cxx:169
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:340
BWText
the main class to read the text part of BeagleWorks Text file
Definition: BWText.hxx:60
BWParser::getPageLeftTop
Vec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: BWParser.cxx:160
BWParser::readRSRCZones
bool readRSRCZones()
read the resource fork zone
Definition: BWParser.cxx:371
BWParser::createZones
bool createZones()
finds the different objects zones
Definition: BWParser.cxx:288
BWParser
the main class to read a BeagleWorks file
Definition: BWParser.hxx:57
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:336
BWParser::sendPicture
bool sendPicture(int pId, MWAWPosition const &pos, WPXPropertyList frameExtras=WPXPropertyList())
try to send a picture
Definition: BWParser.cxx:828
MWAWInputStream.hxx
MWAWDebug.hxx
BWParser::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: BWParser.cxx:152
BWParser::parse
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: BWParser.cxx:203
BWParser::~BWParser
virtual ~BWParser()
destructor
Definition: BWParser.cxx:130
BWParser::readFrame
bool readFrame(MWAWEntry const &entry)
read a frame zone
Definition: BWParser.cxx:450
BWParser::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: BWParser.cxx:147
BWParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: BWParser.cxx:924
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
Vec2< float >
BWParser::readLastZone
bool readLastZone()
read the last zone
Definition: BWParser.cxx:694