GreatWksGraph.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 GreatWorks text document ( graphic part )
*
*/
#ifndef GREAT_WKS_GRAPH
# define GREAT_WKS_GRAPH
#include <set>
#include <string>
#include <vector>
#include <librevenge/librevenge.h>
#include "libmwaw_internal.hxx"
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
namespace GreatWksGraphInternal
{
struct Frame;
struct FrameGroup;
struct FrameShape;
struct FrameText;
struct Zone;
struct State;
class SubDocument;
}
class GreatWksDocument;
class GreatWksParser;
class GreatWksDBParser;
class GreatWksDRParser;
class GreatWksSSParser;
class GreatWksGraph
{
friend class GreatWksDocument;
friend class GreatWksParser;
friend class GreatWksDBParser;
friend class GreatWksDRParser;
friend class GreatWksSSParser;
friend class GreatWksGraphInternal::SubDocument;
public:
explicit GreatWksGraph(GreatWksDocument &document);
virtual ~GreatWksGraph();
int version() const;
int numPages() const;
protected:
bool sendPageGraphics();
void flushExtra();
//
// Intermediate level
//
// RSRC
bool readPatterns(MWAWEntry const &entry);
bool readPalettes(MWAWEntry const &entry);
// DataFork: pict
bool sendPageFrames(GreatWksGraphInternal::Zone const &zone);
bool sendFrame(std::shared_ptr<GreatWksGraphInternal::Frame> frame, GreatWksGraphInternal::Zone const &zone);
bool sendGroup(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos);
void sendGroupChild(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos);
bool canCreateGraphic(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone);
void sendGroup(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone, MWAWGraphicListenerPtr &listener);
bool sendTextbox(GreatWksGraphInternal::FrameText const &text, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos);
bool sendTextboxAsGraphic(MWAWBox2f const &box, GreatWksGraphInternal::FrameText const &text, MWAWGraphicStyle const &style, MWAWListenerPtr listener);
bool sendTextbox(MWAWEntry const &entry, MWAWListenerPtr listener);
bool sendPicture(MWAWEntry const &entry, MWAWPosition const &pos);
bool sendShape(GreatWksGraphInternal::FrameShape const &graph, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos);
// DataFork: graphic zone
bool readGraphicZone();
bool isGraphicZone();
bool findGraphicZone();
bool isPageFrames();
bool readPageFrames();
std::shared_ptr<GreatWksGraphInternal::Frame> readFrameHeader();
bool readFrameExtraData(GreatWksGraphInternal::Frame &frame, int id, long endPos=-1);
bool readStyle(MWAWGraphicStyle &style);
bool readLineFormat(std::string &extra);
// interface with mainParser
//
// low level
//
bool readFrameExtraDataRec(GreatWksGraphInternal::Zone &zone, int id, std::set<int> &seens, long endPos=-1, int depth=0);
bool checkGraph(GreatWksGraphInternal::Zone &zone, int id, std::set<int> &seens, int depth=0);
private:
GreatWksGraph(GreatWksGraph const &orig) = delete;
GreatWksGraph &operator=(GreatWksGraph const &orig) = delete;
protected:
//
// data
//
GreatWksDocument &m_document;
MWAWParserStatePtr m_parserState;
std::shared_ptr<GreatWksGraphInternal::State> m_state;
MWAWParser *m_mainParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWInputStream.hxx
GreatWksDBParser
the main class to read a GreatWorks database file
Definition GreatWksDBParser.hxx:62
GreatWksDRParser
the main class to read a GreatWorks graphic file
Definition GreatWksDRParser.hxx:56
GreatWksDocument
the main class to read/store generic data of a GreatWorks document
Definition GreatWksDocument.hxx:61
GreatWksGraphInternal::SubDocument
Internal: the subdocument of a GreatWksGraph.
Definition GreatWksGraph.cxx:464
GreatWksGraph::readFrameHeader
std::shared_ptr< GreatWksGraphInternal::Frame > readFrameHeader()
try to read a basic frame header
Definition GreatWksGraph.cxx:1511
GreatWksGraph::sendPageGraphics
bool sendPageGraphics()
try to send the page graphic
Definition GreatWksGraph.cxx:2269
GreatWksGraph::readLineFormat
bool readLineFormat(std::string &extra)
try to read a line format style? in v1
Definition GreatWksGraph.cxx:1161
GreatWksGraph::checkGraph
bool checkGraph(GreatWksGraphInternal::Zone &zone, int id, std::set< int > &seens, int depth=0)
check if the graph of zones is ok (ie. does not form loop)
Definition GreatWksGraph.cxx:1438
GreatWksGraph::readFrameExtraData
bool readFrameExtraData(GreatWksGraphInternal::Frame &frame, int id, long endPos=-1)
try to read a frame extra data zone
Definition GreatWksGraph.cxx:1702
GreatWksGraph::readPalettes
bool readPalettes(MWAWEntry const &entry)
read a list of color and maybe patterns ( PlTT resource block: v2 )
Definition GreatWksGraph.cxx:606
GreatWksGraph::sendGroupChild
void sendGroupChild(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos)
try to send a group elements by elemenys
Definition GreatWksGraph.cxx:2055
GreatWksGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition GreatWksGraph.cxx:2284
GreatWksGraph::version
int version() const
returns the file version
Definition GreatWksGraph.cxx:529
GreatWksGraph::GreatWksDBParser
friend class GreatWksDBParser
Definition GreatWksGraph.hxx:79
GreatWksGraph::readStyle
bool readStyle(MWAWGraphicStyle &style)
try to read a zone style
Definition GreatWksGraph.cxx:905
GreatWksGraph::sendTextboxAsGraphic
bool sendTextboxAsGraphic(MWAWBox2f const &box, GreatWksGraphInternal::FrameText const &text, MWAWGraphicStyle const &style, MWAWListenerPtr listener)
try to send a textbox via a graphiclistener
Definition GreatWksGraph.cxx:1903
GreatWksGraph::sendPageFrames
bool sendPageFrames(GreatWksGraphInternal::Zone const &zone)
try to send all data corresponding to a zone
Definition GreatWksGraph.cxx:2249
GreatWksGraph::isPageFrames
bool isPageFrames()
check if a zone is or not a page frame zone
Definition GreatWksGraph.cxx:845
GreatWksGraph::readPageFrames
bool readPageFrames()
try to read a list of page frame ( picture, texture or basic )
Definition GreatWksGraph.cxx:1183
GreatWksGraph::sendTextbox
bool sendTextbox(GreatWksGraphInternal::FrameText const &text, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos)
try to send a textbox
Definition GreatWksGraph.cxx:1862
GreatWksGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition GreatWksGraph.hxx:183
GreatWksGraph::GreatWksParser
friend class GreatWksParser
Definition GreatWksGraph.hxx:78
GreatWksGraph::canCreateGraphic
bool canCreateGraphic(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone)
check if we can send a group as graphic
Definition GreatWksGraph.cxx:1976
GreatWksGraph::sendPicture
bool sendPicture(MWAWEntry const &entry, MWAWPosition const &pos)
try to send a picture
Definition GreatWksGraph.cxx:1929
GreatWksGraph::GreatWksDRParser
friend class GreatWksDRParser
Definition GreatWksGraph.hxx:80
GreatWksGraph::findGraphicZone
bool findGraphicZone()
try to find the beginning of the next graphic zone
Definition GreatWksGraph.cxx:775
GreatWksGraph::sendFrame
bool sendFrame(std::shared_ptr< GreatWksGraphInternal::Frame > frame, GreatWksGraphInternal::Zone const &zone)
try to send a frame
Definition GreatWksGraph.cxx:2205
GreatWksGraph::GreatWksGraph
GreatWksGraph(GreatWksDocument &document)
constructor
Definition GreatWksGraph.cxx:518
GreatWksGraph::readFrameExtraDataRec
bool readFrameExtraDataRec(GreatWksGraphInternal::Zone &zone, int id, std::set< int > &seens, long endPos=-1, int depth=0)
try to read a frame extra data zone recursively ( draw method)
Definition GreatWksGraph.cxx:1467
GreatWksGraph::~GreatWksGraph
virtual ~GreatWksGraph()
destructor
Definition GreatWksGraph.cxx:526
GreatWksGraph::GreatWksSSParser
friend class GreatWksSSParser
Definition GreatWksGraph.hxx:81
GreatWksGraph::readPatterns
bool readPatterns(MWAWEntry const &entry)
read a pattern list block ( PAT# resource block )
Definition GreatWksGraph.cxx:563
GreatWksGraph::m_mainParser
MWAWParser * m_mainParser
the main parser;
Definition GreatWksGraph.hxx:187
GreatWksGraph::sendGroup
bool sendGroup(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos)
try to send a group
Definition GreatWksGraph.cxx:1970
GreatWksGraph::m_state
std::shared_ptr< GreatWksGraphInternal::State > m_state
the state
Definition GreatWksGraph.hxx:185
GreatWksGraph::numPages
int numPages() const
returns the number of pages
Definition GreatWksGraph.cxx:535
GreatWksGraph::m_document
GreatWksDocument & m_document
the document
Definition GreatWksGraph.hxx:181
GreatWksGraph::isGraphicZone
bool isGraphicZone()
return true if this corresponds to a graphic zone
Definition GreatWksGraph.cxx:661
GreatWksGraph::operator=
GreatWksGraph & operator=(GreatWksGraph const &orig)=delete
GreatWksGraph::GreatWksDocument
friend class GreatWksDocument
Definition GreatWksGraph.hxx:77
GreatWksGraph::readGraphicZone
bool readGraphicZone()
try to read the graphic zone ( draw file or end of v2 text file)
Definition GreatWksGraph.cxx:698
GreatWksGraph::GreatWksGraph
GreatWksGraph(GreatWksGraph const &orig)=delete
GreatWksGraph::sendShape
bool sendShape(GreatWksGraphInternal::FrameShape const &graph, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos)
try to send a basic picture
Definition GreatWksGraph.cxx:2187
GreatWksParser
the main class to read a GreatWorks text file
Definition GreatWksParser.hxx:57
GreatWksSSParser
the main class to read a GreatWorks spreadsheet file
Definition GreatWksSSParser.hxx:59
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWGraphicStyle
a structure used to define a picture style
Definition MWAWGraphicStyle.hxx:48
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
MWAWGraphicListenerPtr
std::shared_ptr< MWAWGraphicListener > MWAWGraphicListenerPtr
a smart pointer of MWAWGraphicListener
Definition libmwaw_internal.hxx:549
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
GreatWksGraphInternal
Internal: the structures of a GreatWksGraph.
Definition GreatWksGraph.cxx:61
GreatWksGraphInternal::FrameGroup
Internal: the group zone of a GreatWksGraph.
Definition GreatWksGraph.cxx:278
GreatWksGraphInternal::FrameShape
Internal: the basic shape of a GreatWksGraph.
Definition GreatWksGraph.cxx:199
GreatWksGraphInternal::FrameText
Internal: the text zone of a GreatWksGraph.
Definition GreatWksGraph.cxx:343
GreatWksGraphInternal::Frame
Internal: the graphic zone of a GreatWksGraph.
Definition GreatWksGraph.cxx:66
GreatWksGraphInternal::State
Internal: the state of a GreatWksGraph.
Definition GreatWksGraph.cxx:450
GreatWksGraphInternal::Zone
Internal: a list of graphic corresponding to a page.
Definition GreatWksGraph.cxx:426