LWParser.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 LW_PARSER
# define LW_PARSER
#include <string>
#include <vector>
#include <libwpd/libwpd.h>
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
namespace LWParserInternal
{
class SubDocument;
struct State;
}
class LWGraph;
class LWText;
class LWParser : public MWAWParser
{
friend class LWParserInternal::SubDocument;
friend class LWGraph;
friend class LWText;
public:
LWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
virtual ~LWParser();
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;
bool getColumnInfo(int &numCols, int &colSep) const;
void newPage(int number);
bool textInDataFork() const;
// interface with the graph parser
void sendGraphic(int graphId);
// interface with the text parser
bool sendHeaderFooter(bool header);
protected:
bool createZones();
bool readPrintInfo(MWAWEntry const &entry);
bool readDocInfo(MWAWEntry const &entry);
bool readDocument(MWAWEntry const &entry);
bool readLWSR2(MWAWEntry const &entry);
bool readMPSR5(MWAWEntry const &entry);
bool readTOCPage(MWAWEntry const &entry);
bool readTOC(MWAWEntry const &entry);
MWAWInputStreamPtr rsrcInput();
libmwaw::DebugFile &rsrcAscii();
//
// data
//
shared_ptr<LWParserInternal::State> m_state;
bool m_pageSpanSet;
shared_ptr<LWGraph> m_graphParser;
shared_ptr<LWText> m_textParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
LWGraph
the main class to read the graphic part of a LightWay Text file
Definition: LWGraph.hxx:63
LWParser::getPageLeftTop
Vec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: LWParser.cxx:166
MWAWHeader
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:47
LWParser::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: LWParser.cxx:148
LWParser::LWParser
LWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: LWParser.cxx:124
LWParser::m_state
shared_ptr< LWParserInternal::State > m_state
the state
Definition: LWParser.hxx:130
MWAWParser.hxx
LWParser::readDocument
bool readDocument(MWAWEntry const &entry)
read a Document, Header/Footer block (1000)
Definition: LWParser.cxx:619
LWParser::getColumnInfo
bool getColumnInfo(int &numCols, int &colSep) const
returns the number of column and the column separator (in point)
Definition: LWParser.cxx:175
LWParser::newPage
void newPage(int number)
adds a new page
Definition: LWParser.cxx:216
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
LWParser::init
void init()
inits all internal variables
Definition: LWParser.cxx:134
LWText
the main class to read the text part of LightWay Text file
Definition: LWText.hxx:57
LWParser::m_graphParser
shared_ptr< LWGraph > m_graphParser
the graph parser
Definition: LWParser.hxx:136
LWParser::parse
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: LWParser.cxx:232
LWParser::readLWSR2
bool readLWSR2(MWAWEntry const &entry)
read a LWSR block (1002)
Definition: LWParser.cxx:689
LWParser::readPrintInfo
bool readPrintInfo(MWAWEntry const &entry)
read a PrintInfo block
Definition: LWParser.cxx:444
LWParser::readTOCPage
bool readTOCPage(MWAWEntry const &entry)
read a TOC page block
Definition: LWParser.cxx:507
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:340
LWParserInternal::SubDocument
Internal: the subdocument of a LWParser.
Definition: LWParser.cxx:77
LWParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: LWParser.cxx:790
LWParser::~LWParser
virtual ~LWParser()
destructor
Definition: LWParser.cxx:130
LWParser
the main class to read a LightWay Text file
Definition: LWParser.hxx:58
LWParser::sendGraphic
void sendGraphic(int graphId)
ask the graph parser to send a graph
Definition: LWParser.cxx:202
LWParser::sendHeaderFooter
bool sendHeaderFooter(bool header)
try to send the header/footer
Definition: LWParser.cxx:187
LWParser::m_pageSpanSet
bool m_pageSpanSet
a flag to know if page span has been set
Definition: LWParser.hxx:133
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:336
LWParser::readMPSR5
bool readMPSR5(MWAWEntry const &entry)
read a MPSR block (1005)
Definition: LWParser.cxx:715
MWAWInputStream.hxx
MWAWDebug.hxx
LWParser::readTOC
bool readTOC(MWAWEntry const &entry)
read a TOC data block
Definition: LWParser.cxx:550
LWParser::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: LWParser.cxx:153
LWParser::textInDataFork
bool textInDataFork() const
returns true if the main text is in data fork
Definition: LWParser.cxx:158
LWParser::createDocument
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: LWParser.cxx:266
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:87
LWParser::m_textParser
shared_ptr< LWText > m_textParser
the text parser
Definition: LWParser.hxx:139
LWParser::createZones
bool createZones()
finds the different objects zones
Definition: LWParser.cxx:309
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
Vec2< float >
LWParser::readDocInfo
bool readDocInfo(MWAWEntry const &entry)
read a DocInfo block
Definition: LWParser.cxx:372