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
47 namespace MoreParserInternal
48 {
49 class SubDocument;
50 struct State;
51 }
52
53 class MoreText;
54
57 namespace MoreStruct
58 {
59 struct Pattern {
61 Pattern() : m_frontColor(MWAWColor::black()), m_backColor(MWAWColor::white())
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];
70 MWAWColor m_frontColor;
72 MWAWColor m_backColor;
73 };
74 }
75
78 class MoreParser : public MWAWTextParser
79 {
80 friend class MoreParserInternal::SubDocument;
81 friend class MoreText;
82 public:
84 MoreParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
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
94 protected:
96 void init();
97
99 void createDocument(librevenge::RVNGTextInterface *documentInterface);
100
102 MWAWVec2f getPageLeftTop() const;
104 void newPage(int number);
106 bool getColor(int id, MWAWColor &col) const;
107
108 // interface with the text parser
109
110 protected:
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
161 MWAWInputStreamPtr rsrcInput();
162
164 libmwaw::DebugFile &rsrcAscii();
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:
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
MoreParserInternal::SubDocument
Internal: the subdocument of a MoreParser.
Definition: MoreParser.cxx:101
MWAWParser.hxx
BeagleWksDRParserInternal::operator<<
std::ostream & operator<<(std::ostream &o, Shape const &shape)
Definition: BeagleWksDRParser.cxx:98
libmwaw::DebugFile
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:65
MoreStruct::Pattern
Definition: MoreParser.hxx:59
MoreText::MoreParser
friend class MoreParser
Definition: MoreText.hxx:66
MoreParser
the main class to read a More file
Definition: MoreParser.hxx:78
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:196
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:527
MoreStruct::Pattern::Pattern
Pattern()
constructor
Definition: MoreParser.hxx:61
MoreText
the main class to read the text part of More Text file
Definition: MoreText.hxx:64
MoreStruct
a namespace used to define basic structures in a More file
Definition: MoreParser.cxx:1293
MoreStruct::Pattern::m_backColor
MWAWColor m_backColor
the back color
Definition: MoreParser.hxx:72
MWAWTextParser
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:295
MoreParser::m_textParser
shared_ptr< MoreText > m_textParser
the text parser
Definition: MoreParser.hxx:174
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:517
MoreParser::m_state
shared_ptr< MoreParserInternal::State > m_state
the state
Definition: MoreParser.hxx:171
MWAWInputStream.hxx
MWAWDebug.hxx
FullWrtStruct::getColor
bool getColor(int color, MWAWColor &col)
try to convert a file data to a color
Definition: FullWrtStruct.cxx:45
MoreText::createZones
bool createZones()
try to create the text zones using read data
Definition: MoreText.cxx:547
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
MoreParserInternal
Internal: the structures of a MoreParser.
Definition: MoreParser.cxx:58
MoreStruct::Pattern::m_frontColor
MWAWColor m_frontColor
the front color
Definition: MoreParser.hxx:70
MWAWVec2< float >