00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* libwps 00003 * Version: MPL 2.0 / LGPLv2.1+ 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this 00007 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 00008 * 00009 * Major Contributor(s): 00010 * Copyright (C) 2006, 2007 Andrew Ziem 00011 * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca) 00012 * Copyright (C) 2003 Marc Maurer (uwog@uwog.net) 00013 * 00014 * For minor contributions see the git repository. 00015 * 00016 * Alternatively, the contents of this file may be used under the terms 00017 * of the GNU Lesser General Public License Version 2.1 or later 00018 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are 00019 * applicable instead of those above. 00020 */ 00021 00022 #ifndef LOTUS_H 00023 #define LOTUS_H 00024 00025 #include <vector> 00026 00027 #include <librevenge-stream/librevenge-stream.h> 00028 #include "libwps_internal.h" 00029 #include "libwps_tools_win.h" 00030 00031 #include "WKSParser.h" 00032 00033 namespace LotusParserInternal 00034 { 00035 class SubDocument; 00036 struct State; 00037 } 00038 00039 class LotusGraph; 00040 class LotusSpreadsheet; 00041 class LotusStyleManager; 00042 00047 class LotusParser : public WKSParser 00048 { 00049 friend class LotusParserInternal::SubDocument; 00050 friend class LotusGraph; 00051 friend class LotusSpreadsheet; 00052 friend class LotusStyleManager; 00053 public: 00055 LotusParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, 00056 libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN); 00058 ~LotusParser(); 00060 void parse(librevenge::RVNGSpreadsheetInterface *documentInterface); 00062 bool checkHeader(WPSHeader *header, bool strict=false); 00063 00064 protected: 00066 bool checkFilePosition(long pos); 00068 int version() const; 00069 00070 // 00071 // interface 00072 // 00073 00075 bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const; 00079 libwps_tools_win::Font::Type getDefaultFontType() const; 00080 00081 // 00082 // interface with LotusGraph 00083 // 00084 00086 bool hasGraphics(int sheetId) const; 00088 void sendGraphics(int sheetId); 00089 00091 shared_ptr<WKSContentListener> createListener(librevenge::RVNGSpreadsheetInterface *interface); 00092 00093 // 00094 // low level 00095 // 00096 00098 bool readZones(); 00100 bool readDataZone(); 00102 bool readZone(); 00103 00105 00107 bool readMacFontName(long endPos); 00109 bool readFMTFontName(); 00111 bool readLinkZone(); 00113 bool readDocumentInfoMac(long endPos); 00114 00116 00118 bool readChartDefinition(); 00120 bool readChartName(); 00121 00123 00124 00125 shared_ptr<WKSContentListener> m_listener; 00126 00127 shared_ptr<LotusParserInternal::State> m_state; 00129 shared_ptr<LotusStyleManager> m_styleManager; 00131 shared_ptr<LotusGraph> m_graphParser; 00133 shared_ptr<LotusSpreadsheet> m_spreadsheetParser; 00134 }; 00135 00136 #endif /* LOTUS_H */ 00137 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */