Canvas5Parser Class Reference documentation

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

the main class to read a Canvas 5 files More...

`#include <Canvas5Parser.hxx>`

Inheritance diagram for Canvas5Parser:

## 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...
MWAWHeader * | getHeader ()
| returns the header More...
MWAWInputStreamPtr & | getInput ()
| returns the actual input More...
MWAWListenerPtr | getMainListener ()
| returns the main listener More...
MWAWGraphicListenerPtr & | getGraphicListener ()
| returns the graphic listener More...
MWAWPresentationListenerPtr & | getPresentationListener ()
| returns the presentation listener More...
MWAWSpreadsheetListenerPtr & | getSpreadsheetListener ()
| returns the spreadsheet listener More...
MWAWTextListenerPtr & | getTextListener ()
| returns the text listener More...
MWAWFontConverterPtr & | getFontConverter ()
| returns the font converter More...
MWAWFontManagerPtr & | getFontManager ()
| returns the font manager More...
MWAWPageSpan const & | getPageSpan () const
| returns the actual page dimension More...
MWAWPageSpan & | getPageSpan ()
| 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...
MWAWRSRCParserPtr & | getRSRCParser ()
| returns the rsrc parser More...
libmwaw::DebugFile & | ascii ()
| a DebugFile used to write what we recognize when we parse the document More...

## Static Public Member Functions
static std::string | getString (unsigned val)
| very low level: debug print some uint32_t either at char4 or sample int More...

## Protected Types
typedef std::function< void(Canvas5Structure::Stream &, int, std::string const &, long)> | 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...
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 | readFileRSRCs (Canvas5Structure::Stream &stream)
| try to read the third big block: a list of resource?, font, ... More...
bool | readFileDesc (Canvas5Structure::Stream &stream)
| try to read the last block: some pathes, ... More...
bool | readFileHeader (Canvas5Structure::Stream &stream)
| try to read the file header More...
bool | readDocumentSettings (Canvas5Structure::Stream &stream)
| read the document settings More...
bool | readLayers (Canvas5Structure::Stream &stream)
| try to read the different layers More...
bool | readPreview (Canvas5Structure::Stream &stream)
| try to read the preview picture More...
bool | readSlides (Canvas5Structure::Stream &stream)
| try to read the list of slides More...
bool | readTextLinks (Canvas5Structure::Stream &stream)
| try to read the text links More...
bool | readBitmap (Canvas5Structure::Stream &stream, MWAWEmbeddedObject &object, MWAWColor *avgColor=nullptr)
| try to read a bitmap More...
bool | readPrinterRsrc (Canvas5Structure::Stream &stream)
| try to read a printer rsrc 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...
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 (Canvas5Structure::Stream &stream, int expectedValue, std::string const &what, DataFunction const &func)
| try to read an extended data header, ie. More...
bool | readUnknownHeader (Canvas5Structure::Stream &stream, MWAWEntry(&entries)[2], long len, std::string const &what)
| try to read an unknown structure which defined some position and two entries 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 (Canvas5Structure::Stream &stream, std::string const &what, DataFunction const &func=&Canvas5Parser::defDataFunction)
| try to read a index map More...
bool | readSpecialData (long len, unsigned type, std::string &extra)
| try to read a special shape data (internal helper to understand vkfl structure) 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 (Canvas5Structure::Stream &, int, std::string const &, long)
| the default function to parse the data of a index map/a extended header More...
static void | stringDataFunction (Canvas5Structure::Stream &stream, int id, std::string const &what, long len)
| the default function to parse the data of a index map/a extended header More...
static MWAWInputStreamPtr | decode (MWAWInputStreamPtr input)
| try to decode the input stream More...

## Protected Attributes
std::shared_ptr< Canvas5ParserInternal::State > | m_state
| the state More...
std::shared_ptr< Canvas5Graph > | m_graphParser
| the graph parser More...
std::shared_ptr< Canvas5StyleManager > | m_styleManager
| the style manager More...

## Friends
class | Canvas5Graph
class | Canvas5StyleManager

## Detailed Description

the main class to read a Canvas 5 files

## Member Typedef Documentation

## ◆ DataFunction

typedef std::function<void(Canvas5Structure::Stream &, int, std::string const &, long)> 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().

## ◆ 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 | ) |
| staticprotected

try to decode the input stream

Referenced by parse().

## ◆ defDataFunction()

static void Canvas5Parser::defDataFunction | ( | Canvas5Structure::Stream & | ,
|  | int | ,
|  | std::string const & | ,
|  | long |
| ) |  |
| inlinestaticprotected

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

Referenced by readFileRSRCs(), and readTextLinks().

## ◆ getString()

std::string Canvas5Parser::getString | ( | unsigned | val | ) |
| static

very low level: debug print some uint32_t either at char4 or sample int

Referenced by Canvas5StyleManager::readColor(), Canvas5StyleManager::readColorStyle(), readFileRSRCs(), readPnot(), Canvas5Graph::readShapeData(), Canvas5StyleManager::readSymbol(), readTextLinks(), Canvas5StyleManager::readVKFL(), Canvas5Graph::sendSpecial(), Canvas5StyleManager::updateLineColor(), Canvas5StyleManager::updateLineStyle(), and Canvas5StyleManager::updateSurfaceColor().

## ◆ isWindowsFile()

bool Canvas5Parser::isWindowsFile | ( |  | ) | const
| protected

returns true if the file is a windows file

Referenced by Canvas5StyleManager::readFonts(), and readString().

## ◆ parse()

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

virtual function used to parse the input

Implements MWAWGraphicParser.

## ◆ readBitmap()

