MORParser.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 MOR_PARSER
# define MOR_PARSER
#include <string>
#include <vector>
#include <libwpd/libwpd.h>
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
namespace MORParserInternal
{
class SubDocument;
struct State;
}
class MORText;
namespace MORStruct
{
struct Pattern {
Pattern() : m_frontColor(MWAWColor::black()), m_backColor(MWAWColor::white()) {
for (int i=0; i<8; i++) m_pattern[i]=0;
}
friend std::ostream &operator<<(std::ostream &o, Pattern const &pat);
unsigned char m_pattern[8];
MWAWColor m_frontColor;
MWAWColor m_backColor;
};
}
class MORParser : public MWAWParser
{
friend class MORParserInternal::SubDocument;
friend class MORText;
public:
MORParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
virtual ~MORParser();
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 newPage(int number);
bool getColor(int id, MWAWColor &col) const;
// interface with the text parser
protected:
bool createZones();
bool readZonesList();
bool readPrintInfo(MWAWEntry const &entry);
bool readDocumentInfo(MWAWEntry const &entry);
bool readSlideList(MWAWEntry const &entry);
bool readSlide(MWAWEntry const &entry);
bool readGraphic(MWAWEntry const &entry);
bool readUnknown9(MWAWEntry const &entry);
bool readColors(long endPos);
bool readPattern(long endPos, MORStruct::Pattern &pattern);
bool readBackside(long endPos, std::string &extra);
bool readFreePos(MWAWEntry const &entry);
bool readUnkn9Sub(long endPos);
//
// low level
//
bool checkAndStore(MWAWEntry const &entry);
bool checkAndFindSize(MWAWEntry &entry);
MWAWInputStreamPtr rsrcInput();
libmwaw::DebugFile &rsrcAscii();
//
// data
//
shared_ptr<MORParserInternal::State> m_state;
shared_ptr<MORText> m_textParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MORParser::readUnknown9
bool readUnknown9(MWAWEntry const &entry)
read a unknown zone ( block 9 )
Definition: MORParser.cxx:957
MWAWHeader
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:47
MORParser::readFreePos
bool readFreePos(MWAWEntry const &entry)
read the list of free file position
Definition: MORParser.cxx:627
MORParser::checkAndFindSize
bool checkAndFindSize(MWAWEntry &entry)
check if the entry is valid defined by the begin pos points to a zone: dataSz data ...
Definition: MORParser.cxx:199
MORStruct::Pattern::m_frontColor
MWAWColor m_frontColor
the front color
Definition: MORParser.hxx:69
MORStruct::Pattern
Definition: MORParser.hxx:59
MORParser::parse
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: MORParser.cxx:247
MWAWParser.hxx
MORParser::checkAndStore
bool checkAndStore(MWAWEntry const &entry)
check if the entry is valid, if so store it in the list of entry
Definition: MORParser.cxx:185
MORParser
the main class to read a More file
Definition: MORParser.hxx:77
MORParser::readPrintInfo
bool readPrintInfo(MWAWEntry const &entry)
read a PrintInfo zone ( first block )
Definition: MORParser.cxx:459
MORStruct::Pattern::m_backColor
MWAWColor m_backColor
the back color
Definition: MORParser.hxx:71
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
MORParser::m_textParser
shared_ptr< MORText > m_textParser
the text parser
Definition: MORParser.hxx:173
MORParser::readPattern
bool readPattern(long endPos, MORStruct::Pattern &pattern)
read a pattern ( some sub zone of block 9)
Definition: MORParser.cxx:1136
MORParser::getColor
bool getColor(int id, MWAWColor &col) const
return the color which corresponds to an id (if possible)
Definition: MORParser.cxx:231
MORParser::readSlide
bool readSlide(MWAWEntry const &entry)
read a slide definitions
Definition: MORParser.cxx:818
MORParser::getPageLeftTop
Vec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: MORParser.cxx:179
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:161
MORParser::createDocument
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MORParser.cxx:276
MORParser::init
void init()
inits all internal variables
Definition: MORParser.cxx:153
MORParser::readGraphic
bool readGraphic(MWAWEntry const &entry)
read a graphic ( in a slide )
Definition: MORParser.cxx:903
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:340
MORParser::readColors
bool readColors(long endPos)
read a color zone ( beginning of block 9 )
Definition: MORParser.cxx:1044
MORParserInternal::SubDocument
Internal: the subdocument of a MORParser.
Definition: MORParser.cxx:100
MORStruct::Pattern::operator<<
friend std::ostream & operator<<(std::ostream &o, Pattern const &pat)
operator<<
Definition: MORParser.cxx:1271
MORParser::readBackside
bool readBackside(long endPos, std::string &extra)
read a backside ( some sub zone of block 9)
Definition: MORParser.cxx:1086
MORParser::~MORParser
virtual ~MORParser()
destructor
Definition: MORParser.cxx:149
MORParser::readSlideList
bool readSlideList(MWAWEntry const &entry)
read the list of slide definitions
Definition: MORParser.cxx:758
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:336
MWAWInputStream.hxx
MWAWDebug.hxx
MORParser::readDocumentInfo
bool readDocumentInfo(MWAWEntry const &entry)
read a docinfo zone ( second block )
Definition: MORParser.cxx:512
MORStruct::Pattern::Pattern
Pattern()
constructor
Definition: MORParser.hxx:61
MORParser::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: MORParser.cxx:171
MORText
the main class to read the text part of More Text file
Definition: MORText.hxx:64
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:87
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
MORParser::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: MORParser.cxx:166
MORParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: MORParser.cxx:704
Vec2< float >
MORParser::createZones
bool createZones()
finds the different objects zones
Definition: MORParser.cxx:320
MORParser::m_state
shared_ptr< MORParserInternal::State > m_state
the state
Definition: MORParser.hxx:170
MORParser::MORParser
MORParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: MORParser.cxx:143
MORParser::readUnkn9Sub
bool readUnkn9Sub(long endPos)
read the last subzone find in a block 9 ( unknown meaning)
Definition: MORParser.cxx:1165
MORParser::newPage
void newPage(int number)
adds a new page
Definition: MORParser.cxx:218
MORParser::readZonesList
bool readZonesList()
read the list of zones ( v2-3) : first 0x80 bytes
Definition: MORParser.cxx:391
MORStruct::Pattern::m_pattern
unsigned char m_pattern[8]
the pattern
Definition: MORParser.hxx:67