HMWJGraph.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 HMWJ_GRAPH
# define HMWJ_GRAPH
#include <map>
#include <string>
#include <vector>
#include <libwpd/libwpd.h>
#include "libmwaw_internal.hxx"
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
namespace HMWJGraphInternal
{
struct CellFormat;
struct Frame;
struct BasicGraph;
struct CommentFrame;
struct PictureFrame;
struct TableFrame;
struct TextboxFrame;
struct TextFrame;
struct Table;
struct TableCell;
struct State;
class SubDocument;
}
class HMWJParser;
class HMWJGraph
{
friend class HMWJParser;
friend struct HMWJGraphInternal::Table;
friend class HMWJGraphInternal::SubDocument;
public:
HMWJGraph(HMWJParser &parser);
virtual ~HMWJGraph();
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(MWAWEntry const &entry);
shared_ptr<HMWJGraphInternal::Frame> readFrame(int id);
shared_ptr<HMWJGraphInternal::BasicGraph> readBasicGraph(HMWJGraphInternal::Frame const &header, long endPos);
shared_ptr<HMWJGraphInternal::CommentFrame> readCommentData(HMWJGraphInternal::Frame const &header, long endPos);
shared_ptr<HMWJGraphInternal::PictureFrame> readPictureData(HMWJGraphInternal::Frame const &header, long endPos);
shared_ptr<HMWJGraphInternal::TableFrame> readTableData(HMWJGraphInternal::Frame const &header, long endPos);
shared_ptr<HMWJGraphInternal::TextboxFrame> readTextboxData(HMWJGraphInternal::Frame const &header, long endPos);
shared_ptr<HMWJGraphInternal::TextFrame> readTextData(HMWJGraphInternal::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(HMWJGraphInternal::Table &table, long endPos);
bool sendFrame(HMWJGraphInternal::Frame const &frame, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList());
bool sendBasicGraph(HMWJGraphInternal::BasicGraph const &pict, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList());
bool sendComment(HMWJGraphInternal::CommentFrame const &textbox, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList());
bool sendPictureFrame(HMWJGraphInternal::PictureFrame const &pict, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList());
bool sendEmptyPicture(MWAWPosition pos);
bool sendTextbox(HMWJGraphInternal::TextboxFrame const &textbox, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList());
bool sendTableUnformatted(long zId);
// interface with mainParser
std::map<long,int> getTextFrameInformations() const;
bool getFootnoteInformations(long &textZId, std::vector<long> &fPosList) const;
bool sendFrame(long frameId, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList());
bool sendText(long textId, long fPos);
//
// low level
//
private:
HMWJGraph(HMWJGraph const &orig);
HMWJGraph &operator=(HMWJGraph const &orig);
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
shared_ptr<HMWJGraphInternal::State> m_state;
HMWJParser *m_mainParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
HMWJGraphInternal::CommentFrame
Internal: the comment frame of a HMWJGraph.
Definition: HMWJGraph.cxx:359
HMWJGraph::readFrame
shared_ptr< HMWJGraphInternal::Frame > readFrame(int id)
try to read a frame
Definition: HMWJGraph.cxx:1159
HMWJGraph::version
int version() const
returns the file version
Definition: HMWJGraph.cxx:847
HMWJGraph::readBasicGraph
shared_ptr< HMWJGraphInternal::BasicGraph > readBasicGraph(HMWJGraphInternal::Frame const &header, long endPos)
try to read the basic graph data
Definition: HMWJGraph.cxx:2403
HMWJGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: HMWJGraph.hxx:176
libmwaw_internal.hxx
HMWJGraph::readTableData
shared_ptr< HMWJGraphInternal::TableFrame > readTableData(HMWJGraphInternal::Frame const &header, long endPos)
try to read the table data
Definition: HMWJGraph.cxx:2282
HMWJGraph::readPictureData
shared_ptr< HMWJGraphInternal::PictureFrame > readPictureData(HMWJGraphInternal::Frame const &header, long endPos)
try to read the picture data
Definition: HMWJGraph.cxx:2231
HMWJGraph::numPages
int numPages() const
returns the number of pages
Definition: HMWJGraph.cxx:867
HMWJGraph::readGroupData
bool readGroupData(MWAWEntry const &entry, int actZone)
try to read the groupd data ( type 9 )
Definition: HMWJGraph.cxx:1271
HMWJGraph::readGraphData
bool readGraphData(MWAWEntry const &entry, int actZone)
try to read the graph data (zone 8)
Definition: HMWJGraph.cxx:1347
HMWJGraphInternal::BasicGraph
Internal: the geometrical graph of a HMWJGraph.
Definition: HMWJGraph.cxx:540
HMWJGraphInternal::Frame
Internal: the frame header of a HMWJGraph.
Definition: HMWJGraph.cxx:261
HMWJGraph::sendComment
bool sendComment(HMWJGraphInternal::CommentFrame const &textbox, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
try to send a comment box to the listener
Definition: HMWJGraph.cxx:1996
HMWJGraph::readTextboxData
shared_ptr< HMWJGraphInternal::TextboxFrame > readTextboxData(HMWJGraphInternal::Frame const &header, long endPos)
try to read a textbox data
Definition: HMWJGraph.cxx:2325
HMWJGraphInternal::SubDocument
Internal: the subdocument of a HMWJGraph.
Definition: HMWJGraph.cxx:749
HMWJGraph::readPicture
bool readPicture(MWAWEntry const &entry, int actZone)
try to read the pictures definition (type 6)
Definition: HMWJGraph.cxx:1423
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:161
HMWJGraph::HMWJGraph
HMWJGraph(HMWJParser &parser)
constructor
Definition: HMWJGraph.cxx:838
HMWJGraph::sendEmptyPicture
bool sendEmptyPicture(MWAWPosition pos)
try to send an empty picture
Definition: HMWJGraph.cxx:1969
HMWJGraph::readFrames
bool readFrames(MWAWEntry const &entry)
try to read the frames definition (type 3)
Definition: HMWJGraph.cxx:952
HMWJGraph::sendText
bool sendText(long textId, long fPos)
ask main parser to send a text zone
Definition: HMWJGraph.cxx:885
HMWJGraph::sendFrame
bool sendFrame(HMWJGraphInternal::Frame const &frame, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
try to send a frame to the listener
Definition: HMWJGraph.cxx:2087
HMWJGraph::~HMWJGraph
virtual ~HMWJGraph()
destructor
Definition: HMWJGraph.cxx:844
HMWJGraphInternal::PictureFrame
Internal: the picture frame of a HMWJGraph.
Definition: HMWJGraph.cxx:409
HMWJGraph::sendTextbox
bool sendTextbox(HMWJGraphInternal::TextboxFrame const &textbox, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
try to send a textbox to the listener
Definition: HMWJGraph.cxx:2031
HMWJGraph::sendTableUnformatted
bool sendTableUnformatted(long zId)
try to send a table unformatted
Definition: HMWJGraph.cxx:2061
HMWJGraphInternal::Table
Internal: the table of a HMWJGraph.
Definition: HMWJGraph.cxx:148
HMWJGraph::getColor
bool getColor(int colId, int patternId, MWAWColor &color) const
returns the color associated with a pattern
Definition: HMWJGraph.cxx:852
HMWJGraph::readTable
bool readTable(MWAWEntry const &entry, int actZone)
try to read a table (zone 7)
Definition: HMWJGraph.cxx:1465
HMWJGraph::getFootnoteInformations
bool getFootnoteInformations(long &textZId, std::vector< long > &fPosList) const
return the footnote text zone id and the list of first char position
Definition: HMWJGraph.cxx:928
HMWJGraph::getTextFrameInformations
std::map< long, int > getTextFrameInformations() const
return a list textZId -> type which type=0(main), 1(header), 2(footer), 3(footnote), 4(textbox), 9(table), 10(comment)
Definition: HMWJGraph.cxx:890
HMWJGraph::m_mainParser
HMWJParser * m_mainParser
the main parser;
Definition: HMWJGraph.hxx:182
HMWJGraph::readTableFormatsList
bool readTableFormatsList(HMWJGraphInternal::Table &table, long endPos)
try to read a list of format
Definition: HMWJGraph.cxx:1681
HMWJGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: HMWJGraph.cxx:2516
HMWJParser
the main class to read a HanMac Word-J file
Definition: HMWJParser.hxx:102
MWAWInputStream.hxx
MWAWDebug.hxx
HMWJGraphInternal::TextboxFrame
Internal: the textbox frame of a HMWJGraph.
Definition: HMWJGraph.cxx:482
HMWJGraph::m_state
shared_ptr< HMWJGraphInternal::State > m_state
the state
Definition: HMWJGraph.hxx:179
HMWJGraph::operator=
HMWJGraph & operator=(HMWJGraph const &orig)
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
HMWJGraph::sendPageGraphics
bool sendPageGraphics(std::vector< long > const &doNotSendIds)
try to send the page graphic
Definition: HMWJGraph.cxx:2490
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
HMWJGraph::readTextData
shared_ptr< HMWJGraphInternal::TextFrame > readTextData(HMWJGraphInternal::Frame const &header, long endPos)
try to read a text data (text, header/footer, footnote)
Definition: HMWJGraph.cxx:2365
HMWJGraph::sendPictureFrame
bool sendPictureFrame(HMWJGraphInternal::PictureFrame const &pict, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
try to send a picture frame
Definition: HMWJGraph.cxx:1927
HMWJGraph
the main class to read the graphic part of a HanMac Word-J file
Definition: HMWJGraph.hxx:76
HMWJGraph::sendBasicGraph
bool sendBasicGraph(HMWJGraphInternal::BasicGraph const &pict, MWAWPosition pos, WPXPropertyList extras=WPXPropertyList())
try to send a basic picture to the listener
Definition: HMWJGraph.cxx:1809
HMWJGraph::readCommentData
shared_ptr< HMWJGraphInternal::CommentFrame > readCommentData(HMWJGraphInternal::Frame const &header, long endPos)
try to read the comment data
Definition: HMWJGraph.cxx:2179