GreatWksDocument.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.
*/
#ifndef GREAT_WKS_DOCUMENT
# define GREAT_WKS_DOCUMENT
#include <string>
#include <vector>
#include <librevenge/librevenge.h>
#include "MWAWCell.hxx"
#include "MWAWDebug.hxx"
#include "MWAWParser.hxx"
namespace GreatWksDocumentInternal
{
struct State;
}
class GreatWksGraph;
class GreatWksParser;
class GreatWksDBParser;
class GreatWksDRParser;
class GreatWksSSParser;
class GreatWksText;
class GreatWksDocument
{
friend class GreatWksParser;
friend class GreatWksDBParser;
friend class GreatWksDRParser;
friend class GreatWksSSParser;
public:
explicit GreatWksDocument(MWAWParser &parser);
virtual ~GreatWksDocument();
bool checkHeader(MWAWHeader *header, bool strict=false);
MWAWParser &getMainParser()
{
return *m_parser;
}
std::shared_ptr<GreatWksGraph> getGraphParser()
{
return m_graphParser;
}
std::shared_ptr<GreatWksText> getTextParser()
{
return m_textParser;
}
MWAWSection getMainSection() const;
void newPage(int page);
bool sendPicture(MWAWEntry const &entry, MWAWPosition const &pos);
// interface with the graph parser
bool canSendTextboxAsGraphic(MWAWEntry const &entry);
bool sendTextbox(MWAWEntry const &entry, MWAWListenerPtr listener);
protected:
bool readRSRCZones();
// formula function
bool readCellInFormula(MWAWVec2i const &pos, MWAWCellContent::FormulaInstruction &instr);
bool readString(long endPos, std::string &res);
bool readNumber(long endPos, double &res, bool &isNan);
bool readFormula(MWAWVec2i const &cPos, long endPos,
std::vector<MWAWCellContent::FormulaInstruction> &formula, std::string &error);
//
// low level
//
bool readPrintInfo(MWAWEntry const &entry);
bool readWPSN(MWAWEntry const &entry);
bool readARRs(MWAWEntry const &entry);
bool readDaHS(MWAWEntry const &entry);
bool readGrDS(MWAWEntry const &entry);
bool readNxEd(MWAWEntry const &entry);
MWAWInputStreamPtr rsrcInput();
libmwaw::DebugFile &rsrcAscii();
private:
GreatWksDocument(GreatWksDocument const &orig) = delete;
GreatWksDocument &operator=(GreatWksDocument const &orig) = delete;
//
// data
//
protected:
std::shared_ptr<GreatWksDocumentInternal::State> m_state;
public:
std::shared_ptr<MWAWParserState> m_parserState;
protected:
MWAWParser *m_parser;
std::shared_ptr<GreatWksGraph> m_graphParser;
std::shared_ptr<GreatWksText> m_textParser;
typedef MWAWSection(MWAWParser::* GetMainSection)() const;
typedef void (MWAWParser::* NewPage)(int page);
GetMainSection m_getMainSection;
NewPage m_newPage;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWCell.hxx
Defines MWAWCell (cell content and format).
MWAWDebug.hxx
MWAWParser.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::~GreatWksDocument
virtual ~GreatWksDocument()
destructor
Definition GreatWksDocument.cxx:98
GreatWksDocument::readRSRCZones
bool readRSRCZones()
read the resource fork zone
Definition GreatWksDocument.cxx:172
GreatWksDocument::m_getMainSection
GetMainSection m_getMainSection
the getMainSection callback
Definition GreatWksDocument.hxx:176
GreatWksDocument::readString
bool readString(long endPos, std::string &res)
try to read a string
Definition GreatWksDocument.cxx:571
GreatWksDocument::readNxEd
bool readNxEd(MWAWEntry const &entry)
read a unknown zone ( NxED resource block: v2 )
Definition GreatWksDocument.cxx:445
GreatWksDocument::GreatWksDocument
GreatWksDocument(GreatWksDocument const &orig)=delete
GreatWksDocument::m_graphParser
std::shared_ptr< GreatWksGraph > m_graphParser
the graph document
Definition GreatWksDocument.hxx:166
GreatWksDocument::GreatWksDocument
GreatWksDocument(MWAWParser &parser)
constructor
Definition GreatWksDocument.cxx:83
GreatWksDocument::readNumber
bool readNumber(long endPos, double &res, bool &isNan)
try to read a number
Definition GreatWksDocument.cxx:586
GreatWksDocument::sendTextbox
bool sendTextbox(MWAWEntry const &entry, MWAWListenerPtr listener)
try to send textbox
Definition GreatWksDocument.cxx:137
GreatWksDocument::GreatWksDBParser
friend class GreatWksDBParser
Definition GreatWksDocument.hxx:63
GreatWksDocument::m_textParser
std::shared_ptr< GreatWksText > m_textParser
the text document
Definition GreatWksDocument.hxx:168
GreatWksDocument::readGrDS
bool readGrDS(MWAWEntry const &entry)
read a unknown zone ( GrDS resource block: v2 )
Definition GreatWksDocument.cxx:405
GreatWksDocument::NewPage
void(MWAWParser::* NewPage)(int page)
callback used to send a page break
Definition GreatWksDocument.hxx:173
GreatWksDocument::getMainSection
MWAWSection getMainSection() const
return the main section
Definition GreatWksDocument.cxx:115
GreatWksDocument::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition GreatWksDocument.cxx:107
GreatWksDocument::readDaHS
bool readDaHS(MWAWEntry const &entry)
read a unknown zone ( DaHS resource block: v2 )
Definition GreatWksDocument.cxx:364
GreatWksDocument::GreatWksParser
friend class GreatWksParser
Definition GreatWksDocument.hxx:62
GreatWksDocument::getMainParser
MWAWParser & getMainParser()
returns the main parser
Definition GreatWksDocument.hxx:76
GreatWksDocument::getTextParser
std::shared_ptr< GreatWksText > getTextParser()
returns the text parser
Definition GreatWksDocument.hxx:86
GreatWksDocument::operator=
GreatWksDocument & operator=(GreatWksDocument const &orig)=delete
GreatWksDocument::m_state
std::shared_ptr< GreatWksDocumentInternal::State > m_state
the state
Definition GreatWksDocument.hxx:157
GreatWksDocument::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition GreatWksDocument.cxx:477
GreatWksDocument::GreatWksDRParser
friend class GreatWksDRParser
Definition GreatWksDocument.hxx:64
GreatWksDocument::canSendTextboxAsGraphic
bool canSendTextboxAsGraphic(MWAWEntry const &entry)
check if a textbox can be send in a graphic zone, ie. does not contains any graphic
Definition GreatWksDocument.cxx:146
GreatWksDocument::getGraphParser
std::shared_ptr< GreatWksGraph > getGraphParser()
returns the graph parser
Definition GreatWksDocument.hxx:81
GreatWksDocument::newPage
void newPage(int page)
send a page break
Definition GreatWksDocument.cxx:124
GreatWksDocument::sendPicture
bool sendPicture(MWAWEntry const &entry, MWAWPosition const &pos)
send a picture
Definition GreatWksDocument.cxx:158
GreatWksDocument::GreatWksSSParser
friend class GreatWksSSParser
Definition GreatWksDocument.hxx:65
GreatWksDocument::readFormula
bool readFormula(MWAWVec2i const &cPos, long endPos, std::vector< MWAWCellContent::FormulaInstruction > &formula, std::string &error)
read to read a formula
Definition GreatWksDocument.cxx:628
GreatWksDocument::m_parserState
std::shared_ptr< MWAWParserState > m_parserState
the parser state
Definition GreatWksDocument.hxx:160
GreatWksDocument::readPrintInfo
bool readPrintInfo(MWAWEntry const &entry)
read a PrintInfo block ( PRNT resource block )
Definition GreatWksDocument.cxx:283
GreatWksDocument::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition GreatWksDocument.cxx:102
GreatWksDocument::readCellInFormula
bool readCellInFormula(MWAWVec2i const &pos, MWAWCellContent::FormulaInstruction &instr)
reads a cell
Definition GreatWksDocument.cxx:542
GreatWksDocument::m_parser
MWAWParser * m_parser
the main parser
Definition GreatWksDocument.hxx:164
GreatWksDocument::readWPSN
bool readWPSN(MWAWEntry const &entry)
read the windows positions ( WPSN resource block )
Definition GreatWksDocument.cxx:230
GreatWksDocument::readARRs
bool readARRs(MWAWEntry const &entry)
read a unknown zone ( ARRs resource block: v2 )
Definition GreatWksDocument.cxx:337
GreatWksDocument::m_newPage
NewPage m_newPage
the new page callback
Definition GreatWksDocument.hxx:178
GreatWksDocument::GetMainSection
MWAWSection(MWAWParser::* GetMainSection)() const
callback used to return the main section
Definition GreatWksDocument.hxx:171
GreatWksGraph
the main class to read the graphic part of a HanMac Word-J file
Definition GreatWksGraph.hxx:76
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
GreatWksText
the main class to read the text part of GreatWorks Text file
Definition GreatWksText.hxx:63
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition MWAWHeader.hxx:57
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
MWAWSection
a class which stores section properties
Definition MWAWSection.hxx:46
libmwaw::DebugFile
Definition MWAWDebug.hxx:66
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition libmwaw_internal.hxx:838
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition libmwaw_internal.hxx:553
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
GreatWksDocumentInternal
Internal: the structures of a GreatWksDocument.
Definition GreatWksDocument.cxx:58
GreatWksDocumentInternal::State
Internal: the state of a GreatWksDocument.
Definition GreatWksDocument.cxx:62
MWAWCellContent::FormulaInstruction
small class use to define a formula instruction
Definition MWAWCell.hxx:397