WPS8Text Class Reference documentation

Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
WPS8Text Class Reference

`#include <WPS8Text.h>`

Inheritance diagram for WPS8Text:

## Public Member Functions
| WPS8Text (WPS8Parser &parser)
| ~WPS8Text () override
void | setListener (WPSContentListenerPtr &listen)
| sets the listener More...
int | numPages () const
| returns the number of pages More...
void | flushExtra ()
| sends the data which have not yet been sent to the listener More...
bool | readStructures ()
| finds all entries which correspond to the text data, parses them and stores data More...
int | getNumTextZones () const
| returns the number of different text zones More...
int | getTextZoneType (int typeId) const
| returns the type of a text zone More...
WPSEntry | getHeaderEntry () const
| returns the header entry (if such entry exists, if not returns an invalid entry) More...
WPSEntry | getFooterEntry () const
| returns the footer entry (if such entry exists, if not returns an invalid entry) More...
WPSEntry | getTextEntry () const
| returns the main zone entry (if such entry exists, if not returns an invalid entry) More...
WPSEntry | getEntry (int strsId) const
| returns ith zone entry (if such entry exists, if not returns an invalid entry) More...
void | readText (WPSEntry const &entry)
| reads a text section and sends it to a listener More...
void | readTextInCell (int strsId, int cellId)
| reads a cell section and sends it to a listener More...
Public Member Functions inherited from WPSTextParser
virtual | ~WPSTextParser ()
| virtual destructor More...
int | version () const
| returns the file version More...
RVNGInputStreamPtr & | getInput ()
| returns the actual input More...

## 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) More...
typedef bool(WPS8Text::* | EndDataParser) (long endPos, std::vector< long > const &textPtrs)
| definition of the last part of plc data parser (low level) More...
Protected Types inherited from WPSTextParser
typedef bool(WPSTextParser::* | FDPParser) (long endPos, int &id, std::string &mess)
| callback when a new attribute is found in an FDPP/FDPC entry More...

