MWAWOLEParser.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33
34 /*
35 * freely inspired from istorage :
36 * ------------------------------------------------------------
37 * Generic OLE Zones furnished with a copy of the file header
38 *
39 * Compound Storage (32 bit version)
40 * Storage implementation
41 *
42 * This file contains the compound file implementation
43 * of the storage interface.
44 *
45 * Copyright 1999 Francis Beaudet
46 * Copyright 1999 Sylvain St-Germain
47 * Copyright 1999 Thuy Nguyen
48 * Copyright 2005 Mike McCormack
49 *
50 * This library is free software; you can redistribute it and/or
51 * modify it under the terms of the GNU Lesser General Public
52 * License as published by the Free Software Foundation; either
53 * version 2.1 of the License, or (at your option) any later version.
54 *
55 * This library is distributed in the hope that it will be useful,
56 * but WITHOUT ANY WARRANTY; without even the implied warranty of
57 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
58 * Lesser General Public License for more details.
59 *
60 * ------------------------------------------------------------
61 */
62
63 #ifndef MWAW_OLE_PARSER_H
64 #define MWAW_OLE_PARSER_H
65
66 #include <string>
67 #include <vector>
68
69 #include <librevenge-stream/librevenge-stream.h>
70
71 #include "libmwaw_internal.hxx"
72 #include "MWAWInputStream.hxx"
73
74 #include "MWAWDebug.hxx"
75
76 namespace MWAWOLEParserInternal
77 {
78 class CompObj;
79 struct State;
80 }
81
85 class MWAWOLEParser
86 {
87 public:
93 explicit MWAWOLEParser(std::string const &mainName, MWAWFontConverterPtr const &fontConverter, int fontId);
94
96 ~MWAWOLEParser();
97
100 bool parse(MWAWInputStreamPtr fileInput);
102 void updateMetaData(librevenge::RVNGPropertyList &metaData) const;
104 int getFontEncoding() const;
106 std::vector<std::string> const &getNotParse() const;
108 std::vector<int> const &getObjectsId() const;
110 std::vector<MWAWPosition> const &getObjectsPosition() const;
112 std::vector<librevenge::RVNGBinaryData> const &getObjects() const;
114 std::vector<std::string> const &getObjectsType() const;
115
117 bool getObject(int id, librevenge::RVNGBinaryData &obj, MWAWPosition &pos, std::string &type) const;
118
122 void setObject(int id, librevenge::RVNGBinaryData const &obj, MWAWPosition const &pos,
123 std::string const &type);
124
125 protected:
127 bool readSummaryInformation(MWAWInputStreamPtr input, std::string const &oleName,
128 int &encoding, librevenge::RVNGPropertyList &pList,
129 libmwaw::DebugFile &ascii) const;
131 bool readSummaryProperty(MWAWInputStreamPtr input, long endPos, int type,
132 libmwaw::DebugFile &ascii, libmwaw::DebugStream &f) const;
134 bool readSummaryPropertyString(MWAWInputStreamPtr input, long endPos, int type, librevenge::RVNGString &string,
135 libmwaw::DebugStream &f) const;
137 bool readSummaryPropertyLong(MWAWInputStreamPtr input, long endPos, int type, long &value,
138 libmwaw::DebugStream &f) const;
139
141 static bool readOle(MWAWInputStreamPtr ip, std::string const &oleName,
142 libmwaw::DebugFile &ascii);
144 static bool readMM(MWAWInputStreamPtr input, std::string const &oleName,
145 libmwaw::DebugFile &ascii);
147 static bool readObjInfo(MWAWInputStreamPtr input, std::string const &oleName,
148 libmwaw::DebugFile &ascii);
150 bool readCompObj(MWAWInputStreamPtr ip, std::string const &oleName,
151 libmwaw::DebugFile &ascii);
152
154 static bool isOlePres(MWAWInputStreamPtr ip, std::string const &oleName);
156 static bool readOlePres(MWAWInputStreamPtr ip, librevenge::RVNGBinaryData &data, MWAWPosition &pos,
157 libmwaw::DebugFile &ascii);
158
160 static bool isOle10Native(MWAWInputStreamPtr ip, std::string const &oleName);
162 static bool readOle10Native(MWAWInputStreamPtr ip, librevenge::RVNGBinaryData &data,
163 libmwaw::DebugFile &ascii);
164
168 bool readContents(MWAWInputStreamPtr input, std::string const &oleName,
169 librevenge::RVNGBinaryData &pict, MWAWPosition &pos, libmwaw::DebugFile &ascii);
170
176 bool readCONTENTS(MWAWInputStreamPtr input, std::string const &oleName,
177 librevenge::RVNGBinaryData &pict, MWAWPosition &pos, libmwaw::DebugFile &ascii);
178
179
181 std::string m_avoidOLE;
183 std::shared_ptr<MWAWOLEParserInternal::State> m_state;
184 };
185
186 #endif
187 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
libmwaw_internal.hxx
libmwaw::DebugFile
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:65
MWAWOLEParserInternal
Low level: namespace used to define/store the data used by MWAWOLEParser.
Definition: MWAWOLEParser.cxx:52
MWAWOLEParser
a class used to parse some basic oles Tries to read the different ole parts and stores their contents...
Definition: MWAWOLEParser.hxx:85
MWAWOLEParser::m_state
std::shared_ptr< MWAWOLEParserInternal::State > m_state
the main state
Definition: MWAWOLEParser.hxx:183
MWAWOLEParser::m_avoidOLE
std::string m_avoidOLE
if filled, does not parse content with this name
Definition: MWAWOLEParser.hxx:181
MWAWDebug.hxx
MWAWInputStream.hxx
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:547
MWAWFontConverterPtr
std::shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition: libmwaw_internal.hxx:539
libmwaw::DebugStream
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition: MWAWDebug.hxx:61
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47