Quattro9Parser Class Reference documentation

Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
Quattro9Parser Class Referencefinal

This class parses Quattro Pro WP spreadsheet: .qpw. More...

`#include <Quattro9.h>`

Inheritance diagram for Quattro9Parser:

## Public Member Functions
| Quattro9Parser (RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN, char const *password=nullptr)
| constructor More...
| ~Quattro9Parser () final
| destructor More...
void | parse (librevenge::RVNGSpreadsheetInterface *documentInterface) final
| called by WPSDocument to parse the file More...
bool | checkHeader (WPSHeader *header, bool strict=false)
| checks if the document header is correct (or not) More...
Public Member Functions inherited from WKSParser
| WKSParser (RVNGInputStreamPtr &input, WPSHeaderPtr &header)
virtual | ~WKSParser ()

## Protected Member Functions
int | version () const
| return the file version More...
libwps_tools_win::Font::Type | getDefaultFontType () const
| returns the default font type, ie. More...
bool | getExternalFileName (int fId, librevenge::RVNGString &fName) const
| returns the name of the fId file More...
bool | getField (int fId, librevenge::RVNGString &text, QuattroFormulaInternal::CellReference &ref, librevenge::RVNGString const &fileName) const
| returns the text and cell of a field instruction More...
bool | getFont (int id, WPSFont &font) const
| returns the font corresponding to an id More...
Vec2f | getCellPosition (int sheetId, Vec2i const &cell) const
| returns the beginning position of a cell More...
bool | getColor (int id, WPSColor &color) const
| returns the color corresponding to an id More...
bool | getPattern (int id, WPSGraphicStyle::Pattern &pattern) const
| returns the pattern corresponding to a pattern id between 0 and 24 More...
bool | sendPageGraphics (int sheetId) const
| send the page graphic corresponding to a sheet More...
std::shared_ptr< WKSContentListener > | createListener (librevenge::RVNGSpreadsheetInterface *interface)
| creates the main listener More...
void | sendHeaderFooter (bool header)
| send the header/footer More...
bool | checkHeader (std::shared_ptr< WPSStream > stream, bool strict)
| checks if the document header is correct (or not) More...
bool | readZones ()
| finds the different zones in the main OLE stream (spreadsheet, chart, print, ...) More...
bool | readZone (std::shared_ptr< WPSStream > &stream)
| try to read a zone More...
bool | readPString (std::shared_ptr< WPSStream > const &stream, long endPos, Quattro9ParserInternal::TextEntry &entry)
| try to read a string: length[2bytes], unknow[bytes] followed by the string More...
bool | readFontNames (std::shared_ptr< WPSStream > const &stream)
| read a font name zone: zone 6 More...
bool | readFontStyles (std::shared_ptr< WPSStream > const &stream)
| read a font style zone: zone 7 More...
bool | readDocumentFields (std::shared_ptr< WPSStream > const &stream)
| read a zone 406 which contains a list of fields More...
bool | readDocumentStrings (std::shared_ptr< WPSStream > const &stream)
| read a zone 407 which contains a list of stream More...
bool | readTextStyles (std::shared_ptr< WPSStream > const &stream, long endPos, Quattro9ParserInternal::TextEntry &entry)
| read a text entry style zone More...
bool | readTextFontStyles (std::shared_ptr< WPSStream > const &stream, int dataSz, WPSFont &font)
| read a font style in a text entry zone More...
void | addDocumentStrings ()
| add the document strings to the spreadsheetParser More...
bool | parseOLEStream (RVNGInputStreamPtr input, std::string const &avoid="")
| try to parse the OLE stream(except the main stream) More...
Protected Member Functions inherited from WKSParser
RVNGInputStreamPtr & | getInput ()
void | resetInput (RVNGInputStreamPtr const &newInput)
RVNGInputStreamPtr | getFileInput ()
WPSHeaderPtr & | getHeader ()
int | version () const
void | setVersion (int vers)
libwps::DebugFile & | ascii ()
| a DebugFile used to write what we recognize when we parse the document More...

## Static Protected Member Functions
static bool | readFilePositions (std::shared_ptr< WPSStream > const &stream, long(&filePos)[2])
| read a zone which contains two files position (prev and next): zone 2,402,602,a02 More...
static bool | readOleLinkInfo (std::shared_ptr< WPSStream > stream)
| try to read the link info sub stream More...
static bool | readOleBOlePart (std::shared_ptr< WPSStream > stream)
| try to read the BOlePart sub stream: a zone which contains 5 long More...
static RVNGInputStreamPtr | decodeStream (RVNGInputStreamPtr input, std::vector< uint8_t > const &key)
| try to decode a stream, if successful, replace the stream'input by the new one More...

## Protected Attributes
std::shared_ptr< WKSContentListener > | m_listener
std::shared_ptr< Quattro9ParserInternal::State > | m_state
| the listener (if set) More...
std::shared_ptr< Quattro9Graph > | m_graphParser
| the graph manager More...
std::shared_ptr< Quattro9Spreadsheet > | m_spreadsheetParser
| the spreadsheet manager More...

