CWGraph.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 CW_GRAPH
# define CW_GRAPH
#include <string>
#include <vector>
#include <libwpd/libwpd.h>
#include "libmwaw_internal.hxx"
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "CWStruct.hxx"
namespace CWGraphInternal
{
struct Group;
struct State;
struct Style;
struct Zone;
struct ZoneBasic;
struct ZoneBitmap;
struct ZonePict;
}
class CWParser;
class CWStyleManager;
class CWGraph
{
friend class CWParser;
public:
CWGraph(CWParser &parser);
virtual ~CWGraph();
int version() const;
int numPages() const;
shared_ptr<CWStruct::DSET> readGroupZone
(CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
shared_ptr<CWStruct::DSET> readBitmapZone
(CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
bool readColorList(MWAWEntry const &entry);
bool getColor(int id, MWAWColor &col) const;
float getPatternPercent(int id) const;
bool getWallPaperColor(int id, MWAWColor &col) const;
bool getLineColor(CWGraphInternal::Style const style, MWAWColor &col) const;
bool getSurfaceColor(CWGraphInternal::Style const style, MWAWColor &col) const;
protected:
bool sendZone(int number, MWAWPosition pos=MWAWPosition());
void flushExtra();
//
// Intermediate level
//
void updateInformation(CWGraphInternal::Group &group) const;
/* read a simple group */
shared_ptr<CWGraphInternal::Zone> readGroupDef(MWAWEntry const &entry);
/* read a simple graphic zone */
bool readBasicGraphic(MWAWEntry const &entry,
CWGraphInternal::ZoneBasic &zone);
/* read the group data.
\note \a beginGroupPos is only used to help debugging */
bool readGroupData(CWGraphInternal::Group &group, long beginGroupPos);
/* try to read the polygon data */
bool readPolygonData(shared_ptr<CWGraphInternal::Zone> zone);
/* try to read a pict data zone */
bool readPictData(shared_ptr<CWGraphInternal::Zone> zone);
/* read a picture */
bool readPICT(CWGraphInternal::ZonePict &zone);
/* read a postcript zone */
bool readPS(CWGraphInternal::ZonePict &zone);
/* read a ole document zone */
bool readOLE(CWGraphInternal::ZonePict &zone);
/* try to read the qtime data zone */
bool readQTimeData(shared_ptr<CWGraphInternal::Zone> zone);
/* read a named picture */
bool readNamedPict(CWGraphInternal::ZonePict &zone);
/* try to read a bitmap zone */
bool readBitmapColorMap(std::vector<MWAWColor> &cMap);
/* try to read the bitmap */
bool readBitmapData(CWGraphInternal::ZoneBitmap &zone);
//
// low level
//
/* read the first zone of a group type */
bool readGroupHeader(CWGraphInternal::Group &group);
/* read some unknown data in first zone */
bool readGroupUnknown(CWGraphInternal::Group &group, int zoneSz, int id);
bool sendPicture(CWGraphInternal::ZonePict &pict, MWAWPosition pos,
WPXPropertyList extras = WPXPropertyList());
bool sendBasicPicture(CWGraphInternal::ZoneBasic &pict, MWAWPosition pos,
WPXPropertyList extras = WPXPropertyList());
bool sendBitmap(CWGraphInternal::ZoneBitmap &pict, MWAWPosition pos,
WPXPropertyList extras = WPXPropertyList());
private:
CWGraph(CWGraph const &orig);
CWGraph &operator=(CWGraph const &orig);
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
shared_ptr<CWGraphInternal::State> m_state;
CWParser *m_mainParser;
shared_ptr<CWStyleManager> m_styleManager;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
CWGraph::readPICT
bool readPICT(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1787
CWStruct::DSET
main structure which correspond to a document part
Definition: CWStruct.hxx:55
CWGraph::getSurfaceColor
bool getSurfaceColor(CWGraphInternal::Style const style, MWAWColor &col) const
return the surface color which corresponds to some ids (if possible)
Definition: CWGraph.cxx:811
CWStyleManager
a structure to store the style list and the lookup zone
Definition: CWStyleManager.hxx:60
CWGraph::getLineColor
bool getLineColor(CWGraphInternal::Style const style, MWAWColor &col) const
return the line color which corresponds to some ids (if possible)
Definition: CWGraph.cxx:798
CWGraph::readNamedPict
bool readNamedPict(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1955
CWGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: CWGraph.cxx:2653
libmwaw_internal.hxx
CWGraph::readGroupData
bool readGroupData(CWGraphInternal::Group &group, long beginGroupPos)
Definition: CWGraph.cxx:1301
CWGraph::m_styleManager
shared_ptr< CWStyleManager > m_styleManager
the style manager
Definition: CWGraph.hxx:206
CWGraph::readPolygonData
bool readPolygonData(shared_ptr< CWGraphInternal::Zone > zone)
Definition: CWGraph.cxx:1646
CWGraph::readColorList
bool readColorList(MWAWEntry const &entry)
reads a color map zone ( v4-v6)
Definition: CWGraph.cxx:925
CWGraphInternal::ZoneBasic
Internal: small class to store a basic graphic zone of a CWGraph.
Definition: CWGraph.cxx:227
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:161
CWGraph::operator=
CWGraph & operator=(CWGraph const &orig)
CWGraph::sendZone
bool sendZone(int number, MWAWPosition pos=MWAWPosition())
sends the zone data to the listener (if it exists )
Definition: CWGraph.cxx:2182
CWGraph
the main class to read the graphic part of Claris Works file
Definition: CWGraph.hxx:72
CWGraphInternal::Group
Internal: class which stores a group of graphics, ...
Definition: CWGraph.cxx:521
CWGraph::readQTimeData
bool readQTimeData(shared_ptr< CWGraphInternal::Zone > zone)
Definition: CWGraph.cxx:1918
CWGraph::readOLE
bool readOLE(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1870
CWStruct.hxx
CWGraph::readPS
bool readPS(CWGraphInternal::ZonePict &zone)
Definition: CWGraph.cxx:1830
CWGraph::readPictData
bool readPictData(shared_ptr< CWGraphInternal::Zone > zone)
Definition: CWGraph.cxx:1724
CWGraphInternal::Style
Internal: the structure used to store a style of a CWGraph.
Definition: CWGraph.cxx:101
CWGraph::readBitmapData
bool readBitmapData(CWGraphInternal::ZoneBitmap &zone)
Definition: CWGraph.cxx:2052
CWGraph::numPages
int numPages() const
returns the number of pages
Definition: CWGraph.cxx:734
CWGraph::sendPicture
bool sendPicture(CWGraphInternal::ZonePict &pict, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
sends a picture zone
Definition: CWGraph.cxx:2579
CWGraph::sendBasicPicture
bool sendBasicPicture(CWGraphInternal::ZoneBasic &pict, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
sends a basic graphic zone
Definition: CWGraph.cxx:2354
CWGraph::version
int version() const
returns the file version
Definition: CWGraph.cxx:729
CWParser
the main class to read a Claris Works file
Definition: CWParser.hxx:73
CWGraph::readGroupDef
shared_ptr< CWGraphInternal::Zone > readGroupDef(MWAWEntry const &entry)
Definition: CWGraph.cxx:1097
CWGraph::readBitmapZone
shared_ptr< CWStruct::DSET > readBitmapZone(CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Bitmap DSET
Definition: CWGraph.cxx:975
CWGraph::getColor
bool getColor(int id, MWAWColor &col) const
return the color which corresponds to an id (if possible)
Definition: CWGraph.cxx:760
MWAWInputStream.hxx
MWAWDebug.hxx
CWGraph::updateInformation
void updateInformation(CWGraphInternal::Group &group) const
update the group information to choose how to send the group data
Definition: CWGraph.cxx:2086
CWGraph::CWGraph
CWGraph(CWParser &parser)
constructor
Definition: CWGraph.cxx:720
CWGraphInternal::ZonePict
Internal: the structure used to store a PICT or a MOVIE.
Definition: CWGraph.cxx:314
CWGraph::sendBitmap
bool sendBitmap(CWGraphInternal::ZoneBitmap &pict, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
sends a bitmap graphic zone
Definition: CWGraph.cxx:2513
CWGraph::readBasicGraphic
bool readBasicGraphic(MWAWEntry const &entry, CWGraphInternal::ZoneBasic &zone)
Definition: CWGraph.cxx:1436
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
CWGraph::readGroupUnknown
bool readGroupUnknown(CWGraphInternal::Group &group, int zoneSz, int id)
Definition: CWGraph.cxx:1581
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
CWGraph::readGroupHeader
bool readGroupHeader(CWGraphInternal::Group &group)
Definition: CWGraph.cxx:1497
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
CWGraph::~CWGraph
virtual ~CWGraph()
destructor
Definition: CWGraph.cxx:726
CWGraph::getPatternPercent
float getPatternPercent(int id) const
return the pattern percent which corresponds to an id (or -1)
Definition: CWGraph.cxx:773
CWGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: CWGraph.hxx:197
CWGraph::readGroupZone
shared_ptr< CWStruct::DSET > readGroupZone(CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Group DSET
Definition: CWGraph.cxx:832
CWGraph::getWallPaperColor
bool getWallPaperColor(int id, MWAWColor &col) const
return the wall paper color which corresponds to an id (if possible)
Definition: CWGraph.cxx:785
CWGraph::m_state
shared_ptr< CWGraphInternal::State > m_state
the state
Definition: CWGraph.hxx:200
CWGraphInternal::ZoneBitmap
Internal: structure to store a bitmap of a CWGraph.
Definition: CWGraph.cxx:375
CWGraph::m_mainParser
CWParser * m_mainParser
the main parser;
Definition: CWGraph.hxx:203
CWGraph::readBitmapColorMap
bool readBitmapColorMap(std::vector< MWAWColor > &cMap)
Definition: CWGraph.cxx:2005