WPS8Parser Class Reference

This class parses Works version 2000 through 8. More...

`#include <WPS8.h>`

Inheritance diagram for WPS8Parser:

## Public Member Functions

| WPS8Parser (WPXInputStreamPtr &input, WPSHeaderPtr &header)
| constructor More...
| ~WPS8Parser ()
| destructor More...
void | parse (WPXDocumentInterface *documentInterface)
| called by WPSDocument to parse the file More...
Public Member Functions inherited from WPSParser
| WPSParser (WPXInputStreamPtr &input, WPSHeaderPtr &header)
virtual | ~WPSParser ()

## Protected Member Functions

bool | checkInFile (long pos)
| return true if the pos is in the file, update the file size if need More...
void | newPage (int number)
| adds a new page More...
void | setListener (shared_ptr< WPS8ContentListener > listener)
| set the listener More...
shared_ptr< WPS8ContentListener > | createListener (WPXDocumentInterface *interface)
| creates the main listener More...
bool | createStructures ()
| tries to parse the main zone, ... More...
bool | createOLEStructures ()
| tries to parse the different OLE zones ( except the main zone ) More...
float | pageHeight () const
| returns the page height, ie. paper size less margin (in inches) More...
float | pageWidth () const
| returns the page width, ie. paper size less margin (in inches) More...
int | numColumns () const
| returns the number of columns More...
void | sendPageFrames ()
| send the frames which corresponds to a given page to the listener More...
void | sendTextBox (WPSPosition const &pos, int strsid, WPXPropertyList frameExtras=WPXPropertyList())
| creates a subdocument to send a textbox which correspond to the strsid text zone More...
void | send (WPSEntry const &entry)
| sends text corresponding to the entry to the listener (via WPS8Text) More...
void | send (int strsId)
| sends text corresponding to the strsId to the listener (via WPS8Text) More...
void | sendTextInCell (int strsId, int cellId)
| send the text of a cell to a listener (via WPS8Text) More...
bool | sendTable (Vec2f const &size, int objectId)
| sends a table as a character with given size ( via its WPS8Table ) More...
int | getTableSTRSId (int tableId) const
| retrieve the strsId corresponding to a table ( mainly for debug) More...
bool | sendObject (Vec2f const &size, int objectId, bool ole)
| sends an object as a character with given size (via its WPS8Graph ) More...
bool | parseHeaderIndexEntry ()
| parses an index entry More...
bool | parseHeaderIndexEntryEnd (long endPos, WPSEntry &hie, std::string &mess)
| function which is called, if some data remains after the basic content of an entry: by default does nothing More...
bool | parseHeaderIndex ()
| tries to find the beginning of the list of indices, then try to find all entries in this list. More...
bool | readDocProperties (WPSEntry const &entry, WPSPageSpan &page)
| reads the DOP zone: the document properties More...
bool | readFRAM (WPSEntry const &entry)
| reads the FRAM zone: ie a zone which can contains textbox, picture, ... More...
bool | readSYID (WPSEntry const &entry, std::vector< int > &listId)
| parses a SYID zone More...
bool | readWNPR (WPSEntry const &entry)
| parses the WNPR zone : a zone which seems to contain the printer preferences. More...
bool | readSPELLING (WPXInputStreamPtr input, std::string const &oleName)
| finds the structures of the Ole zone "SPELLING" More...
Protected Member Functions inherited from WPSParser
WPXInputStreamPtr & | getInput ()
WPSHeaderPtr & | getHeader ()
int | version () const
void | setVersion (int vers)
NameMultiMap & | getNameEntryMap ()
NameMultiMap const & | getNameEntryMap () const
libwps::DebugFile & | ascii ()
| a DebugFile used to write what we recognize when we parse the document More...

## Protected Attributes

