Quattro.h
Go to the documentation of this file.
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 QUATTRO_H
00023 #define QUATTRO_H
00024 
00025 #include <vector>
00026 
00027 #include <librevenge-stream/librevenge-stream.h>
00028 #include "libwps/libwps.h"
00029 
00030 #include "libwps_internal.h"
00031 #include "libwps_tools_win.h"
00032 
00033 #include "WKSParser.h"
00034 
00035 namespace QuattroParserInternal
00036 {
00037 class SubDocument;
00038 struct State;
00039 }
00040 
00041 class QuattroSpreadsheet;
00042 
00047 class QuattroParser : public WKSParser
00048 {
00049         friend class QuattroParserInternal::SubDocument;
00050         friend class QuattroSpreadsheet;
00051 public:
00053         QuattroParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header,
00054                       libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN);
00056         ~QuattroParser();
00058         void parse(librevenge::RVNGSpreadsheetInterface *documentInterface);
00060         bool checkHeader(WPSHeader *header, bool strict=false);
00061 
00062 protected:
00064         bool checkFilePosition(long pos);
00066         int version() const;
00070         libwps_tools_win::Font::Type getDefaultFontType() const;
00072         bool hasLICSCharacters() const;
00073 
00074         //
00075         // interface with QuattroSpreadsheet
00076         //
00077 
00079         bool getColor(int id, WPSColor &color) const;
00081         bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const;
00082 
00084         shared_ptr<WKSContentListener> createListener(librevenge::RVNGSpreadsheetInterface *interface);
00086         void sendHeaderFooter(bool header);
00087 
00088         //
00089         // low level
00090         //
00091 
00093         bool readZones();
00095         bool readZone();
00096 
00098 
00100         bool readUserFonts();
00101 
00103         bool readHeaderFooter(bool header);
00104 
00106         bool readFieldName();
00107 
00109 
00111         bool readChartName();
00112 
00114         bool readChartDef();
00115 
00117 
00119         bool readWindowRecord();
00124         bool readUnknown1();
00125 
00126         shared_ptr<WKSContentListener> m_listener; 
00127 
00128         shared_ptr<QuattroParserInternal::State> m_state;
00130         shared_ptr<QuattroSpreadsheet> m_spreadsheetParser;
00131 };
00132 
00133 #endif /* WPS4_H */
00134 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */