MindWrtParser.hxx Source File documentation

MindWrtParser.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33
34 /*
35 * Parser to convert MindWrite document
36 */
37 #ifndef MIND_WRT_PARSER
38 # define MIND_WRT_PARSER
39
40 #include <string>
41 #include <vector>
42
43 #include "MWAWDebug.hxx"
44 #include "MWAWInputStream.hxx"
45
46 #include "MWAWParser.hxx"
47
48 namespace MindWrtParserInternal
49 {
50 struct LineInfo;
51 struct State;
52 class SubDocument;
53 }
54
60 class MindWrtParser final : public MWAWTextParser
61 {
62 friend class MindWrtParserInternal::SubDocument;
63
64 public:
66 MindWrtParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
68 ~MindWrtParser() final;
69
71 bool checkHeader(MWAWHeader *header, bool strict=false) final;
72
73 // the main parse function
74 void parse(librevenge::RVNGTextInterface *documentInterface) final;
75
76 protected:
78 void init();
79
81 void createDocument(librevenge::RVNGTextInterface *documentInterface);
82
84 bool createZones();
85
87 bool sendZone(int i);
88
90 bool readGraphic(MindWrtParserInternal::LineInfo const &line);
91
93 bool readRuler(MindWrtParserInternal::LineInfo &line);
94
96 bool readCompressedText(MindWrtParserInternal::LineInfo const &line);
97
99 bool readText(MindWrtParserInternal::LineInfo const &line);
100
102 void sendText(std::string const &text, std::vector<MWAWFont> const &fonts, std::vector<int> const &textPos);
104 void sendHeaderFooter(bool header);
106 void sendHeaderFooterFields(bool header);
108 bool readFonts(MWAWEntry const &entry, std::vector<MWAWFont> &fonts, std::vector<int> &textPos);
109
111 bool readPrintInfo(MWAWEntry &entry);
112
114 bool readLinesInfo(MWAWEntry &entry);
115
117 bool readLastZone(MWAWEntry &entry);
118
120 bool readZone8(MWAWEntry &entry);
122 bool readHeadingStates(MWAWEntry &entry);
124 bool readHeadingFields(MWAWEntry &entry);
126 bool readHeadingProperties(MWAWEntry &entry);
128 bool readHeadingCustom(MWAWEntry &entry);
129
131 void setProperty(MWAWParagraph const &para);
132
134 void newPage(int number);
135
136 //
137 // low level
138 //
139
141 MWAWEntry readEntry();
142
143 protected:
144 //
145 // data
146 //
148 std::shared_ptr<MindWrtParserInternal::State> m_state;
149 };
150 #endif
151 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MindWrtParser::init
void init()
inits all internal variables
Definition: MindWrtParser.cxx:599
MindWrtParser::setProperty
void setProperty(MWAWParagraph const &para)
sends a paragraph property to the listener
Definition: MindWrtParser.cxx:2084
MindWrtParser::parse
void parse(librevenge::RVNGTextInterface *documentInterface) final
virtual function used to parse the input
Definition: MindWrtParser.cxx:641
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
MindWrtParser::sendZone
bool sendZone(int i)
try to send a zone
Definition: MindWrtParser.cxx:853
MindWrtParser::readHeadingCustom
bool readHeadingCustom(MWAWEntry &entry)
read the heading custom zone
Definition: MindWrtParser.cxx:1672
MWAWParser.hxx
MindWrtParser::readHeadingStates
bool readHeadingStates(MWAWEntry &entry)
read the heading state
Definition: MindWrtParser.cxx:1624
librevenge
Definition: MWAWDocument.hxx:56
MindWrtParser::readHeadingProperties
bool readHeadingProperties(MWAWEntry &entry)
read the heading property zone
Definition: MindWrtParser.cxx:1799
MindWrtParser::newPage
void newPage(int number)
adds a new page
Definition: MindWrtParser.cxx:613
MindWrtParser::readRuler
bool readRuler(MindWrtParserInternal::LineInfo &line)
try to read a ruler
Definition: MindWrtParser.cxx:982
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:2054
MindWrtParserInternal
Internal: the structures of a MindWrtParser.
Definition: MindWrtParser.cxx:59
MindWrtParser::MindWrtParser
MindWrtParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition: MindWrtParser.cxx:588
MindWrtParser::readLastZone
bool readLastZone(MWAWEntry &entry)
read the last zone ( pos + 7fffffff )
Definition: MindWrtParser.cxx:1582
MindWrtParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition: MindWrtParser.cxx:1396
MindWrtParser::sendHeaderFooter
void sendHeaderFooter(bool header)
try to send the header/footer zone
Definition: MindWrtParser.cxx:1077
MindWrtParser::sendHeaderFooterFields
void sendHeaderFooterFields(bool header)
try to send the header/footer fields as text (in a textbox)
Definition: MindWrtParser.cxx:1099
MindWrtParser::readZone8
bool readZone8(MWAWEntry &entry)
read the 8th zone ( unknown zone)
Definition: MindWrtParser.cxx:1876
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:557
MindWrtParser::~MindWrtParser
~MindWrtParser() final
destructor
Definition: MindWrtParser.cxx:595
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:43
MindWrtParser::readHeadingFields
bool readHeadingFields(MWAWEntry &entry)
read the heading field zone ( zone 12 )
Definition: MindWrtParser.cxx:1930
MindWrtParser::readFonts
bool readFonts(MWAWEntry const &entry, std::vector< MWAWFont > &fonts, std::vector< int > &textPos)
try to read the fonts
Definition: MindWrtParser.cxx:1334
MWAWTextParser
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:298
MindWrtParser::readLinesInfo
bool readLinesInfo(MWAWEntry &entry)
read the lines information zone
Definition: MindWrtParser.cxx:1503
MindWrtParser::readEntry
MWAWEntry readEntry()
read a file entry
Definition: MindWrtParser.cxx:626
MindWrtParser::readGraphic
bool readGraphic(MindWrtParserInternal::LineInfo const &line)
try to read a graphic
Definition: MindWrtParser.cxx:940
MWAWInputStream.hxx
MWAWDebug.hxx
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:547
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:84
MindWrtParser
the main class to read a MindWrite file
Definition: MindWrtParser.hxx:60
MindWrtParser::createZones
bool createZones()
finds the different objects zones
Definition: MindWrtParser.cxx:738
MindWrtParser::createDocument
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MindWrtParser.cxx:694
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
MindWrtParser::readText
bool readText(MindWrtParserInternal::LineInfo const &line)
try to read a non compressed text zone
Definition: MindWrtParser.cxx:1167
MindWrtParser::m_state
std::shared_ptr< MindWrtParserInternal::State > m_state
the state
Definition: MindWrtParser.hxx:148
MindWrtParser::readPrintInfo
bool readPrintInfo(MWAWEntry &entry)
read the print info zone
Definition: MindWrtParser.cxx:1988
MindWrtParser::readCompressedText
bool readCompressedText(MindWrtParserInternal::LineInfo const &line)
try to read a compressed text zone
Definition: MindWrtParser.cxx:1235
MindWrtParserInternal::SubDocument
Internal: the subdocument of a MindWrtParser.
Definition: MindWrtParser.cxx:523