Debian Codegraph @

src/lib/PowerPoint7Parser.hxx

raw
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 ([email protected])
18 * Copyright (C) 2002,2004 Marc Maurer ([email protected])
19 * Copyright (C) 2004-2006 Fridrich Strba ([email protected])
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent ([email protected])
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 POWER_POINT7_PARSER
35 # define POWER_POINT7_PARSER
36
37 #include <map>
38 #include <set>
39 #include <vector>
40
41 #include "MWAWDebug.hxx"
42 #include "MWAWInputStream.hxx"
43
44 #include "MWAWParser.hxx"
45
46 namespace PowerPoint7ParserInternal
47 {
48 struct State;
49 }
50
51 namespace PowerPoint7Struct
52 {
53 struct SlideId;
54 }
55
56 class PowerPoint7Graph;
57 class PowerPoint7Text;
58
59 /** \brief the main class to read a Microsoft PowerPoint 95 files (Windows)
60 */
61 class PowerPoint7Parser final : public MWAWPresentationParser
62 {
63 friend class PowerPoint7Graph;
64 friend class PowerPoint7Text;
65 public:
66 //! constructor
67 PowerPoint7Parser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
68 //! destructor
69 ~PowerPoint7Parser() final;
70
71 //! checks if the document header is correct (or not)
72 bool checkHeader(MWAWHeader *header, bool strict=false) final;
73
74 // the main parse function
75 void parse(librevenge::RVNGPresentationInterface *documentInterface) final;
76
77 protected:
78 //! creates the listener which will be associated to the document
79 void createDocument(librevenge::RVNGPresentationInterface *documentInterface);
80
81 //! finds the different zones
82 bool createZones();
83 //! try to send all slides
84 void sendSlides();
85
86 //
87 // send data
88 //
89
90 // interface with the text parser
91
92 //! returns the color corresponding to an id
93 bool getColor(int cId, MWAWColor &col) const;
94 //! try to send the text content
95 bool sendText(int textId);
96
97 //
98 // low level
99 //
100
101 //! try to read the main zone: the zone 3
102 bool readDocRoot();
103 //! try to read the main sub zone: the zone 10: child of Root
104 bool readMainSub10(long endPos);
105 //! try to read the document's zone 1000: child of Root
106 bool readDocument(long endPos);
107 //! try to read the document atom's zone 1001: child of Document
108 bool readDocAtom(int level, long endPos);
109 //! try to read the slide information 1005: dimension, has background, ...
110 bool readSlideInformation(int level, long endPos);
111 //! try to read the slides zone 1006(slides) or 1016(master)
112 bool readSlides(int level, long endPos, bool master);
113 //! try to read the slide zone 1007
114 bool readSlideAtom(int level, long endPos,
115 PowerPoint7Struct::SlideId &sId, PowerPoint7Struct::SlideId &mId);
116 //! try to read the notes zone 1008
117 bool readNotes(int level, long endPos);
118 //! try to read the note atom zone 1009
119 bool readNoteAtom(int level, long endPos, PowerPoint7Struct::SlideId &sId);
120 //! try to read the environment zone 1010
121 bool readEnvironment(int level, long endPos);
122 //! try to read the color scheme 1012
123 bool readColorScheme(int level, long endPos, std::vector<MWAWColor> &colors);
124 //! try to read the zone 1015: child of Slides
125 bool readZone1015(int level, long endPos);
126 //! try to read the slide show info zone 1017
127 bool readSlideShowInfo(int level, long endPos);
128 //! try to read the slide view info zone 1018
129 bool readSlideViewInfo(int level, long endPos);
130 //! try to read the guide atom zone 1019
131 bool readGuideAtom(int level, long endPos);
132 //! try to read the view info zone 1021
133 bool readViewInfoAtom(int level, long endPos);
134 //! try to read the slide view info zone 1022
135 bool readSlideViewInfoAtom(int level, long endPos);
136 //! try to read the vba info zone 1023
137 bool readVbaInfo(int level, long endPos);
138 //! try to read the vba info zone 1024
139 bool readVbaInfoAtom(int level, long endPos);
140 //! try to read the slide show doc info atom 1025: child of Document
141 bool readSSDocInfoAtom(int level, long endPos);
142 //! try to read the summary zone 1026: child of Document
143 bool readSummary(int level, long endPos);
144 //! try to read the zone 1028: child of Environment
145 bool readZone1028(int level, long endPos);
146 //! try to read the zone 1029
147 bool readZone1028Atom(int level, long endPos);
148 //! try to read the outline view info zone 1031
149 bool readOutlineViewInfo(int level, long endPos);
150 //! try to read the sorter view info zone 1032
151 bool readSorterViewInfo(int level, long endPos);
152
153 //! try to read the container list zone 2000: child of Document
154 bool readContainerList(int level, long endPos);
155 //! try to read the container atom zone 2001
156 bool readContainerAtom(int level, long endPos, int &N);
157 //! try to read an identifier zone 2017
158 bool readIdentifier(int level, long endPos, int &id, std::string const &wh);
159 //! try to read the bookmark collection zone 2019
160 bool readBookmarkCollection(int level, long endPos);
161 //! try to read the sound collection zone 2020
162 bool readSoundCollection(int level, long endPos);
163 //! try to read the bookmark seed atom zone 2025
164 bool readBookmarkSeedAtom(int level, long endPos);
165 //! try to read the zone 2026: child of SlideViewInfo
166 bool readZone2026(int level, long endPos);
167 //! try to read the color list zone 2031
168 bool readColorList(int level, long endPos, std::vector<MWAWColor> &colors);
169
170 //! try to read the zone 3000: child of Handout/Notes/Slides/Zone3001
171 bool readZone3000(int level, long endPos);
172 //! try to read the zone 3012: child of Environment
173 bool readZone3012(int level, long endPos);
174 //! try to read the zone 3013: child of Zone3012
175 bool readZone3012Atom(int level, long endPos);
176
177 //! try to read the text chars atom zone 4000
178 bool readTextCharsAtom(int level, long endPos);
179 //! try to read the style text prop atom zone 4001
180 bool readStyleTextPropAtom(int level, long endPos, int &textId);
181 //! try to read the outline text props9 atom zone 4009
182 bool readOutlineTextProps9Atom(int level, long endPos,
183 int &pId, PowerPoint7Struct::SlideId &sId);
184 //! try to read the outline text props header9 atom zone 4015
185 bool readOutlineTextPropsHeader9Atom(int level, long endPos);
186 //! try to read the string zone 4026
187 bool readString(int level, long endPos, std::string &string, int &zId, std::string const &what="");
188 //! try to read a slide identifier zone 4032
189 bool readSlideIdentifier(int level, long endPos, PowerPoint7Struct::SlideId &sId);
190 //! try to read the zone 4039: child of Zone4072
191 bool readZone4039(int level, long endPos);
192 //! try to read the Kinsoku zone 4040
193 bool readKinsoku(int level, long endPos);
194 //! try to read the handout zone 4041
195 bool readHandout(int level, long endPos);
196 //! try to read the zone 4042: child of FontCollection
197 bool readZone4042(int level, long endPos);
198 //! try to read the Kinsoku atom zone 4050
199 bool readKinsokuAtom(int level, long endPos);
200 //! try to read the zone 4052: child of Zone1028
201 bool readZone1028Data(int level, long endPos);
202 //! try to read a container of a slide identifier 4054
203 bool readSlideIdentifierContainer(int level, long endPos, PowerPoint7Struct::SlideId &sId);
204 //! try to read the header footer zone: 4057
205 bool readHeaderFooters(int level, long endPos);
206 //! try to read the header footer atom zone: 4058
207 bool readHeaderFooterAtom(int level, long endPos);
208 //! try to read the zone 4072: child of Zone3008
209 bool readZone4072(int level, long endPos);
210
211 //! try to read a zone
212 bool readZone(int level, long endPos);
213 //! try to read a zone with no data
214 bool readZoneNoData(int level, long endPos, std::string const &name, std::string const &wh="");
215
216 //! try to read the "Text_Content" stream
217 bool parseTextContent(MWAWInputStreamPtr input);
218 //! check for unparsed zone
219 void checkForUnparsedZones();
220 protected:
221 //
222 // data
223 //
224 //! the state
225 std::shared_ptr<PowerPoint7ParserInternal::State> m_state;
226 };
227 #endif
228 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: