ClarisWksGraph.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 Claris Works text document ( graphic part )
*
*/
#ifndef CLARIS_WKS_GRAPH
# define CLARIS_WKS_GRAPH
#include <string>
#include <vector>
#include <librevenge/librevenge.h>
#include "libmwaw_internal.hxx"
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWPosition.hxx"
#include "ClarisWksStruct.hxx"
namespace ClarisWksGraphInternal
{
struct Group;
struct State;
struct Style;
struct Zone;
struct Chart;
struct ZoneShape;
struct Bitmap;
struct ZonePict;
class SubDocument;
}
class ClarisWksDocument;
class ClarisWksParser;
class MWAWParser;
class ClarisWksGraph
{
friend class ClarisWksGraphInternal::SubDocument;
friend class ClarisWksDocument;
friend class ClarisWksParser;
public:
explicit ClarisWksGraph(ClarisWksDocument &document);
virtual ~ClarisWksGraph();
int version() const;
int numPages() const;
bool getPageDimension(MWAWVec2f &dim) const;
void computePositions() const;
void findMasterPage() const;
std::shared_ptr<ClarisWksStruct::DSET> readGroupZone
(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
std::shared_ptr<ClarisWksStruct::DSET> readBitmapZone
(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
bool readDatabasePictZone();
bool getSurfaceColor(ClarisWksGraphInternal::Style const &style, MWAWColor &col) const;
protected:
bool canSendGroupAsGraphic(int number) const;
bool sendPageGraphics(int groupId);
bool sendMaster(int pg);
bool sendDatabasePictZone(int pictId, MWAWListenerPtr listener, MWAWPosition const &pos=MWAWPosition());
bool sendGroup(int number, MWAWListenerPtr listener, MWAWPosition const &pos=MWAWPosition());
bool canSendBitmapAsGraphic(int number) const;
bool sendBitmap(int number, MWAWListenerPtr listener, MWAWPosition const &pos=MWAWPosition());
void flushExtra();
// interface with main parser
void askToSend(int number, MWAWListenerPtr listener, MWAWPosition const &pos=MWAWPosition());
//
// Intermediate level
//
void updateGroup(ClarisWksGraphInternal::Group &group) const;
bool canSendAsGraphic(ClarisWksGraphInternal::Group &group) const;
bool sendGroup(ClarisWksGraphInternal::Group &group, MWAWPosition const &position);
bool sendGroupChild(std::vector<std::shared_ptr<ClarisWksGraphInternal::Zone> > const &lChild, MWAWListenerPtr listener, MWAWVec2f const &leftTop);
bool sendGroupChild(std::shared_ptr<ClarisWksGraphInternal::Zone> zone, MWAWPosition position);
bool sendPageChild(ClarisWksGraphInternal::Group &group);
/* read a simple group */
std::shared_ptr<ClarisWksGraphInternal::Zone> readGroupDef(MWAWEntry const &entry);
/* read the group data.
\note \a beginGroupPos is only used to help debugging */
bool readGroupData(ClarisWksGraphInternal::Group &group, long beginGroupPos);
/* read a simple graphic zone */
bool readShape(MWAWEntry const &entry,
ClarisWksGraphInternal::ZoneShape &zone);
/* try to read the chart data */
bool readChartData(std::shared_ptr<ClarisWksGraphInternal::Zone> zone);
/* try to read a pict data zone */
bool readPictData(std::shared_ptr<ClarisWksGraphInternal::Zone> zone);
/* try to read the polygon data */
bool readPolygonData(std::shared_ptr<ClarisWksGraphInternal::Zone> zone);
/* read a picture */
bool readPICT(ClarisWksGraphInternal::ZonePict &zone);
/* read a postcript zone */
bool readPS(ClarisWksGraphInternal::ZonePict &zone);
/* read a ole document zone */
bool readOLE(ClarisWksGraphInternal::ZonePict &zone);
/* try to read the qtime data zone */
bool readQTimeData(std::shared_ptr<ClarisWksGraphInternal::Zone> zone);
/* read a named picture */
bool readNamedPict(ClarisWksGraphInternal::ZonePict &zone);
/* try to read a bitmap zone */
bool readBitmapColorMap(std::vector<MWAWColor> &cMap);
/* try to read the bitmap */
bool readBitmapData(ClarisWksGraphInternal::Bitmap &zone);
//
// low level
//
/* read the first zone of a group type */
bool readGroupHeader(ClarisWksGraphInternal::Group &group);
/* read some unknown data in first zone */
bool readGroupUnknown(ClarisWksGraphInternal::Group &group, int zoneSz, int id);
bool sendPicture(ClarisWksGraphInternal::ZonePict &pict, MWAWPosition pos);
bool sendShape(ClarisWksGraphInternal::ZoneShape const &pict, MWAWPosition pos);
bool sendBitmap(ClarisWksGraphInternal::Bitmap &pict, MWAWListener &listener, MWAWPosition pos);
private:
ClarisWksGraph(ClarisWksGraph const &orig) = delete;
ClarisWksGraph &operator=(ClarisWksGraph const &orig) = delete;
protected:
//
// data
//
ClarisWksDocument &m_document;
MWAWParserStatePtr m_parserState;
std::shared_ptr<ClarisWksGraphInternal::State> m_state;
MWAWParser *m_mainParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
ClarisWksStruct.hxx
MWAWDebug.hxx
MWAWInputStream.hxx
MWAWPosition.hxx
ClarisWksDocument
main document information used to create a ClarisWorks file
Definition ClarisWksDocument.hxx:74
ClarisWksGraphInternal::SubDocument
Internal: the subdocument of a ClarisWksGraph.
Definition ClarisWksGraph.cxx:776
ClarisWksGraph::readPictData
bool readPictData(std::shared_ptr< ClarisWksGraphInternal::Zone > zone)
Definition ClarisWksGraph.cxx:2249
ClarisWksGraph::readChartData
bool readChartData(std::shared_ptr< ClarisWksGraphInternal::Zone > zone)
Definition ClarisWksGraph.cxx:2202
ClarisWksGraph::sendPageGraphics
bool sendPageGraphics(int groupId)
sends the page element
Definition ClarisWksGraph.cxx:3410
ClarisWksGraph::readGroupUnknown
bool readGroupUnknown(ClarisWksGraphInternal::Group &group, int zoneSz, int id)
Definition ClarisWksGraph.cxx:2051
ClarisWksGraph::readGroupHeader
bool readGroupHeader(ClarisWksGraphInternal::Group &group)
Definition ClarisWksGraph.cxx:1958
ClarisWksGraph::sendPicture
bool sendPicture(ClarisWksGraphInternal::ZonePict &pict, MWAWPosition pos)
sends a picture zone
Definition ClarisWksGraph.cxx:3278
ClarisWksGraph::m_mainParser
MWAWParser * m_mainParser
the main parser;
Definition ClarisWksGraph.hxx:236
ClarisWksGraph::computePositions
void computePositions() const
compute the pages position
Definition ClarisWksGraph.cxx:849
ClarisWksGraph::canSendBitmapAsGraphic
bool canSendBitmapAsGraphic(int number) const
check if we can send a group as graphic
Definition ClarisWksGraph.cxx:3139
ClarisWksGraph::m_state
std::shared_ptr< ClarisWksGraphInternal::State > m_state
the state
Definition ClarisWksGraph.hxx:233
ClarisWksGraph::readShape
bool readShape(MWAWEntry const &entry, ClarisWksGraphInternal::ZoneShape &zone)
Definition ClarisWksGraph.cxx:1818
ClarisWksGraph::readPS
bool readPS(ClarisWksGraphInternal::ZonePict &zone)
Definition ClarisWksGraph.cxx:2346
ClarisWksGraph::numPages
int numPages() const
returns the number of pages
Definition ClarisWksGraph.cxx:860
ClarisWksGraph::sendBitmap
bool sendBitmap(int number, MWAWListenerPtr listener, MWAWPosition const &pos=MWAWPosition())
sends the bitmap data to the listener (if it exists )
Definition ClarisWksGraph.cxx:3167
ClarisWksGraph::updateGroup
void updateGroup(ClarisWksGraphInternal::Group &group) const
update the group information to choose how to send the group data
Definition ClarisWksGraph.cxx:2634
ClarisWksGraph::ClarisWksDocument
friend class ClarisWksDocument
Definition ClarisWksGraph.hxx:80
ClarisWksGraph::sendGroupChild
bool sendGroupChild(std::vector< std::shared_ptr< ClarisWksGraphInternal::Zone > > const &lChild, MWAWListenerPtr listener, MWAWVec2f const &leftTop)
send a child group as graphic or as presentation
Definition ClarisWksGraph.cxx:2695
ClarisWksGraph::readPICT
bool readPICT(ClarisWksGraphInternal::ZonePict &zone)
Definition ClarisWksGraph.cxx:2311
ClarisWksGraph::readGroupZone
std::shared_ptr< ClarisWksStruct::DSET > readGroupZone(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Group DSET
Definition ClarisWksGraph.cxx:902
ClarisWksGraph::sendMaster
bool sendMaster(int pg)
sends the master zone (ie. the background zone in a graphic document)
Definition ClarisWksGraph.cxx:3382
ClarisWksGraph::sendPageChild
bool sendPageChild(ClarisWksGraphInternal::Group &group)
send the child element corresponding to some page
Definition ClarisWksGraph.cxx:2754
ClarisWksGraph::readBitmapColorMap
bool readBitmapColorMap(std::vector< MWAWColor > &cMap)
Definition ClarisWksGraph.cxx:2519
ClarisWksGraph::readQTimeData
bool readQTimeData(std::shared_ptr< ClarisWksGraphInternal::Zone > zone)
Definition ClarisWksGraph.cxx:2433
ClarisWksGraph::findMasterPage
void findMasterPage() const
find the master zone to the content zones in a graphic document
Definition ClarisWksGraph.cxx:1293
ClarisWksGraph::ClarisWksGraph
ClarisWksGraph(ClarisWksGraph const &orig)=delete
ClarisWksGraph::sendDatabasePictZone
bool sendDatabasePictZone(int pictId, MWAWListenerPtr listener, MWAWPosition const &pos=MWAWPosition())
sends the database zone if known
Definition ClarisWksGraph.cxx:3151
ClarisWksGraph::sendGroup
bool sendGroup(int number, MWAWListenerPtr listener, MWAWPosition const &pos=MWAWPosition())
sends the zone data to the listener (if it exists )
Definition ClarisWksGraph.cxx:3423
ClarisWksGraph::readGroupDef
std::shared_ptr< ClarisWksGraphInternal::Zone > readGroupDef(MWAWEntry const &entry)
Definition ClarisWksGraph.cxx:1338
ClarisWksGraph::getPageDimension
bool getPageDimension(MWAWVec2f &dim) const
returns the page dimension if known (in point)
Definition ClarisWksGraph.cxx:876
ClarisWksGraph::readGroupData
bool readGroupData(ClarisWksGraphInternal::Group &group, long beginGroupPos)
Definition ClarisWksGraph.cxx:1626
ClarisWksGraph::ClarisWksGraph
ClarisWksGraph(ClarisWksDocument &document)
constructor
Definition ClarisWksGraph.cxx:833
ClarisWksGraph::sendShape
bool sendShape(ClarisWksGraphInternal::ZoneShape const &pict, MWAWPosition pos)
sends a basic graphic zone
Definition ClarisWksGraph.cxx:3123
ClarisWksGraph::askToSend
void askToSend(int number, MWAWListenerPtr listener, MWAWPosition const &pos=MWAWPosition())
ask the main parser to send a zone
Definition ClarisWksGraph.cxx:882
ClarisWksGraph::getSurfaceColor
bool getSurfaceColor(ClarisWksGraphInternal::Style const &style, MWAWColor &col) const
return the surface color which corresponds to some ids (if possible)
Definition ClarisWksGraph.cxx:890
ClarisWksGraph::ClarisWksParser
friend class ClarisWksParser
Definition ClarisWksGraph.hxx:81
ClarisWksGraph::m_document
ClarisWksDocument & m_document
the document
Definition ClarisWksGraph.hxx:227
ClarisWksGraph::operator=
ClarisWksGraph & operator=(ClarisWksGraph const &orig)=delete
ClarisWksGraph::~ClarisWksGraph
virtual ~ClarisWksGraph()
destructor
Definition ClarisWksGraph.cxx:841
ClarisWksGraph::version
int version() const
returns the file version
Definition ClarisWksGraph.cxx:844
ClarisWksGraph::readPolygonData
bool readPolygonData(std::shared_ptr< ClarisWksGraphInternal::Zone > zone)
Definition ClarisWksGraph.cxx:2114
ClarisWksGraph::readOLE
bool readOLE(ClarisWksGraphInternal::ZonePict &zone)
Definition ClarisWksGraph.cxx:2386
ClarisWksGraph::readBitmapZone
std::shared_ptr< ClarisWksStruct::DSET > readBitmapZone(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Bitmap DSET
Definition ClarisWksGraph.cxx:1000
ClarisWksGraph::readDatabasePictZone
bool readDatabasePictZone()
try to read a database picture zone, v5-v6
Definition ClarisWksGraph.cxx:1115
ClarisWksGraph::readNamedPict
bool readNamedPict(ClarisWksGraphInternal::ZonePict &zone)
Definition ClarisWksGraph.cxx:2469
ClarisWksGraph::readBitmapData
bool readBitmapData(ClarisWksGraphInternal::Bitmap &zone)
Definition ClarisWksGraph.cxx:2566
ClarisWksGraph::canSendAsGraphic
bool canSendAsGraphic(ClarisWksGraphInternal::Group &group) const
check if we can send a group as graphic
Definition ClarisWksGraph.cxx:3362
ClarisWksGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition ClarisWksGraph.hxx:230
ClarisWksGraph::canSendGroupAsGraphic
bool canSendGroupAsGraphic(int number) const
check if we can send a group as graphic
Definition ClarisWksGraph.cxx:3354
ClarisWksGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition ClarisWksGraph.cxx:3443
ClarisWksParser
the main class to read a Claris Works file
Definition ClarisWksParser.hxx:68
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWListener
This class contains a virtual interface to all listener.
Definition MWAWListener.hxx:50
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition MWAWParser.hxx:100
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition MWAWPosition.hxx:48
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
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition libmwaw_internal.hxx:842
ClarisWksGraphInternal
Internal: the structures of a ClarisWksGraph.
Definition ClarisWksGraph.cxx:69
ClarisWksGraphInternal::Bitmap
Internal: structure to store a bitmap of a ClarisWksGraph.
Definition ClarisWksGraph.cxx:417
ClarisWksGraphInternal::Chart
Internal: structure used to store a chart zone of a ClarisWksGraph.
Definition ClarisWksGraph.cxx:565
ClarisWksGraphInternal::Group
Internal: class which stores a group of graphics, ...
Definition ClarisWksGraph.cxx:681
ClarisWksGraphInternal::State
Internal: the state of a ClarisWksGraph.
Definition ClarisWksGraph.cxx:733
ClarisWksGraphInternal::Style
Internal: the structure used to store a style of a ClarisWksGraph.
Definition ClarisWksGraph.cxx:112
ClarisWksGraphInternal::ZonePict
Internal: the structure used to store a PICT or a MOVIE.
Definition ClarisWksGraph.cxx:340
ClarisWksGraphInternal::ZoneShape
Internal: small class to store a basic graphic zone of a ClarisWksGraph.
Definition ClarisWksGraph.cxx:285
ClarisWksGraphInternal::Zone
Internal: the generic structure used to store a zone of a ClarisWksGraph.
Definition ClarisWksGraph.cxx:177
ClarisWksStruct::DSET
main structure which correspond to a document part
Definition ClarisWksStruct.hxx:87
MWAWColor
the class to store a color
Definition libmwaw_internal.hxx:192