bool Canvas5Parser::readBitmap | ( | Canvas5Structure::Stream & | stream,
|  | MWAWEmbeddedObject & | object,
|  | MWAWColor * | avgColor = `nullptr`
| ) |  |
| protected

try to read a bitmap

Referenced by Canvas5Graph::readBitmaps(), and Canvas5StyleManager::readVKFL().

## ◆ 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 Canvas5StyleManager::readColors(), readDefined(), readIndexMap(), and readUsed().

## ◆ readDefined()

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

try to read the defined list

Referenced by Canvas5Graph::readBitmaps(), readFileRSRCs(), readSlides(), and readTextLinks().

## ◆ readDocumentSettings()

bool Canvas5Parser::readDocumentSettings | ( | Canvas5Structure::Stream & | stream | ) |
| protected

read the document settings

Referenced by readMainBlock().

## ◆ readDouble()

bool Canvas5Parser::readDouble | ( | Canvas5Structure::Stream & | stream,
|  | double & | val,
|  | bool & | isNaN
| ) |  | const
| protected

try to read a double 8

Referenced by readDocumentSettings(), and Canvas5Graph::sendExtrude().

## ◆ readExtendedHeader()

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

try to read an extended data header, ie.

N0 is expected to be value

Note
  the function func is called on each entry excepted the first one

Referenced by Canvas5Graph::readBitmaps(), Canvas5StyleManager::readCharStyles(), Canvas5StyleManager::readColors(), Canvas5StyleManager::readDashes(), readFileRSRCs(), Canvas5Graph::readMatrices(), Canvas5StyleManager::readPenStyles(), readSlides(), Canvas5StyleManager::readStrokes(), Canvas5StyleManager::readStyles(), and readTextLinks().

## ◆ readFileDesc()

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

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

Referenced by createZones().

## ◆ readFileHeader()

bool Canvas5Parser::readFileHeader | ( | Canvas5Structure::Stream & | stream | ) |
| protected

try to read the file header

Referenced by createZones().

## ◆ readFileRSRCs()

bool Canvas5Parser::readFileRSRCs | ( | Canvas5Structure::Stream & | stream | ) |
| protected

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

Referenced by createZones().

## ◆ readIndexMap()

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

try to read a index map

Referenced by Canvas5StyleManager::readArrows(), Canvas5StyleManager::readColors(), readFileRSRCs(), Canvas5StyleManager::readPenStyles(), readSlides(), and readTextLinks().

## ◆ readLayers()

bool Canvas5Parser::readLayers | ( | Canvas5Structure::Stream & | stream | ) |
| protected

try to read the different layers

Referenced by readMainBlock().

## ◆ readMainBlock()

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

try to read the first big block

Referenced by createZones().

## ◆ 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().

## ◆ readPreview()

bool Canvas5Parser::readPreview | ( | Canvas5Structure::Stream & | stream | ) |
| protected

try to read the preview picture

Referenced by readMainBlock().

## ◆ readPrinterRsrc()

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

try to read a printer rsrc

Referenced by readFileRSRCs().

## ◆ readSlides()

bool Canvas5Parser::readSlides | ( | Canvas5Structure::Stream & | stream | ) |
| protected

try to read the list of slides

Referenced by readMainBlock().

## ◆ readSpecialData()

bool Canvas5Parser::readSpecialData | ( | long | len,
|  | unsigned | type,
|  | std::string & | extra
| ) |  |
| protected

try to read a special shape data (internal helper to understand vkfl structure)

Referenced by Canvas5StyleManager::readVKFL().

## ◆ 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 | ( | Canvas5Structure::Stream & | stream | ) |
| protected

try to read the text links

Referenced by readMainBlock().

## ◆ readUnknownHeader()

bool Canvas5Parser::readUnknownHeader | ( | Canvas5Structure::Stream & | stream,
|  | MWAWEntry(&) | entries[2],
|  | long | len,
|  | std::string const & | what
| ) |  |
| protected

try to read an unknown structure which defined some position and two entries

Referenced by Canvas5StyleManager::readVKFL(), and Canvas5Graph::sendEffect().

## ◆ readUsed()

bool Canvas5Parser::readUsed | ( | Canvas5Structure::Stream & | stream,
|  | std::string const & | what
| ) |  |
| protected

try to read the used list

Referenced by Canvas5StyleManager::readArrows(), Canvas5StyleManager::readColors(), Canvas5StyleManager::readDashes(), readFileRSRCs(), Canvas5Graph::readMatrices(), Canvas5StyleManager::readStrokes(), and Canvas5StyleManager::readStyles().

## ◆ 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().

## ◆ stringDataFunction()

void Canvas5Parser::stringDataFunction | ( | Canvas5Structure::Stream & | stream,
|  | int | id,
|  | std::string const & | what,
|  | long | len
| ) |  |
| staticprotected

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

Referenced by readFileRSRCs(), and Canvas5StyleManager::readStyles().

## Friends And Related Function Documentation

## ◆ Canvas5Graph

friend class Canvas5Graph
| 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

the graph parser

Referenced by Canvas5Parser(), createZones(), readMainBlock(), readSpecialData(), and send().

## ◆ m_state

std::shared_ptr<Canvas5ParserInternal::State> Canvas5Parser::m_state
| protected

the state

Referenced by Canvas5Parser(), checkHeader(), createDocument(), createZones(), isWindowsFile(), parse(), readDocumentSettings(), readFileHeader(), readLayers(), readMainBlock(), readPreview(), readSlides(), and send().

## ◆ m_styleManager

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

the style manager

Referenced by Canvas5Parser(), readDocumentSettings(), readFileRSRCs(), and readMainBlock().

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

- Canvas5Parser.hxx
- Canvas5Parser.cxx