Canvas5Image.hxx Source File documentation

Canvas5Image.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/*
35 * Parser to Canvas 5/6 drawing document ( image part )
36 */
37#ifndef CANVAS5_IMAGE
38# define CANVAS5_IMAGE
39
40#include <string>
41#include <utility>
42#include <vector>
43
44#include <librevenge/librevenge.h>
45
46#include "libmwaw_internal.hxx"
47
48#include "MWAWDebug.hxx"
49#include "MWAWGraphicStyle.hxx"
50#include "MWAWInputStream.hxx"
51#include "MWAWPosition.hxx"
52
53namespace Canvas5Structure
54{
55struct Stream;
56}
57
58namespace Canvas5ImageInternal
59{
60struct VKFLImage;
61struct VKFLShape;
62
63struct State;
64}
65
66class Canvas5Parser;
67class Canvas5StyleManager;
68
77 class Canvas5Image
78{
79 friend class Canvas5Parser;
80
81public:
83 explicit Canvas5Image(Canvas5Parser &parser);
85 virtual ~Canvas5Image();
86
88 int version() const;
89
90 // interface with other parser
91
93 bool readAGIFRsrc(std::shared_ptr<Canvas5Structure::Stream> stream);
95 bool readMACORsrc(std::shared_ptr<Canvas5Structure::Stream> stream);
97 bool readQkTmRsrc(Canvas5Structure::Stream &stream);
100 bool readVKFL(std::shared_ptr<Canvas5Structure::Stream> stream, long len, std::shared_ptr<Canvas5ImageInternal::VKFLImage> &image);
101
103 bool readImages(std::shared_ptr<Canvas5Structure::Stream> stream);
105 bool readImages9(std::shared_ptr<Canvas5Structure::Stream> stream);
107 bool getBitmap(int bitmapId, MWAWEmbeddedObject &object);
109 std::shared_ptr<Canvas5ImageInternal::VKFLImage> getGIF(int gifId);
111 bool readMacroIndent(Canvas5Structure::Stream &stream, std::vector<unsigned> &id, std::string &extra);
113 std::shared_ptr<Canvas5ImageInternal::VKFLImage> getMACO(std::vector<unsigned> const &id);
115 bool getQuickTime(int quicktimeId, MWAWEmbeddedObject &object);
117 bool getArrow(std::shared_ptr<Canvas5ImageInternal::VKFLImage> image, MWAWGraphicStyle::Arrow &arrow) const;
119 bool getTexture(std::shared_ptr<Canvas5ImageInternal::VKFLImage> image, MWAWEmbeddedObject &texture, MWAWVec2i &textureDim, MWAWColor &averageColor) const;
121 bool send(std::shared_ptr<Canvas5ImageInternal::VKFLImage> image, MWAWListenerPtr listener,
122 MWAWBox2f const &box, MWAWTransformation const &transformation) const;
123
124protected:
125 //
126 // Low level
127 //
129 std::shared_ptr<Canvas5StyleManager> getStyleManager() const;
131 bool readVKFLShape(std::shared_ptr<Canvas5Structure::Stream> stream, Canvas5ImageInternal::VKFLImage &image);
133 bool readVKFLShapeMainData(std::shared_ptr<Canvas5Structure::Stream> stream, Canvas5ImageInternal::VKFLImage &image, Canvas5ImageInternal::VKFLShape &shape,
134 MWAWEntry const &data);
136 bool readVKFLShapeOtherData(std::shared_ptr<Canvas5Structure::Stream> stream, Canvas5ImageInternal::VKFLImage &image,
137 std::tuple<MWAWEntry, unsigned, long> const &dataTypePos,
138 std::vector<long> &childFieldPos, int subId);
139
141 bool send(Canvas5ImageInternal::VKFLImage const &image, size_t &shapeId, MWAWListenerPtr listener,
142 MWAWGraphicStyle const &style, MWAWTransformation const &transformation) const;
143private:
144 Canvas5Image(Canvas5Image const &orig) = delete;
145 Canvas5Image &operator=(Canvas5Image const &orig) = delete;
146
147protected:
148 //
149 // data
150 //
152 MWAWParserStatePtr m_parserState;
153
155 std::shared_ptr<Canvas5ImageInternal::State> m_state;
156
158 Canvas5Parser *m_mainParser;
159};
160#endif
161// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWGraphicStyle.hxx
MWAWInputStream.hxx
MWAWPosition.hxx
Canvas5Image
the main class to read/convert the image or movie inside of Canvas 5-11 files
Definition: Canvas5Image.hxx:78
Canvas5Image::getGIF
std::shared_ptr< Canvas5ImageInternal::VKFLImage > getGIF(int gifId)
try to retrieve a gif given a GIF id
Definition: Canvas5Image.cxx:269
Canvas5Image::getQuickTime
bool getQuickTime(int quicktimeId, MWAWEmbeddedObject &object)
try to retrieve a quicktime given a quicktimeId
Definition: Canvas5Image.cxx:289
Canvas5Image::readMacroIndent
bool readMacroIndent(Canvas5Structure::Stream &stream, std::vector< unsigned > &id, std::string &extra)
try to read a macro indent (low level)
Definition: Canvas5Image.cxx:423
Canvas5Image::readQkTmRsrc
bool readQkTmRsrc(Canvas5Structure::Stream &stream)
try to read the QkTm rsrc block: a list of media? v6
Definition: Canvas5Image.cxx:754
Canvas5Image::~Canvas5Image
virtual ~Canvas5Image()
destructor
Definition: Canvas5Image.cxx:244
Canvas5Image::readImages9
bool readImages9(std::shared_ptr< Canvas5Structure::Stream > stream)
try to read the list of bitmap: v9
Definition: Canvas5Image.cxx:355
Canvas5Image::operator=
Canvas5Image & operator=(Canvas5Image const &orig)=delete
Canvas5Image::m_state
std::shared_ptr< Canvas5ImageInternal::State > m_state
the state
Definition: Canvas5Image.hxx:155
Canvas5Image::version
int version() const
returns the file version
Definition: Canvas5Image.cxx:248
Canvas5Image::getArrow
bool getArrow(std::shared_ptr< Canvas5ImageInternal::VKFLImage > image, MWAWGraphicStyle::Arrow &arrow) const
try to retrieve an arrow from a VKFL image
Definition: Canvas5Image.cxx:820
Canvas5Image::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: Canvas5Image.hxx:152
Canvas5Image::send
bool send(std::shared_ptr< Canvas5ImageInternal::VKFLImage > image, MWAWListenerPtr listener, MWAWBox2f const &box, MWAWTransformation const &transformation) const
try to send a image where box is the image bdbox before applying transformation
Definition: Canvas5Image.cxx:1685
Canvas5Image::readImages
bool readImages(std::shared_ptr< Canvas5Structure::Stream > stream)
try to read the second big block: the list of bitmap
Definition: Canvas5Image.cxx:311
Canvas5Image::Canvas5Image
Canvas5Image(Canvas5Image const &orig)=delete
Canvas5Image::readVKFLShapeMainData
bool readVKFLShapeMainData(std::shared_ptr< Canvas5Structure::Stream > stream, Canvas5ImageInternal::VKFLImage &image, Canvas5ImageInternal::VKFLShape &shape, MWAWEntry const &data)
try to read a shape header in an image
Definition: Canvas5Image.cxx:1218
Canvas5Image::readVKFL
bool readVKFL(std::shared_ptr< Canvas5Structure::Stream > stream, long len, std::shared_ptr< Canvas5ImageInternal::VKFLImage > &image)
try to read an unknown vectorized graphic format used to store symbol, texture and arrow
Definition: Canvas5Image.cxx:886
Canvas5Image::m_mainParser
Canvas5Parser * m_mainParser
the main parser;
Definition: Canvas5Image.hxx:158
Canvas5Image::getMACO
std::shared_ptr< Canvas5ImageInternal::VKFLImage > getMACO(std::vector< unsigned > const &id)
try to retrieve a macros image given a MACO id
Definition: Canvas5Image.cxx:279
Canvas5Image::readVKFLShapeOtherData
bool readVKFLShapeOtherData(std::shared_ptr< Canvas5Structure::Stream > stream, Canvas5ImageInternal::VKFLImage &image, std::tuple< MWAWEntry, unsigned, long > const &dataTypePos, std::vector< long > &childFieldPos, int subId)
try to read a external data corresponding to some shapes in an image
Definition: Canvas5Image.cxx:1440
Canvas5Image::getTexture
bool getTexture(std::shared_ptr< Canvas5ImageInternal::VKFLImage > image, MWAWEmbeddedObject &texture, MWAWVec2i &textureDim, MWAWColor &averageColor) const
try to retrieve an texture from a VKFL image
Definition: Canvas5Image.cxx:862
Canvas5Image::readMACORsrc
bool readMACORsrc(std::shared_ptr< Canvas5Structure::Stream > stream)
try to read the macros rsrc blocks: a list of vectorised image
Definition: Canvas5Image.cxx:456
Canvas5Image::getStyleManager
std::shared_ptr< Canvas5StyleManager > getStyleManager() const
return the style manager
Definition: Canvas5Image.cxx:253
Canvas5Image::readVKFLShape
bool readVKFLShape(std::shared_ptr< Canvas5Structure::Stream > stream, Canvas5ImageInternal::VKFLImage &image)
try to read a shape in an image
Definition: Canvas5Image.cxx:1118
Canvas5Image::getBitmap
bool getBitmap(int bitmapId, MWAWEmbeddedObject &object)
try to retrieve a bitmap given a bitmapId
Definition: Canvas5Image.cxx:258
Canvas5Image::readAGIFRsrc
bool readAGIFRsrc(std::shared_ptr< Canvas5Structure::Stream > stream)
try to read the AGIF rsrc block: a list of vectorised image v6
Definition: Canvas5Image.cxx:626
Canvas5Parser
the main class to read a Canvas 5-10 files (and probably some not password protected Windows 11 files...
Definition: Canvas5Parser.hxx:72
Canvas5StyleManager
the main class to read the style part of Canvas 5 file
Definition: Canvas5StyleManager.hxx:86
MWAWBox2< float >
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
MWAWGraphicStyle
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:48
MWAWTransformation
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libmwaw_internal.hxx:1199
MWAWVec2< int >
libmwaw_internal.hxx
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:553
Canvas5ImageInternal
Internal: the structures of a Canvas5Image.
Definition: Canvas5Image.cxx:70
Canvas5Structure
a namespace used to define basic function or structure to read a Canvas v5-v11 file
Definition: Canvas5BMParser.hxx:64
Canvas5ImageInternal::VKFLImage
Internal: the internal image of a Canvas5Image.
Definition: Canvas5Image.cxx:166
Canvas5ImageInternal::VKFLShape
Internal: the internal shape of a Canvas5Image.
Definition: Canvas5Image.cxx:93
Canvas5Structure::Stream
a sub stream of Canvas5Structure
Definition: Canvas5Structure.hxx:49
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
MWAWGraphicStyle::Arrow
a structure used to define an arrow
Definition: MWAWGraphicStyle.hxx:59