MWAWOLEParser.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* 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 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
/*
* 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 MWAW_OLE_PARSER_H
#define MWAW_OLE_PARSER_H
#include <string>
#include <vector>
#include <librevenge-stream/librevenge-stream.h>
#include "libmwaw_internal.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWDebug.hxx"
namespace MWAWOLEParserInternal
{
class CompObj;
struct State;
}
class MWAWOLEParser
{
public:
explicit MWAWOLEParser(std::string const &mainName, MWAWFontConverterPtr const &fontConverter, int fontId);
~MWAWOLEParser();
bool parse(MWAWInputStreamPtr fileInput);
void updateMetaData(librevenge::RVNGPropertyList &metaData) const;
int getFontEncoding() const;
std::vector<std::string> const &getNotParse() const;
std::vector<int> const &getObjectsId() const;
std::vector<MWAWPosition> const &getObjectsPosition() const;
std::vector<librevenge::RVNGBinaryData> const &getObjects() const;
std::vector<std::string> const &getObjectsType() const;
bool getObject(int id, librevenge::RVNGBinaryData &obj, MWAWPosition &pos, std::string &type) const;
void setObject(int id, librevenge::RVNGBinaryData const &obj, MWAWPosition const &pos,
std::string const &type);
bool readSummaryInformation(MWAWInputStreamPtr input, std::string const &oleName,
int &encoding, librevenge::RVNGPropertyList &pList,
libmwaw::DebugFile &ascii,
long endPos=-1) const;
protected:
bool readSummaryProperty(MWAWInputStreamPtr input, long endPos, int type,
libmwaw::DebugFile &ascii, libmwaw::DebugStream &f) const;
bool readSummaryPropertyString(MWAWInputStreamPtr input, long endPos, int type, librevenge::RVNGString &string,
libmwaw::DebugStream &f) const;
bool readSummaryPropertyLong(MWAWInputStreamPtr input, long endPos, int type, long &value,
libmwaw::DebugStream &f) const;
static bool readOle(MWAWInputStreamPtr ip, std::string const &oleName,
libmwaw::DebugFile &ascii);
static bool readMM(MWAWInputStreamPtr input, std::string const &oleName,
libmwaw::DebugFile &ascii);
static bool readObjInfo(MWAWInputStreamPtr input, std::string const &oleName,
libmwaw::DebugFile &ascii);
bool readCompObj(MWAWInputStreamPtr ip, std::string const &oleName,
libmwaw::DebugFile &ascii);
static bool isOlePres(MWAWInputStreamPtr ip, std::string const &oleName);
static bool readOlePres(MWAWInputStreamPtr ip, librevenge::RVNGBinaryData &data, MWAWPosition &pos,
libmwaw::DebugFile &ascii);
static bool isOle10Native(MWAWInputStreamPtr ip, std::string const &oleName);
static bool readOle10Native(MWAWInputStreamPtr ip, librevenge::RVNGBinaryData &data,
libmwaw::DebugFile &ascii);
bool readContents(MWAWInputStreamPtr input, std::string const &oleName,
librevenge::RVNGBinaryData &pict, MWAWPosition &pos, libmwaw::DebugFile &ascii);
bool readCONTENTS(MWAWInputStreamPtr input, std::string const &oleName,
librevenge::RVNGBinaryData &pict, MWAWPosition &pos, libmwaw::DebugFile &ascii);
std::string m_avoidOLE;
std::shared_ptr<MWAWOLEParserInternal::State> m_state;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWInputStream.hxx
MWAWOLEParserInternal::CompObj
Internal: internal method to compobj definition.
Definition MWAWOLEParser.cxx:56
MWAWOLEParser::MWAWOLEParser
MWAWOLEParser(std::string const &mainName, MWAWFontConverterPtr const &fontConverter, int fontId)
constructor
Definition MWAWOLEParser.cxx:244
MWAWOLEParser::getFontEncoding
int getFontEncoding() const
returns the font encoding find in SummaryInformation or -1
Definition MWAWOLEParser.cxx:254
MWAWOLEParser::readCONTENTS
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:1395
MWAWOLEParser::isOle10Native
static bool isOle10Native(MWAWInputStreamPtr ip, std::string const &oleName)
theOle10Native : basic Windows© picture, with no size
Definition MWAWOLEParser.cxx:1244
MWAWOLEParser::readCompObj
bool readCompObj(MWAWInputStreamPtr ip, std::string const &oleName, libmwaw::DebugFile &ascii)
the "CompObj" contains : UserType,ClipName,ProgIdName
Definition MWAWOLEParser.cxx:652
MWAWOLEParser::m_avoidOLE
std::string m_avoidOLE
if filled, does not parse content with this name
Definition MWAWOLEParser.hxx:186
MWAWOLEParser::readOlePres
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:1143
MWAWOLEParser::readSummaryProperty
bool readSummaryProperty(MWAWInputStreamPtr input, long endPos, int type, libmwaw::DebugFile &ascii, libmwaw::DebugStream &f) const
try to read a summary property
Definition MWAWOLEParser.cxx:979
MWAWOLEParser::getObjectsId
std::vector< int > const & getObjectsId() const
returns the list of id for which we have find a representation
Definition MWAWOLEParser.cxx:273
MWAWOLEParser::getObjectsType
std::vector< std::string > const & getObjectsType() const
returns the list of data type
Definition MWAWOLEParser.cxx:288
MWAWOLEParser::getObjectsPosition
std::vector< MWAWPosition > const & getObjectsPosition() const
returns the list of data positions which have been read
Definition MWAWOLEParser.cxx:278
MWAWOLEParser::readOle
static bool readOle(MWAWInputStreamPtr ip, std::string const &oleName, libmwaw::DebugFile &ascii)
the "Ole" small structure : unknown contain
Definition MWAWOLEParser.cxx:542
MWAWOLEParser::readMM
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:596
MWAWOLEParser::readSummaryInformation
bool readSummaryInformation(MWAWInputStreamPtr input, std::string const &oleName, int &encoding, librevenge::RVNGPropertyList &pList, libmwaw::DebugFile &ascii, long endPos=-1) const
the summary information and the doc summary information
Definition MWAWOLEParser.cxx:772
MWAWOLEParser::readSummaryPropertyLong
bool readSummaryPropertyLong(MWAWInputStreamPtr input, long endPos, int type, long &value, libmwaw::DebugStream &f) const
try to read a summary property: type 2,3,9,12,
Definition MWAWOLEParser.cxx:954
MWAWOLEParser::isOlePres
static bool isOlePres(MWAWInputStreamPtr ip, std::string const &oleName)
the OlePres001 seems to contain standart picture file and size
Definition MWAWOLEParser.cxx:1098
MWAWOLEParser::readOle10Native
static bool readOle10Native(MWAWInputStreamPtr ip, librevenge::RVNGBinaryData &data, libmwaw::DebugFile &ascii)
extracts the picture if it is possible
Definition MWAWOLEParser.cxx:1260
MWAWOLEParser::readObjInfo
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:575
MWAWOLEParser::getNotParse
std::vector< std::string > const & getNotParse() const
returns the list of unknown ole
Definition MWAWOLEParser.cxx:268
MWAWOLEParser::parse
bool parse(MWAWInputStreamPtr fileInput)
tries to parse basic OLE (excepted mainName)
Definition MWAWOLEParser.cxx:323
MWAWOLEParser::readSummaryPropertyString
bool readSummaryPropertyString(MWAWInputStreamPtr input, long endPos, int type, librevenge::RVNGString &string, libmwaw::DebugStream &f) const
try to read a summary property: type 1e
Definition MWAWOLEParser.cxx:922
MWAWOLEParser::updateMetaData
void updateMetaData(librevenge::RVNGPropertyList &metaData) const
update the meta data, using information find in SummaryInformation
Definition MWAWOLEParser.cxx:259
MWAWOLEParser::~MWAWOLEParser
~MWAWOLEParser()
destructor
Definition MWAWOLEParser.cxx:250
MWAWOLEParser::readContents
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:1298
MWAWOLEParser::getObjects
std::vector< librevenge::RVNGBinaryData > const & getObjects() const
returns the list of data which have been read
Definition MWAWOLEParser.cxx:283
MWAWOLEParser::setObject
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:306
MWAWOLEParser::getObject
bool getObject(int id, librevenge::RVNGBinaryData &obj, MWAWPosition &pos, std::string &type) const
returns the picture corresponding to an id
Definition MWAWOLEParser.cxx:293
MWAWOLEParser::m_state
std::shared_ptr< MWAWOLEParserInternal::State > m_state
the main state
Definition MWAWOLEParser.hxx:188
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition MWAWPosition.hxx:48
libmwaw::DebugFile
Definition MWAWDebug.hxx:66
libmwaw_internal.hxx
MWAWFontConverterPtr
std::shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition libmwaw_internal.hxx:545
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
MWAWOLEParserInternal
Low level: namespace used to define/store the data used by MWAWOLEParser.
Definition MWAWOLEParser.cxx:53
libmwaw::DebugStream
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition MWAWDebug.hxx:61
MWAWOLEParserInternal::State
Internal: internal state of a MWAWOLEParser.
Definition MWAWOLEParser.cxx:203