WPSOLEParser.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* libwps
* Version: MPL 2.0 / LGPLv2.1+
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Major Contributor(s):
* Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU Lesser General Public License Version 2.1 or later
* (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
* applicable instead of those above.
*
* For further information visit http://libwps.sourceforge.net
*/
/*
* freely inspired from istorage :
* ------------------------------------------------------------
* Generic OLE Zones furnished with a copy of the file header
*
* Compound Storage (32 bit version)
* Storage implementation
*
* This file contains the compound file implementation
* of the storage interface.
*
* Copyright 1999 Francis Beaudet
* Copyright 1999 Sylvain St-Germain
* Copyright 1999 Thuy Nguyen
* Copyright 2005 Mike McCormack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* ------------------------------------------------------------
*/
#ifndef WPS_OLE_PARSER_H
#define WPS_OLE_PARSER_H
#include <string>
#include <vector>
#include <libwpd-stream/WPXStream.h>
#include "libwps_internal.h"
#include "WPSDebug.h"
class WPXBinaryData;
namespace libwps
{
class Storage;
}
class WPSPosition;
namespace WPSOLEParserInternal
{
class CompObj;
}
class WPSOLEParser
{
public:
WPSOLEParser(const std::string &mainName);
~WPSOLEParser();
bool parse(shared_ptr<libwps::Storage> fileInput);
std::vector<std::string> const &getNotParse() const
{
return m_unknownOLEs;
}
std::vector<int> const &getObjectsId() const
{
return m_objectsId;
}
std::vector<WPSPosition> const &getObjectsPosition() const
{
return m_objectsPosition;
}
std::vector<WPXBinaryData> const &getObjects() const
{
return m_objects;
}
bool getObject(int id, WPXBinaryData &obj, WPSPosition &pos) const;
void setObject(int id, WPXBinaryData const &obj, WPSPosition const &pos);
protected:
bool readOle(WPXInputStreamPtr &ip, std::string const &oleName,
libwps::DebugFile &ascii);
bool readMM(WPXInputStreamPtr &input, std::string const &oleName,
libwps::DebugFile &ascii);
bool readObjInfo(WPXInputStreamPtr &input, std::string const &oleName,
libwps::DebugFile &ascii);
bool readCompObj(WPXInputStreamPtr &ip, std::string const &oleName,
libwps::DebugFile &ascii);
bool isOlePres(WPXInputStreamPtr &ip, std::string const &oleName);
bool readOlePres(WPXInputStreamPtr &ip, WPXBinaryData &data, WPSPosition &pos,
libwps::DebugFile &ascii);
bool isOle10Native(WPXInputStreamPtr &ip, std::string const &oleName);
bool readOle10Native(WPXInputStreamPtr &ip, WPXBinaryData &data,
libwps::DebugFile &ascii);
bool readContents(WPXInputStreamPtr &input, std::string const &oleName,
WPXBinaryData &pict, WPSPosition &pos, libwps::DebugFile &ascii);
bool readCONTENTS(WPXInputStreamPtr &input, std::string const &oleName,
WPXBinaryData &pict, WPSPosition &pos, libwps::DebugFile &ascii);
std::string m_avoidOLE;
std::vector<std::string> m_unknownOLEs;
std::vector<WPXBinaryData> m_objects;
std::vector<WPSPosition> m_objectsPosition;
std::vector<int> m_objectsId;
shared_ptr<WPSOLEParserInternal::CompObj> m_compObjIdName;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */