Debian Codegraph @

src/lib/PowerPoint1Parser.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_POINT1_PARSER
35 # define POWER_POINT1_PARSER
36
37 #include <vector>
38
39 #include "MWAWDebug.hxx"
40 #include "MWAWInputStream.hxx"
41
42 #include "MWAWParser.hxx"
43
44 namespace PowerPoint1ParserInternal
45 {
46 struct Frame;
47 struct Scheme;
48 struct Slide;
49 struct TextZone;
50
51 struct State;
52
53 class SubDocument;
54 }
55
56 /** \brief the main class to read a Mac Microsoft PowerPoint v1, v2 files
57 *
58 * \note there is some basic code to find the main zones in a Windows v2 files
59 */
60 class PowerPoint1Parser final : public MWAWPresentationParser
61 {
62 friend class PowerPoint1ParserInternal::SubDocument;
63 public:
64 //! constructor
65 PowerPoint1Parser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
66 //! destructor
67 ~PowerPoint1Parser() final;
68
69 //! checks if the document header is correct (or not)
70 bool checkHeader(MWAWHeader *header, bool strict=false) final;
71
72 // the main parse function
73 void parse(librevenge::RVNGPresentationInterface *documentInterface) final;
74
75 protected:
76 //! creates the listener which will be associated to the document
77 void createDocument(librevenge::RVNGPresentationInterface *documentInterface);
78
79 //! finds the different zones
80 bool createZones();
81 //! try to send all slides
82 void sendSlides();
83
84 //! try to read the list of zones
85 bool readListZones(int &docInfoId);
86
87 //
88 // internal level
89 //
90
91 //! try to read a frame zone in a page
92 bool readFramesList(MWAWEntry const &entry, std::vector<PowerPoint1ParserInternal::Frame> &frame, int schemeId);
93 //! try to read a zone id list zone
94 bool readZoneIdList(MWAWEntry const &entry, int zId);
95 //! try to read a zone id list zone for v2 pc file
96 bool readZoneIdList2(MWAWEntry const &entry, int zId);
97
98 //! try to read a color list
99 bool readColors(MWAWEntry const &entry);
100 //! try to read a color zone, probably used to define the menu, ...
101 bool readColorZone(MWAWEntry const &entry);
102 //! try to read a font style list
103 bool readFonts(MWAWEntry const &entry);
104 //! try to read a font names list
105 bool readFontNames(MWAWEntry const &entry);
106 //! try to read a picture zone
107 bool readPicture(MWAWEntry const &entry, MWAWEmbeddedObject &picture);
108 //! try to read the picture definition: windows v2
109 bool readPictureDefinition(MWAWEntry const &entry, size_t id);
110 //! try to read a print info zone
111 bool readPrintInfo(MWAWEntry const &entry);
112 //! try to read the paragraph style
113 bool readRulers(MWAWEntry const &entry);
114 //! try to read some ruler: windows v2
115 bool readRuler(MWAWEntry const &entry, size_t id);
116 //! try to read a scheme
117 bool readScheme(MWAWEntry const &entry, int id);
118 //! try to read the schemes
119 bool readSchemes();
120 //! try to read a text zone
121 bool readTextZone(MWAWEntry const &entry, PowerPoint1ParserInternal::TextZone &zone);
122 //! try to read a slide zone, update the list of slide ids
123 bool readSlide(MWAWEntry const &entry, std::vector<int> &slideIds);
124 //! try to read the document info zone
125 bool readDocInfo(MWAWEntry const &entry);
126 //! try to read a unknown zone with size 22: related to scheme?
127 bool readZone2(MWAWEntry const &entry);
128
129 //
130 // send data
131 //
132
133 //! try to send a slide
134 bool sendSlide(PowerPoint1ParserInternal::Slide const &slide, bool master);
135 //! try to send a frame zone
136 bool sendFrame(PowerPoint1ParserInternal::Frame const &frame, PowerPoint1ParserInternal::TextZone const &textZone);
137 //! try to send a picture
138 bool sendPicture(MWAWPosition const &position, MWAWGraphicStyle const &style, int pId);
139 //! try to send a text zone
140 bool sendText(PowerPoint1ParserInternal::TextZone const &textZone, MWAWVec2i tId, int rulerId);
141 //! try to send the slide note text
142 bool sendSlideNote(PowerPoint1ParserInternal::Slide const &slide);
143
144 //
145 // low level
146 //
147
148 //! try to return a color corresponding to a scheme and color
149 bool getColor(int colorId, int schemeId, MWAWColor &color) const;
150 //! check for unparsed zone
151 void checkForUnparsedZones();
152 protected:
153 //
154 // data
155 //
156 //! the state
157 std::shared_ptr<PowerPoint1ParserInternal::State> m_state;
158 };
159 #endif
160 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: