ClarisDrawGraph.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 Draw document ( graphic part )
*
*/
#ifndef CLARIS_DRAW_GRAPH
# define CLARIS_DRAW_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"
class ClarisDrawStyleManager;
namespace ClarisDrawGraphInternal
{
struct Group;
struct State;
struct Style;
struct Zone;
struct ZoneShape;
struct Bitmap;
class SubDocument;
}
class ClarisDrawParser;
class ClarisDrawGraph
{
friend class ClarisDrawGraphInternal::SubDocument;
friend class ClarisDrawParser;
friend class ClarisWksParser;
public:
explicit ClarisDrawGraph(ClarisDrawParser &parser);
virtual ~ClarisDrawGraph();
int version() const;
void resetState();
int numPages() const;
std::shared_ptr<ClarisWksStruct::DSET> readGroupZone
(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool isLibHeader=false);
std::shared_ptr<ClarisWksStruct::DSET> readBitmapZone(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry);
bool readTransformations();
void updateGroup(bool isLibrary);
bool isEmptyGroup(int gId) const;
bool getSurfaceColor(ClarisDrawGraphInternal::Style const &style, MWAWColor &col) const;
protected:
bool sendBitmap(int number, MWAWPosition const &pos=MWAWPosition());
bool sendGroup(int number, MWAWPosition const &pos=MWAWPosition());
bool sendMainGroupChild(int childId, MWAWPosition const &pos=MWAWPosition());
void flushExtra();
// interface with main parser
bool sendTextZone(int number, int subZone=-1);
//
// Intermediate level
//
/* read a simple group */
std::shared_ptr<ClarisDrawGraphInternal::Zone> readGroupDef(MWAWEntry const &entry);
/* read the group data.
\note \a beginGroupPos is only used to help debugging */
bool readGroupData(ClarisDrawGraphInternal::Group &group, long beginGroupPos, bool isLibHeader);
/* read a simple graphic zone */
bool readShape(MWAWEntry const &entry,
ClarisDrawGraphInternal::ZoneShape &zone);
/* try to read the polygon data */
bool readPolygonData(std::shared_ptr<ClarisDrawGraphInternal::Zone> zone);
/* try to read a bitmap zone */
bool readBitmapColorMap(std::vector<MWAWColor> &cMap);
/* try to read the bitmap */
bool readBitmapData(ClarisDrawGraphInternal::Bitmap &zone);
//
// low level
//
/* read the first zone of a group type */
bool readGroupHeader(ClarisDrawGraphInternal::Group &group);
/* read some unknown data in first zone */
bool readGroupUnknown(ClarisDrawGraphInternal::Group &group, int zoneSz, int id);
bool sendShape(ClarisDrawGraphInternal::ZoneShape &pict, MWAWPosition pos);
bool sendBitmap(ClarisDrawGraphInternal::Bitmap &pict, MWAWPosition pos);
private:
ClarisDrawGraph(ClarisDrawGraph const &orig) = delete;
ClarisDrawGraph &operator=(ClarisDrawGraph const &orig) = delete;
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
std::shared_ptr<ClarisDrawGraphInternal::State> m_state;
ClarisDrawParser *m_mainParser;
std::shared_ptr<ClarisDrawStyleManager> m_styleManager;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
ClarisWksStruct.hxx
MWAWDebug.hxx
MWAWInputStream.hxx
MWAWPosition.hxx
ClarisDrawGraphInternal::SubDocument
Internal: the subdocument of a ClarisDrawGraph.
Definition ClarisDrawGraph.cxx:703
ClarisDrawGraph::m_mainParser
ClarisDrawParser * m_mainParser
the main parser;
Definition ClarisDrawGraph.hxx:179
ClarisDrawGraph::readGroupZone
std::shared_ptr< ClarisWksStruct::DSET > readGroupZone(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry, bool isLibHeader=false)
reads the zone Group DSET
Definition ClarisDrawGraph.cxx:983
ClarisDrawGraph::version
int version() const
returns the file version
Definition ClarisDrawGraph.cxx:796
ClarisDrawGraph::readGroupUnknown
bool readGroupUnknown(ClarisDrawGraphInternal::Group &group, int zoneSz, int id)
Definition ClarisDrawGraph.cxx:1885
ClarisDrawGraph::ClarisDrawParser
friend class ClarisDrawParser
Definition ClarisDrawGraph.hxx:78
ClarisDrawGraph::sendBitmap
bool sendBitmap(int number, MWAWPosition const &pos=MWAWPosition())
sends the bitmap data to the listener (if it exists )
Definition ClarisDrawGraph.cxx:2380
ClarisDrawGraph::sendTextZone
bool sendTextZone(int number, int subZone=-1)
sends a text box content (via the main parser )
Definition ClarisDrawGraph.cxx:821
ClarisDrawGraph::operator=
ClarisDrawGraph & operator=(ClarisDrawGraph const &orig)=delete
ClarisDrawGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition ClarisDrawGraph.hxx:173
ClarisDrawGraph::~ClarisDrawGraph
virtual ~ClarisDrawGraph()
destructor
Definition ClarisDrawGraph.cxx:793
ClarisDrawGraph::isEmptyGroup
bool isEmptyGroup(int gId) const
returns true if a group does not exist or is empty
Definition ClarisDrawGraph.cxx:826
ClarisDrawGraph::m_styleManager
std::shared_ptr< ClarisDrawStyleManager > m_styleManager
the style manager
Definition ClarisDrawGraph.hxx:181
ClarisDrawGraph::sendMainGroupChild
bool sendMainGroupChild(int childId, MWAWPosition const &pos=MWAWPosition())
sends the ith child of the root (if it exists )
Definition ClarisDrawGraph.cxx:2150
ClarisDrawGraph::getSurfaceColor
bool getSurfaceColor(ClarisDrawGraphInternal::Style const &style, MWAWColor &col) const
return the surface color which corresponds to some ids (if possible)
Definition ClarisDrawGraph.cxx:907
ClarisDrawGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition ClarisDrawGraph.cxx:2489
ClarisDrawGraph::readTransformations
bool readTransformations()
read the transformations
Definition ClarisDrawGraph.cxx:915
ClarisDrawGraph::sendGroup
bool sendGroup(int number, MWAWPosition const &pos=MWAWPosition())
sends the zone data to the listener (if it exists )
Definition ClarisDrawGraph.cxx:2241
ClarisDrawGraph::readShape
bool readShape(MWAWEntry const &entry, ClarisDrawGraphInternal::ZoneShape &zone)
Definition ClarisDrawGraph.cxx:1585
ClarisDrawGraph::numPages
int numPages() const
returns the number of pages
Definition ClarisDrawGraph.cxx:806
ClarisDrawGraph::m_state
std::shared_ptr< ClarisDrawGraphInternal::State > m_state
the state
Definition ClarisDrawGraph.hxx:176
ClarisDrawGraph::ClarisWksParser
friend class ClarisWksParser
Definition ClarisDrawGraph.hxx:79
ClarisDrawGraph::readGroupDef
std::shared_ptr< ClarisDrawGraphInternal::Zone > readGroupDef(MWAWEntry const &entry)
Definition ClarisDrawGraph.cxx:1190
ClarisDrawGraph::readBitmapData
bool readBitmapData(ClarisDrawGraphInternal::Bitmap &zone)
Definition ClarisDrawGraph.cxx:2077
ClarisDrawGraph::readBitmapZone
std::shared_ptr< ClarisWksStruct::DSET > readBitmapZone(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry)
reads the zone Bitmap DSET
Definition ClarisDrawGraph.cxx:1074
ClarisDrawGraph::sendShape
bool sendShape(ClarisDrawGraphInternal::ZoneShape &pict, MWAWPosition pos)
sends a basic graphic zone
Definition ClarisDrawGraph.cxx:2348
ClarisDrawGraph::updateGroup
void updateGroup(bool isLibrary)
update the group: ie. remove empty group child
Definition ClarisDrawGraph.cxx:834
ClarisDrawGraph::readGroupHeader
bool readGroupHeader(ClarisDrawGraphInternal::Group &group)
Definition ClarisDrawGraph.cxx:1795
ClarisDrawGraph::resetState
void resetState()
resets the current state
Definition ClarisDrawGraph.cxx:801
ClarisDrawGraph::readBitmapColorMap
bool readBitmapColorMap(std::vector< MWAWColor > &cMap)
Definition ClarisDrawGraph.cxx:2030
ClarisDrawGraph::ClarisDrawGraph
ClarisDrawGraph(ClarisDrawParser &parser)
constructor
Definition ClarisDrawGraph.cxx:785
ClarisDrawGraph::readGroupData
bool readGroupData(ClarisDrawGraphInternal::Group &group, long beginGroupPos, bool isLibHeader)
Definition ClarisDrawGraph.cxx:1386
ClarisDrawGraph::ClarisDrawGraph
ClarisDrawGraph(ClarisDrawGraph const &orig)=delete
ClarisDrawGraph::readPolygonData
bool readPolygonData(std::shared_ptr< ClarisDrawGraphInternal::Zone > zone)
Definition ClarisDrawGraph.cxx:1946
ClarisDrawParser
the main class to read a ClarisDraw v1 file
Definition ClarisDrawParser.hxx:64
ClarisDrawStyleManager
the main class to read a ClarisDraw style
Definition ClarisDrawStyleManager.hxx:60
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
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
ClarisDrawGraphInternal
Internal: the structures of a ClarisDrawGraph.
Definition ClarisDrawGraph.cxx:68
ClarisDrawGraphInternal::Bitmap
Internal: structure to store a bitmap of a ClarisDrawGraph.
Definition ClarisDrawGraph.cxx:403
ClarisDrawGraphInternal::Group
Internal: class which stores a group of graphics, ...
Definition ClarisDrawGraph.cxx:604
ClarisDrawGraphInternal::State
Internal: the state of a ClarisDrawGraph.
Definition ClarisDrawGraph.cxx:662
ClarisDrawGraphInternal::Style
Internal: the structure used to store a style of a ClarisDrawGraph.
Definition ClarisDrawGraph.cxx:139
ClarisDrawGraphInternal::ZoneShape
Internal: small class to store a basic graphic zone of a ClarisDrawGraph.
Definition ClarisDrawGraph.cxx:306
ClarisDrawGraphInternal::Zone
Internal: the generic structure used to store a zone of a ClarisDrawGraph.
Definition ClarisDrawGraph.cxx:204
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