MacWrtProParser Class Referencefinal

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

`#include <MacWrtProParser.hxx>`

Inheritance diagram for MacWrtProParser:

## Public Member Functions

| MacWrtProParser (MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
| constructor
| ~MacWrtProParser () final
| destructor
bool | checkHeader (MWAWHeader *header, bool strict=false) final
| checks if the document header is correct (or not)
void | parse (librevenge::RVNGTextInterface *documentInterface) final
| virtual function used to parse the input
Public Member Functions inherited from MWAWTextParser
| ~MWAWTextParser () override
| destructor
Public Member Functions inherited from MWAWParser
virtual | ~MWAWParser ()
| virtual destructor
int | version () const
| returns the works version
MWAWParserStatePtr | getParserState ()
| returns the parser state
MWAWHeader * | getHeader ()
| returns the header
MWAWInputStreamPtr & | getInput ()
| returns the actual input
MWAWListenerPtr | getMainListener ()
| returns the main listener
MWAWGraphicListenerPtr & | getGraphicListener ()
| returns the graphic listener
MWAWPresentationListenerPtr & | getPresentationListener ()
| returns the presentation listener
MWAWSpreadsheetListenerPtr & | getSpreadsheetListener ()
| returns the spreadsheet listener
MWAWTextListenerPtr & | getTextListener ()
| returns the text listener
MWAWFontConverterPtr & | getFontConverter ()
| returns the font converter
MWAWFontManagerPtr & | getFontManager ()
| returns the font manager
MWAWPageSpan const & | getPageSpan () const
| returns the actual page dimension
MWAWPageSpan & | getPageSpan ()
| 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 )
MWAWRSRCParserPtr & | getRSRCParser ()
| returns the rsrc parser
libmwaw::DebugFile & | ascii ()
| a DebugFile used to write what we recognize when we parse the document

## Protected Member Functions

