CanvasGraph.hxx Source File documentation

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
53namespace CanvasGraphInternal
54{
55struct LocalTransform;
56struct Shape;
57struct State;
58
59class SubDocument;
60}
61
62class CanvasParser;
63class CanvasStyleManager;
64
70 class CanvasGraph
71{
72 friend class CanvasGraphInternal::SubDocument;
73 friend class CanvasParser;
74
75public:
77 explicit CanvasGraph(CanvasParser &parser);
79 virtual ~CanvasGraph();
80
82 int version() const;
83
84protected:
86 void setInput(MWAWInputStreamPtr &input);
88 MWAWInputStreamPtr &getInput();
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
143private:
144 CanvasGraph(CanvasGraph const &orig) = delete;
145 CanvasGraph &operator=(CanvasGraph const &orig) = delete;
146
147protected:
148 //
149 // data
150 //
152 MWAWParserStatePtr m_parserState;
153
155 std::shared_ptr<CanvasGraphInternal::State> m_state;
156
158 CanvasParser *m_mainParser;
160 std::shared_ptr<CanvasStyleManager> m_styleManager;
161};
162#endif
163// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWGraphicStyle.hxx
MWAWInputStream.hxx
MWAWPosition.hxx
CanvasGraphInternal::SubDocument
Internal: the subdocument of a CanvasGraph.
Definition: CanvasGraph.cxx:373
CanvasGraph
the main class to read the graphic part of Canvas file
Definition: CanvasGraph.hxx:71
CanvasGraph::getBitmapBW
bool getBitmapBW(CanvasGraphInternal::Shape const &shape, MWAWEmbeddedObject &obj)
tries to read a bitmap stored in the rectangle's data
Definition: CanvasGraph.cxx:1233
CanvasGraph::readShapeData
bool readShapeData(CanvasGraphInternal::Shape &shape)
try to read the shapes data
Definition: CanvasGraph.cxx:731
CanvasGraph::getBitmap
bool getBitmap(CanvasGraphInternal::Shape const &shape, MWAWEmbeddedObject &obj)
tries to read the color bitmap stored in 55's shape: v3.5
Definition: CanvasGraph.cxx:1070
CanvasGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: CanvasGraph.hxx:152
CanvasGraph::checkUnsent
void checkUnsent() const
look for unsent shapes in debug mode
Definition: CanvasGraph.cxx:1495
CanvasGraph::CanvasGraph
CanvasGraph(CanvasGraph const &orig)=delete
CanvasGraph::sendSpecial
bool sendSpecial(CanvasGraphInternal::Shape const &shape, CanvasGraphInternal::LocalTransform const &local)
tries to send the special content
Definition: CanvasGraph.cxx:2557
CanvasGraph::update
void update(CanvasGraphInternal::Shape const &shape, MWAWGraphicStyle &style) const
updates the style corresponding to a shape
Definition: CanvasGraph.cxx:1517
CanvasGraph::getInput
MWAWInputStreamPtr & getInput()
returns the current input
Definition: CanvasGraph.cxx:472
CanvasGraph::~CanvasGraph
virtual ~CanvasGraph()
destructor
Definition: CanvasGraph.cxx:458
CanvasGraph::m_state
std::shared_ptr< CanvasGraphInternal::State > m_state
the state
Definition: CanvasGraph.hxx:155
CanvasGraph::operator=
CanvasGraph & operator=(CanvasGraph const &orig)=delete
CanvasGraph::version
int version() const
returns the file version
Definition: CanvasGraph.cxx:462
CanvasGraph::getPicture
bool getPicture(CanvasGraphInternal::Shape const &shape, MWAWEmbeddedObject &obj)
tries to read a picture stored in the picture's data
Definition: CanvasGraph.cxx:1433
CanvasGraph::markSent
void markSent(int id)
mark the id's shape as read in debug mode
Definition: CanvasGraph.cxx:1477
CanvasGraph::m_styleManager
std::shared_ptr< CanvasStyleManager > m_styleManager
the style manager
Definition: CanvasGraph.hxx:160
CanvasGraph::m_mainParser
CanvasParser * m_mainParser
the main parser;
Definition: CanvasGraph.hxx:158
CanvasGraph::readShape
bool readShape(int n, std::vector< MWAWEntry > const &dataZonesList)
try to read a shape: to do
Definition: CanvasGraph.cxx:589
CanvasGraph::readShapes
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
CanvasGraph::sendMultiLines
bool sendMultiLines(CanvasGraphInternal::Shape const &shape, CanvasGraphInternal::LocalTransform const &local)
tries the multiligne's special shape: Palm
Definition: CanvasGraph.cxx:2239
CanvasGraph::sendText
bool sendText(CanvasGraphInternal::Shape const &shape)
tries to send the text of a text's shape
Definition: CanvasGraph.cxx:2779
CanvasGraph::sendDimension
bool sendDimension(CanvasGraphInternal::Shape const &shape, CanvasGraphInternal::LocalTransform const &local)
tries the dimension line's special shape: DIMN
Definition: CanvasGraph.cxx:1907
CanvasGraph::readFileBitmap
bool readFileBitmap(long length)
tries to read the file bitmap: windows v3.5
Definition: CanvasGraph.cxx:1338
CanvasGraph::setInput
void setInput(MWAWInputStreamPtr &input)
store the actual input
Definition: CanvasGraph.cxx:467
CanvasGraph::send
bool send(CanvasGraphInternal::Shape const &shape, CanvasGraphInternal::LocalTransform const *local=nullptr)
tries to send a shape
Definition: CanvasGraph.cxx:1596
CanvasGraph::sendShape
bool sendShape(int id)
tries to send a shape with id
Definition: CanvasGraph.cxx:477
CanvasParser
the main class to read a Canvas 2 and 3 files
Definition: CanvasParser.hxx:62
CanvasStyleManager
the main class to read the style part of Canvas file
Definition: CanvasStyleManager.hxx:67
MWAWGraphicStyle
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:48
libmwaw_internal.hxx
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
CanvasGraphInternal
Internal: the structures of a CanvasGraph.
Definition: CanvasGraph.cxx:66
CanvasGraphInternal::LocalTransform
Internal: the local state of a CanvasGraph.
Definition: CanvasGraph.cxx:285
CanvasGraphInternal::Shape
Internal: the shape of a CanvasGraph.
Definition: CanvasGraph.cxx:68
MWAWEmbeddedObject
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467