MsWksDocument Class Reference

the main class to read/store generic data of a MsWorks document v1-v3 More...

`#include <MsWksDocument.hxx>`

## Classes
struct | Zone
| a zone of a MsWksDocument ( main, header, footer ) More...

## Public Types
enum | ZoneType { Z_MAIN , Z_HEADER , Z_FOOTER , Z_NONE }
| the different type of zone (v1-v3) More...

## Public Member Functions
| MsWksDocument (MWAWInputStreamPtr const &input, MWAWParser &parser)
| constructor
virtual | ~MsWksDocument ()
| destructor
int | version () const
| returns the document's version
void | setVersion (int vers)
| sets the document's version
MWAWDocument::Kind | getKind () const
| returns the document's kind
void | setKind (MWAWDocument::Kind kind)
| sets the document's kind
MWAWInputStreamPtr & | getInput ()
| returns the actual input
MWAWParser & | getMainParser ()
| returns the main parser
std::shared_ptr< MsWksGraph > | getGraphParser ()
| returns the graph parser
std::shared_ptr< MsWks3Text > | getTextParser3 ()
| returns the text parser (for v1-v3 document)
std::shared_ptr< MsWks4Text > | getTextParser4 ()
| returns the text parser (for v4 document)
libmwaw::DebugFile & | ascii ()
| a DebugFile used to write what we recognize when we parse the document
bool | checkHeader3 (MWAWHeader *header, bool strict=false)
| checks if the file header corresponds to a v1-v3 document (or not)
long | getLengthOfFileHeader3 () const
| returns the length of the file header of a v1-v3 document (if know)
bool | readPrintInfo ()
| read the print info zone (v1-v3)
bool | readDocumentInfo (long sz=-1)
| try to read the documentinfo ( v1-v3)
bool | readZone (Zone &zone)
| try to read a generic zone
bool | readGroupHeaderFooter (bool header, int check)
| try to read a header/footer group
bool | createOLEZones (MWAWInputStreamPtr input)
| finds the different OLE zones
std::vector< std::string > const & | getUnparsedOLEZones () const
| returns the list of unparsed OLE zones
bool | hasHeader () const
| returns true if the document has some header ( found by checkHeader3)
bool | hasFooter () const
| returns true if the document has some footer ( found by checkHeader3)
float | getHeaderFooterHeight (bool header) const
| returns the header/footer height (found by readGroupHeaderFooter)
void | getPageSpanList (std::vector< MWAWPageSpan > &pagesList, int &numPages)
| get the page span list and the number of page for a v1-v3 document
bool | getColor (int id, MWAWColor &col, int vers)
| returns the color which correspond to an index
std::vector< MWAWColor > const & | getPalette (int vers)
| returns a list of color corresponding to a version
std::multimap< int, Zone > & | getTypeZoneMap ()
| returns the document entry map of a v1-v3 document
Zone | getZone (ZoneType type) const
| returns the zone corresponding to a zoneType (v1-v3 document)
int | getNewZoneId () const
| returns a free zone'id
std::multimap< std::string, MWAWEntry > & | getEntryMap ()
| returns the document entry map of a v4 document
void | sendZone (int zoneType)
| try to send a zone (v1-v3 document)
void | newPage (int page, bool softBreak=false)
| tries to create a new page
void | sendFootnoteContent (int noteId)
| try to send a footnote content (v4 document)
void | sendFootnote (int id)
| tries to send a footnote
void | sendText (int id)
| try to send a text zone (v1-v3 document)
void | sendOLE (int id, MWAWPosition const &pos, MWAWGraphicStyle const &style)
| send an OLE zone
void | sendRBIL (int id, MWAWVec2i const &sz)
| send a rbil zone
void | sendTextbox (MWAWEntry const &entry, std::string const &frame)
| send a textbox

## Public Attributes
std::shared_ptr< MWAWParserState > | m_parserState
| the parser state

## Protected Types
typedef void(MWAWParser::* | NewPage) (int page, bool softBreak)
| callback used to send a page break

## Protected Member Functions
bool | readCellInFormula (MWAWCellContent::FormulaInstruction &instr, bool is2D)
| reads a cell
bool | readDBString (long endPos, std::string &res)
| try to read a string
bool | readDBNumber (long endPos, double &res, bool &isNan, std::string &str)
| try to read a number
bool | readFormula (long endPos, MWAWCellContent &content, std::string &extra)
void | initAsciiFile (std::string const &name)
| inits the ascii file

