LotusParser Class Referencefinal

This class parses a wk3,wk4,123 Lotus spreadsheet. More...

#include <Lotus.h>

Inheritance diagram for LotusParser:
WKSParser

Classes

 basic struct used to store link More...

Public Member Functions

 LotusParser (RVNGInputStreamPtr &input, WPSHeaderPtr &header, char const *password=nullptr)
 constructor
 ~LotusParser () final
 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)
Public Member Functions inherited from WKSParser
 WKSParser (RVNGInputStreamPtr &input, WPSHeaderPtr &header)
virtual ~WKSParser ()

Protected Member Functions

int version () const
 return the file version
bool getFont (int id, WPSFont &font) const
 returns the font corresponding to an id
Link const * getLink (std::string const &lId) const
 returns a link corresponding to an id or nullptr
librevenge::RVNGString getStringForLMBCS (std::string const &text) const
 returns the string corresponding to a LMBCS sequence
std::vector< uint32_t > getUnicodeVectorForLMBCS (std::string const &text) const
 returns the unicode list corresponding to a LMBCS sequence
std::string getDebugStringForLMBCS (std::string const &text) const
 small debug function used to print text with format sequence
void sendText (RVNGInputStreamPtr &input, WPSEntry const &entry) const
 try to send a LBMCS text
bool sendChart (int cId, WPSPosition const &pos, WPSGraphicStyle const &style)
 try to send a chart
bool hasGraphics (int sheetId) const
 return true if the sheet sheetId has some graphic
void sendGraphics (int sheetId)
 send the graphics corresponding to a sheetId
bool getLeftTopPosition (Vec2i const &cell, int spreadsheet, Vec2f &pos) const
 returns the left top position of a cell
librevenge::RVNGString getSheetName (int id) const
 returns the name of the id's spreadsheet
bool updateEmbeddedObject (int id, WPSEmbeddedObject &object) const
 try to retrieve the content of a graphic, knowing it local id
bool createZones ()
 try to parse the different zones
bool createListener (librevenge::RVNGSpreadsheetInterface *interface)
 creates the main listener
bool parseFormatStream ()
 check for the existence of a format stream, if it exists, parse it
bool checkHeader (std::shared_ptr< WPSStream > stream, bool mainStream, bool strict)
 checks if the document header is correct (or not)
bool readZones (std::shared_ptr< WPSStream > stream)
 finds the different zones (spreadsheet, chart, print, ...)
bool readExtFormats (std::shared_ptr< WPSStream > stream)
 parse the extended formats zones 1B
bool readZone (std::shared_ptr< WPSStream > &stream)
 reads a zone
bool readZone1 (std::shared_ptr< WPSStream > stream)
 reads a zone of type 1: 123 files
bool readSheetZone (std::shared_ptr< WPSStream > stream)
 reads a zone of type 2: 123 files
bool readZone4 (std::shared_ptr< WPSStream > stream)
 reads a zone of type 4: 123 files
bool readChartZone (std::shared_ptr< WPSStream > stream)
 reads a zone of type 5: 123 files
bool readRefZone (std::shared_ptr< WPSStream > stream)
 reads a zone of type 6: 123 files
bool readZone8 (std::shared_ptr< WPSStream > stream)
 reads a zone of type 8: 123 files
bool readSheetSize (std::shared_ptr< WPSStream > stream, long endPos, int &row, int &col, int &sheet)
 reads a basic sheet size : mainly for debugging
bool readMacFontName (std::shared_ptr< WPSStream > stream, long endPos)
 reads a mac font name
bool readFMTStyleName (std::shared_ptr< WPSStream > stream)
 reads a format style name: b6
bool readLinkZone (std::shared_ptr< WPSStream > stream)
 reads a link
bool readDocumentInfoMac (std::shared_ptr< WPSStream > stream, long endPos)
 reads a mac document info zone: zone 1b, then 2af8
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 bool readZone7 (std::shared_ptr< WPSStream > stream)
 reads a zone of type 7: 123 files
static bool readVersionZone (std::shared_ptr< WPSStream > stream)
 reads a zone of type a: 123 files
static bool readZoneV3 (std::shared_ptr< WPSStream > stream)
 parse a wk123 zone
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
static std::vector< uint8_t > retrievePasswordKeys (std::vector< uint8_t > const &fileKeys)
 try to guess a password knowing its file keys. Returns the keys if it founds a valid password

Protected Attributes

std::shared_ptr< WKSContentListener > m_listener
std::shared_ptr< LotusParserInternal::State > m_state
 the listener (if set)
std::shared_ptr< LotusStyleManager > m_styleManager
 the style manager
std::shared_ptr< LotusChart > m_chartParser
 the chart manager
