| 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ |
| 2 | /* libwps |
| 3 | * Version: MPL 2.0 / LGPLv2.1+ |
| 4 | * |
| 5 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 6 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 7 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 8 | * |
| 9 | * Major Contributor(s): |
| 10 | * Copyright (C) 2009, 2011 Alonso Laurent ([email protected]) |
| 11 | * Copyright (C) 2006, 2007 Andrew Ziem |
| 12 | * Copyright (C) 2004-2006 Fridrich Strba ([email protected]) |
| 13 | * Copyright (C) 2004 Marc Maurer ([email protected]) |
| 14 | * Copyright (C) 2003-2005 William Lachance ([email protected]) |
| 15 | * |
| 16 | * For minor contributions see the git repository. |
| 17 | * |
| 18 | * Alternatively, the contents of this file may be used under the terms |
| 19 | * of the GNU Lesser General Public License Version 2.1 or later |
| 20 | * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are |
| 21 | * applicable instead of those above. |
| 22 | * |
| 23 | * For further information visit http://libwps.sourceforge.net |
| 24 | */ |
| 25 | |
| 26 | /* |
| 27 | */ |
| 28 | |
| 29 | #ifndef WPS_OLE1_PARSER_H |
| 30 | #define WPS_OLE1_PARSER_H |
| 31 | |
| 32 | #include <string> |
| 33 | |
| 34 | #include <librevenge-stream/librevenge-stream.h> |
| 35 | |
| 36 | #include "libwps_internal.h" |
| 37 | #include "libwps_tools_win.h" |
| 38 | |
| 39 | namespace WPSOLE1ParserInternal |
| 40 | { |
| 41 | struct State; |
| 42 | struct OLEZone; |
| 43 | } |
| 44 | |
| 45 | /** \brief a class used to parse a container which is used by Lotus123 (and also by RagTime). |
| 46 | |
| 47 | \note I suppose that this is related to some OLE1 format, but I am not sure. |
| 48 | */ |
| 49 | class WPSOLE1Parser |
| 50 | { |
| 51 | public: |
| 52 | /** constructor knowing the file stream */ |
| 53 | explicit WPSOLE1Parser(std::shared_ptr<WPSStream> const &fileStream); |
| 54 | |
| 55 | /** destructor */ |
| 56 | ~WPSOLE1Parser(); |
| 57 | |
| 58 | //! try to find the different zones |
| 59 | bool createZones(); |
| 60 | |
| 61 | /** try to return a string corresponding to a name: |
| 62 | - WK3, FM3, lotus 123 v5 main file part |
| 63 | - 123, lotus 123 v6+ main file part |
| 64 | - CR3, maybe some database ? |
| 65 | - Doc Info Object (its children defines author, ...) |
| 66 | - WCHChart some Chart |
| 67 | - Lotus:TOOLS:ByteStream some object |
| 68 | */ |
| 69 | std::shared_ptr<WPSStream> getStreamForName(std::string const &name) const; |
| 70 | /** try to return a string corresponding to some id */ |
| 71 | std::shared_ptr<WPSStream> getStreamForId(int id) const; |
| 72 | /** try to retrieve the meta data */ |
| 73 | bool updateMetaData(librevenge::RVNGPropertyList &list, libwps_tools_win::Font::Type encoding) const; |
| 74 | /** try to retrieve the content of a graphic, knowing it local id */ |
| 75 | bool updateEmbeddedObject(int id, WPSEmbeddedObject &object) const; |
| 76 | |
| 77 | protected: |
| 78 | /** try to update the zone name */ |
| 79 | bool updateZoneNames(WPSOLE1ParserInternal::OLEZone &zone) const; |
| 80 | /// try to return a stream correponding to a zone |
| 81 | std::shared_ptr<WPSStream> getStream(WPSOLE1ParserInternal::OLEZone const &zone) const; |
| 82 | /// check for unparsed zone |
| 83 | void checkIfParsed(WPSOLE1ParserInternal::OLEZone const &zone) const; |
| 84 | |
| 85 | private: |
| 86 | //! a smart ptr used to stored the file data |
| 87 | std::shared_ptr<WPSOLE1ParserInternal::State> m_state; |
| 88 | }; |
| 89 | |
| 90 | #endif |
| 91 | /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ |