MDWParser.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 MDW_PARSER
# define MDW_PARSER
#include <string>
#include <vector>
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
namespace MDWParserInternal
{
struct LineInfo;
struct State;
class SubDocument;
}
class MDWParser : public MWAWParser
{
friend class MDWParserInternal::SubDocument;
public:
MDWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
virtual ~MDWParser();
bool checkHeader(MWAWHeader *header, bool strict=false);
// the main parse function
void parse(WPXDocumentInterface *documentInterface);
protected:
void init();
void createDocument(WPXDocumentInterface *documentInterface);
bool createZones();
bool sendZone(int i);
bool readGraphic(MDWParserInternal::LineInfo const &line);
bool readRuler(MDWParserInternal::LineInfo &line);
bool readCompressedText(MDWParserInternal::LineInfo const &line);
bool readText(MDWParserInternal::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 &entry);
bool readLinesInfo(MWAWEntry &entry);
bool readLastZone(MWAWEntry &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
//
shared_ptr<MDWParserInternal::State> m_state;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MDWParser::MDWParser
MDWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: MDWParser.cxx:551
MWAWHeader
a function used by MWAWDocument to store the version of document and the input
Definition: MWAWHeader.hxx:47
MDWParser::sendText
void sendText(std::string const &text, std::vector< MWAWFont > const &fonts, std::vector< int > const &textPos)
try to send the text
Definition: MDWParser.cxx:2025
MDWParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: MDWParser.cxx:1363
MDWParser::init
void init()
inits all internal variables
Definition: MDWParser.cxx:561
MDWParser::readZone8
bool readZone8(MWAWEntry &entry)
read the 8th zone ( unknown zone)
Definition: MDWParser.cxx:1845
MWAWParser.hxx
MDWParser::m_state
shared_ptr< MDWParserInternal::State > m_state
the state
Definition: MDWParser.hxx:148
MDWParser::readHeadingFields
bool readHeadingFields(MWAWEntry &entry)
read the heading field zone ( zone 12 )
Definition: MDWParser.cxx:1900
MDWParser::createDocument
void createDocument(WPXDocumentInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MDWParser.cxx:658
MDWParser::readHeadingStates
bool readHeadingStates(MWAWEntry &entry)
read the heading state
Definition: MDWParser.cxx:1593
MDWParser::sendHeaderFooter
void sendHeaderFooter(bool header)
try to send the header/footer zone
Definition: MDWParser.cxx:1041
MDWParser::readEntry
MWAWEntry readEntry()
read a file entry
Definition: MDWParser.cxx:588
MDWParser::readCompressedText
bool readCompressedText(MDWParserInternal::LineInfo const &line)
try to read a compressed text zone
Definition: MDWParser.cxx:1203
MDWParser::readHeadingProperties
bool readHeadingProperties(MWAWEntry &entry)
read the heading property zone
Definition: MDWParser.cxx:1768
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:340
MDWParser::readHeadingCustom
bool readHeadingCustom(MWAWEntry &entry)
read the heading custom zone
Definition: MDWParser.cxx:1641
MDWParser::parse
void parse(WPXDocumentInterface *documentInterface)
virtual function used to parse the input
Definition: MDWParser.cxx:603
MDWParser::readFonts
bool readFonts(MWAWEntry const &entry, std::vector< MWAWFont > &fonts, std::vector< int > &textPos)
try to read the fonts
Definition: MDWParser.cxx:1301
MDWParser::readGraphic
bool readGraphic(MDWParserInternal::LineInfo const &line)
try to read a graphic
Definition: MDWParser.cxx:904
MDWParser::sendHeaderFooterFields
void sendHeaderFooterFields(bool header)
try to send the header/footer fields as text (in a textbox)
Definition: MDWParser.cxx:1064
MDWParser::sendZone
bool sendZone(int i)
try to send a zone
Definition: MDWParser.cxx:819
MDWParser::readPrintInfo
bool readPrintInfo(MWAWEntry &entry)
read the print info zone
Definition: MDWParser.cxx:1959
MDWParser::readText
bool readText(MDWParserInternal::LineInfo const &line)
try to read a non compressed text zone
Definition: MDWParser.cxx:1135
MDWParser::createZones
bool createZones()
finds the different objects zones
Definition: MDWParser.cxx:703
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:336
MDWParser::newPage
void newPage(int number)
adds a new page
Definition: MDWParser.cxx:575
MWAWInputStream.hxx
MWAWDebug.hxx
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:83
MDWParser
the main class to read a MindWrite file
Definition: MDWParser.hxx:60
MDWParser::~MDWParser
virtual ~MDWParser()
destructor
Definition: MDWParser.cxx:557
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
MDWParser::readRuler
bool readRuler(MDWParserInternal::LineInfo &line)
try to read a ruler
Definition: MDWParser.cxx:947
MDWParser::setProperty
void setProperty(MWAWParagraph const &para)
sends a paragraph property to the listener
Definition: MDWParser.cxx:2055
MDWParser::readLinesInfo
bool readLinesInfo(MWAWEntry &entry)
read the lines information zone
Definition: MDWParser.cxx:1471
MDWParserInternal::LineInfo
Internal: a line information of a MDWParser.
Definition: MDWParser.cxx:237
MDWParser::readLastZone
bool readLastZone(MWAWEntry &entry)
read the last zone ( pos + 7fffffff )
Definition: MDWParser.cxx:1551
MDWParserInternal::SubDocument
Internal: the subdocument of a MWParser.
Definition: MDWParser.cxx:488