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 
53 namespace Canvas5Structure
54 {
55 struct Stream;
56 }
57 
58 namespace Canvas5ImageInternal
59 {
60 struct VKFLImage;
61 struct VKFLShape;
62 
63 struct State;
64 }
65 
66 class Canvas5Parser;
68 
78 {
79  friend class Canvas5Parser;
80 
81 public:
83  explicit Canvas5Image(Canvas5Parser &parser);
85  virtual ~Canvas5Image();
86 
88  int version() const;
89 
90  // interface with other parser
91 
100  bool readVKFL(Canvas5Structure::Stream &stream, long len, std::shared_ptr<Canvas5ImageInternal::VKFLImage> &image);
101 
105  bool getBitmap(int bitmapId, MWAWEmbeddedObject &object);
107  std::shared_ptr<Canvas5ImageInternal::VKFLImage> getGIF(int gifId);
109  bool readMacroIndent(Canvas5Structure::Stream &stream, std::vector<unsigned> &id, std::string &extra);
111  std::shared_ptr<Canvas5ImageInternal::VKFLImage> getMACO(std::vector<unsigned> const &id);
113  bool getQuickTime(int quicktimeId, MWAWEmbeddedObject &object);
115  bool getArrow(std::shared_ptr<Canvas5ImageInternal::VKFLImage> image, MWAWGraphicStyle::Arrow &arrow) const;
117  bool getTexture(std::shared_ptr<Canvas5ImageInternal::VKFLImage> image, MWAWEmbeddedObject &texture, MWAWVec2i &textureDim, MWAWColor &averageColor) const;
119  bool send(std::shared_ptr<Canvas5ImageInternal::VKFLImage> image, MWAWListenerPtr listener,
120  MWAWBox2f const &box, MWAWTransformation const &transformation) const;
121 
122 protected:
123  //
124  // Low level
125  //
127  std::shared_ptr<Canvas5StyleManager> getStyleManager() const;
132  MWAWEntry const &data);
135  std::tuple<MWAWEntry, unsigned, long> const &dataTypePos,
136  std::vector<long> &childFieldPos, int subId);
137 
139  bool send(Canvas5ImageInternal::VKFLImage const &image, size_t &shapeId, MWAWListenerPtr listener,
140  MWAWGraphicStyle const &style, MWAWTransformation const &transformation) const;
141 private:
142  Canvas5Image(Canvas5Image const &orig) = delete;
143  Canvas5Image &operator=(Canvas5Image const &orig) = delete;
144 
145 protected:
146  //
147  // data
148  //
151 
153  std::shared_ptr<Canvas5ImageInternal::State> m_state;
154 
157 };
158 #endif
159 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
the main class to read/convert the image or movie inside of Canvas 5/6 file
Definition: Canvas5Image.hxx:78
std::shared_ptr< Canvas5ImageInternal::VKFLImage > getGIF(int gifId)
try to retrieve a gif given a GIF id
Definition: Canvas5Image.cxx:269
bool getQuickTime(int quicktimeId, MWAWEmbeddedObject &object)
try to retrieve a quicktime given a quicktimeId
Definition: Canvas5Image.cxx:289
bool readMacroIndent(Canvas5Structure::Stream &stream, std::vector< unsigned > &id, std::string &extra)
try to read a macro indent (low level)
Definition: Canvas5Image.cxx:357
bool readQkTmRsrc(Canvas5Structure::Stream &stream)
try to read the QkTm rsrc block: a list of media? v6
Definition: Canvas5Image.cxx:641
virtual ~Canvas5Image()
destructor
Definition: Canvas5Image.cxx:244
std::shared_ptr< Canvas5ImageInternal::State > m_state
the state
Definition: Canvas5Image.hxx:153
int version() const
returns the file version
Definition: Canvas5Image.cxx:248
bool getArrow(std::shared_ptr< Canvas5ImageInternal::VKFLImage > image, MWAWGraphicStyle::Arrow &arrow) const
try to retrieve an arrow from a VKFL image
Definition: Canvas5Image.cxx:707
MWAWParserStatePtr m_parserState
the parser state
Definition: Canvas5Image.hxx:150
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:1497
Canvas5Image(Canvas5Image const &orig)=delete
bool readVKFLShapeMainData(Canvas5Structure::Stream &stream, Canvas5ImageInternal::VKFLImage &image, Canvas5ImageInternal::VKFLShape &shape, MWAWEntry const &data)
try to read a shape header in an image
Definition: Canvas5Image.cxx:1082
Canvas5Parser * m_mainParser
the main parser;
Definition: Canvas5Image.hxx:156
Canvas5Image & operator=(Canvas5Image const &orig)=delete
bool readMACORsrc(Canvas5Structure::Stream &stream)
try to read the macros rsrc blocks: a list of vectorised image
Definition: Canvas5Image.cxx:390
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
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:746
Canvas5Image(Canvas5Parser &parser)
constructor
Definition: Canvas5Image.cxx:237
std::shared_ptr< Canvas5StyleManager > getStyleManager() const
return the style manager
Definition: Canvas5Image.cxx:253
bool readVKFLShapeOtherData(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:1272
bool readVKFL(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:770
bool readVKFLShape(Canvas5Structure::Stream &stream, Canvas5ImageInternal::VKFLImage &image)
try to read a shape in an image
Definition: Canvas5Image.cxx:987
bool readAGIFRsrc(Canvas5Structure::Stream &stream)
try to read the AGIF rsrc block: a list of vectorised image v6
Definition: Canvas5Image.cxx:515
bool readBitmaps(Canvas5Structure::Stream &stream)
try to read the second big block: the bitmap
Definition: Canvas5Image.cxx:311
bool getBitmap(int bitmapId, MWAWEmbeddedObject &object)
try to retrieve a bitmap given a bitmapId
Definition: Canvas5Image.cxx:258
the main class to read a Canvas 5/6 files
Definition: Canvas5Parser.hxx:72
the main class to read the style part of Canvas 5 file
Definition: Canvas5StyleManager.hxx:86
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:48
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libmwaw_internal.hxx:1199
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:553
Internal: the structures of a Canvas5Image.
Definition: Canvas5Image.cxx:70
a namespace used to define basic function or structure to read a Canvas 5 file
Definition: Canvas5BMParser.hxx:64
Internal: the internal image of a Canvas5Image.
Definition: Canvas5Image.cxx:166
Internal: the internal shape of a Canvas5Image.
Definition: Canvas5Image.cxx:93
a sub stream of Canvas5Structure
Definition: Canvas5Structure.hxx:49
the class to store a color
Definition: libmwaw_internal.hxx:192
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
a structure used to define an arrow
Definition: MWAWGraphicStyle.hxx:56

Generated on Thu Oct 7 2021 10:16:48 for libmwaw by doxygen 1.9.1