NSParser.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 NS_PARSER
# define NS_PARSER
#include <string>
#include <vector>
#include <libwpd/libwpd.h>
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "NSStruct.hxx"
#include "MWAWParser.hxx"
namespace NSParserInternal
{
struct State;
}
class NSGraph;
class NSText;
class NSParser : public MWAWParser
{
friend struct NSStruct::RecursifData;
friend class NSGraph;
friend class NSText;
public:
NSParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
virtual ~NSParser();
bool checkHeader(MWAWHeader *header, bool strict=false);
// the main parse function
void parse(WPXDocumentInterface *documentInterface);
protected:
void init();
void createDocument(WPXDocumentInterface *documentInterface);
Vec2f getPageLeftTop() const;
void getColumnInfo(int &numColumns, float &colSep) const;
void getFootnoteInfo(NSStruct::FootnoteInfo &fInfo) const;
void newPage(int number);
// variable access
std::string getDateFormat(NSStruct::ZoneType zoneId, int vId) const;
bool getReferenceData(NSStruct::ZoneType zoneId, int vId,
MWAWField::Type &fType,
std::string &content,
std::vector<int> &number) const;
// interface with the graph parser
bool sendPicture(int pictId, MWAWPosition const &pictPos,
WPXPropertyList extras = WPXPropertyList());
protected:
bool createZones();
bool readPrintInfo(MWAWEntry const &entry);
bool readCPRC(MWAWEntry const &entry);
bool readPageLimit(MWAWEntry const &entry);
bool readStringsList(MWAWEntry const &entry, std::vector<std::string> &list, bool simpleList);
bool readINFO(MWAWEntry const &entry);
bool readReference(NSStruct::RecursifData const &data);
bool readVariable(NSStruct::RecursifData const &data);
bool readCNTR(MWAWEntry const &entry, int zoneId);
bool readNumberingReset(MWAWEntry const &entry, int zoneId);
bool readSGP1(NSStruct::RecursifData const &data);
bool readABBR(MWAWEntry const &entry);
bool readFTA2(MWAWEntry const &entry);
bool readFnSc(MWAWEntry const &entry);
MWAWInputStreamPtr rsrcInput();
libmwaw::DebugFile &rsrcAscii();
//
// data
//
shared_ptr<NSParserInternal::State> m_state;
shared_ptr<NSGraph> m_graphParser;
shared_ptr<NSText> m_textParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
NSParser::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: NSParser.cxx:339
MWAWHeader
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:47
NSParser::m_graphParser
shared_ptr< NSGraph > m_graphParser
the graph parser
Definition: NSParser.hxx:158
NSParser::getColumnInfo
void getColumnInfo(int &numColumns, float &colSep) const
returns the columns information
Definition: NSParser.cxx:353
NSParser::getReferenceData
bool getReferenceData(NSStruct::ZoneType zoneId, int vId, MWAWField::Type &fType, std::string &content, std::vector< int > &number) const
returns the fieldtype or a string corresponding to a variable
Definition: NSParser.cxx:398
NSParser::readStringsList
bool readStringsList(MWAWEntry const &entry, std::vector< std::string > &list, bool simpleList)
read a list of strings
Definition: NSParser.cxx:817
NSParser::readVariable
bool readVariable(NSStruct::RecursifData const &data)
parse the DSPL/VARI/VRS resource: numbering definition, variable or variable ?
Definition: NSParser.cxx:899
NSParser::getPageLeftTop
Vec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: NSParser.cxx:347
MWAWParser.hxx
NSParser::readReference
bool readReference(NSStruct::RecursifData const &data)
parse the MRK7 resource
Definition: NSParser.cxx:1215
NSParser::newPage
void newPage(int number)
adds a new page
Definition: NSParser.cxx:483
libmwaw::DebugFile
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:67
NSParser::parse
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: NSParser.cxx:499
NSParser::readNumberingReset
bool readNumberingReset(MWAWEntry const &entry, int zoneId)
parse the DPND resource: numbering reset ( one by zone ) : related to CNTR and VRS ...
Definition: NSParser.cxx:1177
NSParser::readSGP1
bool readSGP1(NSStruct::RecursifData const &data)
parse the SGP1 resource: a unknown resource
Definition: NSParser.cxx:1411
NSStruct::ZoneType
ZoneType
the different zone
Definition: NSStruct.hxx:50
NSParser::getFootnoteInfo
void getFootnoteInfo(NSStruct::FootnoteInfo &fInfo) const
returns the footnote information
Definition: NSParser.cxx:359
NSParser::readPrintInfo
bool readPrintInfo(MWAWEntry const &entry)
read the print info zone ( id=128 )
Definition: NSParser.cxx:1552
NSParser::readFnSc
bool readFnSc(MWAWEntry const &entry)
parse the FnSc resource: a unknown resource, find in v6 document
Definition: NSParser.cxx:2002
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:340
NSParser::readCNTR
bool readCNTR(MWAWEntry const &entry, int zoneId)
read the CNTR resource: a list of version controler ?
Definition: NSParser.cxx:1860
NSStruct::FootnoteInfo
Internal: low level a structure helping to store the footnote information.
Definition: NSStruct.hxx:101
NSParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: NSParser.cxx:772
NSParser::m_textParser
shared_ptr< NSText > m_textParser
the text parser
Definition: NSParser.hxx:161
NSParser::readABBR
bool readABBR(MWAWEntry const &entry)
parse the ABBR resource: a list of abreviation?
Definition: NSParser.cxx:1902
NSParser::init
void init()
inits all internal variables
Definition: NSParser.cxx:320
NSParser::createZones
bool createZones()
finds the different objects zones
Definition: NSParser.cxx:588
NSParser::m_state
shared_ptr< NSParserInternal::State > m_state
the state
Definition: NSParser.hxx:155
NSParser
the main class to read a Nisus Writer file
Definition: NSParser.hxx:59
NSStruct.hxx
NSParser::NSParser
NSParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: NSParser.cxx:310
NSGraph
the main class to read the graphic part of a Nisus file
Definition: NSGraph.hxx:67
NSParser::readINFO
bool readINFO(MWAWEntry const &entry)
read the INFO info zone, an unknown zone of size 0x23a: to doo
Definition: NSParser.cxx:2039
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:336
NSParser::readFTA2
bool readFTA2(MWAWEntry const &entry)
parse the FTA2 resource: a list of ? find in v6 document
Definition: NSParser.cxx:1953
MWAWInputStream.hxx
MWAWDebug.hxx
NSText
the main class to read the text part of Nisus file
Definition: NSText.hxx:60
NSParser::sendPicture
bool sendPicture(int pictId, MWAWPosition const &pictPos, WPXPropertyList extras=WPXPropertyList())
try to send a picture
Definition: NSParser.cxx:367
NSParser::readCPRC
bool readCPRC(MWAWEntry const &entry)
read the CPRC info zone ( id=128 ), an unknown zone
Definition: NSParser.cxx:1822
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:87
NSParser::createDocument
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: NSParser.cxx:533
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
MWAWField::Type
Type
Defines some basic type for field.
Definition: libmwaw_internal.hxx:283
NSParser::getDateFormat
std::string getDateFormat(NSStruct::ZoneType zoneId, int vId) const
returns the date format corresponding to a variable id or ""
Definition: NSParser.cxx:379
NSParser::readPageLimit
bool readPageLimit(MWAWEntry const &entry)
read the PGLY info zone ( id=128 )
Definition: NSParser.cxx:1619
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
Vec2< float >
NSStruct::RecursifData
Internal: low level a structure helping to read recursifList.
Definition: NSStruct.hxx:130
NSParser::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: NSParser.cxx:334
NSParser::~NSParser
virtual ~NSParser()
destructor
Definition: NSParser.cxx:316