CanvasParser.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
#ifndef CANVAS_PARSER
# define CANVAS_PARSER
#include <string>
#include <vector>
#include <librevenge/librevenge.h>
#include "MWAWDebug.hxx"
#include "MWAWGraphicStyle.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWPosition.hxx"
#include "MWAWParser.hxx"
namespace CanvasParserInternal
{
struct Layer;
struct State;
}
class CanvasGraph;
class CanvasStyleManager;
class CanvasParser final : public MWAWGraphicParser
{
friend class CanvasGraph;
friend class CanvasStyleManager;
public:
CanvasParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
~CanvasParser() final;
bool checkHeader(MWAWHeader *header, bool strict=false) final;
// the main parse function
void parse(librevenge::RVNGDrawingInterface *documentInterface) final;
protected:
void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
//
// interface
//
bool isWindowsFile() const;
protected:
bool createZones();
MWAWInputStreamPtr &getInput();
// Intermediate level
bool readFileHeader();
bool readDocumentHeader();
bool readBrushes();
bool readGrids();
bool readLayers();
bool readMacroNames();
bool readFormats();
bool readSprays();
bool readViews();
//
// last v3 zones
//
bool readEndV3();
//
// Mac RSRC
//
bool readRSRCFileHeader(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile);
bool readPrintInfo(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile);
bool readLPOL(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile);
bool readUsers(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile);
bool readWindows(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile);
//
// Windows RSRC
//
bool readRSRCWindowsFile();
bool readCNam(MWAWEntry const &entry);
bool readCSet(MWAWEntry const &entry);
bool readPrinterDev(MWAWEntry const &entry);
bool readPage(MWAWEntry const &entry);
bool readPrinterSST(MWAWEntry const &entry);
bool readUnknownZoneHeader();
bool readUnknownZone0();
bool readUnknownZone1();
bool readUnknownZone2();
bool readUnknownZone3();
bool readUnknownZone4();
//
// send data to the listener
//
bool send(CanvasParserInternal::Layer const &layer);
//
// low level
//
bool readString(librevenge::RVNGString &string, int maxSize, bool canBeCString=false);
bool readString(MWAWInputStreamPtr input, librevenge::RVNGString &string, int maxSize, bool canBeCString=false);
bool decode(long length);
//
// data
//
std::shared_ptr<CanvasParserInternal::State> m_state;
std::shared_ptr<CanvasGraph> m_graphParser;
std::shared_ptr<CanvasStyleManager> m_styleManager;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWGraphicStyle.hxx
MWAWInputStream.hxx
MWAWParser.hxx
MWAWPosition.hxx
CanvasGraph
the main class to read the graphic part of Canvas file
Definition CanvasGraph.hxx:71
CanvasParser::CanvasStyleManager
friend class CanvasStyleManager
Definition CanvasParser.hxx:64
CanvasParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition CanvasParser.cxx:843
CanvasParser::readPage
bool readPage(MWAWEntry const &entry)
read the Windows Page RSRC: v3
Definition CanvasParser.cxx:2200
CanvasParser::parse
void parse(librevenge::RVNGDrawingInterface *documentInterface) final
virtual function used to parse the input
Definition CanvasParser.cxx:582
CanvasParser::createDocument
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition CanvasParser.cxx:626
CanvasParser::readWindows
bool readWindows(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile)
read the RSRC Windows zone: v3
Definition CanvasParser.cxx:1975
CanvasParser::readViews
bool readViews()
try to read the views
Definition CanvasParser.cxx:1559
CanvasParser::CanvasGraph
friend class CanvasGraph
Definition CanvasParser.hxx:63
CanvasParser::readPrintInfo
bool readPrintInfo(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile)
read the print info zone
Definition CanvasParser.cxx:1771
CanvasParser::readRSRCFileHeader
bool readRSRCFileHeader(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile)
read the RSRC HeAd(a copy of file header) zone: v3
Definition CanvasParser.cxx:1868
CanvasParser::readLayers
bool readLayers()
try to read the layers
Definition CanvasParser.cxx:750
CanvasParser::createZones
bool createZones()
finds the different objects zones
Definition CanvasParser.cxx:655
CanvasParser::readPrinterSST
bool readPrinterSST(MWAWEntry const &entry)
read the Windows PSST RSRC: v3 (the printer, device name, ...)
Definition CanvasParser.cxx:2319
CanvasParser::readUnknownZoneHeader
bool readUnknownZoneHeader()
read the first unknown zone
Definition CanvasParser.cxx:1090
CanvasParser::readMacroNames
bool readMacroNames()
read the macro names
Definition CanvasParser.cxx:1057
CanvasParser::m_graphParser
std::shared_ptr< CanvasGraph > m_graphParser
the graph parser
Definition CanvasParser.hxx:193
CanvasParser::getInput
MWAWInputStreamPtr & getInput()
returns the current input
Definition CanvasParser.cxx:555
CanvasParser::CanvasParser
CanvasParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition CanvasParser.cxx:534
CanvasParser::readLPOL
bool readLPOL(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile)
read the RSRC LPol zone: v3
Definition CanvasParser.cxx:1836
CanvasParser::readString
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
Definition CanvasParser.cxx:1715
CanvasParser::readDocumentHeader
bool readDocumentHeader()
read the document header
Definition CanvasParser.cxx:968
CanvasParser::readGrids
bool readGrids()
read the grid: or a list which begins by a grid
Definition CanvasParser.cxx:1354
CanvasParser::readRSRCWindowsFile
bool readRSRCWindowsFile()
read the resource file which ends the file
Definition CanvasParser.cxx:2006
CanvasParser::readPrinterDev
bool readPrinterDev(MWAWEntry const &entry)
read the Windows DevM RSRC: v3 (main data of the printer device)
Definition CanvasParser.cxx:2287
CanvasParser::readBrushes
bool readBrushes()
try to read the brush
Definition CanvasParser.cxx:1213
CanvasParser::readUsers
bool readUsers(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile)
read the RSRC user zone: v3
Definition CanvasParser.cxx:1910
CanvasParser::readFileHeader
bool readFileHeader()
read the file header: list of unknown numbers
Definition CanvasParser.cxx:897
CanvasParser::m_styleManager
std::shared_ptr< CanvasStyleManager > m_styleManager
the style manager
Definition CanvasParser.hxx:195
CanvasParser::readEndV3
bool readEndV3()
try to read the end zone: v3
Definition CanvasParser.cxx:1609
CanvasParser::isWindowsFile
bool isWindowsFile() const
returns true if the file is a windows file
Definition CanvasParser.cxx:574
CanvasParser::readCSet
bool readCSet(MWAWEntry const &entry)
read the Windows CSet RSRC: v3 (contains the string Default)
Definition CanvasParser.cxx:2175
CanvasParser::~CanvasParser
~CanvasParser() final
destructor
Definition CanvasParser.cxx:551
CanvasParser::send
bool send(CanvasParserInternal::Layer const &layer)
tries to send a layer
Definition CanvasParser.cxx:2361
CanvasParser::readCNam
bool readCNam(MWAWEntry const &entry)
read the Windows CNam RSRC: v3 (always 256 0's bytes)
Definition CanvasParser.cxx:2144
CanvasParser::readSprays
bool readSprays()
try to read the spray
Definition CanvasParser.cxx:1291
CanvasParser::readFormats
bool readFormats()
read the formats' zone, mainly an unit's conversion table
Definition CanvasParser.cxx:1317
CanvasParser::readUnknownZone2
bool readUnknownZone2()
read an unknown zone
Definition CanvasParser.cxx:1473
CanvasParser::m_state
std::shared_ptr< CanvasParserInternal::State > m_state
the state
Definition CanvasParser.hxx:191
CanvasParser::readUnknownZone4
bool readUnknownZone4()
read an unknown zone: the last zone of a v2 files
Definition CanvasParser.cxx:1520
CanvasParser::readUnknownZone0
bool readUnknownZone0()
read an unknown zone: contains a layer name, some font id,sz, ...
Definition CanvasParser.cxx:1107
CanvasParser::readUnknownZone1
bool readUnknownZone1()
read an unknown zone
Definition CanvasParser.cxx:1421
CanvasParser::readUnknownZone3
bool readUnknownZone3()
read an unknown zone
Definition CanvasParser.cxx:1494
CanvasParser::decode
bool decode(long length)
try to decode some data: length==-1 means decode end of input
Definition CanvasParser.cxx:562
CanvasStyleManager
the main class to read the style part of Canvas file
Definition CanvasStyleManager.hxx:67
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWGraphicParser::MWAWGraphicParser
MWAWGraphicParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor (protected)
Definition MWAWParser.hxx:259
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition MWAWHeader.hxx:57
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition libmwaw_internal.hxx:561
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
CanvasParserInternal
Internal: the structures of a CanvasParser.
Definition CanvasParser.cxx:61
libmwaw
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition libmwaw_internal.cxx:51
librevenge
Definition MWAWDocument.hxx:57
CanvasParserInternal::Layer
Internal: the layer of a CanvasParser.
Definition CanvasParser.cxx:63
CanvasParserInternal::State
Internal: the state of a CanvasParser.
Definition CanvasParser.cxx:469