WPS4Text Class Reference

The class which parses text zones in a pc MS Works document v1-4. More...

#include <WPS4Text.h>

List of all members.

Public Member Functions

 WPS4Text (WPS4Parser &parser, WPXInputStreamPtr &input)
 contructor
 ~WPS4Text ()
 destructor
void setListener (WPS4ContentListenerPtr &listen)
 sets the listener
int numPages () const
 returns the number of pages
void flushExtra ()
 sends the data which have not yet been sent to the listener

Protected Types

typedef bool(WPS4Text::* FDPParser )(long endPos, int &id, std::string &mess)
 callback when a new attribute is found in an FDPP/FDPC entry
typedef bool(WPS4Text::* DataParser )(long bot, long eot, int id, long endPos, std::string &mess)
 definition of the plc data parser (low level)

Protected Member Functions

WPSEntry getHeaderEntry () const
 returns the header entry (if such entry exists, if not returns an invalid entry)
WPSEntry getFooterEntry () const
 returns the footer entry (if such entry exists, if not returns an invalid entry)
WPSEntry getMainTextEntry () const
 returns the main text entry (if such entry exists, if not returns an invalid entry)
WPSEntry getAllTextEntry () const
 returns the text position
bool readText (WPSEntry const &entry)
 reads a text section and sends it to a listener
bool readEntries ()
 finds all text entries (TEXT, SHdr, SFtr, BTEC, BTEP, FTNp, FTNp, BKMK, FONT, CHRT)
bool readStructures ()
 parsed all the text entries
bool findFDPStructures (int which)
 finds the FDPC/FDPP structure using the BTEC/BTEP entries
bool findFDPStructuresByHand (int which)
 finds the FDPC/FDPP structure by searching after the text zone
bool readFDP (WPSEntry const &entry, std::vector< WPS4TextInternal::DataFOD > &fods, FDPParser parser)
 parses a FDPP or a FDPC entry (which contains a list of ATTR_TEXT/ATTR_PARAG with their definition ) and adds found data in listFODs
bool readPLC (WPSEntry const &zone, std::vector< long > &textPtrs, std::vector< long > &listValues, DataParser parser=0L)
 reads a PLC (Pointer List Composant ?) in zone entry
bool defDataParser (long bot, long eot, int id, long endPos, std::string &mess)
 default plc reader
bool readFontNames (WPSEntry const &entry)
 reads the font names
bool readFont (long endPos, int &id, std::string &mess)
 reads a font properties
void setProperty (WPS4TextInternal::Font const &font)
 sends a font to the listener
bool readParagraph (long endPos, int &id, std::string &mess)
 reads a paragraph properties
void setProperty (WPS4TextInternal::Paragraph const &para)
 sends a paragraph properties to the listener
bool readDosLink (WPSEntry const &entry)
 reads the ZZDLink ( a list of filename )
bool objectDataParser (long bot, long eot, int id, long endPos, std::string &mess)
 reads a object properties ( position in text, size and definition in file)
bool readFootNotes (WPSEntry const &ftnD, WPSEntry const &ftnP)
 reads the footnotes positions and definitions ( zones FTNd and FTNp)
bool footNotesDataParser (long bot, long eot, int id, long endPos, std::string &mess)
 reads a book mark property ( string)
bool bkmkDataParser (long bot, long eot, int id, long endPos, std::string &mess)
 reads a book mark property ( string)
bool dttmDataParser (long bot, long eot, int id, long endPos, std::string &mess)
 reads a date time property
int version () const
 returns the file version : 1-4
libwps::DebugFileascii ()
 returns the debug file

Protected Attributes

WPXInputStreamPtr m_input
 the main input
WPS4Parserm_mainParser
 the main parser
WPS4ContentListenerPtr m_listener
 the listener
shared_ptr
< WPS4TextInternal::State
m_state
 the internal state
libwps::DebugFilem_asciiFile
 the ascii file

Friends

class WPS4Parser

Detailed Description

The class which parses text zones in a pc MS Works document v1-4.

This class must be associated with a WPS4Parser. It finds and reads:

  • TEXT[3] : the text limits ( header, footer, main text with notes)
  • SHdr, SFtr : a string to store header/footer in v1-2 (?)
  • BTEC : the fonts properties
  • BTEP : the paragraph properties
  • FONT : the font names
  • FTNp, FTNd : the footnote positions (text position and text of notes)
  • BKMK : a comment field ( contain a string )
  • CHRT : a chart ( unknown format ) It reads:
  • DTTM : field contents ( only parsed)
  • EOBJ : the text position with the position and size of an object
Note:
It also reads the size of the document because this size is stored between the "entries" which defines the text positions and the BTEC positions...

Member Typedef Documentation

typedef bool(WPS4Text::* WPS4Text::DataParser)(long bot, long eot, int id, long endPos, std::string &mess) [protected]

definition of the plc data parser (low level)

Parameters:
inputthe file's input
endPosthe end of the properties' definition,
bot,\parameot defined the text zone corresponding to these properties
idthe number of this properties
messa string which can be filled to indicate unparsed data
typedef bool(WPS4Text::* WPS4Text::FDPParser)(long endPos, int &id, std::string &mess) [protected]

callback when a new attribute is found in an FDPP/FDPC entry

Returns:
true and filled id if this attribute can be parsed
Note:
mess can be filled to add a message in debugFile

Constructor & Destructor Documentation

