CanvasGraph.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 text document ( graphic part )
36  *
37  */
38 #ifndef CANVAS_GRAPH
39 # define CANVAS_GRAPH
40 
41 #include <string>
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 CanvasGraphInternal
54 {
55 struct LocalTransform;
56 struct Shape;
57 struct State;
58 
59 class SubDocument;
60 }
61 
62 class CanvasParser;
63 class CanvasStyleManager;
64 
71 {
73  friend class CanvasParser;
74 
75 public:
77  explicit CanvasGraph(CanvasParser &parser);
79  virtual ~CanvasGraph();
80 
82  int version() const;
83 
84 protected:
86  void setInput(MWAWInputStreamPtr &input);
89 
90  // interface with main parser
91 
93  bool sendShape(int id);
94 
95  //
96  // Intermediate level
97  //
98 
100  bool readShapes(int numShapes, unsigned long shapeLength, unsigned long dataLength);
102  bool readShape(int n, std::vector<MWAWEntry> const &dataZonesList);
105 
111  bool readFileBitmap(long length);
114 
115  //
116  // send data to the listener
117  //
118 
120  void update(CanvasGraphInternal::Shape const &shape, MWAWGraphicStyle &style) const;
122  bool send(CanvasGraphInternal::Shape const &shape, CanvasGraphInternal::LocalTransform const *local=nullptr);
130  bool sendText(CanvasGraphInternal::Shape const &shape);
132  bool sendText(int zId);
133 
134  //
135  // Low level
136  //
137 
139  void markSent(int id);
141  void checkUnsent() const;
142 
143 private:
144  CanvasGraph(CanvasGraph const &orig) = delete;
145  CanvasGraph &operator=(CanvasGraph const &orig) = delete;
146 
147 protected:
148  //
149  // data
150  //
153 
155  std::shared_ptr<CanvasGraphInternal::State> m_state;
156 
160  std::shared_ptr<CanvasStyleManager> m_styleManager;
161 };
162 #endif
163 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWInputStreamPtr & getInput()
returns the current input
Definition: CanvasGraph.cxx:472
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
CanvasGraph & operator=(CanvasGraph const &orig)=delete
void setInput(MWAWInputStreamPtr &input)
store the actual input
Definition: CanvasGraph.cxx:467
the main class to read a Canvas 2 and 3 files
Definition: CanvasParser.hxx:61
bool readShapeData(CanvasGraphInternal::Shape &shape)
try to read the shapes data
Definition: CanvasGraph.cxx:731
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
bool readShape(int n, std::vector< MWAWEntry > const &dataZonesList)
try to read a shape: to do
Definition: CanvasGraph.cxx:589
Internal: the local state of a CanvasGraph.
Definition: CanvasGraph.cxx:285
void update(CanvasGraphInternal::Shape const &shape, MWAWGraphicStyle &style) const
updates the style corresponding to a shape
Definition: CanvasGraph.cxx:1517
void checkUnsent() const
look for unsent shapes in debug mode
Definition: CanvasGraph.cxx:1495
Internal: the subdocument of a CanvasGraph.
Definition: CanvasGraph.cxx:372
bool sendShape(int id)
tries to send a shape with id
Definition: CanvasGraph.cxx:477
the main class to read the graphic part of Canvas file
Definition: CanvasGraph.hxx:70
Internal: the shape of a CanvasGraph.
Definition: CanvasGraph.cxx:68
the main class to read the style part of Canvas file
Definition: CanvasStyleManager.hxx:66
bool sendText(CanvasGraphInternal::Shape const &shape)
tries to send the text of a text&#39;s shape
Definition: CanvasGraph.cxx:2779
virtual ~CanvasGraph()
destructor
Definition: CanvasGraph.cxx:458
bool getBitmap(CanvasGraphInternal::Shape const &shape, MWAWEmbeddedObject &obj)
tries to read the color bitmap stored in 55&#39;s shape: v3.5
Definition: CanvasGraph.cxx:1070
Internal: the structures of a CanvasGraph.
Definition: CanvasGraph.cxx:65
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
bool getBitmapBW(CanvasGraphInternal::Shape const &shape, MWAWEmbeddedObject &obj)
tries to read a bitmap stored in the rectangle&#39;s data
Definition: CanvasGraph.cxx:1233
CanvasParser * m_mainParser
the main parser;
Definition: CanvasGraph.hxx:158
bool sendSpecial(CanvasGraphInternal::Shape const &shape, CanvasGraphInternal::LocalTransform const &local)
tries to send the special content
Definition: CanvasGraph.cxx:2557
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
std::shared_ptr< CanvasStyleManager > m_styleManager
the style manager
Definition: CanvasGraph.hxx:160
int version() const
returns the file version
Definition: CanvasGraph.cxx:462
bool getPicture(CanvasGraphInternal::Shape const &shape, MWAWEmbeddedObject &obj)
tries to read a picture stored in the picture&#39;s data
Definition: CanvasGraph.cxx:1433
void markSent(int id)
mark the id&#39;s shape as read in debug mode
Definition: CanvasGraph.cxx:1477
std::shared_ptr< CanvasGraphInternal::State > m_state
the state
Definition: CanvasGraph.hxx:155
bool send(CanvasGraphInternal::Shape const &shape, CanvasGraphInternal::LocalTransform const *local=nullptr)
tries to send a shape
Definition: CanvasGraph.cxx:1596
bool sendMultiLines(CanvasGraphInternal::Shape const &shape, CanvasGraphInternal::LocalTransform const &local)
tries the multiligne&#39;s special shape: Palm
Definition: CanvasGraph.cxx:2239
CanvasGraph(CanvasParser &parser)
constructor
Definition: CanvasGraph.cxx:450
MWAWParserStatePtr m_parserState
the parser state
Definition: CanvasGraph.hxx:152
bool readFileBitmap(long length)
tries to read the file bitmap: windows v3.5
Definition: CanvasGraph.cxx:1338
bool sendDimension(CanvasGraphInternal::Shape const &shape, CanvasGraphInternal::LocalTransform const &local)
tries the dimension line&#39;s special shape: DIMN
Definition: CanvasGraph.cxx:1907
bool readShapes(int numShapes, unsigned long shapeLength, unsigned long dataLength)
try to read the shapes: in fact, the compression header + the list of shapes
Definition: CanvasGraph.cxx:497

Generated for libmwaw by doxygen 1.8.14