WPS4Parser Class Reference documentation

WPS4Parser Class Reference

This class parses Works version 2 through 4. More...

`#include <WPS4.h>`

Inheritance diagram for WPS4Parser:

## Public Member Functions
| WPS4Parser (RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN)
| constructor
| ~WPS4Parser ()
| destructor
void | parse (librevenge::RVNGTextInterface *documentInterface)
| called by WPSDocument to parse the file
bool | checkHeader (WPSHeader *header, bool strict=false)
| checks if the document header is correct (or not)
Public Member Functions inherited from WPSParser
| WPSParser (RVNGInputStreamPtr &input, WPSHeaderPtr &header)
virtual | ~WPSParser ()

## Protected Member Functions
bool | getColor (int id, WPSColor &color) const
| color
void | setSizeFile (long sz)
| sets the file size ( filled by WPS4Text )
bool | checkFilePosition (long pos)
| return true if the pos is in the file, update the file size if need
void | newPage (int number)
| adds a new page
void | setListener (shared_ptr< WPSContentListener > listener)
| set the listener
bool | createStructures ()
| tries to parse the main zone, ...
bool | createOLEStructures ()
| tries to parse the different OLE zones ( except the main zone )
shared_ptr< WPSContentListener > | createListener (librevenge::RVNGTextInterface *interface)
| creates the main listener
float | pageHeight () const
| returns the page height, ie. paper size less margin (in inches)
float | pageWidth () const
| returns the page width, ie. paper size less margin (in inches)
int | numColumns () const
| returns the number of columns
libwps_tools_win::Font::Type | getDefaultFontType () const
| returns the default font type, ie.
libwps_tools_win::Font::Type | getOEMFontType () const
| returns the document codepage ( given from the file OEM field )
void | createDocument (WPSEntry const &entry, libwps::SubDocumentType type)
| creates a document for a comment entry and then send the data
void | createNote (WPSEntry const &entry, librevenge::RVNGString const &label)
| creates a document for a footnote entry with label and then send the data
void | createTextBox (WPSEntry const &entry, WPSPosition const &pos, librevenge::RVNGPropertyList &extras)
| creates a textbox and then send the data
void | send (WPSEntry const &entry, libwps::SubDocumentType type)
| sends text corresponding to the entry to the listener (via WPS4Text)
int | readObject (RVNGInputStreamPtr input, WPSEntry const &entry)
| tries to read a picture ( via its WPS4Graph )
void | sendObject (WPSPosition const &position, int id)
| sends an object with given id ( via its WPS4Graph )
bool | findZones ()
| finds the different zones (text, print, ...) and updates nameMultiMap
bool | parseEntry (std::string const &name)
| parses an entry
bool | readDocDim ()
| tries to read the document dimension
bool | readPrnt (WPSEntry const &entry)
| tries to read the printer information
bool | readDocWindowsInfo (WPSEntry const &entry)
| reads the additional windows info
Protected Member Functions inherited from WPSParser
RVNGInputStreamPtr & | getInput ()
RVNGInputStreamPtr | getFileInput ()
WPSHeaderPtr & | getHeader ()
int | version () const
void | setVersion (int vers)
libwps::DebugFile & | ascii ()
| a DebugFile used to write what we recognize when we parse the document
NameMultiMap & | getNameEntryMap ()
NameMultiMap const & | getNameEntryMap () const

## Protected Attributes
shared_ptr< WPSContentListener > | m_listener
shared_ptr< WPS4Graph > | m_graphParser
| the graph parser
shared_ptr< WPS4Text > | m_textParser
| the text parser
shared_ptr< WPS4ParserInternal::State > | m_state
| the internal state

## Friends
class | WPS4ParserInternal::SubDocument
class | WPS4Graph
class | WPS4Text

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

## Detailed Description

This class parses Works version 2 through 4.

## Constructor & Destructor Documentation

## ◆ WPS4Parser()

WPS4Parser::WPS4Parser | ( | RVNGInputStreamPtr & | input,
|  | WPSHeaderPtr & | header,
|  | libwps_tools_win::Font::Type | encoding = libwps_tools_win::Font::UNKNOWN )

constructor

## ◆ ~WPS4Parser()

WPS4Parser::~WPS4Parser | ( |  | ) |

destructor

## Member Function Documentation

## ◆ checkFilePosition()

bool WPS4Parser::checkFilePosition | ( | long | pos | ) |
| protected

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

Referenced by checkHeader(), findZones(), and parseEntry().

## ◆ checkHeader()

bool WPS4Parser::checkHeader | ( | WPSHeader * | header,
|  | bool | strict = false )

checks if the document header is correct (or not)

Referenced by libwps::WPSDocument::isFileFormatSupported(), and parse().

## ◆ createDocument()

void WPS4Parser::createDocument | ( | WPSEntry const & | entry,
|  | libwps::SubDocumentType | type )
| protected

creates a document for a comment entry and then send the data

Note
  actually all bookmarks (comments) are empty

Referenced by WPS4Text::readText().

## ◆ createListener()

shared_ptr< WPSContentListener > WPS4Parser::createListener | ( | librevenge::RVNGTextInterface * | interface | ) |
| protected

creates the main listener

Referenced by parse().

## ◆ createNote()

void WPS4Parser::createNote | ( | WPSEntry const & | entry,
|  | librevenge::RVNGString const & | label )
| protected

creates a document for a footnote entry with label and then send the data

Referenced by WPS4Text::readText().

## ◆ createOLEStructures()

bool WPS4Parser::createOLEStructures | ( |  | ) |
| protected

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

Referenced by parse().

## ◆ createStructures()

