CanvasParser Class Reference documentation

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

the main class to read a Canvas 2 and 3 files More...

`#include <CanvasParser.hxx>`

Inheritance diagram for CanvasParser:

## Public Member Functions
| CanvasParser (MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
| constructor
| ~CanvasParser () 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
Public Member Functions inherited from MWAWParser
virtual | ~MWAWParser ()
| virtual destructor
int | version () const
| returns the works version
MWAWParserStatePtr | getParserState ()
| returns the parser state
MWAWHeader * | getHeader ()
| returns the header
MWAWInputStreamPtr & | getInput ()
| returns the actual input
MWAWListenerPtr | getMainListener ()
| returns the main listener
MWAWGraphicListenerPtr & | getGraphicListener ()
| returns the graphic listener
MWAWPresentationListenerPtr & | getPresentationListener ()
| returns the presentation listener
MWAWSpreadsheetListenerPtr & | getSpreadsheetListener ()
| returns the spreadsheet listener
MWAWTextListenerPtr & | getTextListener ()
| returns the text listener
MWAWFontConverterPtr & | getFontConverter ()
| returns the font converter
MWAWFontManagerPtr & | getFontManager ()
| returns the font manager
MWAWPageSpan const & | getPageSpan () const
| returns the actual page dimension
MWAWPageSpan & | getPageSpan ()
| 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 )
MWAWRSRCParserPtr & | getRSRCParser ()
| returns the rsrc parser
libmwaw::DebugFile & | ascii ()
| a DebugFile used to write what we recognize when we parse the document

## 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
bool | createZones ()
| finds the different objects zones
MWAWInputStreamPtr & | getInput ()
| returns the current input
bool | readFileHeader ()
| read the file header: list of unknown numbers
bool | readDocumentHeader ()
| read the document header
bool | readBrushes ()
| try to read the brush
bool | readGrids ()
| read the grid: or a list which begins by a grid
bool | readLayers ()
| try to read the layers
bool | readMacroNames ()
| read the macro names
bool | readFormats ()
| read the formats' zone, mainly an unit's conversion table
bool | readSprays ()
| try to read the spray
bool | readViews ()
| try to read the views
bool | readEndV3 ()
| try to read the end zone: v3
bool | readRSRCFileHeader (MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile)
| read the RSRC HeAd(a copy of file header) zone: v3
bool | readPrintInfo (MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile)
| read the print info zone
bool | readLPOL (MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile)
| read the RSRC LPol zone: v3
bool | readUsers (MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile)
| read the RSRC user zone: v3
bool | readWindows (MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile)
| read the RSRC Windows zone: v3
bool | readRSRCWindowsFile ()
| read the resource file which ends the file
bool | readCNam (MWAWEntry const &entry)
| read the Windows CNam RSRC: v3 (always 256 0's bytes)
bool | readCSet (MWAWEntry const &entry)
| read the Windows CSet RSRC: v3 (contains the string Default)
bool | readPrinterDev (MWAWEntry const &entry)
| read the Windows DevM RSRC: v3 (main data of the printer device)
bool | readPage (MWAWEntry const &entry)
| read the Windows Page RSRC: v3
bool | readPrinterSST (MWAWEntry const &entry)
| read the Windows PSST RSRC: v3 (the printer, device name, ...)
bool | readUnknownZoneHeader ()
| read the first unknown zone
bool | readUnknownZone0 ()
| read an unknown zone: contains a layer name, some font id,sz, ...
bool | readUnknownZone1 ()
| read an unknown zone
bool | readUnknownZone2 ()
| read an unknown zone
bool | readUnknownZone3 ()
| read an unknown zone
bool | readUnknownZone4 ()
| read an unknown zone: the last zone of a v2 files
bool | send (CanvasParserInternal::Layer const &layer)
| tries to send a layer
bool | readString (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 | readString (MWAWInputStreamPtr input, librevenge::RVNGString &string, int maxSize, bool canBeCString=false)
| try to read a pascal string in the data fork or the resource fork
bool | decode (long length)
| try to decode some data: length==-1 means decode end of input
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

## Protected Attributes
std::shared_ptr< CanvasParserInternal::State > | m_state
| the state
std::shared_ptr< CanvasGraph > | m_graphParser
| the graph parser
std::shared_ptr< CanvasStyleManager > | m_styleManager
| the style manager

## Friends
class | CanvasGraph
class | CanvasStyleManager

## Detailed Description

the main class to read a Canvas 2 and 3 files

## Constructor & Destructor Documentation

## ◆ CanvasParser()

CanvasParser::CanvasParser | ( | MWAWInputStreamPtr const & | input,
|  | MWAWRSRCParserPtr const & | rsrcParser,
|  | MWAWHeader * | header )

constructor

## ◆ ~CanvasParser()

CanvasParser::~CanvasParser | ( |  | ) |
| final

destructor

## Member Function Documentation

## ◆ checkHeader()

bool CanvasParser::checkHeader | ( | MWAWHeader * | header,
|  | bool | strict = false )
| finalvirtual

checks if the document header is correct (or not)

Implements MWAWParser.

Referenced by parse().

## ◆ createDocument()

void CanvasParser::createDocument | ( | librevenge::RVNGDrawingInterface * | documentInterface | ) |
| protected

creates the listener which will be associated to the document

Referenced by parse().

## ◆ createZones()

bool CanvasParser::createZones | ( |  | ) |
| protected

finds the different objects zones

Referenced by parse().

## ◆ decode()

bool CanvasParser::decode | ( | long | length | ) |
| protected

try to decode some data: length==-1 means decode end of input

Referenced by createZones(), readBrushes(), CanvasStyleManager::readColors(), CanvasStyleManager::readDashes(), readEndV3(), readLayers(), CanvasStyleManager::readPatterns(), readRSRCWindowsFile(), CanvasGraph::readShapes(), readSprays(), readUnknownZone2(), readUnknownZone3(), readUnknownZone4(), and readViews().

## ◆ getInput()

MWAWInputStreamPtr & CanvasParser::getInput | ( |  | ) |
| protected

returns the current input

Referenced by checkHeader(), createZones(), parse(), readBrushes(), readCNam(), readCSet(), readDocumentHeader(), readEndV3(), readFileHeader(), readFormats(), readGrids(), readLayers(), readMacroNames(), readPage(), readPrinterDev(), readPrinterSST(), readRSRCWindowsFile(), readSprays(), readString(), readUnknownZone0(), readUnknownZone1(), readUnknownZone2(), readUnknownZone3(), readUnknownZone4(), readUnknownZoneHeader(), and readViews().

## ◆ isWindowsFile()

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

returns true if the file is a windows file

Referenced by CanvasGraph::getBitmap(), CanvasGraph::getBitmapBW(), parse(), readBrushes(), readFileHeader(), CanvasStyleManager::readFonts(), CanvasGraph::readShape(), CanvasGraph::readShapeData(), CanvasGraph::readShapes(), readString(), and CanvasGraph::sendMultiLines().

## ◆ parse()

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

virtual function used to parse the input

Implements MWAWGraphicParser.

## ◆ readBrushes()

bool CanvasParser::readBrushes | ( |  | ) |
| protected

try to read the brush

Referenced by createZones().

## ◆ readCNam()

bool CanvasParser::readCNam | ( | MWAWEntry const & | entry | ) |
| protected

read the Windows CNam RSRC: v3 (always 256 0's bytes)

Referenced by readRSRCWindowsFile().

## ◆ readCSet()

bool CanvasParser::readCSet | ( | MWAWEntry const & | entry | ) |
| protected

read the Windows CSet RSRC: v3 (contains the string Default)

Referenced by readRSRCWindowsFile().

## ◆ readDocumentHeader()

bool CanvasParser::readDocumentHeader | ( |  | ) |
| protected

read the document header

Referenced by createZones().

## ◆ readEndV3()

bool CanvasParser::readEndV3 | ( |  | ) |
| protected

try to read the end zone: v3

Referenced by createZones().

## ◆ readFileHeader()

bool CanvasParser::readFileHeader | ( |  | ) |
| protected

read the file header: list of unknown numbers

Referenced by parse().

## ◆ readFormats()

bool CanvasParser::readFormats | ( |  | ) |
| protected

read the formats' zone, mainly an unit's conversion table

Referenced by createZones().

## ◆ readGrids()

bool CanvasParser::readGrids | ( |  | ) |
| protected

read the grid: or a list which begins by a grid

Referenced by createZones().

## ◆ readLayers()

bool CanvasParser::readLayers | ( |  | ) |
| protected

try to read the layers

Referenced by createZones().

## ◆ readLPOL()

bool CanvasParser::readLPOL | ( | MWAWInputStreamPtr | input,
|  | MWAWEntry const & | entry,
|  | libmwaw::DebugFile & | ascFile )
| protected

read the RSRC LPol zone: v3

Referenced by createZones().

## ◆ readMacroNames()

bool CanvasParser::readMacroNames | ( |  | ) |
| protected

read the macro names

Referenced by createZones().

## ◆ readPage()

bool CanvasParser::readPage | ( | MWAWEntry const & | entry | ) |
| protected

read the Windows Page RSRC: v3

Referenced by readRSRCWindowsFile().

## ◆ readPrinterDev()

bool CanvasParser::readPrinterDev | ( | MWAWEntry const & | entry | ) |
| protected

read the Windows DevM RSRC: v3 (main data of the printer device)

Referenced by readRSRCWindowsFile().

## ◆ readPrinterSST()

bool CanvasParser::readPrinterSST | ( | MWAWEntry const & | entry | ) |
| protected

read the Windows PSST RSRC: v3 (the printer, device name, ...)

Referenced by readRSRCWindowsFile().

## ◆ readPrintInfo()

bool CanvasParser::readPrintInfo | ( | MWAWInputStreamPtr | input,
|  | MWAWEntry const & | entry,
|  | libmwaw::DebugFile & | ascFile )
| protected

read the print info zone

Referenced by createZones().

## ◆ readRSRCFileHeader()

bool CanvasParser::readRSRCFileHeader | ( | MWAWInputStreamPtr | input,
|  | MWAWEntry const & | entry,
|  | libmwaw::DebugFile & | ascFile )
| protected

read the RSRC HeAd(a copy of file header) zone: v3

Referenced by createZones().

## ◆ readRSRCWindowsFile()

bool CanvasParser::readRSRCWindowsFile | ( |  | ) |
| protected

read the resource file which ends the file

Referenced by createZones().

## ◆ readSprays()

bool CanvasParser::readSprays | ( |  | ) |
| protected

try to read the spray

Referenced by createZones().

## ◆ readString() [1/2]

bool CanvasParser::readString | ( | 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 readCSet(), readDocumentHeader(), readFormats(), readGrids(), readLayers(), readMacroNames(), readPage(), readPrinterDev(), readPrinterSST(), readRSRCWindowsFile(), CanvasGraph::readShapeData(), readString(), readUnknownZone0(), readUsers(), readViews(), and CanvasGraph::sendDimension().

## ◆ readString() [2/2]

bool CanvasParser::readString | ( | MWAWInputStreamPtr | input,
|  | librevenge::RVNGString & | string,
|  | int | maxSize,
|  | bool | canBeCString = false )
| protected

try to read a pascal string in the data fork or the resource fork

## ◆ readUnknownZone0()

bool CanvasParser::readUnknownZone0 | ( |  | ) |
| protected

read an unknown zone: contains a layer name, some font id,sz, ...

Referenced by createZones().

## ◆ readUnknownZone1()

bool CanvasParser::readUnknownZone1 | ( |  | ) |
| protected

read an unknown zone

Referenced by createZones().

## ◆ readUnknownZone2()

bool CanvasParser::readUnknownZone2 | ( |  | ) |
| protected

read an unknown zone

Referenced by createZones().

## ◆ readUnknownZone3()

bool CanvasParser::readUnknownZone3 | ( |  | ) |
| protected

read an unknown zone

Referenced by createZones().

## ◆ readUnknownZone4()

bool CanvasParser::readUnknownZone4 | ( |  | ) |
| protected

read an unknown zone: the last zone of a v2 files

Referenced by createZones().

## ◆ readUnknownZoneHeader()

bool CanvasParser::readUnknownZoneHeader | ( |  | ) |
| protected

read the first unknown zone

Referenced by createZones().

## ◆ readUsers()

bool CanvasParser::readUsers | ( | MWAWInputStreamPtr | input,
|  | MWAWEntry const & | entry,
|  | libmwaw::DebugFile & | ascFile )
| protected

read the RSRC user zone: v3

Referenced by createZones().

## ◆ readViews()

bool CanvasParser::readViews | ( |  | ) |
| protected

try to read the views

Referenced by createZones().

## ◆ readWindows()

bool CanvasParser::readWindows | ( | MWAWInputStreamPtr | input,
|  | MWAWEntry const & | entry,
|  | libmwaw::DebugFile & | ascFile )
| protected

read the RSRC Windows zone: v3

Referenced by createZones().

## ◆ send()

bool CanvasParser::send | ( | CanvasParserInternal::Layer const & | layer | ) |
| protected

tries to send a layer

Referenced by parse().

## Friends And Related Symbol Documentation

## ◆ CanvasGraph

friend class CanvasGraph
| friend

Referenced by CanvasParser().

## ◆ CanvasStyleManager

friend class CanvasStyleManager
| friend

Referenced by CanvasParser().

## Member Data Documentation

## ◆ m_graphParser

std::shared_ptr<CanvasGraph> CanvasParser::m_graphParser
| protected

the graph parser

Referenced by CanvasParser(), createZones(), parse(), and send().

## ◆ m_state

std::shared_ptr<CanvasParserInternal::State> CanvasParser::m_state
| protected

the state

Referenced by CanvasParser(), checkHeader(), createDocument(), createZones(), decode(), getInput(), isWindowsFile(), parse(), readBrushes(), readDocumentHeader(), readFileHeader(), readGrids(), readLayers(), readRSRCWindowsFile(), readSprays(), readUnknownZone3(), readUnknownZone4(), readUsers(), and readViews().

## ◆ m_styleManager

std::shared_ptr<CanvasStyleManager> CanvasParser::m_styleManager
| protected

the style manager

Referenced by CanvasParser(), createZones(), parse(), readEndV3(), and readRSRCWindowsFile().

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

- CanvasParser.hxx
- CanvasParser.cxx