HanMacWrdJGraph.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-J text document ( graphic part )
*
*/
#ifndef HAN_MAC_WRD_J_GRAPH
# define HAN_MAC_WRD_J_GRAPH
#include <map>
#include <set>
#include <string>
#include <vector>
#include <librevenge/librevenge.h>
#include "libmwaw_internal.hxx"
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
namespace HanMacWrdJGraphInternal
{
struct CellFormat;
struct Frame;
struct CommentFrame;
struct Group;
struct PictureFrame;
struct ShapeGraph;
struct TableFrame;
struct TextboxFrame;
struct TextFrame;
struct Table;
struct TableCell;
struct State;
class SubDocument;
}
class HanMacWrdJParser;
class HanMacWrdJGraph
{
friend class HanMacWrdJParser;
friend struct HanMacWrdJGraphInternal::Table;
friend class HanMacWrdJGraphInternal::SubDocument;
public:
explicit HanMacWrdJGraph(HanMacWrdJParser &parser);
virtual ~HanMacWrdJGraph();
int version() const;
int numPages() const;
protected:
bool getColor(int colId, int patternId, MWAWColor &color) const;
void prepareStructures();
bool sendPageGraphics(std::vector<long> const &doNotSendIds);
void flushExtra();
//
// Intermediate level
//
bool readFrames(MWAWEntry const &entry);
std::shared_ptr<HanMacWrdJGraphInternal::Frame> readFrame(int id);
std::shared_ptr<HanMacWrdJGraphInternal::ShapeGraph> readShapeGraph(HanMacWrdJGraphInternal::Frame const &header, long endPos);
std::shared_ptr<HanMacWrdJGraphInternal::CommentFrame> readCommentData(HanMacWrdJGraphInternal::Frame const &header, long endPos);
std::shared_ptr<HanMacWrdJGraphInternal::PictureFrame> readPictureData(HanMacWrdJGraphInternal::Frame const &header, long endPos);
std::shared_ptr<HanMacWrdJGraphInternal::TableFrame> readTableData(HanMacWrdJGraphInternal::Frame const &header, long endPos);
std::shared_ptr<HanMacWrdJGraphInternal::TextboxFrame> readTextboxData(HanMacWrdJGraphInternal::Frame const &header, long endPos);
std::shared_ptr<HanMacWrdJGraphInternal::TextFrame> readTextData(HanMacWrdJGraphInternal::Frame const &header, long endPos);
bool readGroupData(MWAWEntry const &entry, int actZone);
bool readGraphData(MWAWEntry const &entry, int actZone);
bool readPicture(MWAWEntry const &entry, int actZone);
bool readTable(MWAWEntry const &entry, int actZone);
bool readTableFormatsList(HanMacWrdJGraphInternal::Table &table, long endPos);
bool sendFrame(HanMacWrdJGraphInternal::Frame const &frame, MWAWPosition const &pos);
bool sendShapeGraph(HanMacWrdJGraphInternal::ShapeGraph const &pict, MWAWPosition const &pos);
bool sendComment(HanMacWrdJGraphInternal::CommentFrame const &textbox, MWAWPosition const &pos, librevenge::RVNGPropertyList const &extras=librevenge::RVNGPropertyList());
bool sendPictureFrame(HanMacWrdJGraphInternal::PictureFrame const &pict, MWAWPosition const &pos);
bool sendEmptyPicture(MWAWPosition const &pos);
bool sendTextbox(HanMacWrdJGraphInternal::TextboxFrame const &textbox, MWAWPosition const &pos);
bool sendTableUnformatted(long zId);
bool sendGroup(long zId, MWAWPosition const &pos);
bool sendGroup(HanMacWrdJGraphInternal::Group const &group, MWAWPosition const &pos);
bool canCreateGraphic(HanMacWrdJGraphInternal::Group const &group);
void sendGroupChild(HanMacWrdJGraphInternal::Group const &group, MWAWPosition const &pos);
void sendGroup(HanMacWrdJGraphInternal::Group const &group, MWAWGraphicListenerPtr const &listener);
// interface with mainParser
std::map<long,int> getTextFrameInformations() const;
bool getFootnoteInformations(long &textZId, std::vector<long> &fPosList) const;
bool sendFrame(long frameId, MWAWPosition const &pos);
bool sendText(long textId, long fPos, MWAWListenerPtr const &listener=MWAWListenerPtr());
//
// low level
//
bool checkGroupStructures(long zId, std::set<long> &seens, bool inGroup, int depth=0);
private:
HanMacWrdJGraph(HanMacWrdJGraph const &orig) = delete;
HanMacWrdJGraph &operator=(HanMacWrdJGraph const &orig) = delete;
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
std::shared_ptr<HanMacWrdJGraphInternal::State> m_state;
HanMacWrdJParser *m_mainParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWInputStream.hxx
HanMacWrdJGraphInternal::SubDocument
Internal: the subdocument of a HanMacWrdJGraph.
Definition HanMacWrdJGraph.cxx:955
HanMacWrdJGraph::readTableFormatsList
bool readTableFormatsList(HanMacWrdJGraphInternal::Table &table, long endPos)
try to read a list of format
Definition HanMacWrdJGraph.cxx:1920
HanMacWrdJGraph::sendText
bool sendText(long textId, long fPos, MWAWListenerPtr const &listener=MWAWListenerPtr())
ask main parser to send a text zone
Definition HanMacWrdJGraph.cxx:1113
HanMacWrdJGraph::readTextboxData
std::shared_ptr< HanMacWrdJGraphInternal::TextboxFrame > readTextboxData(HanMacWrdJGraphInternal::Frame const &header, long endPos)
try to read a textbox data
Definition HanMacWrdJGraph.cxx:2497
HanMacWrdJGraph::readShapeGraph
std::shared_ptr< HanMacWrdJGraphInternal::ShapeGraph > readShapeGraph(HanMacWrdJGraphInternal::Frame const &header, long endPos)
try to read the basic graph data
Definition HanMacWrdJGraph.cxx:2575
HanMacWrdJGraph::canCreateGraphic
bool canCreateGraphic(HanMacWrdJGraphInternal::Group const &group)
check if we can send a group as graphic
Definition HanMacWrdJGraph.cxx:2836
HanMacWrdJGraph::readFrame
std::shared_ptr< HanMacWrdJGraphInternal::Frame > readFrame(int id)
try to read a frame
Definition HanMacWrdJGraph.cxx:1397
HanMacWrdJGraph::sendTextbox
bool sendTextbox(HanMacWrdJGraphInternal::TextboxFrame const &textbox, MWAWPosition const &pos)
try to send a textbox to the listener
Definition HanMacWrdJGraph.cxx:2174
HanMacWrdJGraph::getFootnoteInformations
bool getFootnoteInformations(long &textZId, std::vector< long > &fPosList) const
return the footnote text zone id and the list of first char position
Definition HanMacWrdJGraph.cxx:1154
HanMacWrdJGraph::HanMacWrdJGraph
HanMacWrdJGraph(HanMacWrdJGraph const &orig)=delete
HanMacWrdJGraph::sendGroup
bool sendGroup(long zId, MWAWPosition const &pos)
try to send a group to the listener
Definition HanMacWrdJGraph.cxx:2809
HanMacWrdJGraph::~HanMacWrdJGraph
virtual ~HanMacWrdJGraph()
destructor
Definition HanMacWrdJGraph.cxx:1073
HanMacWrdJGraph::sendFrame
bool sendFrame(HanMacWrdJGraphInternal::Frame const &frame, MWAWPosition const &pos)
try to send a frame to the listener
Definition HanMacWrdJGraph.cxx:2232
HanMacWrdJGraph::operator=
HanMacWrdJGraph & operator=(HanMacWrdJGraph const &orig)=delete
HanMacWrdJGraph::prepareStructures
void prepareStructures()
check the group structures, the linked textbox
Definition HanMacWrdJGraph.cxx:2719
HanMacWrdJGraph::readPictureData
std::shared_ptr< HanMacWrdJGraphInternal::PictureFrame > readPictureData(HanMacWrdJGraphInternal::Frame const &header, long endPos)
try to read the picture data
Definition HanMacWrdJGraph.cxx:2405
HanMacWrdJGraph::HanMacWrdJParser
friend class HanMacWrdJParser
Definition HanMacWrdJGraph.hxx:80
HanMacWrdJGraph::sendTableUnformatted
bool sendTableUnformatted(long zId)
try to send a table unformatted
Definition HanMacWrdJGraph.cxx:2203
HanMacWrdJGraph::sendPictureFrame
bool sendPictureFrame(HanMacWrdJGraphInternal::PictureFrame const &pict, MWAWPosition const &pos)
try to send a picture frame
Definition HanMacWrdJGraph.cxx:2075
HanMacWrdJGraph::numPages
int numPages() const
returns the number of pages
Definition HanMacWrdJGraph.cxx:1097
HanMacWrdJGraph::checkGroupStructures
bool checkGroupStructures(long zId, std::set< long > &seens, bool inGroup, int depth=0)
check the graph structures: ie.
Definition HanMacWrdJGraph.cxx:2775
HanMacWrdJGraph::readGraphData
bool readGraphData(MWAWEntry const &entry, int actZone)
try to read the graph data (zone 8)
Definition HanMacWrdJGraph.cxx:1586
HanMacWrdJGraph::sendPageGraphics
bool sendPageGraphics(std::vector< long > const &doNotSendIds)
try to send the page graphic
Definition HanMacWrdJGraph.cxx:3047
HanMacWrdJGraph::getColor
bool getColor(int colId, int patternId, MWAWColor &color) const
returns the color associated with a pattern
Definition HanMacWrdJGraph.cxx:1082
HanMacWrdJGraph::sendShapeGraph
bool sendShapeGraph(HanMacWrdJGraphInternal::ShapeGraph const &pict, MWAWPosition const &pos)
try to send a basic picture to the listener
Definition HanMacWrdJGraph.cxx:2053
HanMacWrdJGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition HanMacWrdJGraph.hxx:193
HanMacWrdJGraph::readPicture
bool readPicture(MWAWEntry const &entry, int actZone)
try to read the pictures definition (type 6)
Definition HanMacWrdJGraph.cxx:1663
HanMacWrdJGraph::sendGroupChild
void sendGroupChild(HanMacWrdJGraphInternal::Group const &group, MWAWPosition const &pos)
try to send a group elements by elements
Definition HanMacWrdJGraph.cxx:2913
HanMacWrdJGraph::m_mainParser
HanMacWrdJParser * m_mainParser
the main parser;
Definition HanMacWrdJGraph.hxx:199
HanMacWrdJGraph::readCommentData
std::shared_ptr< HanMacWrdJGraphInternal::CommentFrame > readCommentData(HanMacWrdJGraphInternal::Frame const &header, long endPos)
try to read the comment data
Definition HanMacWrdJGraph.cxx:2354
HanMacWrdJGraph::sendComment
bool sendComment(HanMacWrdJGraphInternal::CommentFrame const &textbox, MWAWPosition const &pos, librevenge::RVNGPropertyList const &extras=librevenge::RVNGPropertyList())
try to send a comment box to the listener
Definition HanMacWrdJGraph.cxx:2142
HanMacWrdJGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition HanMacWrdJGraph.cxx:3072
HanMacWrdJGraph::readTextData
std::shared_ptr< HanMacWrdJGraphInternal::TextFrame > readTextData(HanMacWrdJGraphInternal::Frame const &header, long endPos)
try to read a text data (text, header/footer, footnote)
Definition HanMacWrdJGraph.cxx:2537
HanMacWrdJGraph::readFrames
bool readFrames(MWAWEntry const &entry)
try to read the frames definition (type 3)
Definition HanMacWrdJGraph.cxx:1177
HanMacWrdJGraph::m_state
std::shared_ptr< HanMacWrdJGraphInternal::State > m_state
the state
Definition HanMacWrdJGraph.hxx:196
HanMacWrdJGraph::readTable
bool readTable(MWAWEntry const &entry, int actZone)
try to read a table (zone 7)
Definition HanMacWrdJGraph.cxx:1705
HanMacWrdJGraph::HanMacWrdJGraph
HanMacWrdJGraph(HanMacWrdJParser &parser)
constructor
Definition HanMacWrdJGraph.cxx:1066
HanMacWrdJGraph::readTableData
std::shared_ptr< HanMacWrdJGraphInternal::TableFrame > readTableData(HanMacWrdJGraphInternal::Frame const &header, long endPos)
try to read the table data
Definition HanMacWrdJGraph.cxx:2454
HanMacWrdJGraph::getTextFrameInformations
std::map< long, int > getTextFrameInformations() const
return a list textZId -> type which type=0(main), 1(header), 2(footer), 3(footnote),...
Definition HanMacWrdJGraph.cxx:1118
HanMacWrdJGraph::readGroupData
bool readGroupData(MWAWEntry const &entry, int actZone)
try to read the groupd data ( type 9 )
Definition HanMacWrdJGraph.cxx:1511
HanMacWrdJGraph::version
int version() const
returns the file version
Definition HanMacWrdJGraph.cxx:1077
HanMacWrdJGraph::sendEmptyPicture
bool sendEmptyPicture(MWAWPosition const &pos)
try to send an empty picture
Definition HanMacWrdJGraph.cxx:2114
HanMacWrdJParser
the main class to read a HanMac Word-J file
Definition HanMacWrdJParser.hxx:110
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
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
HanMacWrdJGraphInternal
Internal: the structures of a HanMacWrdJGraph.
Definition HanMacWrdJGraph.cxx:63
HanMacWrdJGraphInternal::CellFormat
a cell format in HanMacWrdJGraph
Definition HanMacWrdJGraph.cxx:68
HanMacWrdJGraphInternal::CommentFrame
Internal: the comment frame of a HanMacWrdJGraph.
Definition HanMacWrdJGraph.cxx:442
HanMacWrdJGraphInternal::Frame
Internal: the frame header of a HanMacWrdJGraph.
Definition HanMacWrdJGraph.cxx:323
HanMacWrdJGraphInternal::Group
Internal: a group of a HanMacWrdJGraph.
Definition HanMacWrdJGraph.cxx:489
HanMacWrdJGraphInternal::PictureFrame
Internal: the picture frame of a HanMacWrdJGraph.
Definition HanMacWrdJGraph.cxx:516
HanMacWrdJGraphInternal::ShapeGraph
Internal: the geometrical graph of a HanMacWrdJGraph.
Definition HanMacWrdJGraph.cxx:716
HanMacWrdJGraphInternal::State
Internal: the state of a HanMacWrdJGraph.
Definition HanMacWrdJGraph.cxx:801
HanMacWrdJGraphInternal::TableCell
a table cell in a table in HanMacWrdJGraph
Definition HanMacWrdJGraph.cxx:98
HanMacWrdJGraphInternal::TableFrame
Internal: the table frame of a HanMacWrdJGraph.
Definition HanMacWrdJGraph.cxx:580
HanMacWrdJGraphInternal::Table
Internal: the table of a HanMacWrdJGraph.
Definition HanMacWrdJGraph.cxx:167
HanMacWrdJGraphInternal::TextFrame
Internal: the text frame (basic, header, footer, footnote) of a HanMacWrdJGraph.
Definition HanMacWrdJGraph.cxx:678
HanMacWrdJGraphInternal::TextboxFrame
Internal: the textbox frame of a HanMacWrdJGraph.
Definition HanMacWrdJGraph.cxx:625
MWAWColor
the class to store a color
Definition libmwaw_internal.hxx:192