## Protected Attributes
std::shared_ptr< MsWksDocumentInternal::State > | m_state
| the state
MWAWParser * | m_parser
| the main parser
MsWksDocument * | m_parentDocument
| the parent document (if this is not the main document)
MWAWInputStreamPtr | m_input
| the input which can be an OLE in MSWorks 4 file
libmwaw::DebugFile | m_asciiFile
| the debug file of the actual input
std::shared_ptr< MsWksGraph > | m_graphParser
| the graph document
std::shared_ptr< MsWks3Text > | m_textParser3
| the text document (for v1-3 document)
std::shared_ptr< MsWks4Text > | m_textParser4
| the text document (for v4 document)
NewPage | m_newPage
| the new page callback

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

## Friends
class | MsWksDocumentInternal::SubDocument
class | MsWksParser
class | MsWks4Zone
class | MsWksDBParser
class | MsWksDRParser
class | MsWksSSParser

## Detailed Description

the main class to read/store generic data of a MsWorks document v1-v3

## Member Typedef Documentation

## ◆ NewPage

typedef void(MWAWParser::* MsWksDocument::NewPage) (int page, bool softBreak)
| protected

callback used to send a page break

## Member Enumeration Documentation

## ◆ ZoneType

enum MsWksDocument::ZoneType

the different type of zone (v1-v3)

Enumerator
Z_MAIN |
Z_HEADER |
Z_FOOTER |
Z_NONE |

## Constructor & Destructor Documentation

## ◆ MsWksDocument() [1/2]

MsWksDocument::MsWksDocument | ( | MWAWInputStreamPtr const & | input,
|  | MWAWParser & | parser )

constructor

Referenced by MsWksDocument(), and operator=().

## ◆ ~MsWksDocument()

MsWksDocument::~MsWksDocument | ( |  | ) |
| virtual

destructor

## ◆ MsWksDocument() [2/2]

MsWksDocument::MsWksDocument | ( | MsWksDocument const & | orig | ) |
| private delete

## Member Function Documentation

## ◆ ascii()

libmwaw::DebugFile & MsWksDocument::ascii | ( |  | ) |
| inline

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

Referenced by checkHeader3(), readDocumentInfo(), readGroupHeaderFooter(), and readPrintInfo().

## ◆ checkHeader3()

bool MsWksDocument::checkHeader3 | ( | MWAWHeader * | header,
|  | bool | strict = false )

checks if the file header corresponds to a v1-v3 document (or not)

## ◆ createOLEZones()

bool MsWksDocument::createOLEZones | ( | MWAWInputStreamPtr | input | ) |

finds the different OLE zones

## ◆ getColor()

bool MsWksDocument::getColor | ( | int | id,
|  | MWAWColor & | col,
|  | int | vers )

returns the color which correspond to an index

## ◆ getEntryMap()

std::multimap< std::string, MWAWEntry > & MsWksDocument::getEntryMap | ( |  | ) |

returns the document entry map of a v4 document

## ◆ getGraphParser()

std::shared_ptr< MsWksGraph > MsWksDocument::getGraphParser | ( |  | ) |
| inline

returns the graph parser

## ◆ getHeaderFooterHeight()

float MsWksDocument::getHeaderFooterHeight | ( | bool | header | ) | const

returns the header/footer height (found by readGroupHeaderFooter)

## ◆ getInput()

MWAWInputStreamPtr & MsWksDocument::getInput | ( |  | ) |
| inline

returns the actual input

Referenced by checkHeader3(), getPageSpanList(), readCellInFormula(), readDBNumber(), readDBString(), readDocumentInfo(), readFormula(), readGroupHeaderFooter(), readPrintInfo(), readZone(), and sendFootnote().

## ◆ getKind()

MWAWDocument::Kind MsWksDocument::getKind | ( |  | ) | const

returns the document's kind

## ◆ getLengthOfFileHeader3()

long MsWksDocument::getLengthOfFileHeader3 | ( |  | ) | const

returns the length of the file header of a v1-v3 document (if know)

## ◆ getMainParser()

MWAWParser & MsWksDocument::getMainParser | ( |  | ) |
| inline

returns the main parser

## ◆ getNewZoneId()

int MsWksDocument::getNewZoneId | ( |  | ) | const

returns a free zone'id

## ◆ getPageSpanList()

