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);
104  bool readShapeData(CanvasGraphInternal::Shape &shape);
105 
107  bool getBitmapBW(CanvasGraphInternal::Shape const &shape, MWAWEmbeddedObject &obj);
109  bool getBitmap(CanvasGraphInternal::Shape const &shape, MWAWEmbeddedObject &obj);
111  bool readFileBitmap(long length);
113  bool getPicture(CanvasGraphInternal::Shape const &shape, MWAWEmbeddedObject &obj);
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);
124  bool sendDimension(CanvasGraphInternal::Shape const &shape, CanvasGraphInternal::LocalTransform const &local);
126  bool sendMultiLines(CanvasGraphInternal::Shape const &shape, CanvasGraphInternal::LocalTransform const &local);
128  bool sendSpecial(CanvasGraphInternal::Shape const &shape, CanvasGraphInternal::LocalTransform const &local);
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:
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
the main class to read a Canvas 2 and 3 files
Definition: CanvasParser.hxx:63
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
Internal: the local state of a CanvasGraph.
Definition: CanvasGraph.cxx:285
bool send(CanvasParserInternal::Layer const &layer)
tries to send a layer
Definition: CanvasParser.cxx:2363
Internal: the subdocument of a CanvasGraph.
Definition: CanvasGraph.cxx:372
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
MWAWInputStreamPtr & getInput()
returns the current input
Definition: CanvasParser.cxx:558
int version() const
returns the works version
Definition: MWAWParser.hxx:108
the main class to read the style part of Canvas file
Definition: CanvasStyleManager.hxx:66
Internal: the structures of a CanvasGraph.
Definition: CanvasGraph.cxx:65
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
CanvasParser * m_mainParser
the main parser;
Definition: CanvasGraph.hxx:158
MWAWParser & operator=(const MWAWParser &)=delete
private operator=: forbidden
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
friend class CanvasGraph
Definition: CanvasParser.hxx:65
std::shared_ptr< CanvasGraphInternal::State > m_state
the state
Definition: CanvasGraph.hxx:155
MWAWParserStatePtr m_parserState
the parser state
Definition: CanvasGraph.hxx:152

Generated on Sat Sep 24 2022 13:42:42 for libmwaw by doxygen 1.8.13