MindWrtParser.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 MindWrite document
*/
#ifndef MIND_WRT_PARSER
# define MIND_WRT_PARSER
#include <string>
#include <vector>
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
namespace MindWrtParserInternal
{
struct LineInfo;
struct State;
class SubDocument;
}
class MindWrtParser final : public MWAWTextParser
{
friend class MindWrtParserInternal::SubDocument;
public:
MindWrtParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
~MindWrtParser() 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);
bool createZones();
bool sendZone(int i);
bool readGraphic(MindWrtParserInternal::LineInfo const &line);
bool readRuler(MindWrtParserInternal::LineInfo &line);
bool readCompressedText(MindWrtParserInternal::LineInfo const &line);
bool readText(MindWrtParserInternal::LineInfo const &line);
void sendText(std::string const &text, std::vector<MWAWFont> const &fonts, std::vector<int> const &textPos);
void sendHeaderFooter(bool header);
void sendHeaderFooterFields(bool header);
bool readFonts(MWAWEntry const &entry, std::vector<MWAWFont> &fonts, std::vector<int> &textPos);
bool readPrintInfo(MWAWEntry const &entry);
bool readLinesInfo(MWAWEntry &entry);
bool readLastZone(MWAWEntry const &entry);
bool readZone8(MWAWEntry &entry);
bool readHeadingStates(MWAWEntry &entry);
bool readHeadingFields(MWAWEntry &entry);
bool readHeadingProperties(MWAWEntry &entry);
bool readHeadingCustom(MWAWEntry &entry);
void setProperty(MWAWParagraph const &para);
void newPage(int number);
//
// low level
//
MWAWEntry readEntry();
protected:
//
// data
//
std::shared_ptr<MindWrtParserInternal::State> m_state;
};
#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
MWAWFont
Class to store font.
Definition MWAWFont.hxx:44
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition MWAWHeader.hxx:57
MWAWParagraph
class to store the paragraph properties
Definition MWAWParagraph.hxx:85
MWAWTextParser::MWAWTextParser
MWAWTextParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor (protected)
Definition MWAWParser.hxx:307
MindWrtParserInternal::SubDocument
Internal: the subdocument of a MindWrtParser.
Definition MindWrtParser.cxx:526
MindWrtParser::parse
void parse(librevenge::RVNGTextInterface *documentInterface) final
virtual function used to parse the input
Definition MindWrtParser.cxx:643
MindWrtParser::readEntry
MWAWEntry readEntry()
read a file entry
Definition MindWrtParser.cxx:628
MindWrtParser::setProperty
void setProperty(MWAWParagraph const &para)
sends a paragraph property to the listener
Definition MindWrtParser.cxx:2085
MindWrtParser::readRuler
bool readRuler(MindWrtParserInternal::LineInfo &line)
try to read a ruler
Definition MindWrtParser.cxx:983
MindWrtParser::sendHeaderFooterFields
void sendHeaderFooterFields(bool header)
try to send the header/footer fields as text (in a textbox)
Definition MindWrtParser.cxx:1100
MindWrtParser::readHeadingProperties
bool readHeadingProperties(MWAWEntry &entry)
read the heading property zone
Definition MindWrtParser.cxx:1800
MindWrtParser::readPrintInfo
bool readPrintInfo(MWAWEntry const &entry)
read the print info zone
Definition MindWrtParser.cxx:1989
MindWrtParser::sendText
void sendText(std::string const &text, std::vector< MWAWFont > const &fonts, std::vector< int > const &textPos)
try to send the text
Definition MindWrtParser.cxx:2055
MindWrtParser::readText
bool readText(MindWrtParserInternal::LineInfo const &line)
try to read a non compressed text zone
Definition MindWrtParser.cxx:1168
MindWrtParser::createZones
bool createZones()
finds the different objects zones
Definition MindWrtParser.cxx:740
MindWrtParser::m_state
std::shared_ptr< MindWrtParserInternal::State > m_state
the state
Definition MindWrtParser.hxx:148
MindWrtParser::sendZone
bool sendZone(int i)
try to send a zone
Definition MindWrtParser.cxx:855
MindWrtParser::readCompressedText
bool readCompressedText(MindWrtParserInternal::LineInfo const &line)
try to read a compressed text zone
Definition MindWrtParser.cxx:1236
MindWrtParser::sendHeaderFooter
void sendHeaderFooter(bool header)
try to send the header/footer zone
Definition MindWrtParser.cxx:1078
MindWrtParser::newPage
void newPage(int number)
adds a new page
Definition MindWrtParser.cxx:615
MindWrtParser::~MindWrtParser
~MindWrtParser() final
destructor
Definition MindWrtParser.cxx:597
MindWrtParser::readLastZone
bool readLastZone(MWAWEntry const &entry)
read the last zone ( pos + 7fffffff )
Definition MindWrtParser.cxx:1583
MindWrtParser::MindWrtParser
MindWrtParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition MindWrtParser.cxx:590
MindWrtParser::init
void init()
inits all internal variables
Definition MindWrtParser.cxx:601
MindWrtParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition MindWrtParser.cxx:1397
MindWrtParser::readLinesInfo
bool readLinesInfo(MWAWEntry &entry)
read the lines information zone
Definition MindWrtParser.cxx:1504
MindWrtParser::readGraphic
bool readGraphic(MindWrtParserInternal::LineInfo const &line)
try to read a graphic
Definition MindWrtParser.cxx:941
MindWrtParser::readZone8
bool readZone8(MWAWEntry &entry)
read the 8th zone ( unknown zone)
Definition MindWrtParser.cxx:1877
MindWrtParser::readHeadingStates
bool readHeadingStates(MWAWEntry &entry)
read the heading state
Definition MindWrtParser.cxx:1625
MindWrtParser::readHeadingFields
bool readHeadingFields(MWAWEntry &entry)
read the heading field zone ( zone 12 )
Definition MindWrtParser.cxx:1931
MindWrtParser::readHeadingCustom
bool readHeadingCustom(MWAWEntry &entry)
read the heading custom zone
Definition MindWrtParser.cxx:1673
MindWrtParser::readFonts
bool readFonts(MWAWEntry const &entry, std::vector< MWAWFont > &fonts, std::vector< int > &textPos)
try to read the fonts
Definition MindWrtParser.cxx:1335
MindWrtParser::createDocument
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition MindWrtParser.cxx:696
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition libmwaw_internal.hxx:561
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
MindWrtParserInternal
Internal: the structures of a MindWrtParser.
Definition MindWrtParser.cxx:60
librevenge
Definition MWAWDocument.hxx:57
MindWrtParserInternal::LineInfo
Internal: a line information of a MindWrtParser.
Definition MindWrtParser.cxx:256
MindWrtParserInternal::State
Internal: the state of a MindWrtParser.
Definition MindWrtParser.cxx:488