MSKGraph.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 Microsoft Works text document ( graphic part )
*
*/
#ifndef MSK_MWAW_GRAPH
# define MSK_MWAW_GRAPH
#include <list>
#include <string>
#include <vector>
#include "MWAWPosition.hxx"
#include "MWAWEntry.hxx"
#include "MWAWParser.hxx"
namespace MSKGraphInternal
{
struct Font;
struct Zone;
struct DataPict;
struct Table;
struct GroupZone;
struct TextBox;
struct State;
class SubDocument;
}
class MSKParser;
class MSK3Parser;
class MSK4Zone;
class MSKGraph
{
friend class MSK3Parser;
friend class MSK4Zone;
friend class MSKGraphInternal::SubDocument;
public:
MSKGraph(MSKParser &parser);
virtual ~MSKGraph();
int version() const;
int numPages(int zoneId) const;
void send(int id, MWAWPosition::AnchorTo anchor);
void sendAll(int zoneId, bool mainZone);
struct SendData {
// constructor
SendData();
enum Type { RBDR, RBIL, ALL } m_type;
int m_id;
MWAWPosition::AnchorTo m_anchor;
int m_page;
Vec2i m_size;
};
void sendObjects(SendData const what);
void computePositions(int zoneId, std::vector<int> &linesHeight, std::vector<int> &pagesHeight);
protected:
void flushExtra();
//
// Intermediate level
//
bool readPictHeader(MSKGraphInternal::Zone &pict);
int getEntryPictureV1(int zoneId, MWAWEntry &zone);
int getEntryPicture(int zoneId, MWAWEntry &zone);
// version 4 file
bool readRB(MWAWInputStreamPtr input, MWAWEntry const &entry);
bool readPictureV4(MWAWInputStreamPtr input, MWAWEntry const &entry);
bool readText(MSKGraphInternal::TextBox &textBox);
void sendTextBox(int id);
void checkTextBoxLinks(int zId);
void sendFrameText(MWAWEntry const &entry, std::string const &frame);
bool readTable(MSKGraphInternal::Table &table);
void sendTable(int id);
bool readChart(MSKGraphInternal::Zone &zone);
//
// low level
//
shared_ptr<MSKGraphInternal::GroupZone> readGroup(MSKGraphInternal::Zone &group);
bool readFont(MSKGraphInternal::Font &font);
private:
MSKGraph(MSKGraph const &orig);
MSKGraph &operator=(MSKGraph const &orig);
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
shared_ptr<MSKGraphInternal::State> m_state;
MSKParser *m_mainParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MSKGraph::SendData::ALL
Definition: MSKGraph.hxx:98
MSKGraph::getEntryPictureV1
int getEntryPictureV1(int zoneId, MWAWEntry &zone)
checks if the next zone is a v1 picture and returns a zone id.
Definition: MSKGraph.cxx:1679
MSKGraph::send
void send(int id, MWAWPosition::AnchorTo anchor)
send a zone (textbox, ...)
Definition: MSKGraph.cxx:2603
MSKGraph::readRB
bool readRB(MWAWInputStreamPtr input, MWAWEntry const &entry)
reads the RBDR or a RBIL zone: a zone which seems to regroup all pages pictures
Definition: MSKGraph.cxx:1746
MSKGraph::SendData::RBIL
Definition: MSKGraph.hxx:98
MWAWParser.hxx
MSKGraph::SendData::RBDR
Definition: MSKGraph.hxx:98
MSKGraph::~MSKGraph
virtual ~MSKGraph()
destructor
Definition: MSKGraph.cxx:1004
MWAWEntry.hxx
MSKGraphInternal::Zone
Internal: the generic pict.
Definition: MSKGraph.cxx:157
MSKGraph::readChart
bool readChart(MSKGraphInternal::Zone &zone)
try to read a chart (very incomplete)
Definition: MSKGraph.cxx:2262
MSKGraph
the main class to read the text part of Claris Works file
Definition: MSKGraph.hxx:71
MSKGraph::sendTable
void sendTable(int id)
try to a table zone
Definition: MSKGraph.cxx:2476
MSKGraph::SendData::m_anchor
MWAWPosition::AnchorTo m_anchor
the anchor
Definition: MSKGraph.hxx:102
MSKGraphInternal::SubDocument
Internal: the subdocument of a MSKGraph.
Definition: MSKGraph.cxx:900
MSKGraph::checkTextBoxLinks
void checkTextBoxLinks(int zId)
check the text box link
Definition: MSKGraph.cxx:1858
MSKGraphInternal::Font
Internal: the fonts.
Definition: MSKGraph.cxx:66
MSKGraph::readTable
bool readTable(MSKGraphInternal::Table &table)
try to read a table zone
Definition: MSKGraph.cxx:2141
MSKGraph::SendData::SendData
SendData()
Definition: MSKGraph.cxx:2782
MSKGraph::SendData
Definition: MSKGraph.hxx:94
MSKGraph::readText
bool readText(MSKGraphInternal::TextBox &textBox)
try to read a text zone
Definition: MSKGraph.cxx:1994
MSKGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: MSKGraph.cxx:2770
MSKGraph::SendData::Type
Type
the type
Definition: MSKGraph.hxx:98
MWAWPosition::AnchorTo
AnchorTo
a list of enum used to defined the anchor
Definition: MWAWPosition.hxx:51
MSKParser
generic parser for Microsoft Works file
Definition: MSKParser.hxx:57
MSKGraph::SendData::m_page
int m_page
the page ( used if anchor==page)
Definition: MSKGraph.hxx:104
MSKGraph::MSKGraph
MSKGraph(MSKParser &parser)
constructor
Definition: MSKGraph.cxx:998
MSKGraph::sendTextBox
void sendTextBox(int id)
send a textbox to the listener
Definition: MSKGraph.cxx:2411
MSK3Parser
the main class to read a Microsoft Works file
Definition: MSK3Parser.hxx:62
MSKGraph::operator=
MSKGraph & operator=(MSKGraph const &orig)
MSK4Zone
The class which parses the main zones of a mac MS Works document v4.
Definition: MSK4Zone.hxx:76
MSKGraph::version
int version() const
returns the file version
Definition: MSKGraph.cxx:1007
MSKGraphInternal::TextBox
Internal: the textbox of a MSKGraph ( v2-v3)
Definition: MSKGraph.cxx:770
MSKGraph::m_state
shared_ptr< MSKGraphInternal::State > m_state
the state
Definition: MSKGraph.hxx:183
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:336
MSKGraph::SendData::m_id
int m_id
the rbil id
Definition: MSKGraph.hxx:100
MSKGraph::readPictHeader
bool readPictHeader(MSKGraphInternal::Zone &pict)
read the picture header
Definition: MSKGraph.cxx:1041
MSKGraph::sendAll
void sendAll(int zoneId, bool mainZone)
send all the picture corresponding to a zone
Definition: MSKGraph.cxx:2686
MSKGraph::numPages
int numPages(int zoneId) const
returns the number of pages
Definition: MSKGraph.cxx:1014
MSKGraph::readPictureV4
bool readPictureV4(MWAWInputStreamPtr input, MWAWEntry const &entry)
reads a Pict zone: a zone which seems to code in v4 : header/footer picture
Definition: MSKGraph.cxx:1922
MSKGraph::sendObjects
void sendObjects(SendData const what)
sends all the object of a page, frame, ...
Definition: MSKGraph.cxx:2696
MWAWPosition.hxx
MSKGraph::sendFrameText
void sendFrameText(MWAWEntry const &entry, std::string const &frame)
ask m_mainParser to send a frame text(v4)
Definition: MSKGraph.cxx:1031
MSKGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: MSKGraph.hxx:180
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
MSKGraph::computePositions
void computePositions(int zoneId, std::vector< int > &linesHeight, std::vector< int > &pagesHeight)
try to update positions knowing pages and lines height
Definition: MSKGraph.cxx:1646
MSKGraph::readFont
bool readFont(MSKGraphInternal::Font &font)
reads the textbox font
Definition: MSKGraph.cxx:2558
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
MSKGraph::SendData::m_type
enum MSKGraph::SendData::Type m_type
MSKGraphInternal::Table
Internal: the table of a MSKGraph.
Definition: MSKGraph.cxx:722
Vec2< int >
MSKGraph::readGroup
shared_ptr< MSKGraphInternal::GroupZone > readGroup(MSKGraphInternal::Zone &group)
try to read the group data
Definition: MSKGraph.cxx:1954
MSKGraph::getEntryPicture
int getEntryPicture(int zoneId, MWAWEntry &zone)
checks if the next zone is a v2 picture and returns a zone id.
Definition: MSKGraph.cxx:1172
MSKGraph::m_mainParser
MSKParser * m_mainParser
the main parser;
Definition: MSKGraph.hxx:186
MSKGraph::SendData::m_size
Vec2i m_size
the size of the data ( used by rbil )
Definition: MSKGraph.hxx:106