Canvas5Parser Class Referencefinal

the main class to read a Canvas 5-10 files (and probably some not password protected Windows 11 files) More...

#include <Canvas5Parser.hxx>

Inheritance diagram for Canvas5Parser:
MWAWGraphicParser MWAWParser

Classes

struct  Item
 a structure used to store the item data of a Canvas5Parser More...
 

Public Member Functions

 Canvas5Parser (MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
 constructor More...
 
 ~Canvas5Parser () final
 destructor More...
 
bool checkHeader (MWAWHeader *header, bool strict=false) final
 checks if the document header is correct (or not) More...
 
void parse (librevenge::RVNGDrawingInterface *documentInterface) final
 virtual function used to parse the input More...
 
- Public Member Functions inherited from MWAWGraphicParser
 ~MWAWGraphicParser () override
 destructor More...
 
- Public Member Functions inherited from MWAWParser
virtual ~MWAWParser ()
 virtual destructor More...
 
int version () const
 returns the works version More...
 
MWAWParserStatePtr getParserState ()
 returns the parser state More...
 
MWAWHeadergetHeader ()
 returns the header More...
 
MWAWInputStreamPtrgetInput ()
 returns the actual input More...
 
MWAWListenerPtr getMainListener ()
 returns the main listener More...
 
MWAWGraphicListenerPtrgetGraphicListener ()
 returns the graphic listener More...
 
MWAWPresentationListenerPtrgetPresentationListener ()
 returns the presentation listener More...
 
MWAWSpreadsheetListenerPtrgetSpreadsheetListener ()
 returns the spreadsheet listener More...
 
MWAWTextListenerPtrgetTextListener ()
 returns the text listener More...
 
MWAWFontConverterPtrgetFontConverter ()
 returns the font converter More...
 
MWAWFontManagerPtrgetFontManager ()
 returns the font manager More...
 
MWAWPageSpan const & getPageSpan () const
 returns the actual page dimension More...
 
MWAWPageSpangetPageSpan ()
 returns the actual page dimension More...
 
double getFormLength () const
 returns the form length More...
 
double getFormWidth () const
 returns the form width More...
 
double getPageLength () const
 returns the page length (form length without margin ) More...
 
double getPageWidth () const
 returns the page width (form width without margin ) More...
 
MWAWRSRCParserPtrgetRSRCParser ()
 returns the rsrc parser More...
 
libmwaw::DebugFileascii ()
 a DebugFile used to write what we recognize when we parse the document More...
 

Protected Types

typedef std::function< void(std::shared_ptr< Canvas5Structure::Stream >, Item const &, std::string const &)> DataFunction
 a function used to parse the data of a index map/a extended header More...
 

Protected Member Functions

void createDocument (librevenge::RVNGDrawingInterface *documentInterface)
 creates the listener which will be associated to the document More...
 
bool isWindowsFile () const
 returns true if the file is a windows file More...
 
librevenge::RVNGString getTextLink (int textLinkId) const
 returns the link corresponding to a text id More...
 
bool createZones ()
 finds the different objects zones More...
 
bool readMainBlock (std::shared_ptr< Canvas5Structure::Stream > stream)
 try to read the first big block More...
 
bool readMainBlock9 (std::shared_ptr< Canvas5Structure::Stream > stream)
 try to read the first big block: v9 More...
 
bool readFileRSRCs (std::shared_ptr< Canvas5Structure::Stream > stream)
 try to read the third big block: a list of resource?, font, ... More...
 
bool readSI200 (Canvas5Structure::Stream &stream)
 try to read the SI200 zone: v6 More...
 
bool readFileDesc (Canvas5Structure::Stream &stream)
 try to read the last block: some pathes, ... More...
 
bool readFileHeader (std::shared_ptr< Canvas5Structure::Stream > stream)
 try to read the file header More...
 
bool readDocumentSettings (std::shared_ptr< Canvas5Structure::Stream > stream)
 read the document settings More...
 
bool readLayers (std::shared_ptr< Canvas5Structure::Stream > stream)
 try to read the different layers More...
 
bool readSlides (std::shared_ptr< Canvas5Structure::Stream > stream)
 try to read the list of slides More...
 
bool readTextLinks (std::shared_ptr< Canvas5Structure::Stream > stream)
 try to read the text links More...
 
bool readPrinterRsrc (Canvas5Structure::Stream &stream)
 try to read a printer rsrc More...
 
bool readOLnkRsrc (std::shared_ptr< Canvas5Structure::Stream > stream)
 try to read the OLnk rsrc block: v6 More...
 
bool readObjectDBRsrc (std::shared_ptr< Canvas5Structure::Stream > stream)
 try to read the object database: XOBD v6 More...
 
bool readPnot (Canvas5Structure::Stream &stream, MWAWEntry const &entry)
 read the RSRC 0 pnot zone More...
 
bool readPicture (Canvas5Structure::Stream &stream, MWAWEntry const &entry)
 read the RSRC Pict zone More...
 
bool send (Canvas5ParserInternal::Slide const &slide)
 try to send a page/slide More...
 
bool send (Canvas5ParserInternal::Layer const &layer)
 try to send a layer More...
 
bool readString (Canvas5Structure::Stream &stream, librevenge::RVNGString &string, int maxSize, bool canBeCString=false)
 try to read a pascal string in the data fork or a Pascal/C string depending on the file type More...
 
bool readDouble (Canvas5Structure::Stream &stream, double &val, bool &isNaN) const
 try to read a double 8 More...
 
double readDouble (Canvas5Structure::Stream &stream, int fieldSize) const
 try to read a float: either a double: fieldSize=8 or a int32 (divided by 65536) More...
 
int readInteger (Canvas5Structure::Stream &stream, int fieldSize) const
 try to read a int: either a cast a double: fieldSize=8 or a int32/int16 More...
 
bool readDataHeader (Canvas5Structure::Stream &stream, int expectedSize, int &N)
 try to read a data header, ie. N fields with a given size More...
 
bool readExtendedHeader (std::shared_ptr< Canvas5Structure::Stream > stream, int expectedValue, std::string const &what, DataFunction const &func)
 try to read an extended data header, ie. More...
 
bool readUsed (Canvas5Structure::Stream &stream, std::string const &what)
 try to read the used list More...
 
bool readDefined (Canvas5Structure::Stream &stream, std::vector< bool > &defined, std::string const &what)
 try to read the defined list More...
 
bool readIndexMap (std::shared_ptr< Canvas5Structure::Stream > stream, std::string const &what, DataFunction const &func=&Canvas5Parser::defDataFunction)
 try to read a index map More...
 
bool readArray9 (std::shared_ptr< Canvas5Structure::Stream > stream, std::string const &what, DataFunction const &func=&Canvas5Parser::defDataFunction)
 try to read an array: v9 More...
 
bool readItemHeader9 (Canvas5Structure::Stream &stream, int &id, int &used)
 try to read an array item header: v9 More...
 
bool getTAG9 (Canvas5Structure::Stream &stream, std::string &tag, int &type)
 try to return a tag, type:0 means begin, type:1 means end: v9 More...
 
bool checkTAG9 (Canvas5Structure::Stream &stream, std::string const &tag, int type)
 try to check is the following is a tag: v9 More...
 
- Protected Member Functions inherited from MWAWGraphicParser
 MWAWGraphicParser (MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
 constructor (protected) More...
 
 MWAWGraphicParser (MWAWParserStatePtr const &state)
 constructor using a state More...
 
- Protected Member Functions inherited from MWAWParser
 MWAWParser (MWAWParserState::Type type, MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
 constructor (protected) More...
 
 MWAWParser (MWAWParserStatePtr const &state)
 constructor using a state More...
 
void setVersion (int vers)
 sets the document's version More...
 
void setGraphicListener (MWAWGraphicListenerPtr &listener)
 sets the graphic listener More...
 
void resetGraphicListener ()
 resets the listener More...
 
void setPresentationListener (MWAWPresentationListenerPtr &listener)
 sets the presentation listener More...
 
void resetPresentationListener ()
 resets the listener More...
 
void setSpreadsheetListener (MWAWSpreadsheetListenerPtr &listener)
 sets the spreadsheet listener More...
 
void resetSpreadsheetListener ()
 resets the listener More...
 
void setTextListener (MWAWTextListenerPtr &listener)
 sets the text listener More...
 
void resetTextListener ()
 resets the listener More...
 
void setAsciiName (char const *name)
 Debugging: change the default ascii file. More...
 
std::string const & asciiName () const
 return the ascii file name More...
 

Static Protected Member Functions

static void defDataFunction (std::shared_ptr< Canvas5Structure::Stream >, Item const &, std::string const &)
 the default function to parse the data of a index map/a extended header More...
 
static void stringDataFunction (std::shared_ptr< Canvas5Structure::Stream > stream, Item const &item, std::string const &what)
 the default function to parse a string More...
 
static MWAWInputStreamPtr decode (MWAWInputStreamPtr input, int version)
 try to decode the input stream More...
 

Protected Attributes

std::shared_ptr< Canvas5ParserInternal::Statem_state
 the state More...
 
std::shared_ptr< Canvas5Graphm_graphParser
 the graph parser More...
 
std::shared_ptr< Canvas5Imagem_imageParser
 the image parser More...
 
std::shared_ptr< Canvas5StyleManagerm_styleManager
 the style manager More...
 

Friends

class Canvas5Graph
 
class Canvas5Image
 
class Canvas5StyleManager
 

Detailed Description

the main class to read a Canvas 5-10 files (and probably some not password protected Windows 11 files)

Member Typedef Documentation

◆ DataFunction

typedef std::function<void(std::shared_ptr<Canvas5Structure::Stream>, Item const &, std::string const &)> Canvas5Parser::DataFunction
protected

a function used to parse the data of a index map/a extended header

Constructor & Destructor Documentation

◆ Canvas5Parser()

Canvas5Parser::Canvas5Parser ( MWAWInputStreamPtr const &  input,
MWAWRSRCParserPtr const &  rsrcParser,
MWAWHeader header 
)

constructor

◆ ~Canvas5Parser()

Canvas5Parser::~Canvas5Parser ( )
final

destructor

Member Function Documentation

◆ checkHeader()

bool Canvas5Parser::checkHeader ( MWAWHeader header,
bool  strict = false 
)
finalvirtual

checks if the document header is correct (or not)

Implements MWAWParser.

Referenced by parse().

◆ checkTAG9()

bool Canvas5Parser::checkTAG9 ( Canvas5Structure::Stream stream,
std::string const &  tag,
int  type 
)
protected

try to check is the following is a tag: v9

Referenced by readArray9(), Canvas5Image::readImages9(), and readMainBlock9().

◆ createDocument()

void Canvas5Parser::createDocument ( librevenge::RVNGDrawingInterface *  documentInterface)
protected

creates the listener which will be associated to the document

FIXME: it is simpler to create a big page which contains the left and right page, but it may be better to create each page and to only keep in each page the used shapes, ie. to translate back the right shape and also decompose the master page shapes in left/right

Referenced by parse().

◆ createZones()

bool Canvas5Parser::createZones ( )
protected

finds the different objects zones

Referenced by parse().

◆ decode()

MWAWInputStreamPtr Canvas5Parser::decode ( MWAWInputStreamPtr  input,
int  version 
)
staticprotected

try to decode the input stream

Referenced by parse().

◆ defDataFunction()

static void Canvas5Parser::defDataFunction ( std::shared_ptr< Canvas5Structure::Stream ,
Item const &  ,
std::string const &   
)
inlinestaticprotected

the default function to parse the data of a index map/a extended header

Referenced by readObjectDBRsrc(), readOLnkRsrc(), and readTextLinks().

◆ getTAG9()

bool Canvas5Parser::getTAG9 ( Canvas5Structure::Stream stream,
std::string &  tag,
int &  type 
)
protected

try to return a tag, type:0 means begin, type:1 means end: v9

Referenced by checkTAG9(), Canvas5Image::readImages9(), and readMainBlock9().

◆ getTextLink()

librevenge::RVNGString Canvas5Parser::getTextLink ( int  textLinkId) const
protected

returns the link corresponding to a text id

Referenced by Canvas5Graph::sendText().

◆ isWindowsFile()

bool Canvas5Parser::isWindowsFile ( ) const
protected

◆ parse()

void Canvas5Parser::parse ( librevenge::RVNGDrawingInterface *  documentInterface)
finalvirtual

virtual function used to parse the input

Implements MWAWGraphicParser.

◆ readArray9()

◆ readDataHeader()

bool Canvas5Parser::readDataHeader ( Canvas5Structure::Stream stream,
int  expectedSize,
int &  N 
)
protected

try to read a data header, ie. N fields with a given size

Referenced by readDefined(), readIndexMap(), readOLnkRsrc(), and readUsed().

◆ readDefined()

bool Canvas5Parser::readDefined ( Canvas5Structure::Stream stream,
std::vector< bool > &  defined,
std::string const &  what 
)
protected

◆ readDocumentSettings()

bool Canvas5Parser::readDocumentSettings ( std::shared_ptr< Canvas5Structure::Stream stream)
protected

read the document settings

Referenced by readMainBlock(), and readMainBlock9().

◆ readDouble() [1/2]

◆ readDouble() [2/2]

double Canvas5Parser::readDouble ( Canvas5Structure::Stream stream,
int  fieldSize 
) const
protected

try to read a float: either a double: fieldSize=8 or a int32 (divided by 65536)

◆ readExtendedHeader()

bool Canvas5Parser::readExtendedHeader ( std::shared_ptr< Canvas5Structure::Stream stream,
int  expectedValue,
std::string const &  what,
DataFunction const &  func 
)
protected

◆ readFileDesc()

bool Canvas5Parser::readFileDesc ( Canvas5Structure::Stream stream)
protected

try to read the last block: some pathes, ...

Referenced by createZones().

◆ readFileHeader()

bool Canvas5Parser::readFileHeader ( std::shared_ptr< Canvas5Structure::Stream stream)
protected

try to read the file header

Referenced by createZones().

◆ readFileRSRCs()

bool Canvas5Parser::readFileRSRCs ( std::shared_ptr< Canvas5Structure::Stream stream)
protected

try to read the third big block: a list of resource?, font, ...

Referenced by createZones().

◆ readIndexMap()

bool Canvas5Parser::readIndexMap ( std::shared_ptr< Canvas5Structure::Stream stream,
std::string const &  what,
DataFunction const &  func = &Canvas5Parser::defDataFunction 
)
protected

◆ readInteger()

int Canvas5Parser::readInteger ( Canvas5Structure::Stream stream,
int  fieldSize 
) const
protected

try to read a int: either a cast a double: fieldSize=8 or a int32/int16

Referenced by Canvas5StyleManager::readPenStyle(), Canvas5Graph::readShapeData(), Canvas5Image::readVKFLShapeMainData(), and Canvas5Graph::sendTechnical().

◆ readItemHeader9()

bool Canvas5Parser::readItemHeader9 ( Canvas5Structure::Stream stream,
int &  id,
int &  used 
)
protected

try to read an array item header: v9

Referenced by readArray9().

◆ readLayers()

bool Canvas5Parser::readLayers ( std::shared_ptr< Canvas5Structure::Stream stream)
protected

try to read the different layers

Referenced by readMainBlock(), and readMainBlock9().

◆ readMainBlock()

bool Canvas5Parser::readMainBlock ( std::shared_ptr< Canvas5Structure::Stream stream)
protected

try to read the first big block

Referenced by createZones().

◆ readMainBlock9()

bool Canvas5Parser::readMainBlock9 ( std::shared_ptr< Canvas5Structure::Stream stream)
protected

try to read the first big block: v9

Referenced by createZones().

◆ readObjectDBRsrc()

bool Canvas5Parser::readObjectDBRsrc ( std::shared_ptr< Canvas5Structure::Stream stream)
protected

try to read the object database: XOBD v6

Referenced by readFileRSRCs().

◆ readOLnkRsrc()

bool Canvas5Parser::readOLnkRsrc ( std::shared_ptr< Canvas5Structure::Stream stream)
protected

try to read the OLnk rsrc block: v6

Referenced by readFileRSRCs().

◆ readPicture()

bool Canvas5Parser::readPicture ( Canvas5Structure::Stream stream,
MWAWEntry const &  entry 
)
protected

read the RSRC Pict zone

Referenced by createZones().

◆ readPnot()

bool Canvas5Parser::readPnot ( Canvas5Structure::Stream stream,
MWAWEntry const &  entry 
)
protected

read the RSRC 0 pnot zone

Referenced by createZones().

◆ readPrinterRsrc()

bool Canvas5Parser::readPrinterRsrc ( Canvas5Structure::Stream stream)
protected

try to read a printer rsrc

Referenced by readFileRSRCs().

◆ readSI200()

bool Canvas5Parser::readSI200 ( Canvas5Structure::Stream stream)
protected

try to read the SI200 zone: v6

Referenced by createZones().

◆ readSlides()

bool Canvas5Parser::readSlides ( std::shared_ptr< Canvas5Structure::Stream stream)
protected

try to read the list of slides

Referenced by readMainBlock(), and readMainBlock9().

◆ readString()

bool Canvas5Parser::readString ( Canvas5Structure::Stream stream,
librevenge::RVNGString &  string,
int  maxSize,
bool  canBeCString = false 
)
protected

try to read a pascal string in the data fork or a Pascal/C string depending on the file type

Referenced by Canvas5Graph::sendDimension().

◆ readTextLinks()

bool Canvas5Parser::readTextLinks ( std::shared_ptr< Canvas5Structure::Stream stream)
protected

try to read the text links

Referenced by readMainBlock().

◆ readUsed()

◆ send() [1/2]

bool Canvas5Parser::send ( Canvas5ParserInternal::Slide const &  slide)
protected

try to send a page/slide

Referenced by createDocument().

◆ send() [2/2]

bool Canvas5Parser::send ( Canvas5ParserInternal::Layer const &  layer)
protected

try to send a layer

◆ stringDataFunction()

void Canvas5Parser::stringDataFunction ( std::shared_ptr< Canvas5Structure::Stream stream,
Canvas5Parser::Item const &  item,
std::string const &  what 
)
staticprotected

the default function to parse a string

Referenced by readFileRSRCs(), readMainBlock9(), and Canvas5StyleManager::readParaStyles().

Friends And Related Function Documentation

◆ Canvas5Graph

friend class Canvas5Graph
friend

Referenced by Canvas5Parser().

◆ Canvas5Image

friend class Canvas5Image
friend

Referenced by Canvas5Parser().

◆ Canvas5StyleManager

friend class Canvas5StyleManager
friend

Referenced by Canvas5Parser().

Member Data Documentation

◆ m_graphParser

std::shared_ptr<Canvas5Graph> Canvas5Parser::m_graphParser
protected

◆ m_imageParser

std::shared_ptr<Canvas5Image> Canvas5Parser::m_imageParser
protected

◆ m_state

◆ m_styleManager

std::shared_ptr<Canvas5StyleManager> Canvas5Parser::m_styleManager
protected

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

Generated for libmwaw by doxygen 1.8.14