WPS4Text::WPS4Text ( WPS4Parser parser,
WPXInputStreamPtr input 
)

contructor

destructor


Member Function Documentation

libwps::DebugFile& WPS4Text::ascii ( ) [inline, protected]

returns the debug file

Referenced by readDosLink(), readEntries(), readFDP(), readFontNames(), and readText().

bool WPS4Text::bkmkDataParser ( long  bot,
long  eot,
int  id,
long  endPos,
std::string &  mess 
) [protected]

reads a book mark property ( string)

Referenced by readStructures().

bool WPS4Text::defDataParser ( long  bot,
long  eot,
int  id,
long  endPos,
std::string &  mess 
) [protected]

default plc reader

Referenced by readPLC().

bool WPS4Text::dttmDataParser ( long  bot,
long  eot,
int  id,
long  endPos,
std::string &  mess 
) [protected]

reads a date time property

Referenced by readStructures().

bool WPS4Text::findFDPStructures ( int  which) [protected]

finds the FDPC/FDPP structure using the BTEC/BTEP entries

Parameters:
which== 0 means FDPP

Referenced by readStructures().

bool WPS4Text::findFDPStructuresByHand ( int  which) [protected]

finds the FDPC/FDPP structure by searching after the text zone

Parameters:
which== 0 means FDPP

Referenced by readStructures().

sends the data which have not yet been sent to the listener

bool WPS4Text::footNotesDataParser ( long  bot,
long  eot,
int  id,
long  endPos,
std::string &  mess 
) [protected]

reads a book mark property ( string)

Referenced by readFootNotes().

WPSEntry WPS4Text::getAllTextEntry ( ) const [protected]

returns the text position

WPSEntry WPS4Text::getFooterEntry ( ) const [protected]

returns the footer entry (if such entry exists, if not returns an invalid entry)

WPSEntry WPS4Text::getHeaderEntry ( ) const [protected]

returns the header entry (if such entry exists, if not returns an invalid entry)

WPSEntry WPS4Text::getMainTextEntry ( ) const [protected]

returns the main text entry (if such entry exists, if not returns an invalid entry)

int WPS4Text::numPages ( ) const

returns the number of pages

bool WPS4Text::objectDataParser ( long  bot,
long  eot,
int  id,
long  endPos,
std::string &  mess 
) [protected]

reads a object properties ( position in text, size and definition in file)

Referenced by readStructures().

bool WPS4Text::readDosLink ( WPSEntry const &  entry) [protected]

reads the ZZDLink ( a list of filename )

Referenced by readStructures().

bool WPS4Text::readEntries ( ) [protected]

finds all text entries (TEXT, SHdr, SFtr, BTEC, BTEP, FTNp, FTNp, BKMK, FONT, CHRT)

bool WPS4Text::readFDP ( WPSEntry const &  entry,
std::vector< WPS4TextInternal::DataFOD > &  fods,
WPS4Text::FDPParser  parser 
) [protected]

parses a FDPP or a FDPC entry (which contains a list of ATTR_TEXT/ATTR_PARAG with their definition ) and adds found data in listFODs

this data are stored similarly in Mac v4 and all PC version

Note:
only their contents definition differs

Referenced by readStructures().

bool WPS4Text::readFont ( long  endPos,
int &  id,
std::string &  mess 
) [protected]

reads a font properties

Referenced by readStructures().

bool WPS4Text::readFontNames ( WPSEntry const &  entry) [protected]

reads the font names

Referenced by readStructures().

bool WPS4Text::readFootNotes ( WPSEntry const &  ftnD,
WPSEntry const &  ftnP 
) [protected]

reads the footnotes positions and definitions ( zones FTNd and FTNp)

Referenced by readStructures().

bool WPS4Text::readParagraph ( long  endPos,
int &  id,
std::string &  mess 
) [protected]

reads a paragraph properties

Referenced by readStructures().

bool WPS4Text::readPLC ( WPSEntry const &  zone,
std::vector< long > &  textPtrs,
std::vector< long > &  listValues,
WPS4Text::DataParser  parser = 0L 
) [protected]

reads a PLC (Pointer List Composant ?) in zone entry

Parameters:
zonethe zone of the data in the file,
textPtrslists of offset in text zones where properties changes
listValueslists of properties values (filled only if values are simple types: int, ..)
parserthe parser to use to read the values

Referenced by findFDPStructures(), readFootNotes(), and readStructures().

bool WPS4Text::readStructures ( ) [protected]

parsed all the text entries

bool WPS4Text::readText ( WPSEntry const &  entry) [protected]

reads a text section and sends it to a listener

Referenced by flushExtra().

void WPS4Text::setListener ( WPS4ContentListenerPtr listen) [inline]

sets the listener

void WPS4Text::setProperty ( WPS4TextInternal::Font const &  font) [protected]

sends a font to the listener

Parameters:
fontthe font's properties

Referenced by flushExtra(), and readText().

void WPS4Text::setProperty ( WPS4TextInternal::Paragraph const &  para) [protected]

sends a paragraph properties to the listener

Parameters:
parathe paragraph's properties
int WPS4Text::version ( ) const [protected]

returns the file version : 1-4

Referenced by flushExtra(), footNotesDataParser(), readFDP(), readFont(), readFontNames(), readParagraph(), and readText().


Friends And Related Function Documentation

friend class WPS4Parser [friend]

Member Data Documentation

the ascii file

Referenced by ascii().


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