std::shared_ptr< LotusGraph > m_graphParser
 the graph manager
std::shared_ptr< LotusSpreadsheet > m_spreadsheetParser
 the spreadsheet manager
std::shared_ptr< WPSOLE1Parser > m_ole1Parser
 the ole1 parser

Friends

class LotusParserInternal::SubDocument
class LotusChart
class LotusGraph
class LotusSpreadsheet
class LotusStyleManager

Detailed Description

This class parses a wk3,wk4,123 Lotus spreadsheet.

Constructor & Destructor Documentation

◆ LotusParser()

LotusParser::LotusParser ( RVNGInputStreamPtr & input,
WPSHeaderPtr & header,
char const * password = nullptr )

constructor

◆ ~LotusParser()

LotusParser::~LotusParser ( )
final

destructor

Member Function Documentation

◆ checkHeader() [1/2]

bool LotusParser::checkHeader ( std::shared_ptr< WPSStream > stream,
bool mainStream,
bool strict )
protected

checks if the document header is correct (or not)

◆ checkHeader() [2/2]

bool LotusParser::checkHeader ( WPSHeader * header,
bool strict = false )

checks if the document header is correct (or not)

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

◆ createListener()

bool LotusParser::createListener ( librevenge::RVNGSpreadsheetInterface * interface)
protected

creates the main listener

Referenced by parse().

◆ createZones()

bool LotusParser::createZones ( )
protected

try to parse the different zones

Referenced by parse().

◆ decodeStream()

RVNGInputStreamPtr LotusParser::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().

◆ getDebugStringForLMBCS()

std::string LotusParser::getDebugStringForLMBCS ( std::string const & text) const
protected

small debug function used to print text with format sequence

Referenced by readChartZone(), readExtFormats(), readFMTStyleName(), readLinkZone(), readMacFontName(), readRefZone(), readSheetZone(), readZone(), and readZone4().

◆ getFont()

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

returns the font corresponding to an id

Referenced by sendText().

◆ getLeftTopPosition()

bool LotusParser::getLeftTopPosition ( Vec2i const & cell,
int spreadsheet,
Vec2f & pos ) const
protected

returns the left top position of a cell

◆ getLink()

LotusParser::Link const * LotusParser::getLink ( std::string const & lId) const
protected

returns a link corresponding to an id or nullptr

◆ getSheetName()

librevenge::RVNGString LotusParser::getSheetName ( int id) const
protected

returns the name of the id's spreadsheet

◆ getStringForLMBCS()

librevenge::RVNGString LotusParser::getStringForLMBCS ( std::string const & text) const
protected

returns the string corresponding to a LMBCS sequence

Referenced by readMacFontName().

◆ getUnicodeVectorForLMBCS()

std::vector< uint32_t > LotusParser::getUnicodeVectorForLMBCS ( std::string const & text) const
protected

returns the unicode list corresponding to a LMBCS sequence

Referenced by getStringForLMBCS(), and sendText().

◆ hasGraphics()

bool LotusParser::hasGraphics ( int sheetId) const
protected

return true if the sheet sheetId has some graphic

◆ parse()

void LotusParser::parse ( librevenge::RVNGSpreadsheetInterface * documentInterface)
finalvirtual

called by WPSDocument to parse the file

Implements WKSParser.

Referenced by LotusStyleManager.

◆ parseFormatStream()

bool LotusParser::parseFormatStream ( )
protected

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

Referenced by createZones().

◆ readChartZone()

bool LotusParser::readChartZone ( std::shared_ptr< WPSStream > stream)
protected

reads a zone of type 5: 123 files

Referenced by readZone().

◆ readDocumentInfoMac()

bool LotusParser::readDocumentInfoMac ( std::shared_ptr< WPSStream > stream,
long endPos )
protected

reads a mac document info zone: zone 1b, then 2af8

Referenced by readExtFormats().

◆ readExtFormats()

bool LotusParser::readExtFormats ( std::shared_ptr< WPSStream > stream)
protected

parse the extended formats zones 1B

Referenced by readZone().

◆ readFMTStyleName()

bool LotusParser::readFMTStyleName ( std::shared_ptr< WPSStream > stream)
protected

reads a format style name: b6

Referenced by readZone().

◆ readLinkZone()

bool LotusParser::readLinkZone ( std::shared_ptr< WPSStream > stream)
protected

reads a link

Referenced by readZone().

◆ readMacFontName()

bool LotusParser::readMacFontName ( std::shared_ptr< WPSStream > stream,
long endPos )
protected

reads a mac font name

Referenced by readExtFormats().

◆ readRefZone()

bool LotusParser::readRefZone ( std::shared_ptr< WPSStream > stream)
protected