## Protected Member Functions
WPS8Parser & | mainParser ()
| return the main parser More...
WPS8Parser const & | mainParser () const
| return the main parser More...
bool | readFont (long endPos, int &id, std::string &mess)
| reads a font properties More...
bool | readParagraph (long endPos, int &id, std::string &mess)
| the paragraph More...
bool | readString (RVNGInputStreamPtr input, long page_size, librevenge::RVNGString &res)
| reads a string More...
long | readUTF16LE (RVNGInputStreamPtr input, long endPos, uint16_t firstC)
| reads a utf16 character, More...
bool | readNotes (WPSEntry const &entry)
| the footnote ( FTN or EDN ) More...
void | createNotesCorrespondance ()
| creates the notes association : text and notes positions More...
bool | readPLC (WPSEntry const &entry, std::vector< long > &textPtrs, std::vector< long > &listValues, DataParser parser=&WPS8Text::defDataParser, EndDataParser endParser=nullptr)
| reads a PLC (Pointer List Composant ?) in zone entry More...
bool | defDataParser (long, long, int, WPS8Struct::FileData const &data, std::string &mess)
| default parser More...
bool | textZonesDataParser (long bot, long eot, int nId, WPS8Struct::FileData const &data, std::string &mess)
| the text zones parser: STRS More...
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, ... More...
bool | tokenEndDataParser (long endPage, std::vector< long > const &textPtrs)
| reads a field type : TOKN zone More...
bool | bmktEndDataParser (long endPage, std::vector< long > const &textPtrs)
| reads a field type : BMKT zone More...
Protected Member Functions inherited from WPSTextParser
| WPSTextParser (WPSParser &parser, RVNGInputStreamPtr &input)
| constructor More...
std::multimap< std::string, WPSEntry > & | getNameEntryMap ()
| returns the map type->entry More...
std::multimap< std::string, WPSEntry > const & | getNameEntryMap () const
| returns the map type->entry More...
std::vector< DataFOD > | mergeSortedFODLists (std::vector< DataFOD > const &lst1, std::vector< DataFOD > const &lst2) const
| function which takes two sorted list of attribute (by text position). More...
bool | readFDP (WPSEntry const &entry, std::vector< 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 More...
libwps::DebugFile & | ascii ()
| a DebugFile used to write what we recognize when we parse the document More...

## Protected Attributes
WPSContentListenerPtr | m_listener
| the listener More...
std::shared_ptr< WPS8TextStyle > | m_styleParser
| the graph parser More...
std::shared_ptr< WPS8TextInternal::State > | m_state
| the internal state More...
Protected Attributes inherited from WPSTextParser
int | m_version
| the file version More...
RVNGInputStreamPtr | m_input
| the main input More...
WPSParser & | m_mainParser
| pointer to the main zone parser; More...
WPSEntry | m_textPositions
| an entry which corresponds to the complete text zone More...
std::vector< DataFOD > | m_FODList
| the list of a FOD More...
libwps::DebugFile & | m_asciiFile
| the ascii file More...

## Friends
class | WPS8TextInternal::SubDocument
class | WPS8Parser
class | WPS8TextStyle

## Member Typedef Documentation

## ◆ DataParser

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

  bot | defines the begin of the text zone corresponding to these properties
  eot | define the end of the text zone corresponding to these properties
  id | the number of this properties
  data | a reference to store the parsed data
  mess | a string which can be filled to indicate unparsed data

## ◆ EndDataParser

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

  endPos | the end of the properties' definition,
  textPtrs | the list of text positions

## Constructor & Destructor Documentation

## ◆ WPS8Text()

WPS8Text::WPS8Text | ( | WPS8Parser & | parser | ) |
| explicit

## ◆ ~WPS8Text()

WPS8Text::~WPS8Text | ( |  | ) |
| override

## Member Function Documentation

## ◆ bmktEndDataParser()

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

## ◆ createNotesCorrespondance()

void WPS8Text::createNotesCorrespondance | ( |  | ) |
| protected

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

## ◆ defDataParser()

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

default parser

Referenced by readStructures().

## ◆ flushExtra()

void WPS8Text::flushExtra | ( |  | ) |

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

## ◆ getEntry()

WPSEntry WPS8Text::getEntry | ( | int | strsId | ) | const

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

Referenced by createNotesCorrespondance().

## ◆ getFooterEntry()

WPSEntry WPS8Text::getFooterEntry | ( |  | ) | const

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

## ◆ getHeaderEntry()

WPSEntry WPS8Text::getHeaderEntry | ( |  | ) | const

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

## ◆ getNumTextZones()

int WPS8Text::getNumTextZones | ( |  | ) | const

returns the number of different text zones

## ◆ getTextEntry()

WPSEntry WPS8Text::getTextEntry | ( |  | ) | const

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

## ◆ getTextZoneType()

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

## ◆ mainParser() [1/2]

WPS8Parser& WPS8Text::mainParser | ( |  | ) |
| inlineprotected

return the main parser

Referenced by readText().

## ◆ mainParser() [2/2]

WPS8Parser const& WPS8Text::mainParser | ( |  | ) | const
| inlineprotected

return the main parser

## ◆ numPages()

int WPS8Text::numPages | ( |  | ) | const

returns the number of pages

## ◆ objectDataParser()

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

## ◆ readFont()

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

reads a font properties

Referenced by WPS8TextStyle::readStructures().

## ◆ readNotes()

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

## ◆ readParagraph()

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

the paragraph

Referenced by WPS8TextStyle::readStructures().

## ◆ readPLC()

bool WPS8Text::readPLC | ( | WPSEntry const & | entry,
|  | std::vector< long > & | textPtrs,
|  | std::vector< long > & | listValues,
|  | WPS8Text::DataParser | parser = `&WPS8Text::defDataParser`,
|  | WPS8Text::EndDataParser | endParser = `nullptr`
| ) |  |
| protected

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

Parameters

  entry | the file zone
  textPtrs | lists of offset in text zones where properties changes
  listValues | lists of properties values (filled only if values are simple types: int, ..)
  parser | the parser to use to read the values
  endParser | the parser to use to read remaining data

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

## ◆ readString()

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

reads a string

Referenced by bmktEndDataParser(), WPS8TextStyle::readSTSH(), and tokenEndDataParser().

## ◆ readStructures()

bool WPS8Text::readStructures | ( |  | ) |

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

create the main structures

## ◆ readText()

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

## ◆ readTextInCell()

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

reads a cell section and sends it to a listener

## ◆ readUTF16LE()

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

## ◆ setListener()

void WPS8Text::setListener | ( | WPSContentListenerPtr & | listen | ) |

sets the listener

## ◆ textZonesDataParser()

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

## ◆ tokenEndDataParser()

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

## ◆ WPS8Parser

friend class WPS8Parser
| friend

## ◆ WPS8TextInternal::SubDocument

friend class WPS8TextInternal::SubDocument
| friend

## ◆ WPS8TextStyle

friend class WPS8TextStyle
| friend

Referenced by WPS8Text().

## Member Data Documentation

## ◆ m_listener

WPSContentListenerPtr WPS8Text::m_listener
| protected

the listener

Referenced by flushExtra(), readText(), readTextInCell(), and setListener().

## ◆ m_state

std::shared_ptr<WPS8TextInternal::State> WPS8Text::m_state
| mutableprotected

the internal state

Referenced by bmktEndDataParser(), createNotesCorrespondance(), flushExtra(), getEntry(), getFooterEntry(), getHeaderEntry(), getNumTextZones(), getTextEntry(), getTextZoneType(), objectDataParser(), readNotes(), readStructures(), readText(), readTextInCell(), tokenEndDataParser(), and WPS8Text().

## ◆ m_styleParser

std::shared_ptr<WPS8TextStyle> WPS8Text::m_styleParser
| protected

the graph parser

Referenced by readFont(), readParagraph(), readStructures(), readText(), setListener(), and WPS8Text().

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

- WPS8Text.h
- WPS8Text.cpp