## Friends
class | Quattro9ParserInternal::SubDocument
class | Quattro9Graph
class | Quattro9Spreadsheet

## Detailed Description

This class parses Quattro Pro WP spreadsheet: .qpw.

## Constructor & Destructor Documentation

## ◆ Quattro9Parser()

Quattro9Parser::Quattro9Parser | ( | RVNGInputStreamPtr & | input,
|  | WPSHeaderPtr & | header,
|  | libwps_tools_win::Font::Type | encoding = `libwps_tools_win::Font::UNKNOWN`,
|  | char const * | password = `nullptr`
| ) |  |

constructor

## ◆ ~Quattro9Parser()

Quattro9Parser::~Quattro9Parser | ( |  | ) |
| final

destructor

## Member Function Documentation

## ◆ addDocumentStrings()

void Quattro9Parser::addDocumentStrings | ( |  | ) |
| protected

add the document strings to the spreadsheetParser

Referenced by readZone().

## ◆ checkHeader() [1/2]

bool Quattro9Parser::checkHeader | ( | std::shared_ptr< WPSStream > | stream,
|  | bool | strict
| ) |  |
| protected

checks if the document header is correct (or not)

## ◆ checkHeader() [2/2]

bool Quattro9Parser::checkHeader | ( | WPSHeader * | header,
|  | bool | strict = `false`
| ) |  |

checks if the document header is correct (or not)

Referenced by libwps::WPSDocument::isFileFormatSupported(), and parse().

## ◆ createListener()

std::shared_ptr< WKSContentListener > Quattro9Parser::createListener | ( | librevenge::RVNGSpreadsheetInterface * | interface | ) |
| protected

creates the main listener

Referenced by parse().

## ◆ decodeStream()

RVNGInputStreamPtr Quattro9Parser::decodeStream | ( | RVNGInputStreamPtr | input,
|  | std::vector< uint8_t > const & | key
| ) |  |
| staticprotected

try to decode a stream, if successful, replace the stream'input by the new one

Referenced by readZone().

## ◆ getCellPosition()

Vec2f Quattro9Parser::getCellPosition | ( | int | sheetId,
|  | Vec2i const & | cell
| ) |  | const
| protected

returns the beginning position of a cell

Referenced by Quattro9Graph::sendOLE(), Quattro9Graph::sendShape(), and Quattro9Graph::sendTextbox().

## ◆ getColor()

bool Quattro9Parser::getColor | ( | int | id,
|  | WPSColor & | color
| ) |  | const
| protected

returns the color corresponding to an id

Referenced by Quattro9Spreadsheet::readCellStyles().

## ◆ getDefaultFontType()

libwps_tools_win::Font::Type Quattro9Parser::getDefaultFontType | ( |  | ) | const
| protected

returns the default font type, ie.

the encoding given by the constructor if given or the encoding deduced from the version.

Referenced by readDocumentFields(), Quattro9Graph::readTextboxStyle(), readTextFontStyles(), Quattro9Spreadsheet::sendCellContent(), and Quattro9Graph::sendTextbox().

## ◆ getExternalFileName()

bool Quattro9Parser::getExternalFileName | ( | int | fId,
|  | librevenge::RVNGString & | fName
| ) |  | const
| protected

returns the name of the fId file

Referenced by Quattro9Spreadsheet::readCellReference().

## ◆ getField()

bool Quattro9Parser::getField | ( | int | fId,
|  | librevenge::RVNGString & | text,
|  | QuattroFormulaInternal::CellReference & | ref,
|  | librevenge::RVNGString const & | fileName
| ) |  | const
| protected

returns the text and cell of a field instruction

Referenced by Quattro9Spreadsheet::readCellReference().

## ◆ getFont()

bool Quattro9Parser::getFont | ( | int | id,
|  | WPSFont & | font
| ) |  | const
| protected

returns the font corresponding to an id

Referenced by Quattro9Spreadsheet::readCellStyles().

## ◆ getPattern()

bool Quattro9Parser::getPattern | ( | int | id,
|  | WPSGraphicStyle::Pattern & | pattern
| ) |  | const
| protected

returns the pattern corresponding to a pattern id between 0 and 24

Referenced by Quattro9Spreadsheet::readCellStyles().

## ◆ parse()

void Quattro9Parser::parse | ( | librevenge::RVNGSpreadsheetInterface * | documentInterface | ) |
| finalvirtual

called by WPSDocument to parse the file

Implements WKSParser.

## ◆ parseOLEStream()

bool Quattro9Parser::parseOLEStream | ( | RVNGInputStreamPtr | input,
|  | std::string const & | avoid = `""`
| ) |  |
| protected

try to parse the OLE stream(except the main stream)

Referenced by readZones().

## ◆ readDocumentFields()

bool Quattro9Parser::readDocumentFields | ( | std::shared_ptr< WPSStream > const & | stream | ) |
| protected

read a zone 406 which contains a list of fields

Referenced by readZone().

## ◆ readDocumentStrings()

bool Quattro9Parser::readDocumentStrings | ( | std::shared_ptr< WPSStream > const & | stream | ) |
| protected

read a zone 407 which contains a list of stream

Referenced by readZone().

## ◆ readFilePositions()

bool Quattro9Parser::readFilePositions | ( | std::shared_ptr< WPSStream > const & | stream,
|  | long(&) | filePos[2]
| ) |  |
| staticprotected

read a zone which contains two files position (prev and next): zone 2,402,602,a02

Referenced by Quattro9Spreadsheet::readEndColumn(), Quattro9Spreadsheet::readEndSheet(), and readZone().

## ◆ readFontNames()

bool Quattro9Parser::readFontNames | ( | std::shared_ptr< WPSStream > const & | stream | ) |
| protected

read a font name zone: zone 6

Referenced by readZone().

## ◆ readFontStyles()

bool Quattro9Parser::readFontStyles | ( | std::shared_ptr< WPSStream > const & | stream | ) |
| protected

read a font style zone: zone 7

Referenced by readZone().

## ◆ readOleBOlePart()

bool Quattro9Parser::readOleBOlePart | ( | std::shared_ptr< WPSStream > | stream | ) |
| staticprotected

try to read the BOlePart sub stream: a zone which contains 5 long

Referenced by parseOLEStream().

## ◆ readOleLinkInfo()

bool Quattro9Parser::readOleLinkInfo | ( | std::shared_ptr< WPSStream > | stream | ) |
| staticprotected

try to read the link info sub stream

Referenced by parseOLEStream().

## ◆ readPString()

bool Quattro9Parser::readPString | ( | std::shared_ptr< WPSStream > const & | stream,
|  | long | endPos,
|  | Quattro9ParserInternal::TextEntry & | entry
| ) |  |
| protected

try to read a string: length[2bytes], unknow[bytes] followed by the string

Referenced by Quattro9Spreadsheet::readBeginSheet(), Quattro9Spreadsheet::readCellResult(), readDocumentFields(), readDocumentStrings(), readFontNames(), Quattro9Graph::readOLEName(), Quattro9Graph::readTextboxText(), and readZone().

## ◆ readTextFontStyles()

bool Quattro9Parser::readTextFontStyles | ( | std::shared_ptr< WPSStream > const & | stream,
|  | int | dataSz,
|  | WPSFont & | font
| ) |  |
| protected

read a font style in a text entry zone

Referenced by readTextStyles().

## ◆ readTextStyles()

bool Quattro9Parser::readTextStyles | ( | std::shared_ptr< WPSStream > const & | stream,
|  | long | endPos,
|  | Quattro9ParserInternal::TextEntry & | entry
| ) |  |
| protected

read a text entry style zone

Referenced by readPString().

## ◆ readZone()

bool Quattro9Parser::readZone | ( | std::shared_ptr< WPSStream > & | stream | ) |
| protected

try to read a zone

Referenced by checkHeader(), and readZones().

## ◆ readZones()

bool Quattro9Parser::readZones | ( |  | ) |
| protected

finds the different zones in the main OLE stream (spreadsheet, chart, print, ...)

Referenced by parse().

## ◆ sendHeaderFooter()

void Quattro9Parser::sendHeaderFooter | ( | bool | header | ) |
| protected

send the header/footer

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

## ◆ sendPageGraphics()

bool Quattro9Parser::sendPageGraphics | ( | int | sheetId | ) | const
| protected

send the page graphic corresponding to a sheet

Referenced by Quattro9Spreadsheet::sendSpreadsheet().

## ◆ version()

int Quattro9Parser::version | ( |  | ) | const
| protected

return the file version

Referenced by Quattro9Graph::version(), and Quattro9Spreadsheet::version().

## Friends And Related Function Documentation

## ◆ Quattro9Graph

friend class Quattro9Graph
| friend

## ◆ Quattro9ParserInternal::SubDocument

friend class Quattro9ParserInternal::SubDocument
| friend

## ◆ Quattro9Spreadsheet

friend class Quattro9Spreadsheet
| friend

## Member Data Documentation

## ◆ m_graphParser

std::shared_ptr<Quattro9Graph> Quattro9Parser::m_graphParser
| protected

the graph manager

Referenced by getColor(), getPattern(), parse(), parseOLEStream(), readZone(), readZones(), and sendPageGraphics().

## ◆ m_listener

std::shared_ptr<WKSContentListener> Quattro9Parser::m_listener
| protected

Referenced by parse(), and sendHeaderFooter().

## ◆ m_spreadsheetParser

std::shared_ptr<Quattro9Spreadsheet> Quattro9Parser::m_spreadsheetParser
| protected

the spreadsheet manager

Referenced by addDocumentStrings(), createListener(), getCellPosition(), parse(), readDocumentFields(), readZone(), and readZones().

## ◆ m_state

std::shared_ptr<Quattro9ParserInternal::State> Quattro9Parser::m_state
| protected

the listener (if set)

the internal state

Referenced by addDocumentStrings(), checkHeader(), createListener(), getDefaultFontType(), getExternalFileName(), getField(), getFont(), parseOLEStream(), readDocumentFields(), readDocumentStrings(), readFontNames(), readFontStyles(), readZone(), readZones(), sendHeaderFooter(), and version().

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

- Quattro9.h
- Quattro9.cpp