ClarisWksDocument.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.
*/
/*
* Document data used by the Claris Works parser
*
*/
#ifndef CLARIS_WKS_DOCUMENT
# define CLARIS_WKS_DOCUMENT
#include <vector>
#include "libmwaw_internal.hxx"
#include "MWAWParser.hxx"
#include "MWAWPosition.hxx"
#include "ClarisWksStruct.hxx"
class MWAWSection;
namespace ClarisWksDocumentInternal
{
class SubDocument;
struct State;
}
class ClarisWksParser;
class ClarisWksBMParser;
class ClarisWksPRParser;
class ClarisWksSSParser;
class ClarisWksDatabase;
class ClarisWksGraph;
class ClarisWksStyleManager;
class ClarisWksPresentation;
class ClarisWksSpreadsheet;
class ClarisWksTable;
class ClarisWksText;
class ClarisWksDocument
{
public:
friend class ClarisWksParser;
friend class ClarisWksBMParser;
friend class ClarisWksPRParser;
friend class ClarisWksSSParser;
friend class ClarisWksDocumentInternal::SubDocument;
explicit ClarisWksDocument(MWAWParser &parser);
~ClarisWksDocument();
bool checkHeader(MWAWHeader *header, bool strict=false);
bool createZones();
int numPages() const;
MWAWVec2i getDocumentPages();
librevenge::RVNGPropertyList const &getDocumentMetaData() const;
double getTextHeight() const;
MWAWVec2f getPageLeftTop() const;
void updatePageSpanList(std::vector<MWAWPageSpan> &spanList);
void updatePageSpanList(std::vector<MWAWPageSpan> &spanList, MWAWPageSpan &master);
MWAWSection getMainSection() const;
std::shared_ptr<ClarisWksStruct::DSET> getZone(int zId) const;
void updateChildPositions();
void newPage(int page, bool softBreak=false);
std::vector<int> const &getMainZonesList() const;
void forceParsed(int zoneId);
bool canSendZoneAsGraphic(int number) const;
bool sendZone(int zoneId, MWAWListenerPtr listener=MWAWListenerPtr(), MWAWPosition pos=MWAWPosition());
bool sendDatabasePictZone(int pictId, MWAWListenerPtr listener=MWAWListenerPtr(), MWAWPosition const &pos=MWAWPosition());
void sendFootnote(int zoneId);
MWAWParser &getMainParser()
{
return *m_parser;
}
std::shared_ptr<ClarisWksStyleManager> getStyleManager()
{
return m_styleManager;
}
std::shared_ptr<ClarisWksDatabase> getDatabaseParser()
{
return m_databaseParser;
}
std::shared_ptr<ClarisWksGraph> getGraphParser()
{
return m_graphParser;
}
std::shared_ptr<ClarisWksPresentation> getPresentationParser()
{
return m_presentationParser;
}
std::shared_ptr<ClarisWksSpreadsheet> getSpreadsheetParser()
{
return m_spreadsheetParser;
}
std::shared_ptr<ClarisWksTable> getTableParser()
{
return m_tableParser;
}
std::shared_ptr<ClarisWksText> getTextParser()
{
return m_textParser;
}
bool readZone();
bool readDocHeader();
bool readDocInfo();
bool readPrintInfo();
// THE NAMED ENTRY
bool readEndTable(long &eof);
/* sequence of plist of printer : in v6 */
bool readCPRT(MWAWEntry const &entry);
/* read the list of mark */
bool readMARKList(MWAWEntry const &entry);
/* read a URL mark */
bool readURL(long endPos);
/* read a bookmark mark */
bool readBookmark(long endPos);
/* read a document mark */
bool readDocumentMark(long endPos);
/* read a end mark */
bool readEndMark(long endPos);
/* read the document summary */
bool readDSUM(MWAWEntry const &entry, bool inHeader);
/* SNAP (in v6) : size[4]/size[2] picture... */
bool readSNAP(MWAWEntry const &entry);
/* read the temporary file name ? */
bool readTNAM(MWAWEntry const &entry);
//
// low level
//
std::shared_ptr<ClarisWksStruct::DSET> readDSET(bool &complete);
void typeMainZones();
int typeMainZonesRec(int zId, ClarisWksStruct::DSET::Position type, int maxHeight);
bool exploreZonesGraph();
bool exploreZonesGraphRec(int zId, std::set<int> &notDoneList);
void cleanZonesGraph();
bool readStructCellZone(char const *zoneName, bool hasEntete, std::vector<MWAWVec2i> &res);
/* read a list of string zone */
bool readStringList(char const *zoneName, bool hasEntete, std::vector<std::string> &res);
bool readDataLinkList();
bool readZoneA();
void checkOrdering(std::vector<int16_t> &vec16, std::vector<int32_t> &vec32) const;
protected:
MWAWPageSpan getFinalPageSpan() const;
std::shared_ptr<ClarisWksDocumentInternal::State> m_state;
public:
std::shared_ptr<MWAWParserState> m_parserState;
protected:
MWAWParser *m_parser;
std::shared_ptr<ClarisWksStyleManager> m_styleManager;
std::shared_ptr<ClarisWksDatabase> m_databaseParser;
std::shared_ptr<ClarisWksGraph> m_graphParser;
std::shared_ptr<ClarisWksPresentation> m_presentationParser;
std::shared_ptr<ClarisWksSpreadsheet> m_spreadsheetParser;
std::shared_ptr<ClarisWksTable> m_tableParser;
std::shared_ptr<ClarisWksText> m_textParser;
//
// the callback
//
typedef void (MWAWParser::* NewPage)(int page, bool softBreak);
typedef void (MWAWParser::* SendFootnote)(int zoneId);
NewPage m_newPage;
SendFootnote m_sendFootnote;
private:
ClarisWksDocument(ClarisWksDocument const &orig) = delete;
ClarisWksDocument operator=(ClarisWksDocument const &orig) = delete;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
ClarisWksStruct.hxx
MWAWParser.hxx
MWAWPosition.hxx
ClarisWksBMParser
the main class to read a bitmap AppleWorks/ClarisWorks file
Definition ClarisWksBMParser.hxx:66
ClarisWksDatabase
the main class to read the text part of Claris Works file
Definition ClarisWksDatabase.hxx:72
ClarisWksDocumentInternal::SubDocument
Internal: the subdocument of a ClarisWksDocument.
Definition ClarisWksDocument.cxx:141
ClarisWksDocument::~ClarisWksDocument
~ClarisWksDocument()
virtual destructor
Definition ClarisWksDocument.cxx:215
ClarisWksDocument::m_presentationParser
std::shared_ptr< ClarisWksPresentation > m_presentationParser
the spreadsheet parser
Definition ClarisWksDocument.hxx:255
ClarisWksDocument::getTextParser
std::shared_ptr< ClarisWksText > getTextParser()
returns the text parser
Definition ClarisWksDocument.hxx:164
ClarisWksDocument::typeMainZonesRec
int typeMainZonesRec(int zId, ClarisWksStruct::DSET::Position type, int maxHeight)
try to type the main zones recursif, returns the father id
Definition ClarisWksDocument.cxx:2782
ClarisWksDocument::m_graphParser
std::shared_ptr< ClarisWksGraph > m_graphParser
the graph parser
Definition ClarisWksDocument.hxx:253
ClarisWksDocument::readBookmark
bool readBookmark(long endPos)
Definition ClarisWksDocument.cxx:1898
ClarisWksDocument::m_newPage
NewPage m_newPage
the new page callback
Definition ClarisWksDocument.hxx:273
ClarisWksDocument::readEndTable
bool readEndTable(long &eof)
reads the end table ( appears in v3.0 : file version ? )
Definition ClarisWksDocument.cxx:1460
ClarisWksDocument::m_spreadsheetParser
std::shared_ptr< ClarisWksSpreadsheet > m_spreadsheetParser
the spreadsheet parser
Definition ClarisWksDocument.hxx:257
ClarisWksDocument::ClarisWksPRParser
friend class ClarisWksPRParser
Definition ClarisWksDocument.hxx:78
ClarisWksDocument::getMainZonesList
std::vector< int > const & getMainZonesList() const
returns the list of the main zones
Definition ClarisWksDocument.cxx:410
ClarisWksDocument::getDatabaseParser
std::shared_ptr< ClarisWksDatabase > getDatabaseParser()
returns the database parser
Definition ClarisWksDocument.hxx:139
ClarisWksDocument::readCPRT
bool readCPRT(MWAWEntry const &entry)
Definition ClarisWksDocument.cxx:1566
ClarisWksDocument::m_tableParser
std::shared_ptr< ClarisWksTable > m_tableParser
the table parser
Definition ClarisWksDocument.hxx:259
ClarisWksDocument::cleanZonesGraph
void cleanZonesGraph()
remove uneeded edge (mainly header/footer edges in main graph)
Definition ClarisWksDocument.cxx:2806
ClarisWksDocument::readStructCellZone
bool readStructCellZone(char const *zoneName, bool hasEntete, std::vector< MWAWVec2i > &res)
try to read a structured zone list of cells
Definition ClarisWksDocument.cxx:2379
ClarisWksDocument::getTextHeight
double getTextHeight() const
returns the page height, ie. paper size less margin (in inches) less header/footer size
Definition ClarisWksDocument.cxx:312
ClarisWksDocument::getSpreadsheetParser
std::shared_ptr< ClarisWksSpreadsheet > getSpreadsheetParser()
returns the spreadsheet parser
Definition ClarisWksDocument.hxx:154
ClarisWksDocument::readEndMark
bool readEndMark(long endPos)
Definition ClarisWksDocument.cxx:1951
ClarisWksDocument::getPageLeftTop
MWAWVec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition ClarisWksDocument.cxx:317
ClarisWksDocument::getStyleManager
std::shared_ptr< ClarisWksStyleManager > getStyleManager()
returns the style manager
Definition ClarisWksDocument.hxx:134
ClarisWksDocument::forceParsed
void forceParsed(int zoneId)
indicates that a zone is parser
Definition ClarisWksDocument.cxx:2580
ClarisWksDocument::m_state
std::shared_ptr< ClarisWksDocumentInternal::State > m_state
the state
Definition ClarisWksDocument.hxx:239
ClarisWksDocument::m_parserState
std::shared_ptr< MWAWParserState > m_parserState
the parser state
Definition ClarisWksDocument.hxx:242
ClarisWksDocument::updatePageSpanList
void updatePageSpanList(std::vector< MWAWPageSpan > &spanList)
updates the page span list
Definition ClarisWksDocument.cxx:268
ClarisWksDocument::sendDatabasePictZone
bool sendDatabasePictZone(int pictId, MWAWListenerPtr listener=MWAWListenerPtr(), MWAWPosition const &pos=MWAWPosition())
try to send a database picture
Definition ClarisWksDocument.cxx:504
ClarisWksDocument::numPages
int numPages() const
returns the document number of page
Definition ClarisWksDocument.cxx:245
ClarisWksDocument::readDocumentMark
bool readDocumentMark(long endPos)
Definition ClarisWksDocument.cxx:1837
ClarisWksDocument::readDocHeader
bool readDocHeader()
reads the document header
Definition ClarisWksDocument.cxx:1083
ClarisWksDocument::getPresentationParser
std::shared_ptr< ClarisWksPresentation > getPresentationParser()
returns the presentation parser
Definition ClarisWksDocument.hxx:149
ClarisWksDocument::m_databaseParser
std::shared_ptr< ClarisWksDatabase > m_databaseParser
the database parser
Definition ClarisWksDocument.hxx:251
ClarisWksDocument::readDSET
std::shared_ptr< ClarisWksStruct::DSET > readDSET(bool &complete)
reads the zone DSET
Definition ClarisWksDocument.cxx:854
ClarisWksDocument::readSNAP
bool readSNAP(MWAWEntry const &entry)
Definition ClarisWksDocument.cxx:2253
ClarisWksDocument::ClarisWksSSParser
friend class ClarisWksSSParser
Definition ClarisWksDocument.hxx:79
ClarisWksDocument::readPrintInfo
bool readPrintInfo()
read the print info zone
Definition ClarisWksDocument.cxx:2309
ClarisWksDocument::m_parser
MWAWParser * m_parser
the main parser
Definition ClarisWksDocument.hxx:246
ClarisWksDocument::readDataLinkList
bool readDataLinkList()
try to read a structured zone list of picture definition: v5-v6
Definition ClarisWksDocument.cxx:2146
ClarisWksDocument::getDocumentMetaData
librevenge::RVNGPropertyList const & getDocumentMetaData() const
returns the document meta data
Definition ClarisWksDocument.cxx:263
ClarisWksDocument::readDSUM
bool readDSUM(MWAWEntry const &entry, bool inHeader)
Definition ClarisWksDocument.cxx:2038
ClarisWksDocument::SendFootnote
void(MWAWParser::* SendFootnote)(int zoneId)
callback used to send a footnote
Definition ClarisWksDocument.hxx:270
ClarisWksDocument::m_sendFootnote
SendFootnote m_sendFootnote
the send footnote callback
Definition ClarisWksDocument.hxx:275
ClarisWksDocument::ClarisWksParser
friend class ClarisWksParser
Definition ClarisWksDocument.hxx:76
ClarisWksDocument::canSendZoneAsGraphic
bool canSendZoneAsGraphic(int number) const
check if we can send a zone as a graphic
Definition ClarisWksDocument.cxx:423
ClarisWksDocument::readZone
bool readZone()
read a zone
Definition ClarisWksDocument.cxx:746
ClarisWksDocument::m_styleManager
std::shared_ptr< ClarisWksStyleManager > m_styleManager
the style manager
Definition ClarisWksDocument.hxx:248
ClarisWksDocument::m_textParser
std::shared_ptr< ClarisWksText > m_textParser
the text parser
Definition ClarisWksDocument.hxx:261
ClarisWksDocument::readDocInfo
bool readDocInfo()
reads the document info part ( end of the header)
Definition ClarisWksDocument.cxx:1010
ClarisWksDocument::ClarisWksBMParser
friend class ClarisWksBMParser
Definition ClarisWksDocument.hxx:77
ClarisWksDocument::exploreZonesGraph
bool exploreZonesGraph()
try to find the zone dags structure...
Definition ClarisWksDocument.cxx:2586
ClarisWksDocument::getMainSection
MWAWSection getMainSection() const
returns the main document section
Definition ClarisWksDocument.cxx:335
ClarisWksDocument::getZone
std::shared_ptr< ClarisWksStruct::DSET > getZone(int zId) const
return the zone corresponding to an id ( low level)
Definition ClarisWksDocument.cxx:415
ClarisWksDocument::readURL
bool readURL(long endPos)
Definition ClarisWksDocument.cxx:1782
ClarisWksDocument::createZones
bool createZones()
finds the different objects zones
Definition ClarisWksDocument.cxx:519
ClarisWksDocument::NewPage
void(MWAWParser::* NewPage)(int page, bool softBreak)
callback used to send a page break
Definition ClarisWksDocument.hxx:268
ClarisWksDocument::getTableParser
std::shared_ptr< ClarisWksTable > getTableParser()
returns the table parser
Definition ClarisWksDocument.hxx:159
ClarisWksDocument::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition ClarisWksDocument.cxx:642
ClarisWksDocument::ClarisWksDocument
ClarisWksDocument(MWAWParser &parser)
constructor
Definition ClarisWksDocument.cxx:191
ClarisWksDocument::sendZone
bool sendZone(int zoneId, MWAWListenerPtr listener=MWAWListenerPtr(), MWAWPosition pos=MWAWPosition())
try to send a zone
Definition ClarisWksDocument.cxx:453
ClarisWksDocument::exploreZonesGraphRec
bool exploreZonesGraphRec(int zId, std::set< int > &notDoneList)
try to find the zone tree graph ( DSF) function
Definition ClarisWksDocument.cxx:2653
ClarisWksDocument::getDocumentPages
MWAWVec2i getDocumentPages()
returns the number of expected pages ( accross pages x down page)
Definition ClarisWksDocument.cxx:222
ClarisWksDocument::typeMainZones
void typeMainZones()
try to type the main zones
Definition ClarisWksDocument.cxx:2701
ClarisWksDocument::operator=
ClarisWksDocument operator=(ClarisWksDocument const &orig)=delete
ClarisWksDocument::newPage
void newPage(int page, bool softBreak=false)
send a page break
Definition ClarisWksDocument.cxx:326
ClarisWksDocument::updateChildPositions
void updateChildPositions()
try to update the child page of each zone
Definition ClarisWksDocument.cxx:2524
ClarisWksDocument::getFinalPageSpan
MWAWPageSpan getFinalPageSpan() const
returns the final page span to use for the document
Definition ClarisWksDocument.cxx:297
ClarisWksDocument::readTNAM
bool readTNAM(MWAWEntry const &entry)
Definition ClarisWksDocument.cxx:1993
ClarisWksDocument::sendFootnote
void sendFootnote(int zoneId)
ask the main parser to create a document to send a footnote
Definition ClarisWksDocument.cxx:367
ClarisWksDocument::getGraphParser
std::shared_ptr< ClarisWksGraph > getGraphParser()
returns the graph parser
Definition ClarisWksDocument.hxx:144
ClarisWksDocument::ClarisWksDocument
ClarisWksDocument(ClarisWksDocument const &orig)=delete
ClarisWksDocument::readZoneA
bool readZoneA()
try to read a unknown zone which appear to be filled at least in some v2 database file
Definition ClarisWksDocument.cxx:2432
ClarisWksDocument::checkOrdering
void checkOrdering(std::vector< int16_t > &vec16, std::vector< int32_t > &vec32) const
small fonction used to check unusual endian ordering of a list of int16_t, int32_t
Definition ClarisWksDocument.cxx:376
ClarisWksDocument::readStringList
bool readStringList(char const *zoneName, bool hasEntete, std::vector< std::string > &res)
Definition ClarisWksDocument.cxx:2095
ClarisWksDocument::getMainParser
MWAWParser & getMainParser()
returns the main parser
Definition ClarisWksDocument.hxx:129
ClarisWksDocument::readMARKList
bool readMARKList(MWAWEntry const &entry)
Definition ClarisWksDocument.cxx:1619
ClarisWksGraph
the main class to read the graphic part of Claris Works file
Definition ClarisWksGraph.hxx:78
ClarisWksPRParser
the main class to create presentation Claris Works file
Definition ClarisWksPRParser.hxx:68
ClarisWksParser
the main class to read a Claris Works file
Definition ClarisWksParser.hxx:68
ClarisWksPresentation
the main class to read the text part of Claris Works file
Definition ClarisWksPresentation.hxx:71
ClarisWksSSParser
the main class to read a AppleWorks/ClarisWorks spreadsheet file
Definition ClarisWksSSParser.hxx:68
ClarisWksSpreadsheet
the main class to read the text part of Claris Works file
Definition ClarisWksSpreadsheet.hxx:71
ClarisWksStyleManager
a structure to store the style list and the lookup zone
Definition ClarisWksStyleManager.hxx:61
ClarisWksTable
the main class to read the text part of Claris Works file
Definition ClarisWksTable.hxx:70
ClarisWksText
the main class to read the text part of Claris Works file
Definition ClarisWksText.hxx:76
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
MWAWPageSpan
A class which defines the page properties.
Definition MWAWPageSpan.hxx:99
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_internal.hxx
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
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition libmwaw_internal.hxx:842
ClarisWksDocumentInternal
Internal: the structures of a ClarisWksDocument.
Definition ClarisWksDocument.cxx:68
ClarisWksDocumentInternal::State
Internal: the state of a ClarisWksDocument.
Definition ClarisWksDocument.cxx:71
ClarisWksStruct::DSET::Position
Position
the zone position
Definition ClarisWksStruct.hxx:91