WPS4Parser Class Reference

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

#include <WPS4.h>

Inheritance diagram for WPS4Parser:
WPSParser

Public Member Functions

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

Protected Types

typedef std::multimap
< std::string, WPSEntry
NameMultiMap
 a map to retrieve a file entry by name

Protected Member Functions

int version () const
 version
bool getColor (int id, uint32_t &color) const
 color
long getSizeFile () const
 returns the file size (or the ole zone size)
void setSizeFile (long sz)
 sets the file size ( filled by WPS4Text )
bool checkInFile (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< WPS4ContentListener > 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< WPS4ContentListenercreateListener (WPXDocumentInterface *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
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, WPXString const &label)
 creates a document for a footnote entry with label and then send the data
void createTextBox (WPSEntry const &entry, WPSPosition const &pos, WPXPropertyList &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 WPS4MNText)
int readObject (WPXInputStreamPtr input, WPSEntry const &entry)
 tries to read a picture ( via its WPS4Graph )
void sendObject (Vec2f const &size, 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
libwps::DebugFileascii ()
 a DebugFile used to write what we recognize when we parse the document
- Protected Member Functions inherited from WPSParser
WPSHeaderPtrgetHeader ()
WPXInputStreamPtrgetInput ()

Protected Attributes

shared_ptr< WPS4ContentListenerm_listener
shared_ptr< WPS4Graphm_graphParser
 the graph parser
shared_ptr< WPS4Textm_textParser
 the text parser
shared_ptr
< WPS4ParserInternal::State
m_state
 the internal state
NameMultiMap m_nameMultiMap
 a map to retrieve a file entry by name
libwps::DebugFile m_asciiFile
 the debug file

Friends

class WPS4ParserInternal::SubDocument
class WPS4Graph
class WPS4Text

Detailed Description

This class parses Works version 2 through 4.

Member Typedef Documentation

typedef std::multimap<std::string, WPSEntry> WPS4Parser::NameMultiMap
protected

a map to retrieve a file entry by name

Constructor & Destructor Documentation

WPS4Parser::WPS4Parser ( WPXInputStreamPtr input,
WPSHeaderPtr header 
)

constructor

WPS4Parser::~WPS4Parser ( )

destructor

Member Function Documentation

libwps::DebugFile& WPS4Parser::ascii ( )
inlineprotected

a DebugFile used to write what we recognize when we parse the document

Referenced by findZones(), parse(), parseEntry(), readDocDim(), readDocWindowsInfo(), and readPrnt().

bool WPS4Parser::checkInFile ( long  pos)
protected

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

Referenced by parseEntry().

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().

shared_ptr< WPS4ContentListener > WPS4Parser::createListener ( WPXDocumentInterface *  interface)
protected

creates the main listener

Referenced by parse().

void WPS4Parser::createNote ( WPSEntry const &  entry,
WPXString const &  label 
)
protected

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

Referenced by WPS4Text::readText().

bool WPS4Parser::createOLEStructures ( )
protected

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

Referenced by parse().

bool WPS4Parser::createStructures ( )
protected

tries to parse the main zone, ...

Referenced by parse().

void WPS4Parser::createTextBox ( WPSEntry const &  entry,
WPSPosition const &  pos,
WPXPropertyList &  extras 
)
protected

creates a textbox and then send the data

Referenced by WPS4Text::readText().

bool WPS4Parser::findZones ( )
protected

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

Referenced by createStructures().

bool WPS4Parser::getColor ( int  id,
uint32_t &  color 
) const
protected
long WPS4Parser::getSizeFile ( ) const
protected

returns the file size (or the ole zone size)

Referenced by WPS4Text::objectDataParser().

void WPS4Parser::newPage ( int  number)
protected

adds a new page

Referenced by WPS4Text::readText().

int WPS4Parser::numColumns ( ) const
protected

returns the number of columns

Referenced by WPS4Text::readText().

float WPS4Parser::pageHeight ( ) const
protected

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

float WPS4Parser::pageWidth ( ) const
protected

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

Referenced by WPS4Text::readText().

void WPS4Parser::parse ( WPXDocumentInterface *  documentInterface)
virtual

called by WPSDocument to parse the file

Implements WPSParser.

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().

bool WPS4Parser::readDocDim ( )
protected

tries to read the document dimension

Referenced by findZones().

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

reads the additional windows info

Note
this zone contains many unknown data

Referenced by createStructures().

int WPS4Parser::readObject ( WPXInputStreamPtr  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().

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

tries to read the printer information

Referenced by createStructures().

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

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

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

void WPS4Parser::sendObject ( Vec2f const &  size,
int  id 
)
protected

sends an object with given id ( via its WPS4Graph )

The object is sent as a character with given size size

Referenced by WPS4Text::readText().

void WPS4Parser::setListener ( shared_ptr< WPS4ContentListener listener)
protected

set the listener

Referenced by parse().

void WPS4Parser::setSizeFile ( long  sz)
protected

sets the file size ( filled by WPS4Text )

Referenced by WPS4Text::readEntries().

int WPS4Parser::version ( ) const
protected

Friends And Related Function Documentation

friend class WPS4Graph
friend

Referenced by WPS4Parser().

friend class WPS4ParserInternal::SubDocument
friend
friend class WPS4Text
friend

Referenced by WPS4Parser().

Member Data Documentation

libwps::DebugFile WPS4Parser::m_asciiFile
protected

the debug file

Referenced by ascii(), and parse().

shared_ptr<WPS4Graph> WPS4Parser::m_graphParser
protected
shared_ptr<WPS4ContentListener> WPS4Parser::m_listener
protected
shared_ptr<WPS4Text> WPS4Parser::m_textParser
protected

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

Generated on Wed Aug 8 2012 16:07:58 for libwps by doxygen 1.8.1.2