MWAWOLEParser.hxx
Go to the documentation of this file.
00001 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
00002 
00003 /* libmwaw
00004 * Version: MPL 2.0 / LGPLv2+
00005 *
00006 * The contents of this file are subject to the Mozilla Public License Version
00007 * 2.0 (the "License"); you may not use this file except in compliance with
00008 * the License or as specified alternatively below. You may obtain a copy of
00009 * the License at http://www.mozilla.org/MPL/
00010 *
00011 * Software distributed under the License is distributed on an "AS IS" basis,
00012 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013 * for the specific language governing rights and limitations under the
00014 * License.
00015 *
00016 * Major Contributor(s):
00017 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
00018 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
00019 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00020 * Copyright (C) 2006, 2007 Andrew Ziem
00021 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
00022 *
00023 *
00024 * All Rights Reserved.
00025 *
00026 * For minor contributions see the git repository.
00027 *
00028 * Alternatively, the contents of this file may be used under the terms of
00029 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
00030 * in which case the provisions of the LGPLv2+ are applicable
00031 * instead of those above.
00032 */
00033 
00034 /*
00035  *  freely inspired from istorage :
00036  * ------------------------------------------------------------
00037  *      Generic OLE Zones furnished with a copy of the file header
00038  *
00039  * Compound Storage (32 bit version)
00040  * Storage implementation
00041  *
00042  * This file contains the compound file implementation
00043  * of the storage interface.
00044  *
00045  * Copyright 1999 Francis Beaudet
00046  * Copyright 1999 Sylvain St-Germain
00047  * Copyright 1999 Thuy Nguyen
00048  * Copyright 2005 Mike McCormack
00049  *
00050  * This library is free software; you can redistribute it and/or
00051  * modify it under the terms of the GNU Lesser General Public
00052  * License as published by the Free Software Foundation; either
00053  * version 2.1 of the License, or (at your option) any later version.
00054  *
00055  * This library is distributed in the hope that it will be useful,
00056  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00057  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00058  * Lesser General Public License for more details.
00059  *
00060  * ------------------------------------------------------------
00061  */
00062 
00063 #ifndef MWAW_OLE_PARSER_H
00064 #define MWAW_OLE_PARSER_H
00065 
00066 #include <string>
00067 #include <vector>
00068 
00069 #include <libwpd-stream/libwpd-stream.h>
00070 
00071 #include "libmwaw_internal.hxx"
00072 #include "MWAWInputStream.hxx"
00073 
00074 #include "MWAWDebug.hxx"
00075 
00076 class WPXBinaryData;
00077 
00078 namespace MWAWOLEParserInternal
00079 {
00080 class CompObj;
00081 }
00082 
00086 class MWAWOLEParser
00087 {
00088 public:
00091   MWAWOLEParser(std::string mainName);
00092 
00094   ~MWAWOLEParser();
00095 
00098   bool parse(MWAWInputStreamPtr fileInput);
00099 
00101   std::vector<std::string> const &getNotParse() const {
00102     return m_unknownOLEs;
00103   }
00104 
00106   std::vector<int> const &getObjectsId() const {
00107     return m_objectsId;
00108   }
00110   std::vector<MWAWPosition> const &getObjectsPosition() const {
00111     return m_objectsPosition;
00112   }
00114   std::vector<WPXBinaryData> const &getObjects() const {
00115     return m_objects;
00116   }
00118   std::vector<std::string> const &getObjectsType() const {
00119     return m_objectsType;
00120   }
00121 
00123   bool getObject(int id, WPXBinaryData &obj, MWAWPosition &pos, std::string &type) const;
00124 
00128   void setObject(int id, WPXBinaryData const &obj, MWAWPosition const &pos,
00129                  std::string const &type);
00130 
00131 protected:
00132 
00134   static bool readOle(MWAWInputStreamPtr ip, std::string const &oleName,
00135                       libmwaw::DebugFile &ascii);
00137   static bool readMM(MWAWInputStreamPtr input, std::string const &oleName,
00138                      libmwaw::DebugFile &ascii);
00140   static bool readObjInfo(MWAWInputStreamPtr input, std::string const &oleName,
00141                           libmwaw::DebugFile &ascii);
00143   bool readCompObj(MWAWInputStreamPtr ip, std::string const &oleName,
00144                    libmwaw::DebugFile &ascii);
00145 
00147   static  bool isOlePres(MWAWInputStreamPtr ip, std::string const &oleName);
00149   static bool readOlePres(MWAWInputStreamPtr ip, WPXBinaryData &data, MWAWPosition &pos,
00150                           libmwaw::DebugFile &ascii);
00151 
00153   static bool isOle10Native(MWAWInputStreamPtr ip, std::string const &oleName);
00155   static bool readOle10Native(MWAWInputStreamPtr ip, WPXBinaryData &data,
00156                               libmwaw::DebugFile &ascii);
00157 
00161   bool readContents(MWAWInputStreamPtr input, std::string const &oleName,
00162                     WPXBinaryData &pict, MWAWPosition &pos, libmwaw::DebugFile &ascii);
00163 
00169   bool readCONTENTS(MWAWInputStreamPtr input, std::string const &oleName,
00170                     WPXBinaryData &pict, MWAWPosition &pos, libmwaw::DebugFile &ascii);
00171 
00172 
00174   std::string m_avoidOLE;
00176   std::vector<std::string> m_unknownOLEs;
00177 
00179   std::vector<WPXBinaryData> m_objects;
00181   std::vector<MWAWPosition> m_objectsPosition;
00183   std::vector<int> m_objectsId;
00185   std::vector<std::string> m_objectsType;
00186 
00188   shared_ptr<MWAWOLEParserInternal::CompObj> m_compObjIdName;
00189 
00190 };
00191 
00192 #endif
00193 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: