HanMacWrdKGraph.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 HanMac Word text document ( graphic part )
*
*/
#ifndef HAN_MAC_WRD_K_GRAPH
# define HAN_MAC_WRD_K_GRAPH
#include <map>
#include <string>
#include <vector>
#include <librevenge/librevenge.h>
#include "libmwaw_internal.hxx"
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
namespace HanMacWrdKGraphInternal
{
struct Frame;
struct ShapeGraph;
struct FootnoteFrame;
struct Group;
struct PictureFrame;
struct Table;
struct TableCell;
struct TextBox;
struct Picture;
struct State;
class SubDocument;
}
struct HanMacWrdKZone;
class HanMacWrdKParser;
class HanMacWrdKGraph
{
friend class HanMacWrdKParser;
friend class HanMacWrdKGraphInternal::SubDocument;
friend struct HanMacWrdKGraphInternal::Table;
public:
explicit HanMacWrdKGraph(HanMacWrdKParser &parser);
virtual ~HanMacWrdKGraph();
int version() const;
int numPages() const;
protected:
bool getColor(int colId, int patternId, MWAWColor &color) const;
bool sendPageGraphics(std::vector<long> const &doNotSendIds);
void flushExtra();
//
// Intermediate level
//
bool readFrames(std::shared_ptr<HanMacWrdKZone> zone);
bool readPicture(std::shared_ptr<HanMacWrdKZone> zone);
void prepareStructures();
// interface with mainParser
bool sendFrame(long frameId, MWAWPosition const &pos);
bool sendPicture(long pictId, MWAWPosition const &pos);
bool sendText(long textId, long id, MWAWListenerPtr const &listener=MWAWListenerPtr());
std::map<long,int> getTextFrameInformations() const;
//
// low level
//
bool checkGroupStructures(long fileId, long fileSubId, std::multimap<long, long> &seens, bool inGroup, int depth=0);
bool sendPicture(HanMacWrdKGraphInternal::Picture const &picture, MWAWPosition const &pos);
bool sendFrame(HanMacWrdKGraphInternal::Frame const &frame, MWAWPosition const &pos);
bool sendShapeGraph(HanMacWrdKGraphInternal::ShapeGraph const &shape, MWAWPosition const &pos);
bool sendPictureFrame(HanMacWrdKGraphInternal::PictureFrame const &pict, MWAWPosition const &pos);
bool sendEmptyPicture(MWAWPosition const &pos);
bool sendTextBox(HanMacWrdKGraphInternal::TextBox const &textbox, MWAWPosition const &pos);
bool sendTableUnformatted(long fId);
bool sendGroup(long fId, MWAWPosition const &pos);
bool sendGroup(HanMacWrdKGraphInternal::Group const &group, MWAWPosition const &pos);
bool canCreateGraphic(HanMacWrdKGraphInternal::Group const &group);
void sendGroupChild(HanMacWrdKGraphInternal::Group const &group, MWAWPosition const &pos);
void sendGroup(HanMacWrdKGraphInternal::Group const &group, MWAWGraphicListenerPtr &listener);
std::shared_ptr<HanMacWrdKGraphInternal::ShapeGraph> readShapeGraph(std::shared_ptr<HanMacWrdKZone> zone, HanMacWrdKGraphInternal::Frame const &header);
std::shared_ptr<HanMacWrdKGraphInternal::FootnoteFrame> readFootnoteFrame(std::shared_ptr<HanMacWrdKZone> zone, HanMacWrdKGraphInternal::Frame const &header);
std::shared_ptr<HanMacWrdKGraphInternal::Group> readGroup(std::shared_ptr<HanMacWrdKZone> zone, HanMacWrdKGraphInternal::Frame const &header);
std::shared_ptr<HanMacWrdKGraphInternal::PictureFrame> readPictureFrame(std::shared_ptr<HanMacWrdKZone> zone, HanMacWrdKGraphInternal::Frame const &header);
std::shared_ptr<HanMacWrdKGraphInternal::Table> readTable(std::shared_ptr<HanMacWrdKZone> zone, HanMacWrdKGraphInternal::Frame const &header);
std::shared_ptr<HanMacWrdKGraphInternal::TextBox> readTextBox(std::shared_ptr<HanMacWrdKZone> zone, HanMacWrdKGraphInternal::Frame const &header, bool isMemo);
private:
HanMacWrdKGraph(HanMacWrdKGraph const &orig) = delete;
HanMacWrdKGraph &operator=(HanMacWrdKGraph const &orig) = delete;
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
std::shared_ptr<HanMacWrdKGraphInternal::State> m_state;
HanMacWrdKParser *m_mainParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWInputStream.hxx
HanMacWrdKGraphInternal::SubDocument
Internal: the subdocument of a HanMacWrdKGraph.
Definition HanMacWrdKGraph.cxx:826
HanMacWrdKGraph::sendEmptyPicture
bool sendEmptyPicture(MWAWPosition const &pos)
try to send an empty picture
Definition HanMacWrdKGraph.cxx:1393
HanMacWrdKGraph::checkGroupStructures
bool checkGroupStructures(long fileId, long fileSubId, std::multimap< long, long > &seens, bool inGroup, int depth=0)
check the graph structures: ie.
Definition HanMacWrdKGraph.cxx:2240
HanMacWrdKGraph::operator=
HanMacWrdKGraph & operator=(HanMacWrdKGraph const &orig)=delete
HanMacWrdKGraph::~HanMacWrdKGraph
virtual ~HanMacWrdKGraph()
destructor
Definition HanMacWrdKGraph.cxx:950
HanMacWrdKGraph::m_mainParser
HanMacWrdKParser * m_mainParser
the main parser;
Definition HanMacWrdKGraph.hxx:191
HanMacWrdKGraph::sendGroup
bool sendGroup(long fId, MWAWPosition const &pos)
try to send a group to the listener
Definition HanMacWrdKGraph.cxx:1999
HanMacWrdKGraph::readShapeGraph
std::shared_ptr< HanMacWrdKGraphInternal::ShapeGraph > readShapeGraph(std::shared_ptr< HanMacWrdKZone > zone, HanMacWrdKGraphInternal::Frame const &header)
try to read the basic graph data
Definition HanMacWrdKGraph.cxx:1486
HanMacWrdKGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition HanMacWrdKGraph.hxx:185
HanMacWrdKGraph::getTextFrameInformations
std::map< long, int > getTextFrameInformations() const
return a list textZId -> type which 3(footnote), 4(textbox), 9(table), 10(comment)
Definition HanMacWrdKGraph.cxx:996
HanMacWrdKGraph::m_state
std::shared_ptr< HanMacWrdKGraphInternal::State > m_state
the state
Definition HanMacWrdKGraph.hxx:188
HanMacWrdKGraph::sendGroupChild
void sendGroupChild(HanMacWrdKGraphInternal::Group const &group, MWAWPosition const &pos)
try to send a group elements by elements
Definition HanMacWrdKGraph.cxx:2091
HanMacWrdKGraph::readTextBox
std::shared_ptr< HanMacWrdKGraphInternal::TextBox > readTextBox(std::shared_ptr< HanMacWrdKZone > zone, HanMacWrdKGraphInternal::Frame const &header, bool isMemo)
try to read the textbox data
Definition HanMacWrdKGraph.cxx:1779
HanMacWrdKGraph::numPages
int numPages() const
returns the number of pages
Definition HanMacWrdKGraph.cxx:975
HanMacWrdKGraph::readPicture
bool readPicture(std::shared_ptr< HanMacWrdKZone > zone)
try to read a picture zone (type d)
Definition HanMacWrdKGraph.cxx:1165
HanMacWrdKGraph::readFrames
bool readFrames(std::shared_ptr< HanMacWrdKZone > zone)
try to read the frame definition (type 2)
Definition HanMacWrdKGraph.cxx:1044
HanMacWrdKGraph::canCreateGraphic
bool canCreateGraphic(HanMacWrdKGraphInternal::Group const &group)
check if we can send a group as graphic
Definition HanMacWrdKGraph.cxx:2022
HanMacWrdKGraph::sendFrame
bool sendFrame(long frameId, MWAWPosition const &pos)
try to send a frame to the listener
Definition HanMacWrdKGraph.cxx:1266
HanMacWrdKGraph::readTable
std::shared_ptr< HanMacWrdKGraphInternal::Table > readTable(std::shared_ptr< HanMacWrdKZone > zone, HanMacWrdKGraphInternal::Frame const &header)
try to read the table data
Definition HanMacWrdKGraph.cxx:1826
HanMacWrdKGraph::readPictureFrame
std::shared_ptr< HanMacWrdKGraphInternal::PictureFrame > readPictureFrame(std::shared_ptr< HanMacWrdKZone > zone, HanMacWrdKGraphInternal::Frame const &header)
try to read the picture data
Definition HanMacWrdKGraph.cxx:1701
HanMacWrdKGraph::HanMacWrdKGraph
HanMacWrdKGraph(HanMacWrdKGraph const &orig)=delete
HanMacWrdKGraph::sendPageGraphics
bool sendPageGraphics(std::vector< long > const &doNotSendIds)
try to send the page graphic
Definition HanMacWrdKGraph.cxx:2281
HanMacWrdKGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition HanMacWrdKGraph.cxx:2299
HanMacWrdKGraph::version
int version() const
returns the file version
Definition HanMacWrdKGraph.cxx:953
HanMacWrdKGraph::readFootnoteFrame
std::shared_ptr< HanMacWrdKGraphInternal::FootnoteFrame > readFootnoteFrame(std::shared_ptr< HanMacWrdKZone > zone, HanMacWrdKGraphInternal::Frame const &header)
try to read the footnote data
Definition HanMacWrdKGraph.cxx:1743
HanMacWrdKGraph::sendShapeGraph
bool sendShapeGraph(HanMacWrdKGraphInternal::ShapeGraph const &shape, MWAWPosition const &pos)
try to send a basic picture to the listener
Definition HanMacWrdKGraph.cxx:1455
HanMacWrdKGraph::sendTableUnformatted
bool sendTableUnformatted(long fId)
try to send a table unformatted
Definition HanMacWrdKGraph.cxx:1468
HanMacWrdKGraph::HanMacWrdKGraph
HanMacWrdKGraph(HanMacWrdKParser &parser)
constructor
Definition HanMacWrdKGraph.cxx:943
HanMacWrdKGraph::sendText
bool sendText(long textId, long id, MWAWListenerPtr const &listener=MWAWListenerPtr())
ask main parser to send a text zone
Definition HanMacWrdKGraph.cxx:991
HanMacWrdKGraph::HanMacWrdKParser
friend class HanMacWrdKParser
Definition HanMacWrdKGraph.hxx:79
HanMacWrdKGraph::readGroup
std::shared_ptr< HanMacWrdKGraphInternal::Group > readGroup(std::shared_ptr< HanMacWrdKZone > zone, HanMacWrdKGraphInternal::Frame const &header)
try to read the group data
Definition HanMacWrdKGraph.cxx:1663
HanMacWrdKGraph::getColor
bool getColor(int colId, int patternId, MWAWColor &color) const
returns the color associated with a pattern
Definition HanMacWrdKGraph.cxx:958
HanMacWrdKGraph::sendPicture
bool sendPicture(long pictId, MWAWPosition const &pos)
try to send a picture to the listener
Definition HanMacWrdKGraph.cxx:1222
HanMacWrdKGraph::sendPictureFrame
bool sendPictureFrame(HanMacWrdKGraphInternal::PictureFrame const &pict, MWAWPosition const &pos)
try to send a picture frame
Definition HanMacWrdKGraph.cxx:1420
HanMacWrdKGraph::sendTextBox
bool sendTextBox(HanMacWrdKGraphInternal::TextBox const &textbox, MWAWPosition const &pos)
try to send a textbox to the listener
Definition HanMacWrdKGraph.cxx:1431
HanMacWrdKGraph::prepareStructures
void prepareStructures()
check the group structures, the linked textbox
Definition HanMacWrdKGraph.cxx:2212
HanMacWrdKParser
the main class to read a HanMac Word-K file
Definition HanMacWrdKParser.hxx:186
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
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
HanMacWrdKGraphInternal
Internal: the structures of a HanMacWrdKGraph.
Definition HanMacWrdKGraph.cxx:65
HanMacWrdKGraphInternal::FootnoteFrame
Internal: the footnote of a HanMacWrdKGraph.
Definition HanMacWrdKGraph.cxx:244
HanMacWrdKGraphInternal::Frame
Internal: the frame header of a HanMacWrdKGraph.
Definition HanMacWrdKGraph.cxx:70
HanMacWrdKGraphInternal::Group
Internal: the group of a HanMacWrdKGraph.
Definition HanMacWrdKGraph.cxx:282
HanMacWrdKGraphInternal::PictureFrame
Internal: the picture of a HanMacWrdKGraph.
Definition HanMacWrdKGraph.cxx:344
HanMacWrdKGraphInternal::Picture
Internal: the picture of a HanMacWrdKGraph.
Definition HanMacWrdKGraph.cxx:619
HanMacWrdKGraphInternal::ShapeGraph
Internal: the geometrical graph of a HanMacWrdKGraph.
Definition HanMacWrdKGraph.cxx:202
HanMacWrdKGraphInternal::State
Internal: the state of a HanMacWrdKGraph.
Definition HanMacWrdKGraph.cxx:699
HanMacWrdKGraphInternal::TableCell
a table cell in a table in HanMacWrdKGraph
Definition HanMacWrdKGraph.cxx:394
HanMacWrdKGraphInternal::Table
Internal: the table of a HanMacWrdKGraph.
Definition HanMacWrdKGraph.cxx:434
HanMacWrdKGraphInternal::TextBox
Internal: the textbox of a HanMacWrdKGraph.
Definition HanMacWrdKGraph.cxx:501
HanMacWrdKZone
Small class used to store the decoded zone of HanMacWrdKParser.
Definition HanMacWrdKParser.hxx:58
MWAWColor
the class to store a color
Definition libmwaw_internal.hxx:192