ApplePictParser.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 APPLEPICT_PARSER
# define APPLEPICT_PARSER
#include <string>
#include <vector>
#include <librevenge/librevenge.h>
#include "MWAWDebug.hxx"
#include "MWAWGraphicStyle.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
namespace ApplePictParserInternal
{
struct Bitmap;
struct Pixmap;
struct Region;
struct State;
class SubDocument;
}
class ApplePictParser final: public MWAWGraphicParser
{
friend class ApplePictParserInternal::SubDocument;
public:
enum DrawingMethod {
D_FRAME, D_PAINT, D_ERASE, D_INVERT, D_FILL,
D_TEXT, D_UNDEFINED
};
ApplePictParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
~ApplePictParser() final;
bool checkHeader(MWAWHeader *header, bool strict=false) final;
void parse(librevenge::RVNGDrawingInterface *documentInterface) final;
protected:
bool readZone();
void init();
void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
protected:
bool createZones();
//
// low level
//
void drawLine(MWAWVec2i const &pt);
bool readAndDrawRectangle(DrawingMethod method);
void drawRectangle(DrawingMethod method);
bool readAndDrawRoundRectangle(DrawingMethod method);
void drawRoundRectangle(DrawingMethod method);
bool readAndDrawCircle(DrawingMethod method);
void drawCircle(DrawingMethod method);
bool readAndDrawPie(DrawingMethod method);
void drawPie(DrawingMethod method, int startAngle, int dAngle);
bool readAndDrawPolygon(DrawingMethod method);
void drawPolygon(DrawingMethod method);
bool readAndDrawText(std::string &text);
void drawText(MWAWEntry const &entry);
void drawBitmap(ApplePictParserInternal::Bitmap const &bitmap);
void drawPixmap(ApplePictParserInternal::Pixmap const &pixmap);
bool readRGBColor(MWAWColor &color);
bool readBWPattern(MWAWGraphicStyle::Pattern &pattern);
bool readColorPattern(MWAWGraphicStyle::Pattern &pattern);
bool readRegion(ApplePictParserInternal::Region &region);
bool readBitmap(ApplePictParserInternal::Bitmap &bitmap, bool isPacked, bool hasRgn);
bool readPixmap(ApplePictParserInternal::Pixmap &pixmap, bool isPacked, bool haColorTable, bool hasRectMode, bool hasRgn);
bool readQuicktime(MWAWEmbeddedObject &object, MWAWBox2f &bdBox);
static std::string getDrawingName(DrawingMethod method)
{
switch (method) {
case D_FRAME:
return "frame";
case D_PAINT:
return "paint";
case D_ERASE:
return "erase";
case D_INVERT:
return "invert";
case D_FILL:
return "fill";
case D_TEXT:
return "text";
case D_UNDEFINED:
#if !defined(__clang__)
default:
#endif
break;
}
return "";
}
static std::string getModeName(int mode);
//
// data
//
std::shared_ptr<ApplePictParserInternal::State> m_state;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWGraphicStyle.hxx
MWAWInputStream.hxx
MWAWParser.hxx
ApplePictParserInternal::SubDocument
Internal: the subdocument of a ApplePictParser.
Definition ApplePictParser.cxx:751
ApplePictParser::getModeName
static std::string getModeName(int mode)
debug function to print a mode name
Definition ApplePictParser.cxx:2211
ApplePictParser::readAndDrawRoundRectangle
bool readAndDrawRoundRectangle(DrawingMethod method)
read the current round rectangle and draw it
Definition ApplePictParser.cxx:1648
ApplePictParser::readBitmap
bool readBitmap(ApplePictParserInternal::Bitmap &bitmap, bool isPacked, bool hasRgn)
read a bitmap
Definition ApplePictParser.cxx:1826
ApplePictParser::~ApplePictParser
~ApplePictParser() final
destructor
Definition ApplePictParser.cxx:805
ApplePictParser::m_state
std::shared_ptr< ApplePictParserInternal::State > m_state
the state
Definition ApplePictParser.hxx:177
ApplePictParser::ApplePictParser
ApplePictParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition ApplePictParser.cxx:798
ApplePictParser::drawPie
void drawPie(DrawingMethod method, int startAngle, int dAngle)
draw the current circle
Definition ApplePictParser.cxx:2443
ApplePictParser::readRGBColor
bool readRGBColor(MWAWColor &color)
try to read a rgb color
Definition ApplePictParser.cxx:1733
ApplePictParser::readAndDrawPolygon
bool readAndDrawPolygon(DrawingMethod method)
read the current polygon and draw it
Definition ApplePictParser.cxx:1705
ApplePictParser::readZone
bool readZone()
try to read a zone
Definition ApplePictParser.cxx:895
ApplePictParser::readAndDrawPie
bool readAndDrawPie(DrawingMethod method)
read the current pie and draw it
Definition ApplePictParser.cxx:1684
ApplePictParser::init
void init()
inits all internal variables
Definition ApplePictParser.cxx:809
ApplePictParser::getDrawingName
static std::string getDrawingName(DrawingMethod method)
debug function to print a drawing method
Definition ApplePictParser.hxx:148
ApplePictParser::readAndDrawCircle
bool readAndDrawCircle(DrawingMethod method)
read the current circle and draw it
Definition ApplePictParser.cxx:1666
ApplePictParser::drawLine
void drawLine(MWAWVec2i const &pt)
draw a line from current position to position
Definition ApplePictParser.cxx:2386
ApplePictParser::readBWPattern
bool readBWPattern(MWAWGraphicStyle::Pattern &pattern)
try to read a bw pattern
Definition ApplePictParser.cxx:1745
ApplePictParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition ApplePictParser.cxx:2282
ApplePictParser::createZones
bool createZones()
finds the different objects zones
Definition ApplePictParser.cxx:871
ApplePictParser::drawBitmap
void drawBitmap(ApplePictParserInternal::Bitmap const &bitmap)
draw a bitmap
Definition ApplePictParser.cxx:2570
ApplePictParser::drawRectangle
void drawRectangle(DrawingMethod method)
draw the current rectangle
Definition ApplePictParser.cxx:2401
ApplePictParser::drawPolygon
void drawPolygon(DrawingMethod method)
draw the current polygon
Definition ApplePictParser.cxx:2502
ApplePictParser::drawText
void drawText(MWAWEntry const &entry)
draw a current text
Definition ApplePictParser.cxx:2528
ApplePictParser::readColorPattern
bool readColorPattern(MWAWGraphicStyle::Pattern &pattern)
try to read a color pattern
Definition ApplePictParser.cxx:1761
ApplePictParser::readAndDrawRectangle
bool readAndDrawRectangle(DrawingMethod method)
read the current rectangle and draw it
Definition ApplePictParser.cxx:1630
ApplePictParser::readPixmap
bool readPixmap(ApplePictParserInternal::Pixmap &pixmap, bool isPacked, bool haColorTable, bool hasRectMode, bool hasRgn)
read a pixmap
Definition ApplePictParser.cxx:1881
ApplePictParser::drawCircle
void drawCircle(DrawingMethod method)
draw the current circle
Definition ApplePictParser.cxx:2430
ApplePictParser::readRegion
bool readRegion(ApplePictParserInternal::Region &region)
try to read a region
Definition ApplePictParser.cxx:2158
ApplePictParser::DrawingMethod
DrawingMethod
the drawing method: frame, paint, ...
Definition ApplePictParser.hxx:66
ApplePictParser::D_INVERT
@ D_INVERT
Definition ApplePictParser.hxx:67
ApplePictParser::D_ERASE
@ D_ERASE
Definition ApplePictParser.hxx:67
ApplePictParser::D_FILL
@ D_FILL
Definition ApplePictParser.hxx:67
ApplePictParser::D_PAINT
@ D_PAINT
Definition ApplePictParser.hxx:67
ApplePictParser::D_UNDEFINED
@ D_UNDEFINED
Definition ApplePictParser.hxx:68
ApplePictParser::D_FRAME
@ D_FRAME
Definition ApplePictParser.hxx:67
ApplePictParser::D_TEXT
@ D_TEXT
Definition ApplePictParser.hxx:68
ApplePictParser::parse
void parse(librevenge::RVNGDrawingInterface *documentInterface) final
the main parse function
Definition ApplePictParser.cxx:822
ApplePictParser::readQuicktime
bool readQuicktime(MWAWEmbeddedObject &object, MWAWBox2f &bdBox)
try to read a quicktime zone
Definition ApplePictParser.cxx:1962
ApplePictParser::drawRoundRectangle
void drawRoundRectangle(DrawingMethod method)
draw the current round rectangle
Definition ApplePictParser.cxx:2417
ApplePictParser::createDocument
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition ApplePictParser.cxx:847
ApplePictParser::readAndDrawText
bool readAndDrawText(std::string &text)
read the current text and draw it
Definition ApplePictParser.cxx:1792
ApplePictParser::drawPixmap
void drawPixmap(ApplePictParserInternal::Pixmap const &pixmap)
draw a pixmap
Definition ApplePictParser.cxx:2594
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
MWAWGraphicStyle
a structure used to define a picture style
Definition MWAWGraphicStyle.hxx:48
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition MWAWHeader.hxx:57
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition libmwaw_internal.hxx:838
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition libmwaw_internal.hxx:1193
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
ApplePictParserInternal
Internal: the structures of a ApplePictParser.
Definition ApplePictParser.cxx:61
librevenge
Definition MWAWDocument.hxx:57
ApplePictParserInternal::Bitmap
Internal and low level: a class used to read pack/unpack black-white bitmap.
Definition ApplePictParser.cxx:94
ApplePictParserInternal::Pixmap
Internal and low level: a class used to read pack/unpack color pixmap (version 2).
Definition ApplePictParser.cxx:260
ApplePictParserInternal::Region
internal: low level class to store a region
Definition ApplePictParser.cxx:64
ApplePictParserInternal::State
Internal: the state of a ApplePictParser.
Definition ApplePictParser.cxx:596
MWAWColor
the class to store a color
Definition libmwaw_internal.hxx:192
MWAWEmbeddedObject
small class use to define a embedded object
Definition libmwaw_internal.hxx:467