MsWks4Text Class Reference documentation

Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
MsWks4Text Class Reference

The class which parses text zones in a mac MS Works document v4. More...

`#include <MsWks4Text.hxx>`

## Classes
struct | DataFOD
| structure which retrieves data information which correspond to a text position More...

## Public Member Functions
| MsWks4Text (MsWksDocument &document)
| constructor
| ~MsWks4Text ()
| destructor
void | setDefault (MWAWFont const &font)
| sets the default font
int | numPages () const
| returns the number of pages
void | flushExtra (MWAWInputStreamPtr)
| sends the data which have not been sent: actually do nothing

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

## Protected Member Functions
bool | readStructures (MWAWInputStreamPtr input, bool mainOle)
| finds and parses all structures which correspond to the text
bool | readText (MWAWInputStreamPtr input, MWAWEntry const &entry, bool mainOle)
| reads a text section and send it to the listener
bool | readFootNote (MWAWInputStreamPtr input, int id)
| sends the text which corresponds to footnote id to the listner
bool | readPLC (MWAWInputStreamPtr input, MWAWEntry const &entry, std::vector< long > &textPtrs, std::vector< long > &listValues, DataParser parser=&MsWks4Text::defDataParser)
| reads a PLC (Pointer List Composant ?) in zone entry
bool | readSimplePLC (MWAWInputStreamPtr &input, MWAWEntry const &entry, std::vector< long > &textPtrs, std::vector< long > &listValues)
| reads a PLC (Pointer List Composant ?) in zone entry
bool | defDataParser (MWAWInputStreamPtr input, long endPos, long bot, long eot, int id, std::string &mess)
| the default parser (does nothing)
bool | readFontNames (MWAWInputStreamPtr input, MWAWEntry const &entry)
| reads the font names entry : FONT
bool | readFont (MWAWInputStreamPtr &input, long endPos, int &id, std::string &mess)
| reads a font properties
void | setProperty (MsWks4TextInternal::Paragraph const &tabs)
| sends a paragraph properties to the listener
bool | readParagraph (MWAWInputStreamPtr &input, long endPos, int &id, std::string &mess)
| reads a paragraph properties
bool | ftntDataParser (MWAWInputStreamPtr input, long endPos, long bot, long eot, int id, std::string &mess)
| parses the footnote position : FTNT
bool | eobjDataParser (MWAWInputStreamPtr input, long endPos, long bot, long eot, int id, std::string &mess)
| parses the object position : EOBJ
bool | toknDataParser (MWAWInputStreamPtr input, long endPos, long bot, long eot, int id, std::string &mess)
| parses the field properties entries : TOKN.
bool | pgdDataParser (MWAWInputStreamPtr input, long endPos, long, long, int id, std::string &mess)
| parses the pagebreak positin entries : PGD
void | flushNote (int noteId)
| sends to the listener the text which corresponds to noteId
std::vector< DataFOD > | mergeSortedLists (std::vector< DataFOD > const &lst1, std::vector< DataFOD > const &lst2) const
| function which takes two sorted list of attribute (by text position).
bool | readFDP (MWAWInputStreamPtr &input, MWAWEntry 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
bool | findFDPStructures (MWAWInputStreamPtr &input, int which)
| Fills the vector of (FDPCs/FDPPs) paragraph/characters strutures.
bool | findFDPStructuresByHand (MWAWInputStreamPtr &input, int which)
| Fills the vector of (FDPCs/FDPPs) paragraph/characters strutures, a function to call when the normal ways fails.

## Protected Attributes
MWAWParser * | m_mainParser
| the main parser;
MWAWParserStatePtr | m_parserState
| the parser state
MsWksDocument & | m_document
| the main document
MWAWEntry | m_textPositions
| an entry which corresponds to the complete text zone
std::shared_ptr< MsWks4TextInternal::State > | m_state
| the internal state
std::vector< DataFOD > | m_FODsList
| the list of a FOD
std::vector< MWAWEntry const * > | m_FDPCs
| the list of FDPC entries
std::vector< MWAWEntry const * > | m_FDPPs
| the list of FDPP entries

## Private Member Functions
| MsWks4Text (MsWks4Text const &orig)=delete
MsWks4Text & | operator= (MsWks4Text const &orig)=delete

## Friends
class | MsWks4Zone

## Detailed Description

The class which parses text zones in a mac MS Works document v4.

This class must be associated with a MsWks4Zone. It reads the entries:

- TEXT : the text strings
- FONT : the fonts name
- FDPC, BTEC : the fonts properties
- FDPP, BTEP : the paragraph properties
- FTNT : the footnote definition
- PGD : the page break (only parsed)
- TOKN : the field properties (pagenumber, date, ...)

## Member Typedef Documentation

## ◆ DataParser

typedef bool(MsWks4Text::* MsWks4Text::DataParser) (MWAWInputStreamPtr input, long endPos, long bot, long eot, int id, std::string &mess)
| protected

definition of the plc data parser (low level)

Parameters

  endPos | the end of the properties' definition,
  bot | defined the begin of the text zone corresponding to these properties
  eot | defined the end of the text zone corresponding to these properties
  id | the number of this properties
  mess | a string which can be filled to indicate unparsed data

## ◆ FDPParser

typedef bool(MsWks4Text::* MsWks4Text::FDPParser) (MWAWInputStreamPtr &input, long endPos, int &id, std::string &mess)
| protected

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

Parameters

  input | defines the input
  endPos | the last position in the input

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

## ◆ MsWks4Text() [1/2]

MsWks4Text::MsWks4Text | ( | MsWksDocument & | document | ) |
| explicit

constructor

## ◆ ~MsWks4Text()

MsWks4Text::~MsWks4Text | ( |  | ) |

destructor

## ◆ MsWks4Text() [2/2]

MsWks4Text::MsWks4Text | ( | MsWks4Text const & | orig | ) |
| privatedelete

## Member Function Documentation

## ◆ defDataParser()

bool MsWks4Text::defDataParser | ( | MWAWInputStreamPtr | input,
|  | long | endPos,
|  | long | bot,
|  | long | eot,
|  | int | id,
|  | std::string & | mess
| ) |  |
| protected

the default parser (does nothing)

## ◆ eobjDataParser()

bool MsWks4Text::eobjDataParser | ( | MWAWInputStreamPtr | input,
|  | long | endPos,
|  | long | bot,
|  | long | eot,
|  | int | id,
|  | std::string & | mess
| ) |  |
| protected

parses the object position : EOBJ

Referenced by readStructures().

## ◆ findFDPStructures()

bool MsWks4Text::findFDPStructures | ( | MWAWInputStreamPtr & | input,
|  | int | which
| ) |  |
| protected

Fills the vector of (FDPCs/FDPPs) paragraph/characters strutures.

Uses the entry BTEC/BTEP : the normal ways, and calls readSimplePLC on each entry to check that the parsing is correct

Parameters

  input | the file input
  which | set to 0 for paragraphs structures and to 1 for characters structures

Referenced by readStructures().

## ◆ findFDPStructuresByHand()

bool MsWks4Text::findFDPStructuresByHand | ( | MWAWInputStreamPtr & | input,
|  | int | which
| ) |  |
| protected

Fills the vector of (FDPCs/FDPPs) paragraph/characters strutures, a function to call when the normal ways fails.

Uses all entries FDPCs/FDPPs and calls readSimplePLC on each entry to check that the parsing is correct.

Parameters

  input | the file input
  which | set to 0 for paragraphs structures and to 1 for characters structures

Referenced by readStructures().

## ◆ flushExtra()

void MsWks4Text::flushExtra | ( | MWAWInputStreamPtr |  | ) |
| inline

sends the data which have not been sent: actually do nothing

## ◆ flushNote()

void MsWks4Text::flushNote | ( | int | noteId | ) |
| protected

sends to the listener the text which corresponds to noteId

## ◆ ftntDataParser()

bool MsWks4Text::ftntDataParser | ( | MWAWInputStreamPtr | input,
|  | long | endPos,
|  | long | bot,
|  | long | eot,
|  | int | id,
|  | std::string & | mess
| ) |  |
| protected

parses the footnote position : FTNT

Referenced by readStructures().

## ◆ mergeSortedLists()

std::vector< MsWks4Text::DataFOD > MsWks4Text::mergeSortedLists | ( | std::vector< DataFOD > const & | lst1,
|  | std::vector< DataFOD > const & | lst2
| ) |  | const
| protected

function which takes two sorted list of attribute (by text position).

Returns
  a list of attribute

Referenced by readPLC(), and readStructures().

## ◆ numPages()

int MsWks4Text::numPages | ( |  | ) | const

returns the number of pages

## ◆ operator=()

MsWks4Text & MsWks4Text::operator= | ( | MsWks4Text const & | orig | ) |
| privatedelete

## ◆ pgdDataParser()

bool MsWks4Text::pgdDataParser | ( | MWAWInputStreamPtr | input,
|  | long | endPos,
|  | long | ,
|  | long | ,
|  | int | id,
|  | std::string & | mess
| ) |  |
| protected

parses the pagebreak positin entries : PGD

Note
  the read data are not used to create the document

Referenced by readStructures().

## ◆ readFDP()

bool MsWks4Text::readFDP | ( | MWAWInputStreamPtr & | input,
|  | MWAWEntry const & | entry,
|  | std::vector< DataFOD > & | fods,
|  | MsWks4Text::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

Referenced by readStructures().

## ◆ readFont()

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

reads a font properties

Referenced by readStructures().

## ◆ readFontNames()

bool MsWks4Text::readFontNames | ( | MWAWInputStreamPtr | input,
|  | MWAWEntry const & | entry
| ) |  |
| protected

reads the font names entry : FONT

Referenced by readStructures().

## ◆ readFootNote()

bool MsWks4Text::readFootNote | ( | MWAWInputStreamPtr | input,
|  | int | id
| ) |  |
| protected

sends the text which corresponds to footnote id to the listner

## ◆ readParagraph()

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

reads a paragraph properties

Referenced by readStructures().

## ◆ readPLC()

bool MsWks4Text::readPLC | ( | MWAWInputStreamPtr | input,
|  | MWAWEntry const & | entry,
|  | std::vector< long > & | textPtrs,
|  | std::vector< long > & | listValues,
|  | MsWks4Text::DataParser | parser = `&MsWks4Text::defDataParser`
| ) |  |
| protected

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

Parameters

  input | the file's input
  entry | the zone which contains the plc
  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

Referenced by readSimplePLC(), and readStructures().

## ◆ readSimplePLC()

bool MsWks4Text::readSimplePLC | ( | MWAWInputStreamPtr & | input,
|  | MWAWEntry const & | entry,
|  | std::vector< long > & | textPtrs,
|  | std::vector< long > & | listValues
| ) |  |
| inlineprotected

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

Parameters

  input | the file's input
  entry | the zone which contains the plc
  textPtrs | lists of offset in text zones where properties changes
  listValues | lists of properties values (filled only if values are simple types: int, ..)

Referenced by findFDPStructures().

## ◆ readStructures()

bool MsWks4Text::readStructures | ( | MWAWInputStreamPtr | input,
|  | bool | mainOle
| ) |  |
| protected

finds and parses all structures which correspond to the text

More precisely the TEXT, FONT, FDPC/FDPP, BTEC/BTEP, FTNT, PGD, TOKN entries

eobj and RBIL seems linked ( and associate with a 0xc6 symbol in file) RBIL: can store a chart, a calendar, ...

## ◆ readText()

bool MsWks4Text::readText | ( | MWAWInputStreamPtr | input,
|  | MWAWEntry const & | entry,
|  | bool | mainOle
| ) |  |
| protected

reads a text section and send it to the listener

Referenced by readFootNote().

## ◆ setDefault()

void MsWks4Text::setDefault | ( | MWAWFont const & | font | ) |

sets the default font

## ◆ setProperty()

void MsWks4Text::setProperty | ( | MsWks4TextInternal::Paragraph const & | tabs | ) |
| protected

sends a paragraph properties to the listener

Referenced by readText().

## ◆ toknDataParser()

bool MsWks4Text::toknDataParser | ( | MWAWInputStreamPtr | input,
|  | long | endPos,
|  | long | bot,
|  | long | eot,
|  | int | id,
|  | std::string & | mess
| ) |  |
| protected

parses the field properties entries : TOKN.

Note
  the read data are not used to create the document

Referenced by readStructures().

## Friends And Related Function Documentation

## ◆ MsWks4Zone

friend class MsWks4Zone
| friend

## Member Data Documentation

## ◆ m_document

MsWksDocument& MsWks4Text::m_document
| protected

the main document

Referenced by findFDPStructures(), findFDPStructuresByHand(), readFDP(), readFontNames(), readParagraph(), readPLC(), readStructures(), readText(), and toknDataParser().

## ◆ m_FDPCs

std::vector<MWAWEntry const *> MsWks4Text::m_FDPCs
| protected

the list of FDPC entries

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

## ◆ m_FDPPs

std::vector<MWAWEntry const *> MsWks4Text::m_FDPPs
| protected

the list of FDPP entries

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

## ◆ m_FODsList

std::vector<DataFOD> MsWks4Text::m_FODsList
| protected

the list of a FOD

Referenced by numPages(), readPLC(), readStructures(), and readText().

## ◆ m_mainParser

MWAWParser* MsWks4Text::m_mainParser
| protected

the main parser;

Referenced by MsWks4Text().

## ◆ m_parserState

MWAWParserStatePtr MsWks4Text::m_parserState
| protected

the parser state

Referenced by MsWks4Text(), readFont(), readFontNames(), readFootNote(), readParagraph(), readText(), and setProperty().

## ◆ m_state

std::shared_ptr<MsWks4TextInternal::State> MsWks4Text::m_state
| mutableprotected

the internal state

Referenced by eobjDataParser(), ftntDataParser(), MsWks4Text(), numPages(), readFont(), readFontNames(), readFootNote(), readParagraph(), readPLC(), readStructures(), readText(), setDefault(), and setProperty().

## ◆ m_textPositions

MWAWEntry MsWks4Text::m_textPositions
| protected

an entry which corresponds to the complete text zone

Referenced by mergeSortedLists(), readFDP(), readFootNote(), readPLC(), readStructures(), readText(), and toknDataParser().

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

- MsWks4Text.hxx
- MsWks4Text.cxx