void MsWksDocument::getPageSpanList | ( | std::vector< MWAWPageSpan > & | pagesList,
|  | int & | numPages )

get the page span list and the number of page for a v1-v3 document

## ◆ getPalette()

std::vector< MWAWColor > const & MsWksDocument::getPalette | ( | int | vers | ) |

returns a list of color corresponding to a version

Referenced by getColor().

## ◆ getTextParser3()

std::shared_ptr< MsWks3Text > MsWksDocument::getTextParser3 | ( |  | ) |

returns the text parser (for v1-v3 document)

Referenced by readDocumentInfo(), and readGroupHeaderFooter().

## ◆ getTextParser4()

std::shared_ptr< MsWks4Text > MsWksDocument::getTextParser4 | ( |  | ) |

returns the text parser (for v4 document)

## ◆ getTypeZoneMap()

std::multimap< int, MsWksDocument::Zone > & MsWksDocument::getTypeZoneMap | ( |  | ) |

returns the document entry map of a v1-v3 document

Referenced by readGroupHeaderFooter().

## ◆ getUnparsedOLEZones()

std::vector< std::string > const & MsWksDocument::getUnparsedOLEZones | ( |  | ) | const

returns the list of unparsed OLE zones

## ◆ getZone()

MsWksDocument::Zone MsWksDocument::getZone | ( | MsWksDocument::ZoneType | type | ) | const

returns the zone corresponding to a zoneType (v1-v3 document)

Referenced by getPageSpanList(), and sendZone().

## ◆ hasFooter()

bool MsWksDocument::hasFooter | ( |  | ) | const

returns true if the document has some footer ( found by checkHeader3)

## ◆ hasHeader()

bool MsWksDocument::hasHeader | ( |  | ) | const

returns true if the document has some header ( found by checkHeader3)

## ◆ initAsciiFile()

void MsWksDocument::initAsciiFile | ( | std::string const & | name | ) |
| protected

inits the ascii file

## ◆ newPage()

void MsWksDocument::newPage | ( | int | page,
|  | bool | softBreak = false )

tries to create a new page

## ◆ operator=()

MsWksDocument & MsWksDocument::operator= | ( | MsWksDocument const & | orig | ) |
| private delete

## ◆ readCellInFormula()

bool MsWksDocument::readCellInFormula | ( | MWAWCellContent::FormulaInstruction & | instr,
|  | bool | is2D )
| protected

reads a cell

Referenced by readFormula().

## ◆ readDBNumber()

bool MsWksDocument::readDBNumber | ( | long | endPos,
|  | double & | res,
|  | bool & | isNan,
|  | std::string & | str )
| protected

try to read a number

Referenced by readFormula().

## ◆ readDBString()

bool MsWksDocument::readDBString | ( | long | endPos,
|  | std::string & | res )
| protected

try to read a string

Referenced by readDBNumber().

## ◆ readDocumentInfo()

bool MsWksDocument::readDocumentInfo | ( | long | sz = -1 | ) |

try to read the documentinfo ( v1-v3)

Referenced by readZone().

## ◆ readFormula()

bool MsWksDocument::readFormula | ( | long | endPos,
|  | MWAWCellContent & | content,
|  | std::string & | extra )
| protected

## ◆ readGroupHeaderFooter()

bool MsWksDocument::readGroupHeaderFooter | ( | bool | header,
|  | int | check )

try to read a header/footer group

## ◆ readPrintInfo()

bool MsWksDocument::readPrintInfo | ( |  | ) |

read the print info zone (v1-v3)

Referenced by readDocumentInfo().

## ◆ readZone()

bool MsWksDocument::readZone | ( | MsWksDocument::Zone & | zone | ) |

try to read a generic zone

Referenced by readGroupHeaderFooter().

## ◆ sendFootnote()

void MsWksDocument::sendFootnote | ( | int | id | ) |

tries to send a footnote

## ◆ sendFootnoteContent()

void MsWksDocument::sendFootnoteContent | ( | int | noteId | ) |

try to send a footnote content (v4 document)

## ◆ sendOLE()

void MsWksDocument::sendOLE | ( | int | id,
|  | MWAWPosition const & | pos,
|  | MWAWGraphicStyle const & | style )

send an OLE zone

## ◆ sendRBIL()

void MsWksDocument::sendRBIL | ( | int | id,
|  | MWAWVec2i const & | sz )

send a rbil zone

## ◆ sendText()

void MsWksDocument::sendText | ( | int | id | ) |

