WKS4Parser Class Reference documentation

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

This class parses Microsoft Works spreadsheet or a database file. More...

`#include <WKS4.h>`

Inheritance diagram for WKS4Parser:

## Public Member Functions
| WKS4Parser (RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN, char const *password=nullptr)
| constructor
| ~WKS4Parser () override
| destructor
void | parse (librevenge::RVNGSpreadsheetInterface *documentInterface) final
| called by WPSDocument to parse the file
bool | checkHeader (WPSHeader *header, bool strict=false)
| checks if the document header is correct (or not)
bool | readCString (librevenge::RVNGString &string, long maxSize)
| try to read a basic C string, knowing the maximum size
Public Member Functions inherited from WKSParser
| WKSParser (RVNGInputStreamPtr &input, WPSHeaderPtr &header)
virtual | ~WKSParser ()

## Protected Member Functions
bool | checkFilePosition (long pos)
| return true if the pos is in the file, update the file size if need
int | version () const
| return the file version
libwps::WPSCreator | creator () const
| return the file creator
libwps_tools_win::Font::Type | getDefaultFontType () const
| returns the default font type, ie.
libwps::WPSCreator | getCreator () const
| returns the creator
bool | getColor (int id, WPSColor &color) const
| returns the color corresponding to an id
bool | getFont (int id, WPSFont &font, libwps_tools_win::Font::Type &type) const
| returns the font corresponding to an id
librevenge::RVNGString | getSheetName (int id) const
| returns the name of the id's spreadsheet
std::shared_ptr< WKSContentListener > | createListener (librevenge::RVNGSpreadsheetInterface *interface)
| creates the main listener
void | sendHeaderFooter (bool header)
| send the header/footer
bool | parseFormatStream ()
| check for the existence of a format stream, if it exists, parse it
void | resetMainInput (RVNGInputStreamPtr newInput)
| reset the main input
bool | readZones ()
| finds the different zones (spreadsheet, chart, print, ...)
bool | readZone ()
| reads a zone
bool | readZoneQuattro ()
| reads a Quattro Pro zone
bool | readFont ()
| reads a mswork font
bool | readPrnt ()
| reads a printer data ?
bool | readPrn2 ()
| reads another printer data. Seem simillar to ZZPrnt
bool | readHeaderFooter (bool header)
| reads the header/footer
bool | readFieldName ()
| read a list of field name + ...
bool | readWindowRecord ()
| reads windows record 0:7|0:9
bool | readUnknown1 ()
| reads some unknown spreadsheet zones 0:18|0:19|0:20|0:27|0:2a
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

## Static Protected Member Functions
static RVNGInputStreamPtr | decodeStream (RVNGInputStreamPtr input, long endPos, std::vector< uint8_t > const &key)
| try to decode a stream, if successful, replace the stream'input by the new one

## Protected Attributes
std::shared_ptr< WKSContentListener > | m_listener
std::shared_ptr< WKS4ParserInternal::State > | m_state
| the listener (if set)
std::shared_ptr< WKS4Chart > | m_chartParser
| the chart manager
std::shared_ptr< WKS4Spreadsheet > | m_spreadsheetParser
| the spreadsheet manager

## Friends
class | WKS4ParserInternal::SubDocument
class | WKS4Chart
class | WKS4Spreadsheet

## Detailed Description

This class parses Microsoft Works spreadsheet or a database file.

## Constructor & Destructor Documentation

## ◆ WKS4Parser()

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

constructor

## ◆ ~WKS4Parser()

WKS4Parser::~WKS4Parser | ( |  | ) |
| override

destructor

## Member Function Documentation

## ◆ checkFilePosition()

bool WKS4Parser::checkFilePosition | ( | long | pos | ) |
| protected

return true if the pos is in the file, update the file size if need

Referenced by checkHeader(), readCString(), readZone(), readZoneQuattro(), and readZones().

## ◆ checkHeader()

bool WKS4Parser::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 > WKS4Parser::createListener | ( | librevenge::RVNGSpreadsheetInterface * | interface | ) |
| protected

creates the main listener

Referenced by parse().

## ◆ creator()

libwps::WPSCreator WKS4Parser::creator | ( |  | ) | const
| protected

return the file creator

## ◆ decodeStream()

