MWAWOLEParser.hxx
Go to the documentation of this file.
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 (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
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 /*
35  * freely inspired from istorage :
36  * ------------------------------------------------------------
37  * Generic OLE Zones furnished with a copy of the file header
38  *
39  * Compound Storage (32 bit version)
40  * Storage implementation
41  *
42  * This file contains the compound file implementation
43  * of the storage interface.
44  *
45  * Copyright 1999 Francis Beaudet
46  * Copyright 1999 Sylvain St-Germain
47  * Copyright 1999 Thuy Nguyen
48  * Copyright 2005 Mike McCormack
49  *
50  * This library is free software; you can redistribute it and/or
51  * modify it under the terms of the GNU Lesser General Public
52  * License as published by the Free Software Foundation; either
53  * version 2.1 of the License, or (at your option) any later version.
54  *
55  * This library is distributed in the hope that it will be useful,
56  * but WITHOUT ANY WARRANTY; without even the implied warranty of
57  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
58  * Lesser General Public License for more details.
59  *
60  * ------------------------------------------------------------
61  */
62 
63 #ifndef MWAW_OLE_PARSER_H
64 #define MWAW_OLE_PARSER_H
65 
66 #include <string>
67 #include <vector>
68 
69 #include <librevenge-stream/librevenge-stream.h>
70 
71 #include "libmwaw_internal.hxx"
72 #include "MWAWInputStream.hxx"
73 
74 #include "MWAWDebug.hxx"
75 
76 namespace MWAWOLEParserInternal
77 {
78 class CompObj;
79 }
80 
85 {
86 public:
89  MWAWOLEParser(std::string mainName);
90 
93 
96  bool parse(MWAWInputStreamPtr fileInput);
97 
99  std::vector<std::string> const &getNotParse() const
100  {
101  return m_unknownOLEs;
102  }
103 
105  std::vector<int> const &getObjectsId() const
106  {
107  return m_objectsId;
108  }
110  std::vector<MWAWPosition> const &getObjectsPosition() const
111  {
112  return m_objectsPosition;
113  }
115  std::vector<librevenge::RVNGBinaryData> const &getObjects() const
116  {
117  return m_objects;
118  }
120  std::vector<std::string> const &getObjectsType() const
121  {
122  return m_objectsType;
123  }
124 
126  bool getObject(int id, librevenge::RVNGBinaryData &obj, MWAWPosition &pos, std::string &type) const;
127 
131  void setObject(int id, librevenge::RVNGBinaryData const &obj, MWAWPosition const &pos,
132  std::string const &type);
133 
134 protected:
135 
137  static bool readOle(MWAWInputStreamPtr ip, std::string const &oleName,
138  libmwaw::DebugFile &ascii);
140  static bool readMM(MWAWInputStreamPtr input, std::string const &oleName,
141  libmwaw::DebugFile &ascii);
143  static bool readObjInfo(MWAWInputStreamPtr input, std::string const &oleName,
144  libmwaw::DebugFile &ascii);
146  bool readCompObj(MWAWInputStreamPtr ip, std::string const &oleName,
147  libmwaw::DebugFile &ascii);
148 
150  static bool isOlePres(MWAWInputStreamPtr ip, std::string const &oleName);
152  static bool readOlePres(MWAWInputStreamPtr ip, librevenge::RVNGBinaryData &data, MWAWPosition &pos,
153  libmwaw::DebugFile &ascii);
154 
156  static bool isOle10Native(MWAWInputStreamPtr ip, std::string const &oleName);
158  static bool readOle10Native(MWAWInputStreamPtr ip, librevenge::RVNGBinaryData &data,
159  libmwaw::DebugFile &ascii);
160 
164  bool readContents(MWAWInputStreamPtr input, std::string const &oleName,
165  librevenge::RVNGBinaryData &pict, MWAWPosition &pos, libmwaw::DebugFile &ascii);
166 
172  bool readCONTENTS(MWAWInputStreamPtr input, std::string const &oleName,
173  librevenge::RVNGBinaryData &pict, MWAWPosition &pos, libmwaw::DebugFile &ascii);
174 
175 
177  std::string m_avoidOLE;
179  std::vector<std::string> m_unknownOLEs;
180 
182  std::vector<librevenge::RVNGBinaryData> m_objects;
184  std::vector<MWAWPosition> m_objectsPosition;
186  std::vector<int> m_objectsId;
188  std::vector<std::string> m_objectsType;
189 
191  shared_ptr<MWAWOLEParserInternal::CompObj> m_compObjIdName;
192 
193 };
194 
195 #endif
196 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
bool getObject(int id, librevenge::RVNGBinaryData &obj, MWAWPosition &pos, std::string &type) const
returns the picture corresponding to an id
Definition: MWAWOLEParser.cxx:248
std::vector< std::string > m_objectsType
list of picture type
Definition: MWAWOLEParser.hxx:188
static bool readOle(MWAWInputStreamPtr ip, std::string const &oleName, libmwaw::DebugFile &ascii)
the "Ole" small structure : unknown contain
Definition: MWAWOLEParser.cxx:488
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:65
std::vector< librevenge::RVNGBinaryData > m_objects
list of pictures read
Definition: MWAWOLEParser.hxx:182
std::vector< std::string > m_unknownOLEs
list of ole which can not be parsed
Definition: MWAWOLEParser.hxx:179
bool parse(MWAWInputStreamPtr fileInput)
tries to parse basic OLE (excepted mainName)
Definition: MWAWOLEParser.cxx:278
static bool readOlePres(MWAWInputStreamPtr ip, librevenge::RVNGBinaryData &data, MWAWPosition &pos, libmwaw::DebugFile &ascii)
extracts the picture of OlePres001 if it is possible
Definition: MWAWOLEParser.cxx:764
std::vector< std::string > const & getNotParse() const
returns the list of unknown ole
Definition: MWAWOLEParser.hxx:99
static bool readMM(MWAWInputStreamPtr input, std::string const &oleName, libmwaw::DebugFile &ascii)
the "MM" small structure : seems to contain the file versions
Definition: MWAWOLEParser.cxx:542
bool readContents(MWAWInputStreamPtr input, std::string const &oleName, librevenge::RVNGBinaryData &pict, MWAWPosition &pos, libmwaw::DebugFile &ascii)
the Contents : in general a picture : a PNG, an JPEG, a basic metafile, I find also a Word art pictur...
Definition: MWAWOLEParser.cxx:919
~MWAWOLEParser()
destructor
Definition: MWAWOLEParser.cxx:244
Low level: namespace used to define/store the data used by MWAWOLEParser.
Definition: MWAWOLEParser.cxx:94
std::vector< std::string > const & getObjectsType() const
returns the list of data type
Definition: MWAWOLEParser.hxx:120
static bool isOlePres(MWAWInputStreamPtr ip, std::string const &oleName)
the OlePres001 seems to contain standart picture file and size
Definition: MWAWOLEParser.cxx:719
a class used to parse some basic oles Tries to read the different ole parts and stores their contents...
Definition: MWAWOLEParser.hxx:84
std::vector< MWAWPosition > const & getObjectsPosition() const
returns the list of data positions which have been read
Definition: MWAWOLEParser.hxx:110
std::string m_avoidOLE
if filled, does not parse content with this name
Definition: MWAWOLEParser.hxx:177
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:439
void setObject(int id, librevenge::RVNGBinaryData const &obj, MWAWPosition const &pos, std::string const &type)
sets an object just in case, the external parsing find another representation
Definition: MWAWOLEParser.cxx:261
static bool readOle10Native(MWAWInputStreamPtr ip, librevenge::RVNGBinaryData &data, libmwaw::DebugFile &ascii)
extracts the picture if it is possible
Definition: MWAWOLEParser.cxx:881
bool readCompObj(MWAWInputStreamPtr ip, std::string const &oleName, libmwaw::DebugFile &ascii)
the "CompObj" contains : UserType,ClipName,ProgIdName
Definition: MWAWOLEParser.cxx:599
std::vector< MWAWPosition > m_objectsPosition
list of picture size ( if known)
Definition: MWAWOLEParser.hxx:184
std::vector< int > const & getObjectsId() const
returns the list of id for which we have find a representation
Definition: MWAWOLEParser.hxx:105
std::vector< int > m_objectsId
list of pictures id
Definition: MWAWOLEParser.hxx:186
MWAWOLEParser(std::string mainName)
constructor
Definition: MWAWOLEParser.cxx:238
shared_ptr< MWAWOLEParserInternal::CompObj > m_compObjIdName
a smart ptr used to stored the list of compobj id->name
Definition: MWAWOLEParser.hxx:191
std::vector< librevenge::RVNGBinaryData > const & getObjects() const
returns the list of data which have been read
Definition: MWAWOLEParser.hxx:115
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
static bool readObjInfo(MWAWInputStreamPtr input, std::string const &oleName, libmwaw::DebugFile &ascii)
the "ObjInfo" small structure : seems to contain 3 ints=0,3,4
Definition: MWAWOLEParser.cxx:521
static bool isOle10Native(MWAWInputStreamPtr ip, std::string const &oleName)
theOle10Native : basic Windows© picture, with no size
Definition: MWAWOLEParser.cxx:865
bool readCONTENTS(MWAWInputStreamPtr input, std::string const &oleName, librevenge::RVNGBinaryData &pict, MWAWPosition &pos, libmwaw::DebugFile &ascii)
the CONTENTS : seems to store a header size, the header and then a object in EMF (with the same heade...
Definition: MWAWOLEParser.cxx:1018

Generated on Thu Jul 9 2015 20:26:36 for libmwaw by doxygen 1.8.8