WPSOLEParser.h Source File documentation

- 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 <librevenge-stream/librevenge-stream.h>
62
63 #include "libwps_internal.h"
64
65 #include "WPSDebug.h"
66 #include "WPSPosition.h"
67
68 namespace libwps
69 {
70 class Storage;
71 }
72
73 namespace WPSOLEParserInternal
74 {
75 class CompObj;
76 }
77
79 struct WPSOLEParserObject
80 {
82 WPSOLEParserObject() : m_position(), m_data(), m_mime("image/pict")
83 {
84 }
86 WPSPosition m_position;
88 librevenge::RVNGBinaryData m_data;
90 std::string m_mime;
91 };
92
96 class WPSOLEParser
97 {
98 public:
101 WPSOLEParser(const std::string &mainName);
102
104 ~WPSOLEParser();
105
108 bool parse(RVNGInputStreamPtr fileInput);
109
111 std::vector<std::string> const &getNotParse() const
112 {
113 return m_unknownOLEs;
114 }
115
117 std::vector<int> const &getObjectsId() const
118 {
119 return m_objectsId;
120 }
122 std::vector<WPSOLEParserObject> const &getObjects() const
123 {
124 return m_objects;
125 }
126 protected:
127
129 static bool readOle(RVNGInputStreamPtr &ip, std::string const &oleName,
130 libwps::DebugFile &ascii);
132 static bool readMM(RVNGInputStreamPtr &input, std::string const &oleName,
133 libwps::DebugFile &ascii);
135 static bool readObjInfo(RVNGInputStreamPtr &input, std::string const &oleName,
136 libwps::DebugFile &ascii);
138 bool readCompObj(RVNGInputStreamPtr &ip, std::string const &oleName,
139 libwps::DebugFile &ascii);
140
142 static bool isOlePres(RVNGInputStreamPtr &ip, std::string const &oleName);
144 static bool readOlePres(RVNGInputStreamPtr &ip, librevenge::RVNGBinaryData &data,
145 WPSPosition &pos, libwps::DebugFile &ascii);
146
148 static bool isOle10Native(RVNGInputStreamPtr &ip, std::string const &oleName);
150 static bool readOle10Native(RVNGInputStreamPtr &ip, librevenge::RVNGBinaryData &data,
151 libwps::DebugFile &ascii);
152
156 static bool readContents(RVNGInputStreamPtr &input, std::string const &oleName,
157 librevenge::RVNGBinaryData &pict, WPSPosition &pos, libwps::DebugFile &ascii);
158
164 static bool readCONTENTS(RVNGInputStreamPtr &input, std::string const &oleName,
165 librevenge::RVNGBinaryData &pict, WPSPosition &pos, libwps::DebugFile &ascii);
166
168 static bool readMN0AndCheckWKS(RVNGInputStreamPtr &input, std::string const &oleName,
169 librevenge::RVNGBinaryData &wksData, libwps::DebugFile &ascii);
170
172 std::string m_avoidOLE;
174 std::vector<std::string> m_unknownOLEs;
175
177 std::vector<WPSOLEParserObject> m_objects;
179 std::vector<int> m_objectsId;
180
182 shared_ptr<WPSOLEParserInternal::CompObj> m_compObjIdName;
183
184 };
185
186 #endif
187 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPSOLEParser::getObjectsId
std::vector< int > const & getObjectsId() const
returns the list of id for which we have find a representation
Definition: WPSOLEParser.h:117
libwps
Definition: libwps_internal.cpp:37
WPSOLEParserObject::m_position
WPSPosition m_position
the position
Definition: WPSOLEParser.h:86
WPSOLEParserObject::WPSOLEParserObject
WPSOLEParserObject()
constructor
Definition: WPSOLEParser.h:82
libwps::DebugFile
Definition: WPSDebug.h:196
WPSOLEParserInternal
Definition: WPSOLEParser.cpp:84
WPSOLEParser::readCompObj
bool readCompObj(RVNGInputStreamPtr &ip, std::string const &oleName, libwps::DebugFile &ascii)
the "CompObj" contains : UserType,ClipName,ProgIdName
Definition: WPSOLEParser.cpp:565
WPSOLEParser::isOlePres
static bool isOlePres(RVNGInputStreamPtr &ip, std::string const &oleName)
the OlePres001 seems to contain standart picture file and size
Definition: WPSOLEParser.cpp:695
WPSOLEParserObject::m_mime
std::string m_mime
the mime type
Definition: WPSOLEParser.h:90
WPSOLEParser
a class used to parse some basic oles Tries to read the different ole parts and stores their contents...
Definition: WPSOLEParser.h:96
WPSOLEParser::readObjInfo
static bool readObjInfo(RVNGInputStreamPtr &input, std::string const &oleName, libwps::DebugFile &ascii)
the "ObjInfo" small structure : seems to contain 3 ints=0,3,4
Definition: WPSOLEParser.cpp:488
WPSOLEParser::readOlePres
static bool readOlePres(RVNGInputStreamPtr &ip, librevenge::RVNGBinaryData &data, WPSPosition &pos, libwps::DebugFile &ascii)
extracts the picture of OlePres001 if it is possible
Definition: WPSOLEParser.cpp:740
WPSOLEParser::WPSOLEParser
WPSOLEParser(const std::string &mainName)
constructor
Definition: WPSOLEParser.cpp:230
libwps_internal.h
WPSOLEParser::~WPSOLEParser
~WPSOLEParser()
destructor
Definition: WPSOLEParser.cpp:235
WPSOLEParserObject
small struct to store an object
Definition: WPSOLEParser.h:79
WPSOLEParser::m_objectsId
std::vector< int > m_objectsId
list of pictures id
Definition: WPSOLEParser.h:179
WPSOLEParser::m_objects
std::vector< WPSOLEParserObject > m_objects
list of pictures read
Definition: WPSOLEParser.h:177
WPSOLEParser::parse
bool parse(RVNGInputStreamPtr fileInput)
tries to parse basic OLE (excepted mainName)
Definition: WPSOLEParser.cpp:240
WPSOLEParser::readOle
static bool readOle(RVNGInputStreamPtr &ip, std::string const &oleName, libwps::DebugFile &ascii)
the "Ole" small structure : unknown contain
Definition: WPSOLEParser.cpp:453
WPSOLEParser::readMN0AndCheckWKS
static bool readMN0AndCheckWKS(RVNGInputStreamPtr &input, std::string const &oleName, librevenge::RVNGBinaryData &wksData, libwps::DebugFile &ascii)
the "MN0" small structure : can contains a WKS file...
Definition: WPSOLEParser.cpp:1125
RVNGInputStreamPtr
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:82
WPSOLEParser::readContents
static bool readContents(RVNGInputStreamPtr &input, std::string const &oleName, librevenge::RVNGBinaryData &pict, WPSPosition &pos, libwps::DebugFile &ascii)
the Contents : in general a picture : a PNG, an JPEG, a basic metafile, I find also a Word art pictur...
Definition: WPSOLEParser.cpp:906
WPSOLEParser::readCONTENTS
static bool readCONTENTS(RVNGInputStreamPtr &input, std::string const &oleName, librevenge::RVNGBinaryData &pict, WPSPosition &pos, libwps::DebugFile &ascii)
the CONTENTS : seems to store a header size, the header and then a object in EMF (with the same heade...
Definition: WPSOLEParser.cpp:1014
WPSOLEParserObject::m_data
librevenge::RVNGBinaryData m_data
the data
Definition: WPSOLEParser.h:88
WPSOLEParser::isOle10Native
static bool isOle10Native(RVNGInputStreamPtr &ip, std::string const &oleName)
theOle10Native : basic Windows© picture, with no size
Definition: WPSOLEParser.cpp:851
WPSOLEParser::readOle10Native
static bool readOle10Native(RVNGInputStreamPtr &ip, librevenge::RVNGBinaryData &data, libwps::DebugFile &ascii)
extracts the picture if it is possible
Definition: WPSOLEParser.cpp:867
WPSOLEParser::m_compObjIdName
shared_ptr< WPSOLEParserInternal::CompObj > m_compObjIdName
a smart ptr used to stored the list of compobj id->name
Definition: WPSOLEParser.h:182
WPSOLEParser::m_avoidOLE
std::string m_avoidOLE
if filled, does not parse content with this name
Definition: WPSOLEParser.h:172
WPSOLEParser::getObjects
std::vector< WPSOLEParserObject > const & getObjects() const
returns the list of data positions which have been read
Definition: WPSOLEParser.h:122
WPSPosition.h
WPSOLEParser::m_unknownOLEs
std::vector< std::string > m_unknownOLEs
list of ole which can not be parsed
Definition: WPSOLEParser.h:174
WPSPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: WPSPosition.h:39
WPSOLEParser::getNotParse
std::vector< std::string > const & getNotParse() const
returns the list of unknown ole
Definition: WPSOLEParser.h:111
WPSDebug.h
WPSOLEParser::readMM
static bool readMM(RVNGInputStreamPtr &input, std::string const &oleName, libwps::DebugFile &ascii)
the "MM" small structure : seems to contain the file versions
Definition: WPSOLEParser.cpp:509