MWProParser Class Reference

the main class to read a MacWrite II and MacWrite Pro file More...

#include <MWProParser.hxx>

Inheritance diagram for MWProParser:
MWAWParser

Public Member Functions

 MWProParser (MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
 constructor
virtual ~MWProParser ()
 destructor
bool checkHeader (MWAWHeader *header, bool strict=false)
 checks if the document header is correct (or not)
void parse (WPXDocumentInterface *documentInterface)
 virtual function used to parse the input
- Public Member Functions inherited from MWAWParser
virtual ~MWAWParser ()
 virtual destructor
int version () const
 returns the works version
void setVersion (int vers)
 sets the works version

Protected Member Functions

void init ()
 inits all internal variables
void createDocument (WPXDocumentInterface *documentInterface)
 creates the listener which will be associated to the document
bool createZones ()
 finds the different objects zones
bool getZoneData (WPXBinaryData &data, int blockId)
 retrieve the data which corresponds to a zone
bool getFreeZoneList (int blockId, std::vector< int > &blockLists)
 return the chain list of block ( used to get free blocks)
bool parseDataZone (int blockId, int type)
 parse a data zone
bool parseTextZone (shared_ptr< MWProParserInternal::Zone > zone)
 parse a text zone
bool readTextEntries (shared_ptr< MWProParserInternal::Zone > zone, std::vector< MWAWEntry > &res, int textLength)
 try to read the text block entries
bool readTextIds (shared_ptr< MWProParserInternal::Zone > zone, std::vector< MWProParserInternal::TextZoneData > &res, int textLength, int type)
 try to read the text id entries
bool readTextTokens (shared_ptr< MWProParserInternal::Zone > zone, std::vector< MWProParserInternal::Token > &res, int textLength)
 try to read the text token entries
std::vector< int > const & getBlocksCalledByToken () const
 return the list of blockid called by token.
float pageHeight () const
 returns the page height, ie. paper size less margin (in inches)
int numColumns () const
 returns the document number of columns ( filed in MWII)
void newPage (int number, bool softBreak=false)
 adds a new page
bool sendTextZone (int blockId, bool mainZone=false)
 send a text box
int findNumHardBreaks (int blockId)
 compute the number of hard page break
bool sendPictureZone (int blockId, MWAWPosition const &pictPos, WPXPropertyList extras=WPXPropertyList())
 try to send a picture
bool sendTextBoxZone (int blockId, MWAWPosition const &pos, WPXPropertyList extras=WPXPropertyList())
 send a textbox zone
bool sendEmptyFrameZone (MWAWPosition const &pos, WPXPropertyList extras)
 try to send an empty zone (can exist in MWPro1.5)
bool readPrintInfo ()
 read the print info zone
bool readDocHeader ()
 try to read the doc header zone
bool sendPicture (shared_ptr< MWProParserInternal::Zone > zone, MWAWPosition pictPos, WPXPropertyList const &extras)
 try to send a picture
bool sendText (shared_ptr< MWProParserInternal::TextZone > zone, bool mainZone=false)
 try to send a text
int findNumHardBreaks (shared_ptr< MWProParserInternal::TextZone > zone)
 compute the number of hard page break
void checkUnparsed ()
 a debug function which can be used to save the unparsed block
- Protected Member Functions inherited from MWAWParser
 MWAWParser (MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
 constructor (protected)
 MWAWParser (MWAWParserStatePtr state)
 constructor using a state
MWAWParserStatePtr getParserState ()
 returns the parser state
MWAWHeadergetHeader ()
 returns the header
MWAWInputStreamPtrgetInput ()
 returns the actual input
MWAWContentListenerPtrgetListener ()
 returns the listener
MWAWPageSpan const & getPageSpan () const
 returns the actual page dimension
MWAWPageSpangetPageSpan ()
 returns the actual page dimension
double getFormLength () const
 returns the form length
double getFormWidth () const
 returns the form width
double getPageLength () const
 returns the page length (form length without margin )
double getPageWidth () const
 returns the page width (form width without margin )
MWAWRSRCParserPtrgetRSRCParser ()
 returns the rsrc parser
void setListener (MWAWContentListenerPtr &listener)
 sets the listener
void resetListener ()
 resets the listener
MWAWFontConverterPtrgetFontConverter ()
 returns the font converter
void setFontConverter (MWAWFontConverterPtr fontConverter)
 sets the font convertor
libmwaw::DebugFileascii ()
 a DebugFile used to write what we recognize when we parse the document
void setAsciiName (char const *name)
 Debugging: change the default ascii file.
std::string const & asciiName () const
 return the ascii file name

Protected Attributes

shared_ptr
< MWProParserInternal::State
m_state
 the state
shared_ptr< MWProStructuresm_structures
 the structures parser

Friends

class MWProStructures
class MWProStructuresListenerState
class MWProParserInternal::SubDocument

Detailed Description

the main class to read a MacWrite II and MacWrite Pro file

Constructor & Destructor Documentation

MWProParser::MWProParser ( MWAWInputStreamPtr  input,
MWAWRSRCParserPtr  rsrcParser,
MWAWHeader header 
)

constructor

MWProParser::~MWProParser ( )
virtual

destructor

Member Function Documentation

bool MWProParser::checkHeader ( MWAWHeader header,
bool  strict = false 
)
virtual

checks if the document header is correct (or not)

Implements MWAWParser.

Referenced by parse().

void MWProParser::checkUnparsed ( )
protected

a debug function which can be used to save the unparsed block

Referenced by parse().

void MWProParser::createDocument ( WPXDocumentInterface *  documentInterface)
protected

creates the listener which will be associated to the document

Referenced by parse().

bool MWProParser::createZones ( )
protected

finds the different objects zones

Referenced by parse().

int MWProParser::findNumHardBreaks ( int  blockId)
protected

compute the number of hard page break

Referenced by MWProStructures::createZonesV2().

int MWProParser::findNumHardBreaks ( shared_ptr< MWProParserInternal::TextZone zone)
protected

compute the number of hard page break

std::vector< int > const & MWProParser::getBlocksCalledByToken ( ) const
protected

return the list of blockid called by token.

A hack to help structures to retrieve the page attachment

Referenced by MWProStructures::buildPageStructures().

bool MWProParser::getFreeZoneList ( int  blockId,
std::vector< int > &  blockLists 
)
protected

return the chain list of block ( used to get free blocks)

Referenced by parse().

bool MWProParser::getZoneData ( WPXBinaryData &  data,
int  blockId 
)
protected

retrieve the data which corresponds to a zone

Referenced by MWProStructures::createZones(), MWProStructures::createZonesV2(), and parseDataZone().

void MWProParser::init ( )
protected

inits all internal variables

Referenced by MWProParser().

void MWProParser::newPage ( int  number,
bool  softBreak = false 
)
protected

adds a new page

int MWProParser::numColumns ( ) const
protected

returns the document number of columns ( filed in MWII)

float MWProParser::pageHeight ( ) const
protected

returns the page height, ie. paper size less margin (in inches)

void MWProParser::parse ( WPXDocumentInterface *  documentInterface)
virtual

virtual function used to parse the input

Implements MWAWParser.

bool MWProParser::parseDataZone ( int  blockId,
int  type 
)
protected

parse a data zone

Note
type=0 ( text entry), type = 1 ( graphic entry ), other unknown

Referenced by MWProStructures::createZonesV2(), MWProStructures::readBlocksList(), and readTextTokens().

bool MWProParser::parseTextZone ( shared_ptr< MWProParserInternal::Zone zone)
protected

parse a text zone

Referenced by parseDataZone().

bool MWProParser::readDocHeader ( )
protected

try to read the doc header zone

then find 000000fd0000000000018200000100002f00 44[40|80] followed by something like a7c3ec07|a7c4c3c6 : 2 ptrs ? 6f6600000000000000080009000105050506010401

Referenced by createZones().

bool MWProParser::readPrintInfo ( )
protected

read the print info zone

Referenced by checkHeader(), and createZones().

bool MWProParser::readTextEntries ( shared_ptr< MWProParserInternal::Zone zone,
std::vector< MWAWEntry > &  res,
int  textLength 
)
protected

try to read the text block entries

Referenced by parseTextZone().

bool MWProParser::readTextIds ( shared_ptr< MWProParserInternal::Zone zone,
std::vector< MWProParserInternal::TextZoneData > &  res,
int  textLength,
int  type 
)
protected

try to read the text id entries

Referenced by parseTextZone().

bool MWProParser::readTextTokens ( shared_ptr< MWProParserInternal::Zone zone,
std::vector< MWProParserInternal::Token > &  res,
int  textLength 
)
protected

try to read the text token entries

Referenced by parseTextZone().

bool MWProParser::sendEmptyFrameZone ( MWAWPosition const &  pos,
WPXPropertyList  extras 
)
protected

try to send an empty zone (can exist in MWPro1.5)

Referenced by MWProStructures::send().

bool MWProParser::sendPicture ( shared_ptr< MWProParserInternal::Zone zone,
MWAWPosition  pictPos,
WPXPropertyList const &  extras 
)
protected

try to send a picture

Referenced by sendPictureZone().

bool MWProParser::sendPictureZone ( int  blockId,
MWAWPosition const &  pictPos,
WPXPropertyList  extras = WPXPropertyList() 
)
protected

try to send a picture

Referenced by MWProStructures::send(), and sendText().

bool MWProParser::sendText ( shared_ptr< MWProParserInternal::TextZone zone,
bool  mainZone = false 
)
protected

try to send a text

Referenced by sendTextZone().

bool MWProParser::sendTextBoxZone ( int  blockId,
MWAWPosition const &  pos,
WPXPropertyList  extras = WPXPropertyList() 
)
protected

send a textbox zone

Referenced by MWProStructures::send().

bool MWProParser::sendTextZone ( int  blockId,
bool  mainZone = false 
)
protected

send a text box

Referenced by MWProStructures::send().

Friends And Related Function Documentation

friend class MWProParserInternal::SubDocument
friend
friend class MWProStructures
friend

Referenced by init().

friend class MWProStructuresListenerState
friend

Member Data Documentation

shared_ptr<MWProStructures> MWProParser::m_structures
protected

The documentation for this class was generated from the following files:

Generated on Wed May 22 2013 18:12:46 for libmwaw by doxygen 1.8.1.2