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  * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
4  * Copyright (C) 2006, 2007 Andrew Ziem
5  * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
6  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
7  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  *
23  * For further information visit http://libwps.sourceforge.net
24  */
25 
26 /* "This product is not manufactured, approved, or supported by
27  * Corel Corporation or Corel Corporation Limited."
28  */
29 
30 /*
31  * freely inspired from istorage :
32  * ------------------------------------------------------------
33  * Generic OLE Zones furnished with a copy of the file header
34  *
35  * Compound Storage (32 bit version)
36  * Storage implementation
37  *
38  * This file contains the compound file implementation
39  * of the storage interface.
40  *
41  * Copyright 1999 Francis Beaudet
42  * Copyright 1999 Sylvain St-Germain
43  * Copyright 1999 Thuy Nguyen
44  * Copyright 2005 Mike McCormack
45  *
46  * This library is free software; you can redistribute it and/or
47  * modify it under the terms of the GNU Lesser General Public
48  * License as published by the Free Software Foundation; either
49  * version 2.1 of the License, or (at your option) any later version.
50  *
51  * This library is distributed in the hope that it will be useful,
52  * but WITHOUT ANY WARRANTY; without even the implied warranty of
53  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
54  * Lesser General Public License for more details.
55  *
56  * ------------------------------------------------------------
57  */
58 
59 #ifndef WPS_OLE_PARSER_H
60 #define WPS_OLE_PARSER_H
61 
62 #include <string>
63 #include <vector>
64 
65 #include <libwpd-stream/WPXStream.h>
66 
67 #include "libwps_internal.h"
68 
69 #include "WPSDebug.h"
70 
71 class WPXBinaryData;
72 
73 namespace libwps
74 {
75 class Storage;
76 }
77 class WPSPosition;
78 namespace WPSOLEParserInternal
79 {
80 class CompObj;
81 }
82 
87 {
88 public:
91  WPSOLEParser(const std::string &mainName);
92 
94  ~WPSOLEParser();
95 
98  bool parse(shared_ptr<libwps::Storage> fileInput);
99 
101  std::vector<std::string> const &getNotParse() const
102  {
103  return m_unknownOLEs;
104  }
105 
107  std::vector<int> const &getObjectsId() const
108  {
109  return m_objectsId;
110  }
112  std::vector<WPSPosition> const &getObjectsPosition() const
113  {
114  return m_objectsPosition;
115  }
117  std::vector<WPXBinaryData> const &getObjects() const
118  {
119  return m_objects;
120  }
121 
123  bool getObject(int id, WPXBinaryData &obj, WPSPosition &pos) const;
124 
128  void setObject(int id, WPXBinaryData const &obj, WPSPosition const &pos);
129 protected:
130 
132  bool readOle(WPXInputStreamPtr &ip, std::string const &oleName,
133  libwps::DebugFile &ascii);
135  bool readMM(WPXInputStreamPtr &input, std::string const &oleName,
136  libwps::DebugFile &ascii);
138  bool readObjInfo(WPXInputStreamPtr &input, std::string const &oleName,
139  libwps::DebugFile &ascii);
141  bool readCompObj(WPXInputStreamPtr &ip, std::string const &oleName,
142  libwps::DebugFile &ascii);
143 
145  bool isOlePres(WPXInputStreamPtr &ip, std::string const &oleName);
147  bool readOlePres(WPXInputStreamPtr &ip, WPXBinaryData &data, WPSPosition &pos,
148  libwps::DebugFile &ascii);
149 
151  bool isOle10Native(WPXInputStreamPtr &ip, std::string const &oleName);
153  bool readOle10Native(WPXInputStreamPtr &ip, WPXBinaryData &data,
154  libwps::DebugFile &ascii);
155 
159  bool readContents(WPXInputStreamPtr &input, std::string const &oleName,
160  WPXBinaryData &pict, WPSPosition &pos, libwps::DebugFile &ascii);
161 
167  bool readCONTENTS(WPXInputStreamPtr &input, std::string const &oleName,
168  WPXBinaryData &pict, WPSPosition &pos, libwps::DebugFile &ascii);
169 
170 
172  std::string m_avoidOLE;
174  std::vector<std::string> m_unknownOLEs;
175 
177  std::vector<WPXBinaryData> m_objects;
179  std::vector<WPSPosition> m_objectsPosition;
181  std::vector<int> m_objectsId;
182 
184  shared_ptr<WPSOLEParserInternal::CompObj> m_compObjIdName;
185 
186 };
187 
188 #endif
189 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */

Generated on Wed Aug 8 2012 16:07:57 for libwps by doxygen 1.8.1.2