Canvas5Graph.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
/*
* Parser to Canvas v5-v11 text document ( graphic part )
*
*/
#ifndef CANVAS5_GRAPH
# define CANVAS5_GRAPH
#include <string>
#include <utility>
#include <vector>
#include <librevenge/librevenge.h>
#include "libmwaw_internal.hxx"
#include "MWAWDebug.hxx"
#include "MWAWGraphicStyle.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWPosition.hxx"
#include "Canvas5StyleManager.hxx"
class MWAWFont;
class MWAWParagraph;
namespace Canvas5Structure
{
struct Stream;
}
namespace Canvas5GraphInternal
{
struct Shape;
struct ShapeData;
struct State;
struct PseudoShape;
class SubDocument;
}
class Canvas5Image;
class Canvas5Parser;
class Canvas5Graph
{
friend class Canvas5GraphInternal::SubDocument;
friend class Canvas5Image;
friend class Canvas5Parser;
public:
explicit Canvas5Graph(Canvas5Parser &parser);
virtual ~Canvas5Graph();
int version() const;
struct LocalState {
explicit LocalState(MWAWPosition const &pos=MWAWPosition(), MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())
: m_position(pos)
, m_style(style)
, m_transform()
{
}
void multiplyMatrix(std::array<double,9> const &mat);
MWAWPosition m_position;
MWAWGraphicStyle m_style;
MWAWTransformation m_transform;
};
protected:
// interface with main parser
bool sendShape(int sId);
//
// Intermediate level
//
bool findShapeDataZones(std::shared_ptr<Canvas5Structure::Stream> stream);
bool readShapeData(int id, Canvas5GraphInternal::Shape const &shape);
bool readSpecialData(std::shared_ptr<Canvas5Structure::Stream> stream, long len, Canvas5GraphInternal::ShapeData &data, std::string &extra);
std::shared_ptr<Canvas5GraphInternal::PseudoShape> readSpecialData(std::shared_ptr<Canvas5Structure::Stream> stream, long len, unsigned type, MWAWBox2f const &box, std::string &extra);
bool readShapes(Canvas5Structure::Stream &stream, int numShapes);
bool readMatrices(std::shared_ptr<Canvas5Structure::Stream> stream);
bool readDeR3(std::shared_ptr<Canvas5Structure::Stream> stream, Canvas5StyleManager::StyleList &styles);
//
// send data to the listener
//
bool sendShape(int sId, LocalState const &local);
bool send(Canvas5GraphInternal::Shape const &shape, LocalState const &local);
bool sendSpecial(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
LocalState const &local);
bool sendSpecial(MWAWListenerPtr listener, Canvas5GraphInternal::PseudoShape const &pseudoShape, LocalState const &local);
bool sendText(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data);
bool sendCurveText(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
LocalState const &local);
bool sendDimension(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
LocalState const &local);
bool sendDimension9(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
LocalState const &local);
bool sendEffect(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
LocalState const &local);
bool sendExtrude(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
LocalState const &local);
bool sendTechnical(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
LocalState const &local);
bool sendGIF(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data,
LocalState const &local);
//
// Low level
//
void send(MWAWListenerPtr listener, MWAWGraphicShape const &shape, MWAWTransformation const &transform,
MWAWGraphicStyle const &style);
void send(MWAWListenerPtr listener, librevenge::RVNGString const &text, MWAWVec2f const &center,
MWAWTransformation const &transform, MWAWFont const &font, bool addFrame);
private:
Canvas5Graph(Canvas5Graph const &orig) = delete;
Canvas5Graph &operator=(Canvas5Graph const &orig) = delete;
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
std::shared_ptr<Canvas5GraphInternal::State> m_state;
Canvas5Parser *m_mainParser;
std::shared_ptr<Canvas5Image> m_imageParser;
std::shared_ptr<Canvas5StyleManager> m_styleManager;
};
#endif
// 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:352
Canvas5Graph::sendGIF
bool sendGIF(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
tries to send the gif's shape: AnGf (v7)
Definition Canvas5Graph.cxx:2874
Canvas5Graph::m_state
std::shared_ptr< Canvas5GraphInternal::State > m_state
the state
Definition Canvas5Graph.hxx:209
Canvas5Graph::sendExtrude
bool sendExtrude(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
tries to send the extrude's special shape: Extr (pretty basic)
Definition Canvas5Graph.cxx:2739
Canvas5Graph::sendTechnical
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:2977
Canvas5Graph::~Canvas5Graph
virtual ~Canvas5Graph()
destructor
Definition Canvas5Graph.cxx:447
Canvas5Graph::readShapeData
bool readShapeData(int id, Canvas5GraphInternal::Shape const &shape)
try to read a shape data
Definition Canvas5Graph.cxx:689
Canvas5Graph::sendEffect
bool sendEffect(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
tries to send the effect's special shape: effe
Definition Canvas5Graph.cxx:2682
Canvas5Graph::sendDimension9
bool sendDimension9(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
tries to send the dimension line's special shape: DIMN: v9
Definition Canvas5Graph.cxx:3740
Canvas5Graph::m_styleManager
std::shared_ptr< Canvas5StyleManager > m_styleManager
the style manager
Definition Canvas5Graph.hxx:216
Canvas5Graph::Canvas5Graph
Canvas5Graph(Canvas5Parser &parser)
constructor
Definition Canvas5Graph.cxx:438
Canvas5Graph::Canvas5Graph
Canvas5Graph(Canvas5Graph const &orig)=delete
Canvas5Graph::sendCurveText
bool sendCurveText(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
try to send a curve's text zone: CvTe
Definition Canvas5Graph.cxx:3262
Canvas5Graph::readSpecialData
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:911
Canvas5Graph::m_imageParser
std::shared_ptr< Canvas5Image > m_imageParser
the image parser
Definition Canvas5Graph.hxx:214
Canvas5Graph::send
bool send(Canvas5GraphInternal::Shape const &shape, LocalState const &local)
try to send a shape with a transformation
Definition Canvas5Graph.cxx:1758
Canvas5Graph::version
int version() const
returns the file version
Definition Canvas5Graph.cxx:451
Canvas5Graph::readMatrices
bool readMatrices(std::shared_ptr< Canvas5Structure::Stream > stream)
try to read the different matrix
Definition Canvas5Graph.cxx:462
Canvas5Graph::sendText
bool sendText(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data)
try to send a text zone
Definition Canvas5Graph.cxx:2406
Canvas5Graph::sendSpecial
bool sendSpecial(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
try to send a special shape
Definition Canvas5Graph.cxx:2003
Canvas5Graph::sendDimension
bool sendDimension(MWAWListenerPtr listener, Canvas5GraphInternal::Shape const &shape, Canvas5GraphInternal::ShapeData const &data, LocalState const &local)
tries to send the dimension line's special shape: DIMN
Definition Canvas5Graph.cxx:3420
Canvas5Graph::readDeR3
bool readDeR3(std::shared_ptr< Canvas5Structure::Stream > stream, Canvas5StyleManager::StyleList &styles)
try to read a complementary styles zone: DeR3
Definition Canvas5Graph.cxx:1373
Canvas5Graph::sendShape
bool sendShape(int sId)
try to send a shape
Definition Canvas5Graph.cxx:1692
Canvas5Graph::m_mainParser
Canvas5Parser * m_mainParser
the main parser;
Definition Canvas5Graph.hxx:212
Canvas5Graph::operator=
Canvas5Graph & operator=(Canvas5Graph const &orig)=delete
Canvas5Graph::findShapeDataZones
bool findShapeDataZones(std::shared_ptr< Canvas5Structure::Stream > stream)
try to find the list of data's shape zones
Definition Canvas5Graph.cxx:542
Canvas5Graph::readShapes
bool readShapes(Canvas5Structure::Stream &stream, int numShapes)
try to read the different shapes
Definition Canvas5Graph.cxx:601
Canvas5Graph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition Canvas5Graph.hxx:206
Canvas5Graph::Canvas5Parser
friend class Canvas5Parser
Definition Canvas5Graph.hxx:88
Canvas5Graph::Canvas5Image
friend class Canvas5Image
Definition Canvas5Graph.hxx:87
Canvas5Image
the main class to read/convert the image or movie inside of Canvas 5-11 files
Definition Canvas5Image.hxx:78
Canvas5Parser
the main class to read a Canvas 5-10 files (and probably some not password protected Windows 11 files...
Definition Canvas5Parser.hxx:72
MWAWFont
Class to store font.
Definition MWAWFont.hxx:44
MWAWGraphicShape
a structure used to define a picture shape
Definition MWAWGraphicShape.hxx:46
MWAWGraphicStyle
a structure used to define a picture style
Definition MWAWGraphicStyle.hxx:48
MWAWGraphicStyle::emptyStyle
static MWAWGraphicStyle emptyStyle()
returns an empty style.
Definition MWAWGraphicStyle.hxx:477
MWAWParagraph
class to store the paragraph properties
Definition MWAWParagraph.hxx:85
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition MWAWPosition.hxx:48
MWAWTransformation
a transformation which stored the first row of a 3x3 perspective matrix
Definition libmwaw_internal.hxx:1199
libmwaw_internal.hxx
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition libmwaw_internal.hxx:1193
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition libmwaw_internal.hxx:557
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition libmwaw_internal.hxx:553
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition libmwaw_internal.hxx:842
Canvas5GraphInternal
Internal: the structures of a Canvas5Graph.
Definition Canvas5Graph.cxx:70
Canvas5Structure
a namespace used to define basic function or structure to read a Canvas v5-v11 file
Definition Canvas5BMParser.hxx:64
Canvas5GraphInternal::PseudoShape
Internal[low level]: a pseudo class to store the data corresponding to a shape.
Definition Canvas5Graph.cxx:294
Canvas5GraphInternal::ShapeData
Internal: the shape data.
Definition Canvas5Graph.cxx:89
Canvas5GraphInternal::Shape
Internal: the shape of a Canvas5Graph.
Definition Canvas5Graph.cxx:185
Canvas5GraphInternal::State
Internal: the state of a Canvas5Graph.
Definition Canvas5Graph.cxx:310
Canvas5Graph::LocalState
Internal: the local state of a Canvas5Graph.
Definition Canvas5Graph.hxx:100
Canvas5Graph::LocalState::multiplyMatrix
void multiplyMatrix(std::array< double, 9 > const &mat)
set the matrix transform
Definition Canvas5Graph.cxx:4306
Canvas5Graph::LocalState::m_style
MWAWGraphicStyle m_style
the shape style
Definition Canvas5Graph.hxx:113
Canvas5Graph::LocalState::m_transform
MWAWTransformation m_transform
the shape transformation
Definition Canvas5Graph.hxx:115
Canvas5Graph::LocalState::LocalState
LocalState(MWAWPosition const &pos=MWAWPosition(), MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())
default constructor
Definition Canvas5Graph.hxx:102
Canvas5Graph::LocalState::m_position
MWAWPosition m_position
the shape position position
Definition Canvas5Graph.hxx:111
Canvas5Structure::Stream
a sub stream of Canvas5Structure
Definition Canvas5Structure.hxx:49
Canvas5StyleManager::StyleList
a structure use to store a list of styles
Definition Canvas5StyleManager.hxx:109