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 <librevenge-stream/librevenge-stream.h>
00070 
00071 #include "libmwaw_internal.hxx"
00072 #include "MWAWInputStream.hxx"
00073 
00074 #include "MWAWDebug.hxx"
00075 
00076 namespace MWAWOLEParserInternal
00077 {
00078 class CompObj;
00079 }
00080 
00084 class MWAWOLEParser
00085 {
00086 public:
00089   MWAWOLEParser(std::string mainName);
00090 
00092   ~MWAWOLEParser();
00093 
00096   bool parse(MWAWInputStreamPtr fileInput);
00097 
00099   std::vector<std::string> const &getNotParse() const
00100   {
00101     return m_unknownOLEs;
00102   }
00103 
00105   std::vector<int> const &getObjectsId() const
00106   {
00107     return m_objectsId;
00108   }
00110   std::vector<MWAWPosition> const &getObjectsPosition() const
00111   {
00112     return m_objectsPosition;
00113   }
00115   std::vector<librevenge::RVNGBinaryData> const &getObjects() const
00116   {
00117     return m_objects;
00118   }
00120   std::vector<std::string> const &getObjectsType() const
00121   {
00122     return m_objectsType;
00123   }
00124 
00126   bool getObject(int id, librevenge::RVNGBinaryData &obj, MWAWPosition &pos, std::string &type) const;
00127 
00131   void setObject(int id, librevenge::RVNGBinaryData const &obj, MWAWPosition const &pos,
00132                  std::string const &type);
00133 
00134 protected:
00135 
00137   static bool readOle(MWAWInputStreamPtr ip, std::string const &oleName,
00138                       libmwaw::DebugFile &ascii);
00140   static bool readMM(MWAWInputStreamPtr input, std::string const &oleName,
00141                      libmwaw::DebugFile &ascii);
00143   static bool readObjInfo(MWAWInputStreamPtr input, std::string const &oleName,
00144                           libmwaw::DebugFile &ascii);
00146   bool readCompObj(MWAWInputStreamPtr ip, std::string const &oleName,
00147                    libmwaw::DebugFile &ascii);
00148 
00150   static  bool isOlePres(MWAWInputStreamPtr ip, std::string const &oleName);
00152   static bool readOlePres(MWAWInputStreamPtr ip, librevenge::RVNGBinaryData &data, MWAWPosition &pos,
00153                           libmwaw::DebugFile &ascii);
00154 
00156   static bool isOle10Native(MWAWInputStreamPtr ip, std::string const &oleName);
00158   static bool readOle10Native(MWAWInputStreamPtr ip, librevenge::RVNGBinaryData &data,
00159                               libmwaw::DebugFile &ascii);
00160 
00164   bool readContents(MWAWInputStreamPtr input, std::string const &oleName,
00165                     librevenge::RVNGBinaryData &pict, MWAWPosition &pos, libmwaw::DebugFile &ascii);
00166 
00172   bool readCONTENTS(MWAWInputStreamPtr input, std::string const &oleName,
00173                     librevenge::RVNGBinaryData &pict, MWAWPosition &pos, libmwaw::DebugFile &ascii);
00174 
00175 
00177   std::string m_avoidOLE;
00179   std::vector<std::string> m_unknownOLEs;
00180 
00182   std::vector<librevenge::RVNGBinaryData> m_objects;
00184   std::vector<MWAWPosition> m_objectsPosition;
00186   std::vector<int> m_objectsId;
00188   std::vector<std::string> m_objectsType;
00189 
00191   shared_ptr<MWAWOLEParserInternal::CompObj> m_compObjIdName;
00192 
00193 };
00194 
00195 #endif
00196 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: