WPS8Text Class Reference

#include <WPS8Text.h>

Inheritance diagram for WPS8Text:
WPSTextParser

List of all members.

Public Member Functions

 WPS8Text (WPS8Parser &parser)
 ~WPS8Text ()
void setListener (WPSContentListenerPtr &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
bool readStructures ()
 finds all entries which correspond to the text data, parses them and stores data
int getNumTextZones () const
 returns the number of different text zones
int getTextZoneType (int typeId) const
 returns the type of a text zone
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 getTextEntry () const
 returns the main zone entry (if such entry exists, if not returns an invalid entry)
WPSEntry getEntry (int strsId) const
 returns ith zone entry (if such entry exists, if not returns an invalid entry)
void readText (WPSEntry const &entry)
 reads a text section and sends it to a listener
void readTextInCell (int strsId, int cellId)
 reads a cell section and sends it to a listener

Protected Types

typedef bool(WPS8Text::* DataParser )(long bot, long eot, int id, WPS8Struct::FileData const &data, std::string &mess)
 definition of the plc data parser (low level)
typedef bool(WPS8Text::* EndDataParser )(long endPos, std::vector< long > const &textPtrs)
 definition of the last part of plc data parser (low level)

Protected Member Functions

WPS8ParsermainParser ()
 return the main parser
WPS8Parser const & mainParser () const
 return the main parser
bool readFont (long endPos, int &id, std::string &mess)
 reads a font properties
bool readParagraph (long endPos, int &id, std::string &mess)
 the paragraph
bool readString (RVNGInputStreamPtr input, long page_size, librevenge::RVNGString &res)
 reads a string
long readUTF16LE (RVNGInputStreamPtr input, long endPos, uint16_t firstC)
 reads a utf16 character,
bool readNotes (WPSEntry const &entry)
 the footnote ( FTN or EDN )
void createNotesCorrespondance ()
 creates the notes association : text and notes positions
bool readPLC (WPSEntry const &entry, std::vector< long > &textPtrs, std::vector< long > &listValues, DataParser parser=&WPS8Text::defDataParser, EndDataParser endParser=0L)
 reads a PLC (Pointer List Composant ?) in zone entry
bool defDataParser (long, long, int, WPS8Struct::FileData const &data, std::string &mess)
 default parser
bool textZonesDataParser (long bot, long eot, int nId, WPS8Struct::FileData const &data, std::string &mess)
 the text zones parser: STRS
bool objectDataParser (long bot, long eot, int id, WPS8Struct::FileData const &data, std::string &mess)
 reads a EOBJ properties: an object id and its size, ...
bool tokenEndDataParser (long endPage, std::vector< long > const &textPtrs)
 reads a field type : TOKN zone
bool bmktEndDataParser (long endPage, std::vector< long > const &textPtrs)
 reads a field type : BMKT zone

Protected Attributes

WPSContentListenerPtr m_listener
 the listener
shared_ptr< WPS8TextStylem_styleParser
 the graph parser
shared_ptr
< WPS8TextInternal::State
m_state
 the internal state

Friends

class WPS8TextInternal::SubDocument
class WPS8Parser
class WPS8TextStyle

Member Typedef Documentation

typedef bool(WPS8Text::* WPS8Text::DataParser)(long bot, long eot, int id, WPS8Struct::FileData const &data, std::string &mess) [protected]

definition of the plc data parser (low level)

Parameters:
botdefines the begin of the text zone corresponding to these properties
eotdefine the end of the text zone corresponding to these properties
idthe number of this properties
dataa reference to store the parsed data
messa string which can be filled to indicate unparsed data
typedef bool(WPS8Text::* WPS8Text::EndDataParser)(long endPos, std::vector< long > const &textPtrs) [protected]

definition of the last part of plc data parser (low level)

Parameters:
endPosthe end of the properties' definition,
textPtrsthe list of text positions

Constructor & Destructor Documentation


Member Function Documentation

bool WPS8Text::bmktEndDataParser ( long  endPage,
std::vector< long > const &  textPtrs 
) [protected]

reads a field type : BMKT zone

Warning:
the read data are NOT used

Referenced by readStructures().

creates the notes association : text and notes positions

Note:
must be called after all notes have been created

we can now creates the link position -> notes

Referenced by readStructures().

bool WPS8Text::defDataParser ( long  ,
long  ,
int  ,
WPS8Struct::FileData const &  data,
std::string &  mess 
) [protected]

default parser

Referenced by readStructures().

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

WPSEntry WPS8Text::getEntry ( int  strsId) const

returns ith zone entry (if such entry exists, if not returns an invalid entry)

Referenced by createNotesCorrespondance().

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

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

returns the number of different text zones

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

int WPS8Text::getTextZoneType ( int  typeId) const

returns the type of a text zone

1: mainzone, 2: footnote, 3: endnote, 4: ???, 5: text in table/textbox 6: header, 7: footer

WPS8Parser& WPS8Text::mainParser ( ) [inline, protected]

return the main parser

Referenced by readText().

WPS8Parser const& WPS8Text::mainParser ( ) const [inline, protected]

return the main parser

int WPS8Text::numPages ( ) const

returns the number of pages

bool WPS8Text::objectDataParser ( long  bot,
long  eot,
int  id,
WPS8Struct::FileData const &  data,
std::string &  mess 
) [protected]

reads a EOBJ properties: an object id and its size, ...

Referenced by readStructures().

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

reads a font properties

bool WPS8Text::readNotes ( WPSEntry const &  entry) [protected]

the footnote ( FTN or EDN )

Note:
this function must be called after the creation of the text zones

Referenced by readStructures().

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

the paragraph

Referenced by WPS8TextStyle::readStructures().

bool WPS8Text::readPLC ( WPSEntry const &  entry,
std::vector< long > &  textPtrs,
std::vector< long > &  listValues,
WPS8Text::DataParser  parser = &WPS8Text::defDataParser,
WPS8Text::EndDataParser  endParser = 0L 
) [protected]

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

Parameters:
entrythe file zone
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
endParserthe parser to use to read remaining data

Referenced by WPS8TextStyle::findFDPStructures(), and readStructures().

bool WPS8Text::readString ( RVNGInputStreamPtr  input,
long  page_size,
librevenge::RVNGString &  res 
) [protected]

finds all entries which correspond to the text data, parses them and stores data

create the main structures

void WPS8Text::readText ( WPSEntry const &  entry)

reads a text section and sends it to a listener

Read the range of the document text using previously-read formatting information, up to but excluding entry.end().

Referenced by flushExtra(), WPS8TextInternal::SubDocument::parse(), and readTextInCell().

void WPS8Text::readTextInCell ( int  strsId,
int  cellId 
)

reads a cell section and sends it to a listener

long WPS8Text::readUTF16LE ( RVNGInputStreamPtr  input,
long  endPos,
uint16_t  firstC 
) [protected]

reads a utf16 character,

Returns:
0xfffd if an error

CHECKME: for Symbol font, we must probably convert 0xF0xx and 0x00xx in a 0x03yy symbol :-~

Referenced by readString(), and readText().

sets the listener

bool WPS8Text::textZonesDataParser ( long  bot,
long  eot,
int  nId,
WPS8Struct::FileData const &  data,
std::string &  mess 
) [protected]

the text zones parser: STRS

Referenced by readStructures().

bool WPS8Text::tokenEndDataParser ( long  endPage,
std::vector< long > const &  textPtrs 
) [protected]

reads a field type : TOKN zone

Referenced by readStructures().


Friends And Related Function Documentation

friend class WPS8Parser [friend]
friend class WPS8TextInternal::SubDocument [friend]
friend class WPS8TextStyle [friend]

Referenced by WPS8Text().


Member Data Documentation

shared_ptr<WPS8TextStyle> WPS8Text::m_styleParser [protected]

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