Canvas5Graph.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 v5-v11 text document ( graphic part )
36  *
37  */
38 #ifndef CANVAS5_GRAPH
39 # define CANVAS5_GRAPH
40 
41 #include <string>
42 #include <utility>
43 #include <vector>
44 
45 #include <librevenge/librevenge.h>
46 
47 #include "libmwaw_internal.hxx"
48 
49 #include "MWAWDebug.hxx"
50 #include "MWAWGraphicStyle.hxx"
51 #include "MWAWInputStream.hxx"
52 #include "MWAWPosition.hxx"
53 
54 #include "Canvas5StyleManager.hxx"
55 
56 class MWAWFont;
57 class MWAWParagraph;
58 
59 namespace Canvas5Structure
60 {
61 struct Stream;
62 }
63 
64 namespace Canvas5GraphInternal
65 {
66 struct Shape;
67 struct ShapeData;
68 struct State;
69 
70 struct PseudoShape;
71 
72 class SubDocument;
73 }
74 
75 class Canvas5Image;
76 
77 class Canvas5Parser;
78 
85 {
87  friend class Canvas5Image;
88  friend class Canvas5Parser;
89 
90 public:
92  explicit Canvas5Graph(Canvas5Parser &parser);
94  virtual ~Canvas5Graph();
95 
97  int version() const;
98 
100  struct LocalState {
103  : m_position(pos)
104  , m_style(style)
105  , m_transform()
106  {
107  }
109  void multiplyMatrix(std::array<double,9> const &mat);
116  };
117 
118 
119 protected:
120 
121  // interface with main parser
122 
124  bool sendShape(int sId);
125 
126  //
127  // Intermediate level
128  //
129 
131  bool findShapeDataZones(std::shared_ptr<Canvas5Structure::Stream> stream);
133  bool readShapeData(int id, Canvas5GraphInternal::Shape const &shape);
135  bool readSpecialData(std::shared_ptr<Canvas5Structure::Stream> stream, long len, Canvas5GraphInternal::ShapeData &data, std::string &extra);
137  std::shared_ptr<Canvas5GraphInternal::PseudoShape> readSpecialData(std::shared_ptr<Canvas5Structure::Stream> stream, long len, unsigned type, MWAWBox2f const &box, std::string &extra);
139  bool readShapes(Canvas5Structure::Stream &stream, int numShapes);
140 
142  bool readMatrices(std::shared_ptr<Canvas5Structure::Stream> stream);
143 
145  bool readDeR3(std::shared_ptr<Canvas5Structure::Stream> stream, Canvas5StyleManager::StyleList &styles);
146 
147  //
148  // send data to the listener
149  //
150 
152  bool sendShape(int sId, LocalState const &local);
154  bool send(Canvas5GraphInternal::Shape const &shape, LocalState const &local);
157  LocalState const &local);
159  bool sendSpecial(MWAWListenerPtr listener, Canvas5GraphInternal::PseudoShape const &pseudoShape, LocalState const &local);
160 
163 
166  LocalState const &local);
169  LocalState const &local);
172  LocalState const &local);
175  LocalState const &local);
178  LocalState const &local);
181  LocalState const &local);
184  LocalState const &local);
185 
186  //
187  // Low level
188  //
189 
191  void send(MWAWListenerPtr listener, MWAWGraphicShape const &shape, MWAWTransformation const &transform,
192  MWAWGraphicStyle const &style);
194  void send(MWAWListenerPtr listener, librevenge::RVNGString const &text, MWAWVec2f const &center,
195  MWAWTransformation const &transform, MWAWFont const &font, bool addFrame);
196 
197 private:
198  Canvas5Graph(Canvas5Graph const &orig) = delete;
199  Canvas5Graph &operator=(Canvas5Graph const &orig) = delete;
200 
201 protected:
202  //
203  // data
204  //
207 
209  std::shared_ptr<Canvas5GraphInternal::State> m_state;
210 
214  std::shared_ptr<Canvas5Image> m_imageParser;
216  std::shared_ptr<Canvas5StyleManager> m_styleManager;
217 };
218 #endif
219 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
bool readMatrices(std::shared_ptr< Canvas5Structure::Stream > stream)
try to read the different matrix
Definition: Canvas5Graph.cxx:459
std::shared_ptr< Canvas5GraphInternal::State > m_state
the state
Definition: Canvas5Graph.hxx:209
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
Canvas5Parser * m_mainParser
the main parser;
Definition: Canvas5Graph.hxx:212
bool readSpecialData(std::shared_ptr< Canvas5Structure::Stream > stream, long len, Canvas5GraphInternal::ShapeData &data, std::string &extra)
try to read a special shape data
Definition: Canvas5Graph.cxx:908
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:553
Internal: the local state of a Canvas5Graph.
Definition: Canvas5Graph.hxx:100
std::shared_ptr< Canvas5Image > m_imageParser
the image parser
Definition: Canvas5Graph.hxx:214
bool sendCurveText(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
try to send a curve&#39;s text zone: CvTe
Definition: Canvas5Graph.cxx:3255
virtual ~Canvas5Graph()
destructor
Definition: Canvas5Graph.cxx:444
Internal: the subdocument of a Canvas5Graph.
Definition: Canvas5Graph.cxx:348
bool readShapeData(int id, Canvas5GraphInternal::Shape const &shape)
try to read a shape data
Definition: Canvas5Graph.cxx:686
MWAWTransformation m_transform
the shape transformation
Definition: Canvas5Graph.hxx:115
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
LocalState(MWAWPosition const &pos=MWAWPosition(), MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())
default constructor
Definition: Canvas5Graph.hxx:102
int version() const
returns the file version
Definition: Canvas5Graph.cxx:448
bool findShapeDataZones(std::shared_ptr< Canvas5Structure::Stream > stream)
try to find the list of data&#39;s shape zones
Definition: Canvas5Graph.cxx:539
the main class to read the graphic part of Canvas v5-v11 file
Definition: Canvas5Graph.hxx:84
bool readDeR3(std::shared_ptr< Canvas5Structure::Stream > stream, Canvas5StyleManager::StyleList &styles)
try to read a complementary styles zone: DeR3
Definition: Canvas5Graph.cxx:1370
MWAWGraphicStyle m_style
the shape style
Definition: Canvas5Graph.hxx:113
a structure use to store a list of styles
Definition: Canvas5StyleManager.hxx:109
Class to store font.
Definition: MWAWFont.hxx:43
Internal: the structures of a Canvas5Graph.
Definition: Canvas5Graph.cxx:69
MWAWParserStatePtr m_parserState
the parser state
Definition: Canvas5Graph.hxx:206
Internal: the shape data.
Definition: Canvas5Graph.cxx:86
a sub stream of Canvas5Structure
Definition: Canvas5Structure.hxx:49
bool sendTechnical(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
tries to send the technical shape: Tech (v7)
Definition: Canvas5Graph.cxx:2970
bool sendGIF(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
tries to send the gif&#39;s shape: AnGf (v7)
Definition: Canvas5Graph.cxx:2867
bool readShapes(Canvas5Structure::Stream &stream, int numShapes)
try to read the different shapes
Definition: Canvas5Graph.cxx:598
Canvas5Graph & operator=(Canvas5Graph const &orig)=delete
bool sendSpecial(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
try to send a special shape
Definition: Canvas5Graph.cxx:1996
bool sendEffect(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
tries to send the effect&#39;s special shape: effe
Definition: Canvas5Graph.cxx:2675
a structure used to define a picture shape
Definition: MWAWGraphicShape.hxx:45
bool send(Canvas5GraphInternal::Shape const &shape, LocalState const &local)
try to send a shape with a transformation
Definition: Canvas5Graph.cxx:1751
class to store the paragraph properties
Definition: MWAWParagraph.hxx:84
Canvas5Graph(Canvas5Parser &parser)
constructor
Definition: Canvas5Graph.cxx:435
Internal: the shape of a Canvas5Graph.
Definition: Canvas5Graph.cxx:182
the main class to read a Canvas 5-10 files (and probably some not password protected Windows 11 files...
Definition: Canvas5Parser.hxx:71
bool sendExtrude(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
tries to send the extrude&#39;s special shape: Extr (pretty basic)
Definition: Canvas5Graph.cxx:2732
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
bool sendShape(int sId)
try to send a shape
Definition: Canvas5Graph.cxx:1689
std::shared_ptr< Canvas5StyleManager > m_styleManager
the style manager
Definition: Canvas5Graph.hxx:216
void multiplyMatrix(std::array< double, 9 > const &mat)
set the matrix transform
Definition: Canvas5Graph.cxx:4299
bool sendDimension9(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
tries to send the dimension line&#39;s special shape: DIMN: v9
Definition: Canvas5Graph.cxx:3733
MWAWPosition m_position
the shape position position
Definition: Canvas5Graph.hxx:111
Internal[low level]: a pseudo class to store the data corresponding to a shape.
Definition: Canvas5Graph.cxx:291
bool sendText(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data)
try to send a text zone
Definition: Canvas5Graph.cxx:2399
bool sendDimension(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
tries to send the dimension line&#39;s special shape: DIMN
Definition: Canvas5Graph.cxx:3413
a namespace used to define basic function or structure to read a Canvas v5-v11 file ...
Definition: Canvas5BMParser.hxx:63
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libmwaw_internal.hxx:1198
the main class to read/convert the image or movie inside of Canvas 5-11 files
Definition: Canvas5Image.hxx:77
static MWAWGraphicStyle emptyStyle()
returns an empty style.
Definition: MWAWGraphicStyle.hxx:477

Generated for libmwaw by doxygen 1.8.14