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 More...
| ~CanvasParser () 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...

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

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

## 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(), 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 Function 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