try to send a text zone (v1-v3 document)

Referenced by sendZone().

## ◆ sendTextbox()

void MsWksDocument::sendTextbox | ( | MWAWEntry const & | entry,
|  | std::string const & | frame )

send a textbox

## ◆ sendZone()

void MsWksDocument::sendZone | ( | int | zoneType | ) |

try to send a zone (v1-v3 document)

## ◆ setKind()

void MsWksDocument::setKind | ( | MWAWDocument::Kind | kind | ) |

sets the document's kind

## ◆ setVersion()

void MsWksDocument::setVersion | ( | int | vers | ) |

sets the document's version

Referenced by checkHeader3().

## ◆ version()

int MsWksDocument::version | ( |  | ) | const

returns the document's version

Referenced by checkHeader3(), readDocumentInfo(), and readGroupHeaderFooter().

## Friends And Related Symbol Documentation

## ◆ MsWks4Zone

friend class MsWks4Zone
| friend

Referenced by createOLEZones(), MsWks4Zone, and sendTextbox().

## ◆ MsWksDBParser

friend class MsWksDBParser
| friend

Referenced by MsWksDBParser.

## ◆ MsWksDocumentInternal::SubDocument

friend class MsWksDocumentInternal::SubDocument
| friend

## ◆ MsWksDRParser

friend class MsWksDRParser
| friend

Referenced by MsWksDRParser.

## ◆ MsWksParser

friend class MsWksParser
| friend

Referenced by MsWksParser.

## ◆ MsWksSSParser

friend class MsWksSSParser
| friend

Referenced by MsWksSSParser.

## Member Data Documentation

## ◆ m_asciiFile

libmwaw::DebugFile MsWksDocument::m_asciiFile
| protected

the debug file of the actual input

Referenced by ascii(), initAsciiFile(), and MsWksDocument().

## ◆ m_graphParser

std::shared_ptr<MsWksGraph> MsWksDocument::m_graphParser
| protected

the graph document

Referenced by getGraphParser(), getPageSpanList(), MsWksDocument(), readZone(), sendRBIL(), and sendZone().

## ◆ m_input

MWAWInputStreamPtr MsWksDocument::m_input
| protected

the input which can be an OLE in MSWorks 4 file

Referenced by getInput(), initAsciiFile(), and MsWksDocument().

## ◆ m_newPage

NewPage MsWksDocument::m_newPage
| protected

the new page callback

Referenced by MsWksDocument(), and newPage().

## ◆ m_parentDocument

MsWksDocument* MsWksDocument::m_parentDocument
| protected

the parent document (if this is not the main document)

Referenced by MsWksDocument(), newPage(), sendFootnote(), sendOLE(), and sendTextbox().

## ◆ m_parser

MWAWParser* MsWksDocument::m_parser
| protected

the main parser

Referenced by createOLEZones(), getMainParser(), MsWksDocument(), and newPage().

## ◆ m_parserState

std::shared_ptr<MWAWParserState> MsWksDocument::m_parserState

the parser state

Referenced by createOLEZones(), getPageSpanList(), MsWksDocument(), readDocumentInfo(), readFormula(), readPrintInfo(), sendFootnote(), sendFootnoteContent(), sendOLE(), sendTextbox(), setVersion(), and version().

## ◆ m_state

std::shared_ptr<MsWksDocumentInternal::State> MsWksDocument::m_state
| protected

the state

Referenced by checkHeader3(), createOLEZones(), getEntryMap(), getHeaderFooterHeight(), getKind(), getLengthOfFileHeader3(), getNewZoneId(), getPageSpanList(), getPalette(), getTypeZoneMap(), getUnparsedOLEZones(), getZone(), hasFooter(), hasHeader(), MsWksDocument(), readGroupHeaderFooter(), sendFootnoteContent(), sendOLE(), sendTextbox(), and setKind().

## ◆ m_textParser3

std::shared_ptr<MsWks3Text> MsWksDocument::m_textParser3
| protected

the text document (for v1-3 document)

Referenced by getPageSpanList(), getTextParser3(), MsWksDocument(), and sendText().

## ◆ m_textParser4

std::shared_ptr<MsWks4Text> MsWksDocument::m_textParser4
| protected

the text document (for v4 document)

Referenced by getPageSpanList(), getTextParser4(), and MsWksDocument().

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

- MsWksDocument.hxx
- MsWksDocument.cxx