MoreParser.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 MORE_PARSER
# define MORE_PARSER
#include <string>
#include <vector>
#include <librevenge/librevenge.h>
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
namespace MoreParserInternal
{
class SubDocument;
struct State;
}
class MoreText;
namespace MoreStruct
{
struct Pattern {
Pattern()
: m_frontColor(MWAWColor::black())
, m_backColor(MWAWColor::white())
{
for (auto &val : m_pattern) val=0;
}
friend std::ostream &operator<<(std::ostream &o, Pattern const &pat);
unsigned char m_pattern[8];
MWAWColor m_frontColor;
MWAWColor m_backColor;
};
}
class MoreParser final : public MWAWTextParser
{
friend class MoreParserInternal::SubDocument;
friend class MoreText;
public:
MoreParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
~MoreParser() 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);
MWAWVec2f 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, MoreStruct::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
//
std::shared_ptr<MoreParserInternal::State> m_state;
std::shared_ptr<MoreText> m_textParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWInputStream.hxx
MWAWParser.hxx
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
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
MoreParserInternal::SubDocument
Internal: the subdocument of a MoreParser.
Definition MoreParser.cxx:104
MoreParser::init
void init()
inits all internal variables
Definition MoreParser.cxx:155
MoreParser::readPrintInfo
bool readPrintInfo(MWAWEntry const &entry)
read a PrintInfo zone ( first block )
Definition MoreParser.cxx:458
MoreParser::readZonesList
bool readZonesList()
read the list of zones ( v2-3) : first 0x80 bytes
Definition MoreParser.cxx:390
MoreParser::readUnkn9Sub
bool readUnkn9Sub(long endPos)
read the last subzone find in a block 9 ( unknown meaning)
Definition MoreParser.cxx:1173
MoreParser::getColor
bool getColor(int id, MWAWColor &col) const
return the color which corresponds to an id (if possible)
Definition MoreParser.cxx:233
MoreParser::readBackside
bool readBackside(long endPos, std::string &extra)
read a backside ( some sub zone of block 9)
Definition MoreParser.cxx:1101
MoreParser::readFreePos
bool readFreePos(MWAWEntry const &entry)
read the list of free file position
Definition MoreParser.cxx:626
MoreParser::checkAndStore
bool checkAndStore(MWAWEntry const &entry)
check if the entry is valid, if so store it in the list of entry
Definition MoreParser.cxx:187
MoreParser::MoreParser
MoreParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition MoreParser.cxx:143
MoreParser::m_textParser
std::shared_ptr< MoreText > m_textParser
the text parser
Definition MoreParser.hxx:176
MoreParser::readUnknown9
bool readUnknown9(MWAWEntry const &entry)
read a unknown zone ( block 9 )
Definition MoreParser.cxx:973
MoreParser::readDocumentInfo
bool readDocumentInfo(MWAWEntry const &entry)
read a docinfo zone ( second block )
Definition MoreParser.cxx:511
MoreParser::m_state
std::shared_ptr< MoreParserInternal::State > m_state
the state
Definition MoreParser.hxx:173
MoreParser::readColors
bool readColors(long endPos)
read a color zone ( beginning of block 9 )
Definition MoreParser.cxx:1060
MoreParser::createDocument
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition MoreParser.cxx:278
MoreParser::getPageLeftTop
MWAWVec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition MoreParser.cxx:181
MoreParser::parse
void parse(librevenge::RVNGTextInterface *documentInterface) final
virtual function used to parse the input
Definition MoreParser.cxx:249
MoreParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition MoreParser.cxx:719
MoreParser::readSlide
bool readSlide(MWAWEntry const &entry)
read a slide definitions
Definition MoreParser.cxx:834
MoreParser::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition MoreParser.cxx:168
MoreParser::checkAndFindSize
bool checkAndFindSize(MWAWEntry &entry)
check if the entry is valid defined by the begin pos points to a zone: dataSz data
Definition MoreParser.cxx:201
MoreParser::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition MoreParser.cxx:173
MoreParser::readSlideList
bool readSlideList(MWAWEntry const &entry)
read the list of slide definitions
Definition MoreParser.cxx:773
MoreParser::readGraphic
bool readGraphic(MWAWEntry const &entry)
read a graphic ( in a slide )
Definition MoreParser.cxx:919
MoreParser::createZones
bool createZones()
finds the different objects zones
Definition MoreParser.cxx:322
MoreParser::readPattern
bool readPattern(long endPos, MoreStruct::Pattern &pattern)
read a pattern ( some sub zone of block 9)
Definition MoreParser.cxx:1147
MoreParser::MoreText
friend class MoreText
Definition MoreParser.hxx:83
MoreParser::~MoreParser
~MoreParser() final
destructor
Definition MoreParser.cxx:151
MoreParser::newPage
void newPage(int number)
adds a new page
Definition MoreParser.cxx:220
MoreText
the main class to read the text part of More Text file
Definition MoreText.hxx:65
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
MoreParserInternal
Internal: the structures of a MoreParser.
Definition MoreParser.cxx:59
MoreStruct
a namespace used to define basic structures in a More file
Definition MoreParser.cxx:1278
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
MWAWColor
the class to store a color
Definition libmwaw_internal.hxx:192
MoreParserInternal::State
Internal: the state of a MoreParser.
Definition MoreParser.cxx:62
MoreStruct::Pattern
Definition MoreParser.hxx:59
MoreStruct::Pattern::m_pattern
unsigned char m_pattern[8]
the pattern
Definition MoreParser.hxx:70
MoreStruct::Pattern::operator<<
friend std::ostream & operator<<(std::ostream &o, Pattern const &pat)
operator<<
Definition MoreParser.cxx:1279
MoreStruct::Pattern::m_frontColor
MWAWColor m_frontColor
the front color
Definition MoreParser.hxx:72
MoreStruct::Pattern::Pattern
Pattern()
constructor
Definition MoreParser.hxx:61
MoreStruct::Pattern::m_backColor
MWAWColor m_backColor
the back color
Definition MoreParser.hxx:74