RagTime5Graph.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 RagTime 5-6 document ( graphic part )
*
*/
#ifndef RAGTIME5_GRAPH
# define RAGTIME5_GRAPH
#include <string>
#include <map>
#include <vector>
#include <librevenge/librevenge.h>
#include "libmwaw_internal.hxx"
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWPosition.hxx"
#include "RagTime5StructManager.hxx"
#include "RagTime5ClusterManager.hxx"
namespace RagTime5GraphInternal
{
struct ClusterButton;
struct ClusterGraphic;
struct ClusterPicture;
struct Shape;
struct State;
class SubDocument;
}
class RagTime5Document;
class RagTime5StructManager;
class RagTime5StyleManager;
class RagTime5Zone;
class MWAWGraphicStyle;
class RagTime5Graph
{
friend class RagTime5GraphInternal::SubDocument;
friend class RagTime5Document;
public:
explicit RagTime5Graph(RagTime5Document &doc);
virtual ~RagTime5Graph();
int version() const;
int numPages() const;
protected:
void flushExtra(bool onlyCheck=false);
// interface with main parser
bool sendTextZone(MWAWListenerPtr listener, int zId, int pId, double totalWidth=-1);
bool sendButtonZoneAsText(MWAWListenerPtr listener, int zId);
//
// Intermediate level
//
//
// picture
//
bool readPictureContainer(RagTime5Zone &zone);
bool readPictureData(RagTime5Zone &zone);
bool readPictureData(RagTime5Zone &zone, librevenge::RVNGBinaryData &data, std::string &type);
bool readPictureList(RagTime5Zone &zone);
bool readPictureRep(RagTime5Zone &zone);
bool readPictureMatch(RagTime5Zone &zone, bool color);
//
// basic graphic
//
bool readGraphicTypes(RagTime5ClusterManager::Link const &link);
bool readColorPatternZone(RagTime5ClusterManager::Cluster &cluster);
std::shared_ptr<RagTime5ClusterManager::Cluster> readButtonCluster(RagTime5Zone &zone, int zoneType);
std::shared_ptr<RagTime5ClusterManager::Cluster> readGraphicCluster(RagTime5Zone &zone, int zoneType);
bool readGraphicUsed(int typeId);
bool readGraphicShapes(RagTime5GraphInternal::ClusterGraphic &cluster);
bool readGraphicShape(RagTime5GraphInternal::ClusterGraphic &cluster, RagTime5Zone &dataZone, long endPos, int n, librevenge::RVNGString const &dataName);
bool readGraphicTransformations(RagTime5ClusterManager::Link const &link);
std::shared_ptr<RagTime5ClusterManager::Cluster> readPictureCluster(RagTime5Zone &zone, int zoneType);
//
// low level
//
void checkGraphicCluster(RagTime5GraphInternal::ClusterGraphic &cluster);
//
// send data
//
bool send(int zoneId, MWAWListenerPtr listener, MWAWPosition const &pos);
bool send(RagTime5GraphInternal::ClusterButton &cluster, MWAWListenerPtr listener, MWAWPosition const &pos, MWAWGraphicStyle const &style);
bool send(RagTime5GraphInternal::ClusterGraphic &cluster, MWAWListenerPtr listener, MWAWPosition const &pos);
bool send(RagTime5GraphInternal::Shape const &shape, RagTime5GraphInternal::ClusterGraphic const &cluster, MWAWListenerPtr listener, MWAWPosition const &pos, int depth=0);
bool send(RagTime5GraphInternal::ClusterPicture &cluster, MWAWListenerPtr listener, MWAWPosition const &pos);
public:
static std::string printType(unsigned long fileType)
{
return RagTime5StructManager::printType(fileType);
}
private:
RagTime5Graph(RagTime5Graph const &orig);
RagTime5Graph &operator=(RagTime5Graph const &orig);
protected:
//
// data
//
RagTime5Document &m_document;
std::shared_ptr<RagTime5StructManager> m_structManager;
std::shared_ptr<RagTime5StyleManager> m_styleManager;
MWAWParserStatePtr m_parserState;
std::shared_ptr<RagTime5GraphInternal::State> m_state;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWInputStream.hxx
MWAWPosition.hxx
RagTime5ClusterManager.hxx
RagTime5StructManager.hxx
MWAWGraphicStyle
a structure used to define a picture style
Definition MWAWGraphicStyle.hxx:48
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition MWAWPosition.hxx:48
RagTime5Document
the main class to read a RagTime v5 file
Definition RagTime5Document.hxx:77
RagTime5GraphInternal::SubDocument
Internal: the subdocument of a RagTime5Graph.
Definition RagTime5Graph.cxx:545
RagTime5Graph::sendTextZone
bool sendTextZone(MWAWListenerPtr listener, int zId, int pId, double totalWidth=-1)
ask to send a text zone
Definition RagTime5Graph.cxx:653
RagTime5Graph::readGraphicTypes
bool readGraphicTypes(RagTime5ClusterManager::Link const &link)
try to read a main graphic types
Definition RagTime5Graph.cxx:667
RagTime5Graph::RagTime5Graph
RagTime5Graph(RagTime5Document &doc)
constructor
Definition RagTime5Graph.cxx:613
RagTime5Graph::operator=
RagTime5Graph & operator=(RagTime5Graph const &orig)
RagTime5Graph::readGraphicShapes
bool readGraphicShapes(RagTime5GraphInternal::ClusterGraphic &cluster)
try to read the graphic shapes of a cluster
Definition RagTime5Graph.cxx:838
RagTime5Graph::readGraphicCluster
std::shared_ptr< RagTime5ClusterManager::Cluster > readGraphicCluster(RagTime5Zone &zone, int zoneType)
try to read a graphic zone
Definition RagTime5Graph.cxx:3805
RagTime5Graph::readGraphicShape
bool readGraphicShape(RagTime5GraphInternal::ClusterGraphic &cluster, RagTime5Zone &dataZone, long endPos, int n, librevenge::RVNGString const &dataName)
try to read a graphic
Definition RagTime5Graph.cxx:940
RagTime5Graph::checkGraphicCluster
void checkGraphicCluster(RagTime5GraphInternal::ClusterGraphic &cluster)
check the graphic cluster data: check if there is no loop, ...
Definition RagTime5Graph.cxx:3886
RagTime5Graph::readGraphicUsed
bool readGraphicUsed(int typeId)
try to read the id zone => used
Definition RagTime5Graph.cxx:1267
RagTime5Graph::numPages
int numPages() const
returns the number of pages
Definition RagTime5Graph.cxx:631
RagTime5Graph::flushExtra
void flushExtra(bool onlyCheck=false)
sends the data which have not yet been sent to the listener
Definition RagTime5Graph.cxx:1801
RagTime5Graph::readPictureList
bool readPictureList(RagTime5Zone &zone)
try to read a picture list
Definition RagTime5Graph.cxx:1387
RagTime5Graph::m_styleManager
std::shared_ptr< RagTime5StyleManager > m_styleManager
the style manager
Definition RagTime5Graph.hxx:202
RagTime5Graph::m_document
RagTime5Document & m_document
the parser
Definition RagTime5Graph.hxx:197
RagTime5Graph::version
int version() const
returns the file version
Definition RagTime5Graph.cxx:626
RagTime5Graph::readPictureContainer
bool readPictureContainer(RagTime5Zone &zone)
try to read a picture data zone
Definition RagTime5Graph.cxx:1470
RagTime5Graph::readPictureMatch
bool readPictureMatch(RagTime5Zone &zone, bool color)
try to read a picture match zone
Definition RagTime5Graph.cxx:1727
RagTime5Graph::readGraphicTransformations
bool readGraphicTransformations(RagTime5ClusterManager::Link const &link)
try to read a graphic transformations zone
Definition RagTime5Graph.cxx:1326
RagTime5Graph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition RagTime5Graph.hxx:204
RagTime5Graph::sendButtonZoneAsText
bool sendButtonZoneAsText(MWAWListenerPtr listener, int zId)
ask to send the button content as text
Definition RagTime5Graph.cxx:1835
RagTime5Graph::~RagTime5Graph
virtual ~RagTime5Graph()
destructor
Definition RagTime5Graph.cxx:622
RagTime5Graph::RagTime5Document
friend class RagTime5Document
Definition RagTime5Graph.hxx:83
RagTime5Graph::readPictureRep
bool readPictureRep(RagTime5Zone &zone)
try to read a picture rep
Definition RagTime5Graph.cxx:1445
RagTime5Graph::readButtonCluster
std::shared_ptr< RagTime5ClusterManager::Cluster > readButtonCluster(RagTime5Zone &zone, int zoneType)
try to read a button zone
Definition RagTime5Graph.cxx:3688
RagTime5Graph::m_structManager
std::shared_ptr< RagTime5StructManager > m_structManager
the structure manager
Definition RagTime5Graph.hxx:200
RagTime5Graph::printType
static std::string printType(unsigned long fileType)
debug: print a file type
Definition RagTime5Graph.hxx:183
RagTime5Graph::readPictureCluster
std::shared_ptr< RagTime5ClusterManager::Cluster > readPictureCluster(RagTime5Zone &zone, int zoneType)
try to read a picture zone
Definition RagTime5Graph.cxx:3739
RagTime5Graph::readPictureData
bool readPictureData(RagTime5Zone &zone)
try to read a picture data zone: ie. the zone which contains jpeg, tiff, ...
Definition RagTime5Graph.cxx:1543
RagTime5Graph::send
bool send(int zoneId, MWAWListenerPtr listener, MWAWPosition const &pos)
try to send the cluster zone
Definition RagTime5Graph.cxx:638
RagTime5Graph::readColorPatternZone
bool readColorPatternZone(RagTime5ClusterManager::Cluster &cluster)
try to read a zone of color and pattern
Definition RagTime5Graph.cxx:757
RagTime5Graph::RagTime5Graph
RagTime5Graph(RagTime5Graph const &orig)
RagTime5Graph::m_state
std::shared_ptr< RagTime5GraphInternal::State > m_state
the state
Definition RagTime5Graph.hxx:207
RagTime5StructManager
basic class used to store RagTime 5/6 structures
Definition RagTime5StructManager.hxx:175
RagTime5StructManager::printType
static std::string printType(unsigned long fileType)
debug: print a file type
Definition RagTime5StructManager.cxx:100
RagTime5StyleManager
basic class used to read/store RagTime 5/6 styles
Definition RagTime5StyleManager.hxx:63
RagTime5Zone
main zone in a RagTime v5-v6 document
Definition RagTime5StructManager.hxx:51
libmwaw_internal.hxx
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
RagTime5GraphInternal
Internal: the structures of a RagTime5Graph.
Definition RagTime5Graph.cxx:63
RagTime5ClusterManager::Cluster
the cluster data
Definition RagTime5ClusterManager.hxx:261
RagTime5ClusterManager::Link
a link to a small zone (or set of zones) in RagTime 5/6 documents
Definition RagTime5ClusterManager.hxx:113
RagTime5GraphInternal::ClusterButton
the button cluster
Definition RagTime5Graph.cxx:363
RagTime5GraphInternal::ClusterGraphic
the shape cluster
Definition RagTime5Graph.cxx:396
RagTime5GraphInternal::ClusterPicture
the picture cluster
Definition RagTime5Graph.cxx:438
RagTime5GraphInternal::Shape
Internal: the shape of a RagTime5Graph.
Definition RagTime5Graph.cxx:226
RagTime5GraphInternal::State
Internal: the state of a RagTime5Graph.
Definition RagTime5Graph.cxx:463