shared_ptr< WPS8ContentListener > | m_listener
shared_ptr< WPS8Graph > | m_graphParser
| the graph parser More...
shared_ptr< WPS8Table > | m_tableParser
| the table parser More...
shared_ptr< WPS8Text > | m_textParser
| the text parser More...
shared_ptr < WPS8ParserInternal::State > | m_state
| the internal state More...

## Friends

class | WPS8ParserInternal::SubDocument
class | WPS8Graph
class | WPS8Table
class | WPS8Text

## Additional Inherited Members

Public Types inherited from WPSParser
typedef std::multimap < std::string, WPSEntry > | NameMultiMap
| a map to retrieve a file entry by name More...

## Detailed Description

This class parses Works version 2000 through 8.

## Constructor & Destructor Documentation

WPS8Parser::WPS8Parser | ( | WPXInputStreamPtr & | input,
|  | WPSHeaderPtr & | header
| ) |  |

constructor

WPS8Parser::~WPS8Parser | ( |  | ) |

destructor

## Member Function Documentation

bool WPS8Parser::checkInFile | ( | long | pos | ) |

protected

return true if the pos is in the file, update the file size if need

shared_ptr< WPS8ContentListener > WPS8Parser::createListener | ( | WPXDocumentInterface * | interface | ) |

protected

creates the main listener

Referenced by parse().

bool WPS8Parser::createOLEStructures | ( |  | ) |

protected

tries to parse the different OLE zones ( except the main zone )

Referenced by parse().

bool WPS8Parser::createStructures | ( |  | ) |

protected

tries to parse the main zone, ...

Referenced by parse().

int WPS8Parser::getTableSTRSId | ( | int | tableId | ) | const

protected

retrieve the strsId corresponding to a table ( mainly for debug)

Referenced by WPS8Table::flushExtra().

void WPS8Parser::newPage | ( | int | number | ) |

protected

adds a new page

Referenced by WPS8Text::readText().

int WPS8Parser::numColumns | ( |  | ) | const

protected

returns the number of columns

Referenced by WPS8Text::readText().

float WPS8Parser::pageHeight | ( |  | ) | const

protected

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

float WPS8Parser::pageWidth | ( |  | ) | const

protected

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

void WPS8Parser::parse | ( | WPXDocumentInterface * | documentInterface | ) |

virtual

called by WPSDocument to parse the file

Implements WPSParser.

bool WPS8Parser::parseHeaderIndex | ( |  | ) |

protected

tries to find the beginning of the list of indices, then try to find all entries in this list.

In the header, parse the index to the different sections of the CONTENTS stream.

Stores result in nameTable, offsetTable

Referenced by createStructures().

bool WPS8Parser::parseHeaderIndexEntry | ( |  | ) |

protected

parses an index entry

Referenced by parseHeaderIndex().

bool WPS8Parser::parseHeaderIndexEntryEnd | ( | long | endPos,
|  | WPSEntry & | hie,
|  | std::string & | mess
| ) |  |

protected

function which is called, if some data remains after the basic content of an entry: by default does nothing

Referenced by parseHeaderIndexEntry().

bool WPS8Parser::readDocProperties | ( | WPSEntry const & | entry,
|  | WPSPageSpan & | page
| ) |  |

protected

reads the DOP zone: the document properties

Contains the page dimension, the background picture, ...

Referenced by createStructures().

bool WPS8Parser::readFRAM | ( | WPSEntry const & | entry | ) |

protected

reads the FRAM zone: ie a zone which can contains textbox, picture, ...

Frame zone: ie a zone which can contains text, picture, ...

and have some borders

and have some border

Referenced by createStructures().

bool WPS8Parser::readSPELLING | ( | WPXInputStreamPtr | input,
|  | std::string const & | oleName
| ) |  |

protected

finds the structures of the Ole zone "SPELLING"

Referenced by createOLEStructures().

bool WPS8Parser::readSYID | ( | WPSEntry const & | entry,
|  | std::vector< int > & | listId
| ) |  |

