WPSOLEParser.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* libwps
00003  * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
00004  * Copyright (C) 2006, 2007 Andrew Ziem
00005  * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00006  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
00007  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Library General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Library General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Library General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
00022  *
00023  * For further information visit http://libwps.sourceforge.net
00024  */
00025 
00026 /* "This product is not manufactured, approved, or supported by
00027  * Corel Corporation or Corel Corporation Limited."
00028  */
00029 
00030 /*
00031  *  freely inspired from istorage :
00032  * ------------------------------------------------------------
00033  *      Generic OLE Zones furnished with a copy of the file header
00034  *
00035  * Compound Storage (32 bit version)
00036  * Storage implementation
00037  *
00038  * This file contains the compound file implementation
00039  * of the storage interface.
00040  *
00041  * Copyright 1999 Francis Beaudet
00042  * Copyright 1999 Sylvain St-Germain
00043  * Copyright 1999 Thuy Nguyen
00044  * Copyright 2005 Mike McCormack
00045  *
00046  * This library is free software; you can redistribute it and/or
00047  * modify it under the terms of the GNU Lesser General Public
00048  * License as published by the Free Software Foundation; either
00049  * version 2.1 of the License, or (at your option) any later version.
00050  *
00051  * This library is distributed in the hope that it will be useful,
00052  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00053  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00054  * Lesser General Public License for more details.
00055  *
00056  * ------------------------------------------------------------
00057  */
00058 
00059 #ifndef WPS_OLE_PARSER_H
00060 #define WPS_OLE_PARSER_H
00061 
00062 #include <string>
00063 #include <vector>
00064 
00065 #include <libwpd-stream/WPXStream.h>
00066 
00067 #include "libwps_internal.h"
00068 
00069 #include "WPSDebug.h"
00070 
00071 class WPXBinaryData;
00072 
00073 namespace libwps
00074 {
00075 class Storage;
00076 }
00077 class WPSPosition;
00078 namespace WPSOLEParserInternal
00079 {
00080 class CompObj;
00081 }
00082 
00086 class WPSOLEParser
00087 {
00088 public:
00091         WPSOLEParser(const std::string &mainName);
00092 
00094         ~WPSOLEParser();
00095 
00098         bool parse(shared_ptr<libwps::Storage> fileInput);
00099 
00101         std::vector<std::string> const &getNotParse() const
00102         {
00103                 return m_unknownOLEs;
00104         }
00105 
00107         std::vector<int> const &getObjectsId() const
00108         {
00109                 return m_objectsId;
00110         }
00112         std::vector<WPSPosition> const &getObjectsPosition() const
00113         {
00114                 return m_objectsPosition;
00115         }
00117         std::vector<WPXBinaryData> const &getObjects() const
00118         {
00119                 return m_objects;
00120         }
00121 
00123         bool getObject(int id, WPXBinaryData &obj, WPSPosition &pos) const;
00124 
00128         void setObject(int id, WPXBinaryData const &obj, WPSPosition const &pos);
00129 protected:
00130 
00132         bool readOle(WPXInputStreamPtr &ip, std::string const &oleName,
00133                      libwps::DebugFile &ascii);
00135         bool readMM(WPXInputStreamPtr &input, std::string const &oleName,
00136                     libwps::DebugFile &ascii);
00138         bool readObjInfo(WPXInputStreamPtr &input, std::string const &oleName,
00139                          libwps::DebugFile &ascii);
00141         bool readCompObj(WPXInputStreamPtr &ip, std::string const &oleName,
00142                          libwps::DebugFile &ascii);
00143 
00145         bool isOlePres(WPXInputStreamPtr &ip, std::string const &oleName);
00147         bool readOlePres(WPXInputStreamPtr &ip, WPXBinaryData &data, WPSPosition &pos,
00148                          libwps::DebugFile &ascii);
00149 
00151         bool isOle10Native(WPXInputStreamPtr &ip, std::string const &oleName);
00153         bool readOle10Native(WPXInputStreamPtr &ip, WPXBinaryData &data,
00154                              libwps::DebugFile &ascii);
00155 
00159         bool readContents(WPXInputStreamPtr &input, std::string const &oleName,
00160                           WPXBinaryData &pict, WPSPosition &pos, libwps::DebugFile &ascii);
00161 
00167         bool readCONTENTS(WPXInputStreamPtr &input, std::string const &oleName,
00168                           WPXBinaryData &pict, WPSPosition &pos, libwps::DebugFile &ascii);
00169 
00170 
00172         std::string m_avoidOLE;
00174         std::vector<std::string> m_unknownOLEs;
00175 
00177         std::vector<WPXBinaryData> m_objects;
00179         std::vector<WPSPosition> m_objectsPosition;
00181         std::vector<int> m_objectsId;
00182 
00184         shared_ptr<WPSOLEParserInternal::CompObj> m_compObjIdName;
00185 
00186 };
00187 
00188 #endif
00189 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */