MsWksDocument Class Reference documentation

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

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

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

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

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

## 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

## ◆ ~MsWksDocument()

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

destructor

## ◆ MsWksDocument() [2/2]

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

## 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(), MsWksGraph::getEntryPicture(), MsWksGraph::getEntryPictureV1(), MsWksTable::readChart(), readDocumentInfo(), MsWks4Text::readFDP(), MsWks4Text::readFontNames(), readGroupHeaderFooter(), MsWks3Text::readParagraph(), MsWks4Text::readParagraph(), MsWksGraph::readPictureV4(), MsWks4Text::readPLC(), readPrintInfo(), MsWksGraph::readRB(), MsWksTable::readTable(), MsWksGraph::readText(), MsWks4Text::readText(), MsWksGraph::send(), MsWks3Text::sendText(), and MsWks4Text::toknDataParser().

## ◆ 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

Referenced by MsWks3Text::readFont(), MsWksGraph::readPictHeader(), and MsWksTable::readTable().

## ◆ getEntryMap()

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

returns the document entry map of a v4 document

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

## ◆ 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(), MsWks3Text::createZones(), MsWksGraph::getEntryPicture(), MsWksGraph::getEntryPictureV1(), getPageSpanList(), readCellInFormula(), MsWksTable::readChart(), readDBNumber(), readDBString(), readDocumentInfo(), MsWks3Text::readFont(), MsWksGraph::readFont(), readFormula(), MsWksGraph::readGradient(), MsWksGraph::readGroup(), readGroupHeaderFooter(), MsWks3Text::readHeaderFooterString(), MsWks3Text::readParagraph(), MsWksGraph::readPictHeader(), readPrintInfo(), MsWksTable::readTable(), MsWksGraph::readText(), readZone(), MsWks3Text::readZoneHeader(), MsWksGraph::send(), MsWksTable::sendChart(), sendFootnote(), MsWksGraph::sendGroup(), MsWksGraph::sendGroupChild(), MsWksGraph::sendObjects(), MsWks3Text::sendText(), and MsWks3Text::updateNotes().

## ◆ 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(), and MsWksGraph::send().

## ◆ 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

Referenced by newPage(), MsWks4Text::readText(), and MsWks3Text::send().

## ◆ operator=()

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

## ◆ 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

Referenced by MsWks4Text::readText(), and sendFootnote().

## ◆ sendFootnoteContent()

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

try to send a footnote content (v4 document)

Referenced by MsWksDocumentInternal::SubDocument::parse().

## ◆ sendOLE()

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

send an OLE zone

Referenced by MsWksGraph::send(), and sendOLE().

## ◆ sendRBIL()

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

send a rbil zone

Referenced by MsWks4Text::readText().

## ◆ sendText()

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

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

Referenced by MsWksDocumentInternal::SubDocument::parse(), and sendZone().

## ◆ sendTextbox()

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

send a textbox

Referenced by MsWksDocumentInternal::SubDocument::parse(), MsWksGraph::sendFrameText(), and sendTextbox().

## ◆ sendZone()

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

try to send a zone (v1-v3 document)

Referenced by MsWksDocumentInternal::SubDocument::parse().

## ◆ 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 Function Documentation

## ◆ MsWks4Zone

friend class MsWks4Zone
| friend

Referenced by createOLEZones().

## ◆ MsWksDBParser

friend class MsWksDBParser
| friend

## ◆ MsWksDocumentInternal::SubDocument

friend class MsWksDocumentInternal::SubDocument
| friend

## ◆ MsWksDRParser

friend class MsWksDRParser
| friend

## ◆ MsWksParser

friend class MsWksParser
| friend

## ◆ MsWksSSParser

friend class MsWksSSParser
| friend

## Member Data Documentation

## ◆ m_asciiFile

libmwaw::DebugFile MsWksDocument::m_asciiFile
| protected

the debug file of the actual input

Referenced by ascii(), and initAsciiFile().

## ◆ 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(), and initAsciiFile().

## ◆ m_newPage

NewPage MsWksDocument::m_newPage
| protected

the new page callback

Referenced by newPage().

## ◆ m_parentDocument

MsWksDocument* MsWksDocument::m_parentDocument
| protected

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

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

## ◆ m_parser

MWAWParser* MsWksDocument::m_parser
| protected

the main parser

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

## ◆ m_parserState

std::shared_ptr<MWAWParserState> MsWksDocument::m_parserState

the parser state

Referenced by createOLEZones(), getPageSpanList(), 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(), and sendText().

## ◆ m_textParser4

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

the text document (for v4 document)

Referenced by getPageSpanList(), and getTextParser4().

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

- MsWksDocument.hxx
- MsWksDocument.cxx