| 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_OLE_OBJECT_H |
| 30 | #define WPS_OLE_OBJECT_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 | /** \brief a class used to parse/retrieve an OLE object |
| 40 | */ |
| 41 | class WPSOLEObject |
| 42 | { |
| 43 | public: |
| 44 | /** constructor knowing the file stream */ |
| 45 | WPSOLEObject() {} |
| 46 | |
| 47 | /** destructor */ |
| 48 | ~WPSOLEObject() {} |
| 49 | |
| 50 | //! try to read a metafile data |
| 51 | static bool readMetafile(std::shared_ptr<WPSStream> stream, WPSEmbeddedObject &object, |
| 52 | long endPos=-1, bool strict=false); |
| 53 | //! try to read a OLE: 0x0105 ... |
| 54 | static bool readOLE(std::shared_ptr<WPSStream> stream, WPSEmbeddedObject &object, long endPos=-1); |
| 55 | /** try to read a wmf file: 0x0[12]00 0xXX00(with XX>=9) |
| 56 | |
| 57 | \see http://www.fileformat.info/format/wmf/egff.htm */ |
| 58 | static bool readWMF(std::shared_ptr<WPSStream> stream, WPSEmbeddedObject &object,long endPos=-1); |
| 59 | |
| 60 | protected: |
| 61 | //! try to read a stream |
| 62 | static bool readString(std::shared_ptr<WPSStream> stream, std::string &name, long endPos); |
| 63 | //! check if a wmf header |
| 64 | static bool checkIsWMF(std::shared_ptr<WPSStream> stream, long endPos); |
| 65 | |
| 66 | //! try to read a embedded OLE: 0x0105 0000 0200 ... |
| 67 | static bool readEmbeddedOLE(std::shared_ptr<WPSStream> stream, WPSEmbeddedObject &object, long endPos); |
| 68 | //! try to read a static OLE: 0x0105 0000 0[35]00 ... |
| 69 | static bool readStaticOLE(std::shared_ptr<WPSStream> stream, WPSEmbeddedObject &object, long endPos); |
| 70 | }; |
| 71 | |
| 72 | #endif |
| 73 | /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ |