ApplePictParser.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3/* libmwaw
4* Version: MPL 2.0 / LGPLv2+
5*
6* The contents of this file are subject to the Mozilla Public License Version
7* 2.0 (the "License"); you may not use this file except in compliance with
8* the License or as specified alternatively below. You may obtain a copy of
9* the License at http://www.mozilla.org/MPL/
10*
11* Software distributed under the License is distributed on an "AS IS" basis,
12* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13* for the specific language governing rights and limitations under the
14* License.
15*
16* Major Contributor(s):
17* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20* Copyright (C) 2006, 2007 Andrew Ziem
21* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22*
23*
24* All Rights Reserved.
25*
26* For minor contributions see the git repository.
27*
28* Alternatively, the contents of this file may be used under the terms of
29* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30* in which case the provisions of the LGPLv2+ are applicable
31* instead of those above.
32*/
33
34#ifndef APPLEPICT_PARSER
35# define APPLEPICT_PARSER
36
37#include <string>
38#include <vector>
39
40#include <librevenge/librevenge.h>
41
42#include "MWAWDebug.hxx"
43#include "MWAWGraphicStyle.hxx"
44#include "MWAWInputStream.hxx"
45
46#include "MWAWParser.hxx"
47
49{
50struct Bitmap;
51struct Pixmap;
52struct Region;
53struct State;
54
55class SubDocument;
56}
57
62{
64public:
69 };
70
72 ApplePictParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
74 ~ApplePictParser() final;
75
77 bool checkHeader(MWAWHeader *header, bool strict=false) final;
78
80 void parse(librevenge::RVNGDrawingInterface *documentInterface) final;
81
82protected:
84 bool readZone();
85
87 void init();
88
90 void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
91
92protected:
94 bool createZones();
95
96 //
97 // low level
98 //
99
101 void drawLine(MWAWVec2i const &pt);
105 void drawRectangle(DrawingMethod method);
111 bool readAndDrawCircle(DrawingMethod method);
113 void drawCircle(DrawingMethod method);
115 bool readAndDrawPie(DrawingMethod method);
117 void drawPie(DrawingMethod method, int startAngle, int dAngle);
121 void drawPolygon(DrawingMethod method);
123 bool readAndDrawText(std::string &text);
125 void drawText(MWAWEntry const &entry);
126
128 void drawBitmap(ApplePictParserInternal::Bitmap const &bitmap);
130 void drawPixmap(ApplePictParserInternal::Pixmap const &pixmap);
131
133 bool readRGBColor(MWAWColor &color);
135 bool readBWPattern(MWAWGraphicStyle::Pattern &pattern);
137 bool readColorPattern(MWAWGraphicStyle::Pattern &pattern);
139 bool readRegion(ApplePictParserInternal::Region &region);
141 bool readBitmap(ApplePictParserInternal::Bitmap &bitmap, bool isPacked, bool hasRgn);
143 bool readPixmap(ApplePictParserInternal::Pixmap &pixmap, bool isPacked, bool haColorTable, bool hasRectMode, bool hasRgn);
145 bool readQuicktime(MWAWEmbeddedObject &object, MWAWBox2f &bdBox);
146
148 static std::string getDrawingName(DrawingMethod method)
149 {
150 switch (method) {
151 case D_FRAME:
152 return "frame";
153 case D_PAINT:
154 return "paint";
155 case D_ERASE:
156 return "erase";
157 case D_INVERT:
158 return "invert";
159 case D_FILL:
160 return "fill";
161 case D_TEXT:
162 return "text";
163 case D_UNDEFINED:
164#if !defined(__clang__)
165 default:
166#endif
167 break;
168 }
169 return "";
170 }
172 static std::string getModeName(int mode);
173 //
174 // data
175 //
177 std::shared_ptr<ApplePictParserInternal::State> m_state;
178};
179#endif
180// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Internal: the subdocument of a ApplePictParser.
Definition: ApplePictParser.cxx:751
the main class to read a ApplePict file
Definition: ApplePictParser.hxx:62
static std::string getModeName(int mode)
debug function to print a mode name
Definition: ApplePictParser.cxx:2211
bool readAndDrawRoundRectangle(DrawingMethod method)
read the current round rectangle and draw it
Definition: ApplePictParser.cxx:1648
bool readBitmap(ApplePictParserInternal::Bitmap &bitmap, bool isPacked, bool hasRgn)
read a bitmap
Definition: ApplePictParser.cxx:1826
~ApplePictParser() final
destructor
Definition: ApplePictParser.cxx:805
std::shared_ptr< ApplePictParserInternal::State > m_state
the state
Definition: ApplePictParser.hxx:177
void drawPie(DrawingMethod method, int startAngle, int dAngle)
draw the current circle
Definition: ApplePictParser.cxx:2443
bool readRGBColor(MWAWColor &color)
try to read a rgb color
Definition: ApplePictParser.cxx:1733
bool readAndDrawPolygon(DrawingMethod method)
read the current polygon and draw it
Definition: ApplePictParser.cxx:1705
bool readZone()
try to read a zone
Definition: ApplePictParser.cxx:895
bool readAndDrawPie(DrawingMethod method)
read the current pie and draw it
Definition: ApplePictParser.cxx:1684
void init()
inits all internal variables
Definition: ApplePictParser.cxx:809
static std::string getDrawingName(DrawingMethod method)
debug function to print a drawing method
Definition: ApplePictParser.hxx:148
bool readAndDrawCircle(DrawingMethod method)
read the current circle and draw it
Definition: ApplePictParser.cxx:1666
void drawLine(MWAWVec2i const &pt)
draw a line from current position to position
Definition: ApplePictParser.cxx:2386
bool readBWPattern(MWAWGraphicStyle::Pattern &pattern)
try to read a bw pattern
Definition: ApplePictParser.cxx:1745
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition: ApplePictParser.cxx:2282
bool createZones()
finds the different objects zones
Definition: ApplePictParser.cxx:871
void drawBitmap(ApplePictParserInternal::Bitmap const &bitmap)
draw a bitmap
Definition: ApplePictParser.cxx:2570
void drawRectangle(DrawingMethod method)
draw the current rectangle
Definition: ApplePictParser.cxx:2401
void drawPolygon(DrawingMethod method)
draw the current polygon
Definition: ApplePictParser.cxx:2502
void drawText(MWAWEntry const &entry)
draw a current text
Definition: ApplePictParser.cxx:2528
bool readColorPattern(MWAWGraphicStyle::Pattern &pattern)
try to read a color pattern
Definition: ApplePictParser.cxx:1761
bool readAndDrawRectangle(DrawingMethod method)
read the current rectangle and draw it
Definition: ApplePictParser.cxx:1630
bool readPixmap(ApplePictParserInternal::Pixmap &pixmap, bool isPacked, bool haColorTable, bool hasRectMode, bool hasRgn)
read a pixmap
Definition: ApplePictParser.cxx:1881
void drawCircle(DrawingMethod method)
draw the current circle
Definition: ApplePictParser.cxx:2430
bool readRegion(ApplePictParserInternal::Region &region)
try to read a region
Definition: ApplePictParser.cxx:2158
DrawingMethod
the drawing method: frame, paint, ...
Definition: ApplePictParser.hxx:66
@ D_INVERT
Definition: ApplePictParser.hxx:67
@ D_ERASE
Definition: ApplePictParser.hxx:67
@ D_FILL
Definition: ApplePictParser.hxx:67
@ D_PAINT
Definition: ApplePictParser.hxx:67
@ D_UNDEFINED
Definition: ApplePictParser.hxx:68
@ D_FRAME
Definition: ApplePictParser.hxx:67
@ D_TEXT
Definition: ApplePictParser.hxx:68
void parse(librevenge::RVNGDrawingInterface *documentInterface) final
the main parse function
Definition: ApplePictParser.cxx:822
bool readQuicktime(MWAWEmbeddedObject &object, MWAWBox2f &bdBox)
try to read a quicktime zone
Definition: ApplePictParser.cxx:1962
void drawRoundRectangle(DrawingMethod method)
draw the current round rectangle
Definition: ApplePictParser.cxx:2417
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition: ApplePictParser.cxx:847
bool readAndDrawText(std::string &text)
read the current text and draw it
Definition: ApplePictParser.cxx:1792
void drawPixmap(ApplePictParserInternal::Pixmap const &pixmap)
draw a pixmap
Definition: ApplePictParser.cxx:2594
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
virtual class which defines the ancestor of all graphic zone parser
Definition: MWAWParser.hxx:251
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:48
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:57
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:561
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
Internal: the structures of a ApplePictParser.
Definition: ApplePictParser.cxx:61
Definition: MWAWDocument.hxx:57
the class to store a color
Definition: libmwaw_internal.hxx:192
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467

Generated on Wed May 3 2023 07:18:29 for libmwaw by doxygen 1.9.6