Canvas5Graph.hxx Source File documentation

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 Canvas5 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 LocalTransform;
67
68 struct Shape;
69 struct ShapeData;
70 struct State;
71
72 class SubDocument;
73 }
74
75 class Canvas5Parser;
76
82 class Canvas5Graph
83 {
84 friend class Canvas5GraphInternal::SubDocument;
85 friend class Canvas5Parser;
86
87 public:
89 explicit Canvas5Graph(Canvas5Parser &parser);
91 virtual ~Canvas5Graph();
92
94 int version() const;
95
96 protected:
97
98 // interface with main parser
99
101 bool sendShape(int sId);
102
103 //
104 // Intermediate level
105 //
106
108 bool findShapeDataZones(std::shared_ptr<Canvas5Structure::Stream> stream);
110 bool readShapeData(int id, Canvas5GraphInternal::Shape const &shape);
112 bool readSpecialData(long len, unsigned type, std::string &extra);
114 bool readSpecialData(long len, Canvas5GraphInternal::ShapeData &data, std::string &extra);
116 bool readShapes(Canvas5Structure::Stream &stream, int numShapes);
117
119 bool readMatrices(Canvas5Structure::Stream &stream);
120
122 bool readBitmaps(Canvas5Structure::Stream &stream);
123
125 bool readDeR3(Canvas5Structure::Stream &stream, Canvas5StyleManager::StyleList &styles);
126
127 //
128 // send data to the listener
129 //
130
132 bool sendShape(int sId, Canvas5GraphInternal::LocalTransform const &local);
134 bool send(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::LocalTransform const &local);
136 bool sendSpecial(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
137 Canvas5GraphInternal::LocalTransform const &local);
138
140 bool sendTextZone(int shapeId);
142 bool sendText(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data);
144 bool sendCurveText(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
145 Canvas5GraphInternal::LocalTransform const &local);
147 bool sendEffect(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
148 Canvas5GraphInternal::LocalTransform const &local);
150 bool sendExtrude(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
151 Canvas5GraphInternal::LocalTransform const &local);
153 bool sendDimension(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
154 Canvas5GraphInternal::LocalTransform const &local);
155
156 //
157 // Low level
158 //
159
160 private:
161 Canvas5Graph(Canvas5Graph const &orig) = delete;
162 Canvas5Graph &operator=(Canvas5Graph const &orig) = delete;
163
164 protected:
165 //
166 // data
167 //
169 MWAWParserStatePtr m_parserState;
170
172 std::shared_ptr<Canvas5GraphInternal::State> m_state;
173
175 Canvas5Parser *m_mainParser;
177 std::shared_ptr<Canvas5StyleManager> m_styleManager;
178 };
179 #endif
180 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Canvas5StyleManager.hxx
MWAWDebug.hxx
MWAWGraphicStyle.hxx
MWAWInputStream.hxx
MWAWPosition.hxx
Canvas5GraphInternal::SubDocument
Internal: the subdocument of a Canvas5Graph.
Definition: Canvas5Graph.cxx:308
Canvas5Graph
the main class to read the graphic part of Canvas5 file
Definition: Canvas5Graph.hxx:83
Canvas5Graph::sendExtrude
bool sendExtrude(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, Canvas5GraphInternal::LocalTransform const &local)
tries to send the extrude's special shape: Extr (pretty basic)
Definition: Canvas5Graph.cxx:2189
Canvas5Graph::m_state
std::shared_ptr< Canvas5GraphInternal::State > m_state
the state
Definition: Canvas5Graph.hxx:172
Canvas5Graph::~Canvas5Graph
virtual ~Canvas5Graph()
destructor
Definition: Canvas5Graph.cxx:397
Canvas5Graph::readShapeData
bool readShapeData(int id, Canvas5GraphInternal::Shape const &shape)
try to read a shape data
Definition: Canvas5Graph.cxx:596
Canvas5Graph::sendCurveText
bool sendCurveText(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, Canvas5GraphInternal::LocalTransform const &local)
try to send a curve's text zone: CvTe
Definition: Canvas5Graph.cxx:2332
Canvas5Graph::send
bool send(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::LocalTransform const &local)
try to send a shape with a transformation
Definition: Canvas5Graph.cxx:1310
Canvas5Graph::operator=
Canvas5Graph & operator=(Canvas5Graph const &orig)=delete
Canvas5Graph::sendDimension
bool sendDimension(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, Canvas5GraphInternal::LocalTransform const &local)
tries to send the dimension line's special shape: DIMN
Definition: Canvas5Graph.cxx:2482
Canvas5Graph::readMatrices
bool readMatrices(Canvas5Structure::Stream &stream)
try to read the different matrix
Definition: Canvas5Graph.cxx:412
Canvas5Graph::readBitmaps
bool readBitmaps(Canvas5Structure::Stream &stream)
try to read the second big block: the bitmap
Definition: Canvas5Graph.cxx:1209
Canvas5Graph::sendText
bool sendText(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data)
try to send a text zone
Definition: Canvas5Graph.cxx:1792
Canvas5Graph::m_styleManager
std::shared_ptr< Canvas5StyleManager > m_styleManager
the style manager
Definition: Canvas5Graph.hxx:177
Canvas5Graph::Canvas5Graph
Canvas5Graph(Canvas5Parser &parser)
constructor
Definition: Canvas5Graph.cxx:389
Canvas5Graph::Canvas5Graph
Canvas5Graph(Canvas5Graph const &orig)=delete
Canvas5Graph::version
int version() const
returns the file version
Definition: Canvas5Graph.cxx:401
Canvas5Graph::sendTextZone
bool sendTextZone(int shapeId)
try to send the content of a text zone
Definition: Canvas5Graph.cxx:1770
Canvas5Graph::readDeR3
bool readDeR3(Canvas5Structure::Stream &stream, Canvas5StyleManager::StyleList &styles)
try to read a complementary styles zone: DeR3
Definition: Canvas5Graph.cxx:906
Canvas5Graph::readSpecialData
bool readSpecialData(long len, unsigned type, std::string &extra)
try to read a special shape data (internal helper to understand vkfl structure)
Definition: Canvas5Graph.cxx:770
Canvas5Graph::sendShape
bool sendShape(int sId)
try to send a shape
Definition: Canvas5Graph.cxx:1288
Canvas5Graph::sendSpecial
bool sendSpecial(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, Canvas5GraphInternal::LocalTransform const &local)
try to send a special shape
Definition: Canvas5Graph.cxx:1536
Canvas5Graph::m_mainParser
Canvas5Parser * m_mainParser
the main parser;
Definition: Canvas5Graph.hxx:175
Canvas5Graph::findShapeDataZones
bool findShapeDataZones(std::shared_ptr< Canvas5Structure::Stream > stream)
try to find the list of data's shape zones
Definition: Canvas5Graph.cxx:458
Canvas5Graph::readShapes
bool readShapes(Canvas5Structure::Stream &stream, int numShapes)
try to read the different shapes
Definition: Canvas5Graph.cxx:516
Canvas5Graph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: Canvas5Graph.hxx:169
Canvas5Graph::sendEffect
bool sendEffect(Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, Canvas5GraphInternal::LocalTransform const &local)
tries to send the effect's special shape: effe
Definition: Canvas5Graph.cxx:2007
Canvas5Parser
the main class to read a Canvas 5 files
Definition: Canvas5Parser.hxx:71
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:44
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:85
libmwaw_internal.hxx
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
Canvas5GraphInternal
Internal: the structures of a Canvas5Graph.
Definition: Canvas5Graph.cxx:69
Canvas5Structure
a namespace used to define basic structure to read a Canvas 5 file
Definition: Canvas5Graph.hxx:60
Canvas5GraphInternal::LocalTransform
Internal: the local state of a Canvas5Graph.
Definition: Canvas5Graph.cxx:241
Canvas5GraphInternal::ShapeData
Internal: the shape data.
Definition: Canvas5Graph.cxx:71
Canvas5GraphInternal::Shape
Internal: the shape of a Canvas5Graph.
Definition: Canvas5Graph.cxx:132
Canvas5Structure::Stream
a sub stream of Canvas5Structure
Definition: Canvas5Structure.hxx:46
Canvas5StyleManager::StyleList
a structure use to store a list of styles
Definition: Canvas5StyleManager.hxx:83