- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

WPSOLEParser.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwps
3 * Version: MPL 2.0 / LGPLv2.1+
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * Major Contributor(s):
10 * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
11 * Copyright (C) 2006, 2007 Andrew Ziem
12 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
13 * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
14 * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
15 *
16 * For minor contributions see the git repository.
17 *
18 * Alternatively, the contents of this file may be used under the terms
19 * of the GNU Lesser General Public License Version 2.1 or later
20 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
21 * applicable instead of those above.
22 *
23 * For further information visit http://libwps.sourceforge.net
24 */
25
26 /*
27 * freely inspired from istorage :
28 * ------------------------------------------------------------
29 * Generic OLE Zones furnished with a copy of the file header
30 *
31 * Compound Storage (32 bit version)
32 * Storage implementation
33 *
34 * This file contains the compound file implementation
35 * of the storage interface.
36 *
37 * Copyright 1999 Francis Beaudet
38 * Copyright 1999 Sylvain St-Germain
39 * Copyright 1999 Thuy Nguyen
40 * Copyright 2005 Mike McCormack
41 *
42 * This library is free software; you can redistribute it and/or
43 * modify it under the terms of the GNU Lesser General Public
44 * License as published by the Free Software Foundation; either
45 * version 2.1 of the License, or (at your option) any later version.
46 *
47 * This library is distributed in the hope that it will be useful,
48 * but WITHOUT ANY WARRANTY; without even the implied warranty of
49 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
50 * Lesser General Public License for more details.
51 *
52 * ------------------------------------------------------------
53 */
54
55 #ifndef WPS_OLE_PARSER_H
56 #define WPS_OLE_PARSER_H
57
58 #include <string>
59 #include <vector>
60
61 #include <libwpd-stream/WPXStream.h>
62
63 #include "libwps_internal.h"
64
65 #include "WPSDebug.h"
66
67 class WPXBinaryData;
68
69 namespace libwps
70 {
71 class Storage;
72 }
73 class WPSPosition;
74 namespace WPSOLEParserInternal
75 {
76 class CompObj;
77 }
78
82 class WPSOLEParser
83 {
84 public:
87 WPSOLEParser(const std::string &mainName);
88
90 ~WPSOLEParser();
91
94 bool parse(shared_ptr<libwps::Storage> fileInput);
95
97 std::vector<std::string> const &getNotParse() const
98 {
99 return m_unknownOLEs;
100 }
101
103 std::vector<int> const &getObjectsId() const
104 {
105 return m_objectsId;
106 }
108 std::vector<WPSPosition> const &getObjectsPosition() const
109 {
110 return m_objectsPosition;
111 }
113 std::vector<WPXBinaryData> const &getObjects() const
114 {
115 return m_objects;
116 }
117
119 bool getObject(int id, WPXBinaryData &obj, WPSPosition &pos) const;
120
124 void setObject(int id, WPXBinaryData const &obj, WPSPosition const &pos);
125 protected:
126
128 bool readOle(WPXInputStreamPtr &ip, std::string const &oleName,
129 libwps::DebugFile &ascii);
131 bool readMM(WPXInputStreamPtr &input, std::string const &oleName,
132 libwps::DebugFile &ascii);
134 bool readObjInfo(WPXInputStreamPtr &input, std::string const &oleName,
135 libwps::DebugFile &ascii);
137 bool readCompObj(WPXInputStreamPtr &ip, std::string const &oleName,
138 libwps::DebugFile &ascii);
139
141 bool isOlePres(WPXInputStreamPtr &ip, std::string const &oleName);
143 bool readOlePres(WPXInputStreamPtr &ip, WPXBinaryData &data, WPSPosition &pos,
144 libwps::DebugFile &ascii);
145
147 bool isOle10Native(WPXInputStreamPtr &ip, std::string const &oleName);
149 bool readOle10Native(WPXInputStreamPtr &ip, WPXBinaryData &data,
150 libwps::DebugFile &ascii);
151
155 bool readContents(WPXInputStreamPtr &input, std::string const &oleName,
156 WPXBinaryData &pict, WPSPosition &pos, libwps::DebugFile &ascii);
157
163 bool readCONTENTS(WPXInputStreamPtr &input, std::string const &oleName,
164 WPXBinaryData &pict, WPSPosition &pos, libwps::DebugFile &ascii);
165
166
168 std::string m_avoidOLE;
170 std::vector<std::string> m_unknownOLEs;
171
173 std::vector<WPXBinaryData> m_objects;
175 std::vector<WPSPosition> m_objectsPosition;
177 std::vector<int> m_objectsId;
178
180 shared_ptr<WPSOLEParserInternal::CompObj> m_compObjIdName;
181
182 };
183
184 #endif
185 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */