MoreParser.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#ifndef MORE_PARSER
35# define MORE_PARSER
36
37#include <string>
38#include <vector>
39
40#include <librevenge/librevenge.h>
41
42#include "MWAWDebug.hxx"
43#include "MWAWInputStream.hxx"
44
45#include "MWAWParser.hxx"
46
47namespace MoreParserInternal
48{
49class SubDocument;
50struct State;
51}
52
53class MoreText;
54
57namespace MoreStruct
58{
59struct Pattern {
62 {
63 for (int i=0; i<8; i++) m_pattern[i]=0;
64 }
66 friend std::ostream &operator<<(std::ostream &o, Pattern const &pat);
68 unsigned char m_pattern[8];
73};
74}
75
79{
81 friend class MoreText;
82public:
86 virtual ~MoreParser();
87
89 bool checkHeader(MWAWHeader *header, bool strict=false);
90
91 // the main parse function
92 void parse(librevenge::RVNGTextInterface *documentInterface);
93
94protected:
96 void init();
97
99 void createDocument(librevenge::RVNGTextInterface *documentInterface);
100
104 void newPage(int number);
106 bool getColor(int id, MWAWColor &col) const;
107
108 // interface with the text parser
109
110protected:
112 bool createZones();
113
115 bool readZonesList();
116
118 bool readPrintInfo(MWAWEntry const &entry);
119
121 bool readDocumentInfo(MWAWEntry const &entry);
122
124 bool readSlideList(MWAWEntry const &entry);
125
127 bool readSlide(MWAWEntry const &entry);
128
130 bool readGraphic(MWAWEntry const &entry);
131
133 bool readUnknown9(MWAWEntry const &entry);
134
136 bool readColors(long endPos);
137
139 bool readPattern(long endPos, MoreStruct::Pattern &pattern);
140
142 bool readBackside(long endPos, std::string &extra);
143
145 bool readFreePos(MWAWEntry const &entry);
146
148 bool readUnkn9Sub(long endPos);
149
150 //
151 // low level
152 //
153
155 bool checkAndStore(MWAWEntry const &entry);
156
158 bool checkAndFindSize(MWAWEntry &entry);
159
162
165
166 //
167 // data
168 //
169
171 shared_ptr<MoreParserInternal::State> m_state;
172
174 shared_ptr<MoreText> m_textParser;
175};
176#endif
177// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:57
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:296
Internal: the subdocument of a MoreParser.
Definition: MoreParser.cxx:102
the main class to read a More file
Definition: MoreParser.hxx:79
void init()
inits all internal variables
Definition: MoreParser.cxx:156
bool readPrintInfo(MWAWEntry const &entry)
read a PrintInfo zone ( first block )
Definition: MoreParser.cxx:462
bool readZonesList()
read the list of zones ( v2-3) : first 0x80 bytes
Definition: MoreParser.cxx:394
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: MoreParser.cxx:727
bool readUnkn9Sub(long endPos)
read the last subzone find in a block 9 ( unknown meaning)
Definition: MoreParser.cxx:1189
bool getColor(int id, MWAWColor &col) const
return the color which corresponds to an id (if possible)
Definition: MoreParser.cxx:234
bool readBackside(long endPos, std::string &extra)
read a backside ( some sub zone of block 9)
Definition: MoreParser.cxx:1110
bool readFreePos(MWAWEntry const &entry)
read the list of free file position
Definition: MoreParser.cxx:633
bool checkAndStore(MWAWEntry const &entry)
check if the entry is valid, if so store it in the list of entry
Definition: MoreParser.cxx:188
virtual ~MoreParser()
destructor
Definition: MoreParser.cxx:152
shared_ptr< MoreText > m_textParser
the text parser
Definition: MoreParser.hxx:174
bool readUnknown9(MWAWEntry const &entry)
read a unknown zone ( block 9 )
Definition: MoreParser.cxx:981
bool readDocumentInfo(MWAWEntry const &entry)
read a docinfo zone ( second block )
Definition: MoreParser.cxx:515
bool readColors(long endPos)
read a color zone ( beginning of block 9 )
Definition: MoreParser.cxx:1068
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MoreParser.cxx:279
MWAWVec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: MoreParser.cxx:182
shared_ptr< MoreParserInternal::State > m_state
the state
Definition: MoreParser.hxx:171
bool readSlide(MWAWEntry const &entry)
read a slide definitions
Definition: MoreParser.cxx:842
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: MoreParser.cxx:169
MoreParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: MoreParser.cxx:146
bool checkAndFindSize(MWAWEntry &entry)
check if the entry is valid defined by the begin pos points to a zone: dataSz data
Definition: MoreParser.cxx:202
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: MoreParser.cxx:174
bool readSlideList(MWAWEntry const &entry)
read the list of slide definitions
Definition: MoreParser.cxx:781
bool readGraphic(MWAWEntry const &entry)
read a graphic ( in a slide )
Definition: MoreParser.cxx:927
bool createZones()
finds the different objects zones
Definition: MoreParser.cxx:323
void parse(librevenge::RVNGTextInterface *documentInterface)
virtual function used to parse the input
Definition: MoreParser.cxx:250
bool readPattern(long endPos, MoreStruct::Pattern &pattern)
read a pattern ( some sub zone of block 9)
Definition: MoreParser.cxx:1160
void newPage(int number)
adds a new page
Definition: MoreParser.cxx:221
the main class to read the text part of More Text file
Definition: MoreText.hxx:65
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:66
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:513
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:503
Internal: the structures of a MoreParser.
Definition: MoreParser.cxx:59
a namespace used to define basic structures in a More file
Definition: MoreParser.cxx:1294
the class to store a color
Definition: libmwaw_internal.hxx:182
Definition: MoreParser.hxx:59
unsigned char m_pattern[8]
the pattern
Definition: MoreParser.hxx:68
friend std::ostream & operator<<(std::ostream &o, Pattern const &pat)
operator<<
Definition: MoreParser.cxx:1295
MWAWColor m_frontColor
the front color
Definition: MoreParser.hxx:70
Pattern()
constructor
Definition: MoreParser.hxx:61
MWAWColor m_backColor
the back color
Definition: MoreParser.hxx:72

Generated on Wed Jan 19 2022 22:23:15 for libmwaw by doxygen 1.9.3