reads a zone of type 6: 123 files

Referenced by readZone().

◆ readSheetSize()

bool LotusParser::readSheetSize ( std::shared_ptr< WPSStream > stream,
long endPos,
int & row,
int & col,
int & sheet )
protected

reads a basic sheet size : mainly for debugging

Referenced by readZone().

◆ readSheetZone()

bool LotusParser::readSheetZone ( std::shared_ptr< WPSStream > stream)
protected

reads a zone of type 2: 123 files

Referenced by readZone().

◆ readVersionZone()

bool LotusParser::readVersionZone ( std::shared_ptr< WPSStream > stream)
staticprotected

reads a zone of type a: 123 files

Referenced by readZone().

◆ readZone()

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

reads a zone

Referenced by checkHeader(), and readZones().

◆ readZone1()

bool LotusParser::readZone1 ( std::shared_ptr< WPSStream > stream)
protected

reads a zone of type 1: 123 files

Referenced by readZone().

◆ readZone4()

bool LotusParser::readZone4 ( std::shared_ptr< WPSStream > stream)
protected

reads a zone of type 4: 123 files

Referenced by readZone().

◆ readZone7()

bool LotusParser::readZone7 ( std::shared_ptr< WPSStream > stream)
staticprotected

reads a zone of type 7: 123 files

Referenced by readZone().

◆ readZone8()

bool LotusParser::readZone8 ( std::shared_ptr< WPSStream > stream)
protected

reads a zone of type 8: 123 files

Referenced by readZone().

◆ readZones()

bool LotusParser::readZones ( std::shared_ptr< WPSStream > stream)
protected

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

Referenced by createZones(), and parseFormatStream().

◆ readZoneV3()

bool LotusParser::readZoneV3 ( std::shared_ptr< WPSStream > stream)
staticprotected

parse a wk123 zone

Referenced by readZone().

◆ retrievePasswordKeys()

std::vector< uint8_t > LotusParser::retrievePasswordKeys ( std::vector< uint8_t > const & fileKeys)
staticprotected

try to guess a password knowing its file keys. Returns the keys if it founds a valid password

Referenced by readZone().

◆ sendChart()

bool LotusParser::sendChart ( int cId,
WPSPosition const & pos,
WPSGraphicStyle const & style )
protected

try to send a chart

◆ sendGraphics()

void LotusParser::sendGraphics ( int sheetId)
protected

send the graphics corresponding to a sheetId

◆ sendText()

void LotusParser::sendText ( RVNGInputStreamPtr & input,
WPSEntry const & entry ) const
protected

try to send a LBMCS text

◆ updateEmbeddedObject()

bool LotusParser::updateEmbeddedObject ( int id,
WPSEmbeddedObject & object ) const
protected

try to retrieve the content of a graphic, knowing it local id

◆ version()

int LotusParser::version ( ) const
protected

return the file version

Referenced by createZones(), parse(), readExtFormats(), readMacFontName(), readZone(), and readZone8().

◆ LotusChart

friend class LotusChart
friend

Referenced by LotusChart, and LotusParser().

◆ LotusGraph

friend class LotusGraph
friend

Referenced by LotusGraph, and LotusParser().

◆ LotusParserInternal::SubDocument

friend class LotusParserInternal::SubDocument
friend

◆ LotusSpreadsheet

friend class LotusSpreadsheet
friend

Referenced by LotusParser(), and LotusSpreadsheet.

◆ LotusStyleManager

friend class LotusStyleManager
friend

Referenced by LotusParser(), and LotusStyleManager.

Member Data Documentation

◆ m_chartParser

std::shared_ptr<LotusChart> LotusParser::m_chartParser
protected

the chart manager

Referenced by createZones(), LotusParser(), parse(), readExtFormats(), readZone(), and sendChart().

◆ m_graphParser

std::shared_ptr<LotusGraph> LotusParser::m_graphParser
protected

◆ m_listener

std::shared_ptr<WKSContentListener> LotusParser::m_listener
protected

◆ m_ole1Parser

std::shared_ptr<WPSOLE1Parser> LotusParser::m_ole1Parser
protected

the ole1 parser

Referenced by createZones(), LotusParser(), and updateEmbeddedObject().

◆ m_spreadsheetParser

std::shared_ptr<LotusSpreadsheet> LotusParser::m_spreadsheetParser
protected

◆ m_state

◆ m_styleManager

std::shared_ptr<LotusStyleManager> LotusParser::m_styleManager
protected

the style manager

Referenced by createZones(), LotusParser(), parse(), readExtFormats(), readZone(), and sendText().


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

Generated on for libwps by doxygen 1.17.0