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

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
 

Protected Member Functions

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

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
 
static void stringDataFunction (std::shared_ptr< Canvas5Structure::Stream > stream, Item const &item, std::string const &what)
 the default function to parse a string
 
static MWAWInputStreamPtr decode (MWAWInputStreamPtr input, int version)
 try to decode the input stream
 

Protected Attributes

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

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::Layer const &  layer)
protected

try to send a layer

◆ send() [2/2]

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

try to send a page/slide

Referenced by createDocument(), and send().

◆ 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 on Wed May 3 2023 07:18:29 for libmwaw by doxygen 1.9.6