bool WPS4Parser::createStructures | ( |  | ) |
| protected

tries to parse the main zone, ...

Referenced by parse().

## ◆ createTextBox()

void WPS4Parser::createTextBox | ( | WPSEntry const & | entry,
|  | WPSPosition const & | pos,
|  | librevenge::RVNGPropertyList & | extras )
| protected

creates a textbox and then send the data

Referenced by WPS4Text::readText().

## ◆ findZones()

bool WPS4Parser::findZones | ( |  | ) |
| protected

finds the different zones (text, print, ...) and updates nameMultiMap

Referenced by createStructures().

## ◆ getColor()

bool WPS4Parser::getColor | ( | int | id,
|  | WPSColor & | color ) const
| protected

color

Referenced by readDocWindowsInfo().

## ◆ getDefaultFontType()

libwps_tools_win::Font::Type WPS4Parser::getDefaultFontType | ( |  | ) | const
| protected

returns the default font type, ie.

the encoding given by the constructor if given or the encoding deduiced from the version.

Referenced by WPS4Text::footNotesDataParser(), WPS4Text::readFont(), and WPS4Text::readFontNames().

## ◆ getOEMFontType()

libwps_tools_win::Font::Type WPS4Parser::getOEMFontType | ( |  | ) | const
| protected

returns the document codepage ( given from the file OEM field )

## ◆ newPage()

void WPS4Parser::newPage | ( | int | number | ) |
| protected

adds a new page

Referenced by WPS4Text::readText().

## ◆ numColumns()

int WPS4Parser::numColumns | ( |  | ) | const
| protected

returns the number of columns

Referenced by WPS4Text::readText().

## ◆ pageHeight()

float WPS4Parser::pageHeight | ( |  | ) | const
| protected

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

## ◆ pageWidth()

float WPS4Parser::pageWidth | ( |  | ) | const
| protected

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

## ◆ parse()

void WPS4Parser::parse | ( | librevenge::RVNGTextInterface * | documentInterface | ) |
| virtual

called by WPSDocument to parse the file

Implements WPSParser.

## ◆ parseEntry()

bool WPS4Parser::parseEntry | ( | std::string const & | name | ) |
| protected

parses an entry

reads a zone offset and a zone size and checks if this entry is valid

Referenced by findZones(), and WPS4Text::readEntries().

## ◆ readDocDim()

bool WPS4Parser::readDocDim | ( |  | ) |
| protected

tries to read the document dimension

Referenced by findZones().

## ◆ readDocWindowsInfo()

bool WPS4Parser::readDocWindowsInfo | ( | WPSEntry const & | entry | ) |
| protected

reads the additional windows info

    \note this zone contains many unknown data

Referenced by createStructures().

## ◆ readObject()

int WPS4Parser::readObject | ( | RVNGInputStreamPtr | input,
|  | WPSEntry const & | entry )
| protected

tries to read a picture ( via its WPS4Graph )

Note
  returns the object id or -1 if find nothing

Referenced by WPS4Text::objectDataParser().

## ◆ readPrnt()

bool WPS4Parser::readPrnt | ( | WPSEntry const & | entry | ) |
| protected

tries to read the printer information

Referenced by createStructures().

## ◆ send()

void WPS4Parser::send | ( | WPSEntry const & | entry,
|  | libwps::SubDocumentType | type )
| protected

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

Referenced by WPS4ParserInternal::SubDocument::parse().

## ◆ sendObject()

void WPS4Parser::sendObject | ( | WPSPosition const & | position,
|  | int | id )
| protected

sends an object with given id ( via its WPS4Graph )

The object is sent as a character with given size position

Referenced by WPS4Text::readText(), and WPS4Text::sendObjects().

## ◆ setListener()

void WPS4Parser::setListener | ( | shared_ptr< WPSContentListener > | listener | ) |
| protected

set the listener

Referenced by parse().

## ◆ setSizeFile()

void WPS4Parser::setSizeFile | ( | long | sz | ) |
| protected

sets the file size ( filled by WPS4Text )

Referenced by WPS4Text::readEntries().

## Friends And Related Symbol Documentation

## ◆ WPS4Graph

friend class WPS4Graph
| friend

Referenced by WPS4Graph, and WPS4Parser().

## ◆ WPS4ParserInternal::SubDocument

friend class WPS4ParserInternal::SubDocument
| friend

## ◆ WPS4Text

friend class WPS4Text
| friend

Referenced by WPS4Parser(), and WPS4Text.

## Member Data Documentation

## ◆ m_graphParser

shared_ptr<WPS4Graph> WPS4Parser::m_graphParser
| protected

the graph parser

Referenced by createListener(), createOLEStructures(), createStructures(), newPage(), parse(), readObject(), sendObject(), setListener(), and WPS4Parser().

## ◆ m_listener

shared_ptr<WPSContentListener> WPS4Parser::m_listener
| protected

Referenced by createDocument(), createNote(), createTextBox(), newPage(), parse(), send(), setListener(), and WPS4Parser().

## ◆ m_state

shared_ptr<WPS4ParserInternal::State> WPS4Parser::m_state
| protected

the internal state

Referenced by checkFilePosition(), createListener(), findZones(), getColor(), getDefaultFontType(), getOEMFontType(), newPage(), numColumns(), pageHeight(), pageWidth(), readDocDim(), setSizeFile(), and WPS4Parser().

## ◆ m_textParser

shared_ptr<WPS4Text> WPS4Parser::m_textParser
| protected

the text parser

Referenced by createListener(), createStructures(), findZones(), parse(), send(), setListener(), and WPS4Parser().

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

- WPS4.h
- WPS4.cpp