RVNGInputStreamPtr WKS4Parser::decodeStream | ( | RVNGInputStreamPtr | input,
|  | long | endPos,
|  | 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().

## ◆ getColor()

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

returns the color corresponding to an id

## ◆ getCreator()

libwps::WPSCreator WKS4Parser::getCreator | ( |  | ) | const
| protected

returns the creator

## ◆ getDefaultFontType()

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

returns the default font type, ie.

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

Referenced by readCString(), and readFont().

## ◆ getFont()

bool WKS4Parser::getFont | ( | int | id,
|  | WPSFont & | font,
|  | libwps_tools_win::Font::Type & | type ) const
| protected

returns the font corresponding to an id

## ◆ getSheetName()

librevenge::RVNGString WKS4Parser::getSheetName | ( | int | id | ) | const
| protected

returns the name of the id's spreadsheet

## ◆ parse()

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

called by WPSDocument to parse the file

Implements WKSParser.

## ◆ parseFormatStream()

bool WKS4Parser::parseFormatStream | ( |  | ) |
| protected

check for the existence of a format stream, if it exists, parse it

Referenced by parse().

## ◆ readCString()

bool WKS4Parser::readCString | ( | librevenge::RVNGString & | string,
|  | long | maxSize )

try to read a basic C string, knowing the maximum size

Referenced by readFieldName(), readHeaderFooter(), and readZone().

## ◆ readFieldName()

bool WKS4Parser::readFieldName | ( |  | ) |
| protected

read a list of field name + ...

Referenced by readZone().

## ◆ readFont()

bool WKS4Parser::readFont | ( |  | ) |
| protected

reads a mswork font

Referenced by readZone().

## ◆ readHeaderFooter()

bool WKS4Parser::readHeaderFooter | ( | bool | header | ) |
| protected

reads the header/footer

Referenced by readZone().

## ◆ readPrn2()

bool WKS4Parser::readPrn2 | ( |  | ) |
| protected

reads another printer data. Seem simillar to ZZPrnt

Referenced by readZone().

## ◆ readPrnt()

bool WKS4Parser::readPrnt | ( |  | ) |
| protected

reads a printer data ?

Referenced by readZone().

## ◆ readUnknown1()

bool WKS4Parser::readUnknown1 | ( |  | ) |
| protected

reads some unknown spreadsheet zones 0:18|0:19|0:20|0:27|0:2a

Note
  this zones seems to consist of a list of flags potentially followed by other data

Referenced by readZone().

## ◆ readWindowRecord()

bool WKS4Parser::readWindowRecord | ( |  | ) |
| protected

reads windows record 0:7|0:9

Referenced by readZone().

## ◆ readZone()

bool WKS4Parser::readZone | ( |  | ) |
| protected

reads a zone

Referenced by checkHeader(), and readZones().

## ◆ readZoneQuattro()

bool WKS4Parser::readZoneQuattro | ( |  | ) |
| protected

reads a Quattro Pro zone

Referenced by readZones().

## ◆ readZones()

bool WKS4Parser::readZones | ( |  | ) |
| protected

finds the different zones (spreadsheet, chart, print, ...)

Referenced by parse().

## ◆ resetMainInput()

void WKS4Parser::resetMainInput | ( | RVNGInputStreamPtr | newInput | ) |
| protected

reset the main input

Referenced by readZone().

## ◆ sendHeaderFooter()

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

send the header/footer

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

## ◆ version()

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

return the file version

Referenced by readZones().

## Friends And Related Symbol Documentation

## ◆ WKS4Chart

friend class WKS4Chart
| friend

Referenced by WKS4Chart, and WKS4Parser().

## ◆ WKS4ParserInternal::SubDocument

friend class WKS4ParserInternal::SubDocument
| friend

## ◆ WKS4Spreadsheet

friend class WKS4Spreadsheet
| friend

Referenced by WKS4Parser(), and WKS4Spreadsheet.

## Member Data Documentation

## ◆ m_chartParser

std::shared_ptr<WKS4Chart> WKS4Parser::m_chartParser
| protected

the chart manager

Referenced by parse(), readZone(), resetMainInput(), and WKS4Parser().

## ◆ m_listener

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

Referenced by parse(), sendHeaderFooter(), and WKS4Parser().

## ◆ m_spreadsheetParser

std::shared_ptr<WKS4Spreadsheet> WKS4Parser::m_spreadsheetParser
| protected

the spreadsheet manager

Referenced by getSheetName(), parse(), readZone(), readZones(), resetMainInput(), and WKS4Parser().

## ◆ m_state

std::shared_ptr<WKS4ParserInternal::State> WKS4Parser::m_state
| protected

the listener (if set)

the internal state

Referenced by checkFilePosition(), checkHeader(), createListener(), creator(), getColor(), getCreator(), getDefaultFontType(), getFont(), parse(), parseFormatStream(), readFieldName(), readFont(), readHeaderFooter(), readPrnt(), readZone(), readZones(), sendHeaderFooter(), version(), and WKS4Parser().

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

- WKS4.h
- WKS4.cpp