void | init ()
| inits all internal variables
void | createDocument (librevenge::RVNGTextInterface *documentInterface)
| creates the listener which will be associated to the document
bool | createZones ()
| finds the different objects zones
std::shared_ptr< MWAWStream > | getStreamForBlock (int bId)
| returns a stream corresponding to a block
bool | getFreeZoneList (std::vector< int > &blockLists)
| return the chain list of block ( used to get free blocks): MWPro only
bool | parseDataZone (int blockId, int type)
| parse a data zone
bool | parseTextZone (std::shared_ptr< MacWrtProParserInternal::Zone > zone)
| parse a text zone
bool | readTextEntries (std::shared_ptr< MacWrtProParserInternal::Zone > zone, std::vector< MWAWEntry > &res, int textLength)
| try to read the text block entries
bool | readTextIds (std::shared_ptr< MacWrtProParserInternal::Zone > zone, std::vector< MacWrtProParserInternal::TextZoneData > &res, int textLength, int type)
| try to read the text id entries
bool | readTextTokens (std::shared_ptr< MacWrtProParserInternal::Zone > zone, std::vector< MacWrtProParserInternal::Token > &res, int textLength)
| try to read the text token entries
std::vector< int > const & | getGraphicIdCalledByToken () const
| return the list of graphicid called by token.
float | pageHeight () const
| returns the page height, ie. paper size less margin (in inches)
int | numColumns (double &sep) const
| returns the document number of columns and the column separator width in inch( filed in MWII)
void | newPage (int number, bool softBreak=false)
| adds a new page
bool | hasTitlePage () const
| returns true if the document has a title page
std::shared_ptr< MWAWSubDocument > | getSubDocument (int blockId)
| returns a subdocument corresponding to a blockid
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, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())
| try to send a picture
bool | sendTextBoxZone (int blockId, MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())
| send a textbox zone
bool | sendEmptyFrameZone (MWAWPosition const &pos, MWAWGraphicStyle const &style)
| try to send an empty zone (can exist in MacWrtPro1.5)
bool | readPrintInfo ()
| read the print info zone
bool | readDocHeader ()
| try to read the doc header zone
bool | sendPicture (std::shared_ptr< MacWrtProParserInternal::Zone > zone, MWAWPosition pictPos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())
| try to send a picture
bool | sendText (std::shared_ptr< MacWrtProParserInternal::TextZone > zone, bool mainZone=false)
| try to send a text
int | findNumHardBreaks (std::shared_ptr< MacWrtProParserInternal::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 MWAWTextParser
| MWAWTextParser (MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
| constructor (protected)
| MWAWTextParser (MWAWParserStatePtr const &state)
| constructor using a state
Protected Member Functions inherited from MWAWParser
| MWAWParser (MWAWParserState::Type type, MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
| constructor (protected)
| MWAWParser (MWAWParserStatePtr const &state)
| constructor using a state
void | setVersion (int vers)
| sets the document's version
void | setGraphicListener (MWAWGraphicListenerPtr &listener)
| sets the graphic listener
void | resetGraphicListener ()
| resets the listener
void | setPresentationListener (MWAWPresentationListenerPtr &listener)
| sets the presentation listener
void | resetPresentationListener ()
| resets the listener
void | setSpreadsheetListener (MWAWSpreadsheetListenerPtr &listener)
| sets the spreadsheet listener
void | resetSpreadsheetListener ()
| resets the listener
void | setTextListener (MWAWTextListenerPtr &listener)
| sets the text listener
void | resetTextListener ()
| resets the listener
void | setAsciiName (char const *name)
| Debugging: change the default ascii file.
std::string const & | asciiName () const
| return the ascii file name

## Static Protected Member Functions

static std::string | convertDateToDebugString (unsigned date)
| convert a date in a string (for debugging)

## Protected Attributes

std::shared_ptr< MacWrtProParserInternal::State > | m_state
| the state
std::shared_ptr< MacWrtProStructures > | m_structures
| the structures parser

## Friends

class | MacWrtProStructures
class | MacWrtProStructuresListenerState
class | MacWrtProParserInternal::SubDocument

## Detailed Description

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

## Constructor & Destructor Documentation

## MacWrtProParser()

MacWrtProParser::MacWrtProParser | ( | MWAWInputStreamPtr const & | input,
|  | MWAWRSRCParserPtr const & | rsrcParser,
|  | MWAWHeader * | header )

constructor

## ~MacWrtProParser()

MacWrtProParser::~MacWrtProParser | ( |  | ) |

final

destructor

## Member Function Documentation

## checkHeader()

bool MacWrtProParser::checkHeader | ( | MWAWHeader * | header,
|  | bool | strict = false )

final virtual

checks if the document header is correct (or not)

Implements MWAWParser.

Referenced by MacWrtProParserInternal::SubDocument, and parse().

## checkUnparsed()

void MacWrtProParser::checkUnparsed | ( |  | ) |

protected

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

Referenced by pageHeight(), and parse().

## convertDateToDebugString()

std::string MacWrtProParser::convertDateToDebugString | ( | unsigned | date | ) |

static protected

convert a date in a string (for debugging)

Referenced by pageHeight(), MacWrtProStructures::readCharStyles(), readDocHeader(), MacWrtProStructures::readGraphicsList(), and MacWrtProStructures::readStyle().

## createDocument()

void MacWrtProParser::createDocument | ( | librevenge::RVNGTextInterface * | documentInterface | ) |

protected

creates the listener which will be associated to the document

Referenced by MacWrtProParserInternal::SubDocument, and parse().

## createZones()

bool MacWrtProParser::createZones | ( |  | ) |

protected

finds the different objects zones

Referenced by MacWrtProParserInternal::SubDocument, and parse().

## findNumHardBreaks() [1/2]

int MacWrtProParser::findNumHardBreaks | ( | int | blockId | ) |

protected

compute the number of hard page break

Referenced by findNumHardBreaks(), and pageHeight().

## findNumHardBreaks() [2/2]

int MacWrtProParser::findNumHardBreaks | ( | std::shared_ptr< MacWrtProParserInternal::TextZone > | zone | ) |

protected

compute the number of hard page break

## getFreeZoneList()

bool MacWrtProParser::getFreeZoneList | ( | std::vector< int > & | blockLists | ) |

protected

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

Referenced by MacWrtProParserInternal::SubDocument, and parse().

## getGraphicIdCalledByToken()

std::vector< int > const & MacWrtProParser::getGraphicIdCalledByToken | ( |  | ) | const

protected

return the list of graphicid called by token.

A hack to help structures to retrieve the page attachment

Referenced by MacWrtProParserInternal::SubDocument.

## getStreamForBlock()

std::shared_ptr< MWAWStream > MacWrtProParser::getStreamForBlock | ( | int | bId | ) |

protected

returns a stream corresponding to a block

Referenced by createZones(), MacWrtProParserInternal::SubDocument, and parseDataZone().

## getSubDocument()

std::shared_ptr< MWAWSubDocument > MacWrtProParser::getSubDocument | ( | int | blockId | ) |

protected

returns a subdocument corresponding to a blockid

Referenced by pageHeight().

## hasTitlePage()

bool MacWrtProParser::hasTitlePage | ( |  | ) | const

protected

returns true if the document has a title page

Referenced by pageHeight().

## init()

void MacWrtProParser::init | ( |  | ) |

protected

inits all internal variables

Referenced by MacWrtProParser(), and MacWrtProParserInternal::SubDocument.

## newPage()

void MacWrtProParser::newPage | ( | int | number,
|  | bool | softBreak = false )

protected

adds a new page

Referenced by pageHeight().

## numColumns()

int MacWrtProParser::numColumns | ( | double & | sep | ) | const

protected

returns the document number of columns and the column separator width in inch( filed in MWII)

Referenced by pageHeight().

## pageHeight()

float MacWrtProParser::pageHeight | ( |  | ) | const

protected

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

Referenced by pageHeight().

## parse()

void MacWrtProParser::parse | ( | librevenge::RVNGTextInterface * | documentInterface | ) |

final virtual

virtual function used to parse the input

Implements MWAWTextParser.

Referenced by MacWrtProParserInternal::SubDocument.

## parseDataZone()

bool MacWrtProParser::parseDataZone | ( | int | blockId,
|  | int | type )

protected

parse a data zone

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

Referenced by MacWrtProParserInternal::SubDocument, and readTextTokens().

## parseTextZone()

bool MacWrtProParser::parseTextZone | ( | std::shared_ptr< MacWrtProParserInternal::Zone > | zone | ) |

protected

parse a text zone

Referenced by MacWrtProParserInternal::SubDocument, and parseDataZone().

## readDocHeader()

bool MacWrtProParser::readDocHeader | ( |  | ) |

protected

try to read the doc header zone

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

Referenced by createZones(), and pageHeight().

## readPrintInfo()

bool MacWrtProParser::readPrintInfo | ( |  | ) |

protected

read the print info zone

Referenced by checkHeader(), createZones(), and pageHeight().

## readTextEntries()

bool MacWrtProParser::readTextEntries | ( | std::shared_ptr< MacWrtProParserInternal::Zone > | zone,
|  | std::vector< MWAWEntry > & | res,
|  | int | textLength )

protected

try to read the text block entries

Referenced by MacWrtProParserInternal::SubDocument, and parseTextZone().

## readTextIds()

bool MacWrtProParser::readTextIds | ( | std::shared_ptr< MacWrtProParserInternal::Zone > | zone,
|  | std::vector< MacWrtProParserInternal::TextZoneData > & | res,
|  | int | textLength,
|  | int | type )

protected

try to read the text id entries

Referenced by MacWrtProParserInternal::SubDocument, and parseTextZone().

## readTextTokens()

bool MacWrtProParser::readTextTokens | ( | std::shared_ptr< MacWrtProParserInternal::Zone > | zone,
|  | std::vector< MacWrtProParserInternal::Token > & | res,
|  | int | textLength )

protected

try to read the text token entries

Referenced by MacWrtProParserInternal::SubDocument, and parseTextZone().

## sendEmptyFrameZone()

bool MacWrtProParser::sendEmptyFrameZone | ( | MWAWPosition const & | pos,
|  | MWAWGraphicStyle const & | style )

protected

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

Referenced by pageHeight().

## sendPicture()

bool MacWrtProParser::sendPicture | ( | std::shared_ptr< MacWrtProParserInternal::Zone > | zone,
|  | MWAWPosition | pictPos,
|  | MWAWGraphicStyle const & | style = MWAWGraphicStyle::emptyStyle() )

protected

try to send a picture

Referenced by pageHeight(), and sendPictureZone().

## sendPictureZone()

bool MacWrtProParser::sendPictureZone | ( | int | blockId,
|  | MWAWPosition const & | pictPos,
|  | MWAWGraphicStyle const & | style = MWAWGraphicStyle::emptyStyle() )

protected

try to send a picture

Referenced by pageHeight(), and sendText().

## sendText()

bool MacWrtProParser::sendText | ( | std::shared_ptr< MacWrtProParserInternal::TextZone > | zone,
|  | bool | mainZone = false )

protected

try to send a text

Referenced by pageHeight(), and sendTextZone().

## sendTextBoxZone()

bool MacWrtProParser::sendTextBoxZone | ( | int | blockId,
|  | MWAWPosition const & | pos,
|  | MWAWGraphicStyle const & | style = MWAWGraphicStyle::emptyStyle() )

protected

send a textbox zone

Referenced by pageHeight().

## sendTextZone()

bool MacWrtProParser::sendTextZone | ( | int | blockId,
|  | bool | mainZone = false )

protected

send a text box

Referenced by pageHeight().

## Friends And Related Symbol Documentation

## MacWrtProParserInternal::SubDocument

friend class MacWrtProParserInternal::SubDocument

friend

## MacWrtProStructures

friend class MacWrtProStructures

friend

Referenced by init(), and MacWrtProStructures.

## MacWrtProStructuresListenerState

friend class MacWrtProStructuresListenerState

friend

Referenced by MacWrtProStructuresListenerState, and sendText().

## Member Data Documentation

## m_state

std::shared_ptr<MacWrtProParserInternal::State> MacWrtProParser::m_state

protected

the state

Referenced by checkHeader(), checkUnparsed(), createDocument(), createZones(), findNumHardBreaks(), getFreeZoneList(), getGraphicIdCalledByToken(), getStreamForBlock(), hasTitlePage(), init(), MacWrtProParser(), newPage(), numColumns(), parse(), parseDataZone(), parseTextZone(), readDocHeader(), readTextEntries(), readTextTokens(), sendPictureZone(), and sendTextZone().

## m_structures

std::shared_ptr<MacWrtProStructures> MacWrtProParser::m_structures

protected

the structures parser

Referenced by createDocument(), createZones(), init(), MacWrtProParser(), parse(), and sendText().

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

- MacWrtProParser.hxx
- MacWrtProParser.cxx