FullWrtParser.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 convert FullWrite document
*
*/
#ifndef FULL_WRT_PARSER
# define FULL_WRT_PARSER
#include <list>
#include <string>
#include <vector>
#include <librevenge/librevenge.h>
#include "MWAWInputStream.hxx"
#include "FullWrtStruct.hxx"
#include "MWAWParser.hxx"
namespace FullWrtParserInternal
{
struct State;
class SubDocument;
}
class FullWrtGraph;
class FullWrtText;
class FullWrtParser final : public MWAWTextParser
{
friend class FullWrtGraph;
friend class FullWrtText;
friend class FullWrtParserInternal::SubDocument;
public:
FullWrtParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
~FullWrtParser() final;
bool checkHeader(MWAWHeader *header, bool strict=false) final;
// the main parse function
void parse(librevenge::RVNGTextInterface *documentInterface) final;
protected:
void init();
void createDocument(librevenge::RVNGTextInterface *documentInterface);
bool createZones();
bool createFileZones();
void newPage(int number);
bool readDocPosition();
bool readFileZoneFlags(FullWrtStruct::EntryPtr zone);
bool readFileZonePos(FullWrtStruct::EntryPtr zone);
bool readDocZoneData(FullWrtStruct::EntryPtr zone);
bool readDocZoneStruct(FullWrtStruct::EntryPtr zone);
bool readDocInfo(FullWrtStruct::EntryPtr zone);
bool readEndDocInfo(FullWrtStruct::EntryPtr zone);
bool readCitationDocInfo(FullWrtStruct::EntryPtr zone);
bool readPrintInfo(FullWrtStruct::EntryPtr zone);
//
// interface to the graph parser
//
MWAWVec2f getPageLeftTop() const;
bool getBorder(int bId, FullWrtStruct::Border &border) const;
//
// interface to the text parser
//
void sendText(int docId, libmwaw::SubDocumentType type, MWAWNote::Type which=MWAWNote::FootNote);
void sendGraphic(int docId);
void sendVariable(int docId);
void sendReference(int docId);
bool send(int fileId, MWAWColor fontColor=MWAWColor::black());
//
// interface ( mainly debugging function)
//
int getNumDocZoneStruct() const;
std::string getDocumentTypeName(int zId) const;
//
// low level
//
bool readReferenceData(FullWrtStruct::EntryPtr zone);
bool readGenericDocData(FullWrtStruct::EntryPtr zone, FullWrtStruct::ZoneHeader &doc);
protected:
//
// data
//
std::shared_ptr<FullWrtParserInternal::State> m_state;
std::shared_ptr<FullWrtGraph> m_graphParser;
std::shared_ptr<FullWrtText> m_textParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
FullWrtStruct.hxx
MWAWInputStream.hxx
MWAWParser.hxx
FullWrtGraph
the main class to read the graphic part of a FullWrite Text file
Definition FullWrtGraph.hxx:68
FullWrtParserInternal::SubDocument
Internal: the subdocument of a FullWrtParser.
Definition FullWrtParser.cxx:255
FullWrtParser::sendVariable
void sendVariable(int docId)
try to send a variable, in pratice do nothing
Definition FullWrtParser.cxx:1959
FullWrtParser::readDocPosition
bool readDocPosition()
find the last position of the document and read data
Definition FullWrtParser.cxx:1856
FullWrtParser::sendReference
void sendReference(int docId)
try to send a reference, in pratice do nothing
Definition FullWrtParser.cxx:1929
FullWrtParser::~FullWrtParser
~FullWrtParser() final
destructor
Definition FullWrtParser.cxx:312
FullWrtParser::getNumDocZoneStruct
int getNumDocZoneStruct() const
returns the number of zone struct
Definition FullWrtParser.cxx:361
FullWrtParser::readFileZoneFlags
bool readFileZoneFlags(FullWrtStruct::EntryPtr zone)
try to read the file zones main flags
Definition FullWrtParser.cxx:1624
FullWrtParser::parse
void parse(librevenge::RVNGTextInterface *documentInterface) final
virtual function used to parse the input
Definition FullWrtParser.cxx:399
FullWrtParser::FullWrtParser
FullWrtParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition FullWrtParser.cxx:303
FullWrtParser::sendGraphic
void sendGraphic(int docId)
try to send a graphic
Definition FullWrtParser.cxx:373
FullWrtParser::createZones
bool createZones()
finds the different objects zones
Definition FullWrtParser.cxx:572
FullWrtParser::readReferenceData
bool readReferenceData(FullWrtStruct::EntryPtr zone)
try to read the reference data
Definition FullWrtParser.cxx:1560
FullWrtParser::sendText
void sendText(int docId, libmwaw::SubDocumentType type, MWAWNote::Type which=MWAWNote::FootNote)
try to send a footnote/endnote entry
Definition FullWrtParser.cxx:2002
FullWrtParser::readGenericDocData
bool readGenericDocData(FullWrtStruct::EntryPtr zone, FullWrtStruct::ZoneHeader &doc)
try to read the data of a zone which begins with a generic header
Definition FullWrtParser.cxx:1458
FullWrtParser::createFileZones
bool createFileZones()
create the file zone ( first step of create zones)
Definition FullWrtParser.cxx:540
FullWrtParser::m_graphParser
std::shared_ptr< FullWrtGraph > m_graphParser
the graph parser
Definition FullWrtParser.hxx:177
FullWrtParser::FullWrtGraph
friend class FullWrtGraph
Definition FullWrtParser.hxx:68
FullWrtParser::getPageLeftTop
MWAWVec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition FullWrtParser.cxx:350
FullWrtParser::readPrintInfo
bool readPrintInfo(FullWrtStruct::EntryPtr zone)
try read the print info zone
Definition FullWrtParser.cxx:1050
FullWrtParser::createDocument
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition FullWrtParser.cxx:470
FullWrtParser::readDocZoneStruct
bool readDocZoneStruct(FullWrtStruct::EntryPtr zone)
try to read the zone which stores the structure of zone0, ... (ie. Zone1)
Definition FullWrtParser.cxx:1314
FullWrtParser::getBorder
bool getBorder(int bId, FullWrtStruct::Border &border) const
try to return a border corresponding to an id
Definition FullWrtParser.cxx:356
FullWrtParser::getDocumentTypeName
std::string getDocumentTypeName(int zId) const
returns a the type of a document zone ( mainly used for debugging)
Definition FullWrtParser.cxx:366
FullWrtParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition FullWrtParser.cxx:660
FullWrtParser::readDocInfo
bool readDocInfo(FullWrtStruct::EntryPtr zone)
try to read zone2, a zone which stores the document information zone, ...
Definition FullWrtParser.cxx:686
FullWrtParser::send
bool send(int fileId, MWAWColor fontColor=MWAWColor::black())
ask the text parser to send a zone
Definition FullWrtParser.cxx:387
FullWrtParser::m_textParser
std::shared_ptr< FullWrtText > m_textParser
the text parser
Definition FullWrtParser.hxx:179
FullWrtParser::readDocZoneData
bool readDocZoneData(FullWrtStruct::EntryPtr zone)
try to read the zone containing the data of each doc zone (ie. Zone0)
Definition FullWrtParser.cxx:1124
FullWrtParser::newPage
void newPage(int number)
adds a new page
Definition FullWrtParser.cxx:337
FullWrtParser::FullWrtText
friend class FullWrtText
Definition FullWrtParser.hxx:69
FullWrtParser::init
void init()
inits all internal variables
Definition FullWrtParser.cxx:320
FullWrtParser::readCitationDocInfo
bool readCitationDocInfo(FullWrtStruct::EntryPtr zone)
try to read the list of citation (at the end of doc info)
Definition FullWrtParser.cxx:985
FullWrtParser::readFileZonePos
bool readFileZonePos(FullWrtStruct::EntryPtr zone)
try to read the file zones position
Definition FullWrtParser.cxx:1721
FullWrtParser::readEndDocInfo
bool readEndDocInfo(FullWrtStruct::EntryPtr zone)
try to read the end of zone2 (only v2) ?
Definition FullWrtParser.cxx:928
FullWrtParser::m_state
std::shared_ptr< FullWrtParserInternal::State > m_state
the state
Definition FullWrtParser.hxx:174
FullWrtText
the main class to read the text part of writenow file
Definition FullWrtText.hxx:67
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition MWAWHeader.hxx:57
MWAWTextParser::MWAWTextParser
MWAWTextParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor (protected)
Definition MWAWParser.hxx:307
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition libmwaw_internal.hxx:561
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition libmwaw_internal.hxx:842
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
FullWrtParserInternal
Internal: the structures of a FullWrtParser.
Definition FullWrtParser.cxx:62
FullWrtStruct
a namespace use to define common structure in a FullWrite file
Definition FullWrtStruct.cxx:44
libmwaw
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition libmwaw_internal.cxx:51
librevenge
Definition MWAWDocument.hxx:57
FullWrtParserInternal::State
Internal: the state of a FullWrtParser.
Definition FullWrtParser.cxx:163
MWAWColor
the class to store a color
Definition libmwaw_internal.hxx:192
MWAWNote
a note
Definition libmwaw_internal.hxx:445