protected

parses a SYID zone

an unknown zone which seems to have the same number of entries than the text zones (STRS)

Referenced by createStructures().

bool WPS8Parser::readWNPR | ( | WPSEntry const & | entry | ) |

protected

parses the WNPR zone : a zone which seems to contain the printer preferences.

Warning
  : read data are not used

Referenced by createStructures().

void WPS8Parser::send | ( | WPSEntry const & | entry | ) |

protected

sends text corresponding to the entry to the listener (via WPS8Text)

Referenced by WPS8ParserInternal::SubDocument::parse(), send(), and WPS8Table::sendTable().

void WPS8Parser::send | ( | int | strsId | ) |

protected

sends text corresponding to the strsId to the listener (via WPS8Text)

bool WPS8Parser::sendObject | ( | Vec2f const & | size,
|  | int | objectId,
|  | bool | ole
| ) |  |

protected

sends an object as a character with given size (via its WPS8Graph )

Parameters

  size | the size of the object in the document pages
  objectId | the object identificator
  ole | indicated if we look for objects coming from a ole zone or objects coming from a Pict zone

Referenced by WPS8Text::readText().

void WPS8Parser::sendPageFrames | ( |  | ) |

protected

send the frames which corresponds to a given page to the listener

Referenced by parse().

bool WPS8Parser::sendTable | ( | Vec2f const & | size,
|  | int | objectId
| ) |  |

protected

sends a table as a character with given size ( via its WPS8Table )

Referenced by WPS8Text::readText().

void WPS8Parser::sendTextBox | ( | WPSPosition const & | pos,
|  | int | strsid,
|  | WPXPropertyList | frameExtras = `WPXPropertyList()`
| ) |  |

protected

creates a subdocument to send a textbox which correspond to the strsid text zone

Referenced by sendPageFrames(), WPS8Table::sendTable(), and sendTable().

void WPS8Parser::sendTextInCell | ( | int | strsId,
|  | int | cellId
| ) |  |

protected

send the text of a cell to a listener (via WPS8Text)

Referenced by WPS8Table::sendTextInCell().

void WPS8Parser::setListener | ( | shared_ptr< WPS8ContentListener > | listener | ) |

protected

set the listener

Referenced by parse().

## Friends And Related Function Documentation

friend class WPS8Graph

friend

Referenced by WPS8Parser().

friend class WPS8ParserInternal::SubDocument

friend

friend class WPS8Table

friend

Referenced by WPS8Parser().

friend class WPS8Text

friend

Referenced by WPS8Parser().

## Member Data Documentation

shared_ptr<WPS8Graph> WPS8Parser::m_graphParser

protected

the graph parser

Referenced by createListener(), createOLEStructures(), createStructures(), newPage(), parse(), sendObject(), sendPageFrames(), setListener(), and WPS8Parser().

shared_ptr<WPS8ContentListener> WPS8Parser::m_listener

protected

Referenced by newPage(), parse(), sendPageFrames(), sendTextBox(), and setListener().

shared_ptr<WPS8ParserInternal::State> WPS8Parser::m_state

protected

the internal state

Referenced by checkInFile(), createListener(), createStructures(), getTableSTRSId(), newPage(), numColumns(), pageHeight(), pageWidth(), readDocProperties(), readFRAM(), sendPageFrames(), sendTable(), and WPS8Parser().

shared_ptr<WPS8Table> WPS8Parser::m_tableParser

protected

the table parser

Referenced by createListener(), createStructures(), parse(), sendTable(), setListener(), and WPS8Parser().

shared_ptr<WPS8Text> WPS8Parser::m_textParser

protected

the text parser

Referenced by createListener(), createStructures(), parse(), parseHeaderIndexEntryEnd(), readFRAM(), send(), sendTextBox(), sendTextInCell(), setListener(), and WPS8Parser().

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

- WPS8.h
- WPS8.cpp