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 : m_frontColor(MWAWColor::black())
63 , m_backColor(MWAWColor::white())
64 {
65 for (auto &val : m_pattern) val=0;
66 }
68 friend std::ostream &operator<<(std::ostream &o, Pattern const &pat);
70 unsigned char m_pattern[8];
75};
76}
77
80class MoreParser final : public MWAWTextParser
81{
83 friend class MoreText;
84public:
86 MoreParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
88 ~MoreParser() final;
89
91 bool checkHeader(MWAWHeader *header, bool strict=false) final;
92
93 // the main parse function
94 void parse(librevenge::RVNGTextInterface *documentInterface) final;
95
96protected:
98 void init();
99
101 void createDocument(librevenge::RVNGTextInterface *documentInterface);
102
106 void newPage(int number);
108 bool getColor(int id, MWAWColor &col) const;
109
110 // interface with the text parser
111
112protected:
114 bool createZones();
115
117 bool readZonesList();
118
120 bool readPrintInfo(MWAWEntry const &entry);
121
123 bool readDocumentInfo(MWAWEntry const &entry);
124
126 bool readSlideList(MWAWEntry const &entry);
127
129 bool readSlide(MWAWEntry const &entry);
130
132 bool readGraphic(MWAWEntry const &entry);
133
135 bool readUnknown9(MWAWEntry const &entry);
136
138 bool readColors(long endPos);
139
141 bool readPattern(long endPos, MoreStruct::Pattern &pattern);
142
144 bool readBackside(long endPos, std::string &extra);
145
147 bool readFreePos(MWAWEntry const &entry);
148
150 bool readUnkn9Sub(long endPos);
151
152 //
153 // low level
154 //
155
157 bool checkAndStore(MWAWEntry const &entry);
158
160 bool checkAndFindSize(MWAWEntry &entry);
161
164
166 libmwaw::DebugFile &rsrcAscii();
167
168 //
169 // data
170 //
171
173 std::shared_ptr<MoreParserInternal::State> m_state;
174
176 std::shared_ptr<MoreText> m_textParser;
177};
178#endif
179// 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:299
Internal: the subdocument of a MoreParser.
Definition: MoreParser.cxx:104
the main class to read a More file
Definition: MoreParser.hxx:81
void init()
inits all internal variables
Definition: MoreParser.cxx:155
bool readPrintInfo(MWAWEntry const &entry)
read a PrintInfo zone ( first block )
Definition: MoreParser.cxx:458
bool readZonesList()
read the list of zones ( v2-3) : first 0x80 bytes
Definition: MoreParser.cxx:390
bool readUnkn9Sub(long endPos)
read the last subzone find in a block 9 ( unknown meaning)
Definition: MoreParser.cxx:1173
bool getColor(int id, MWAWColor &col) const
return the color which corresponds to an id (if possible)
Definition: MoreParser.cxx:233
bool readBackside(long endPos, std::string &extra)
read a backside ( some sub zone of block 9)
Definition: MoreParser.cxx:1101
bool readFreePos(MWAWEntry const &entry)
read the list of free file position
Definition: MoreParser.cxx:626
bool checkAndStore(MWAWEntry const &entry)
check if the entry is valid, if so store it in the list of entry
Definition: MoreParser.cxx:187
std::shared_ptr< MoreText > m_textParser
the text parser
Definition: MoreParser.hxx:176
bool readUnknown9(MWAWEntry const &entry)
read a unknown zone ( block 9 )
Definition: MoreParser.cxx:973
bool readDocumentInfo(MWAWEntry const &entry)
read a docinfo zone ( second block )
Definition: MoreParser.cxx:511
std::shared_ptr< MoreParserInternal::State > m_state
the state
Definition: MoreParser.hxx:173
bool readColors(long endPos)
read a color zone ( beginning of block 9 )
Definition: MoreParser.cxx:1060
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MoreParser.cxx:278
MWAWVec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: MoreParser.cxx:181
void parse(librevenge::RVNGTextInterface *documentInterface) final
virtual function used to parse the input
Definition: MoreParser.cxx:249
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition: MoreParser.cxx:719
bool readSlide(MWAWEntry const &entry)
read a slide definitions
Definition: MoreParser.cxx:834
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: MoreParser.cxx:168
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
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: MoreParser.cxx:173
bool readSlideList(MWAWEntry const &entry)
read the list of slide definitions
Definition: MoreParser.cxx:773
bool readGraphic(MWAWEntry const &entry)
read a graphic ( in a slide )
Definition: MoreParser.cxx:919
bool createZones()
finds the different objects zones
Definition: MoreParser.cxx:322
bool readPattern(long endPos, MoreStruct::Pattern &pattern)
read a pattern ( some sub zone of block 9)
Definition: MoreParser.cxx:1147
~MoreParser() final
destructor
Definition: MoreParser.cxx:151
void newPage(int number)
adds a new page
Definition: MoreParser.cxx:220
the main class to read the text part of More Text file
Definition: MoreText.hxx:65
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:561
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
Internal: the structures of a MoreParser.
Definition: MoreParser.cxx:59
a namespace used to define basic structures in a More file
Definition: MoreParser.cxx:1278
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition: libmwaw_internal.cxx:51
Definition: MWAWDocument.hxx:57
the class to store a color
Definition: libmwaw_internal.hxx:192
Definition: MoreParser.hxx:59
unsigned char m_pattern[8]
the pattern
Definition: MoreParser.hxx:70
friend std::ostream & operator<<(std::ostream &o, Pattern const &pat)
operator<<
Definition: MoreParser.cxx:1279
MWAWColor m_frontColor
the front color
Definition: MoreParser.hxx:72
Pattern()
constructor
Definition: MoreParser.hxx:61
MWAWColor m_backColor
the back color
Definition: MoreParser.hxx:74

Generated on Wed May 3 2023 07:18:29 for libmwaw by doxygen 1.9.6