FWParser.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 FP_MWAW_PARSER
# define FP_MWAW_PARSER
#include <list>
#include <string>
#include <vector>
#include <libwpd/libwpd.h>
#include "MWAWInputStream.hxx"
#include "FWStruct.hxx"
#include "MWAWParser.hxx"
namespace FWParserInternal
{
struct State;
class SubDocument;
}
class FWGraph;
class FWText;
class FWParser : public MWAWParser
{
friend class FWGraph;
friend class FWText;
friend class FWParserInternal::SubDocument;
public:
FWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
virtual ~FWParser();
bool checkHeader(MWAWHeader *header, bool strict=false);
// the main parse function
void parse(WPXDocumentInterface *documentInterface);
protected:
void init();
void createDocument(WPXDocumentInterface *documentInterface);
bool createZones();
bool createFileZones();
void newPage(int number);
bool readDocPosition();
bool readFileZoneFlags(FWStruct::EntryPtr zone);
bool readFileZonePos(FWStruct::EntryPtr zone);
bool readDocZoneData(FWStruct::EntryPtr zone);
bool readDocZoneStruct(FWStruct::EntryPtr zone);
bool readDocInfo(FWStruct::EntryPtr zone);
bool readEndDocInfo(FWStruct::EntryPtr zone);
bool readCitationDocInfo(FWStruct::EntryPtr zone);
bool readPrintInfo(FWStruct::EntryPtr zone);
//
// interface to the graph parser
//
Vec2f getPageLeftTop() const;
bool getBorder(int bId, FWStruct::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);
//
// interface ( mainly debugging function)
//
int getNumDocZoneStruct() const;
std::string getDocumentTypeName(int zId) const;
//
// low level
//
bool readReferenceData(FWStruct::EntryPtr zone);
bool readGenericDocData(FWStruct::EntryPtr zone, FWStruct::ZoneHeader &doc);
protected:
//
// data
//
shared_ptr<FWParserInternal::State> m_state;
shared_ptr<FWGraph> m_graphParser;
shared_ptr<FWText> m_textParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
FWParser::getPageLeftTop
Vec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: FWParser.cxx:313
MWAWHeader
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:47
FWStruct::EntryPtr
shared_ptr< Entry > EntryPtr
Definition: FWStruct.hxx:135
FWGraph
the main class to read the graphic part of a FullWrite Text file
Definition: FWGraph.hxx:67
FWParser::createFileZones
bool createFileZones()
create the file zone ( first step of create zones)
Definition: FWParser.cxx:465
FWParser::getNumDocZoneStruct
int getNumDocZoneStruct() const
returns the number of zone struct
Definition: FWParser.cxx:324
FWParser
the main class to read a FullWrite file
Definition: FWParser.hxx:66
FWParser::readCitationDocInfo
bool readCitationDocInfo(FWStruct::EntryPtr zone)
try to read the list of citation (at the end of doc info)
Definition: FWParser.cxx:906
FWParser::readDocZoneData
bool readDocZoneData(FWStruct::EntryPtr zone)
try to read the zone containing the data of each doc zone (ie. Zone0)
Definition: FWParser.cxx:1048
MWAWParser.hxx
FWStruct.hxx
FWParser::readDocInfo
bool readDocInfo(FWStruct::EntryPtr zone)
try to read zone2, a zone which stores the document information zone, ...
Definition: FWParser.cxx:610
FWStruct::ZoneHeader
a structure used to store the data of a zone header in a FullWrite file
Definition: FWStruct.hxx:138
FWParser::readEndDocInfo
bool readEndDocInfo(FWStruct::EntryPtr zone)
try to read the end of zone2 (only v2) ?
Definition: FWParser.cxx:849
FWParser::createZones
bool createZones()
finds the different objects zones
Definition: FWParser.cxx:498
libmwaw::SubDocumentType
SubDocumentType
Definition: libmwaw_internal.hxx:157
FWParser::sendGraphic
void sendGraphic(int docId)
try to send a graphic
Definition: FWParser.cxx:336
FWParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: FWParser.cxx:584
MWAWNote::Type
Type
enum to define note type
Definition: libmwaw_internal.hxx:301
FWParserInternal::SubDocument
Internal: the subdocument of a MWParser.
Definition: FWParser.cxx:220
FWParser::sendVariable
void sendVariable(int docId)
try to send a variable, in pratice do nothing
Definition: FWParser.cxx:1879
FWParser::m_textParser
shared_ptr< FWText > m_textParser
the text parser
Definition: FWParser.hxx:179
FWParser::readDocPosition
bool readDocPosition()
find the last position of the document and read data
Definition: FWParser.cxx:1777
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:340
FWParser::init
void init()
inits all internal variables
Definition: FWParser.cxx:283
FWParser::sendReference
void sendReference(int docId)
try to send a reference, in pratice do nothing
Definition: FWParser.cxx:1849
FWParser::m_state
shared_ptr< FWParserInternal::State > m_state
the state
Definition: FWParser.hxx:174
FWParser::readGenericDocData
bool readGenericDocData(FWStruct::EntryPtr zone, FWStruct::ZoneHeader &doc)
try to read the data of a zone which begins with a generic header
Definition: FWParser.cxx:1382
FWParser::sendText
void sendText(int docId, libmwaw::SubDocumentType type, MWAWNote::Type which=MWAWNote::FootNote)
try to send a footnote/endnote entry
Definition: FWParser.cxx:1922
FWParser::readPrintInfo
bool readPrintInfo(FWStruct::EntryPtr zone)
try read the print info zone
Definition: FWParser.cxx:971
FWParser::readFileZoneFlags
bool readFileZoneFlags(FWStruct::EntryPtr zone)
try to read the file zones main flags
Definition: FWParser.cxx:1545
FWParser::readDocZoneStruct
bool readDocZoneStruct(FWStruct::EntryPtr zone)
try to read the zone which stores the structure of zone0, ... (ie. Zone1)
Definition: FWParser.cxx:1238
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:336
FWText
the main class to read the text part of writenow file
Definition: FWText.hxx:66
MWAWInputStream.hxx
MWAWNote::FootNote
Definition: libmwaw_internal.hxx:301
FWParser::~FWParser
virtual ~FWParser()
destructor
Definition: FWParser.cxx:274
FWStruct::Border
Internal: class to store a border which appear in docInfo.
Definition: FWStruct.hxx:60
FWParser::readFileZonePos
bool readFileZonePos(FWStruct::EntryPtr zone)
try to read the file zones position
Definition: FWParser.cxx:1641
FWParser::send
bool send(int fileId)
ask the text parser to send a zone
Definition: FWParser.cxx:350
FWParser::m_graphParser
shared_ptr< FWGraph > m_graphParser
the graph parser
Definition: FWParser.hxx:177
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:87
FWParser::parse
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: FWParser.cxx:362
Vec2< float >
FWParser::getBorder
bool getBorder(int bId, FWStruct::Border &border) const
try to return a border corresponding to an id
Definition: FWParser.cxx:319
FWParser::newPage
void newPage(int number)
adds a new page
Definition: FWParser.cxx:300
FWParser::FWParser
FWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: FWParser.cxx:268
FWParser::getDocumentTypeName
std::string getDocumentTypeName(int zId) const
returns a the type of a document zone ( mainly used for debugging)
Definition: FWParser.cxx:329
FWParser::readReferenceData
bool readReferenceData(FWStruct::EntryPtr zone)
try to read the reference data
Definition: FWParser.cxx:1481
FWParser::createDocument
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: FWParser.cxx:434