WKS4.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 WKS4_H
00023 #define WKS4_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 WKS4ParserInternal
00036 {
00037 class SubDocument;
00038 struct State;
00039 }
00040 
00041 class WKS4Spreadsheet;
00042 
00047 class WKS4Parser : public WKSParser
00048 {
00049         friend class WKS4ParserInternal::SubDocument;
00050         friend class WKS4Spreadsheet;
00051 public:
00053         WKS4Parser(RVNGInputStreamPtr &input, WPSHeaderPtr &header,
00054                    libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN);
00056         ~WKS4Parser();
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;
00074         libwps::WPSCreator getCreator() const;
00075 
00076         //
00077         // interface with WKS4Spreadsheet
00078         //
00079 
00081         bool getColor(int id, WPSColor &color) const;
00083         bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const;
00084 
00085 
00087         shared_ptr<WKSContentListener> createListener(librevenge::RVNGSpreadsheetInterface *interface);
00089         void sendHeaderFooter(bool header);
00090 
00091         //
00092         // low level
00093         //
00094 
00096         bool readZones();
00098         bool readZone();
00100         bool readZoneQuattro();
00101 
00103 
00105         bool readFont();
00106 
00108         bool readPrnt();
00109 
00111         bool readPrn2();
00112 
00114         bool readHeaderFooter(bool header);
00115 
00117         bool readFieldName();
00118 
00120 
00122         bool readChartName();
00123 
00125         bool readChartDef();
00126 
00128         bool readChartFont();
00129 
00131         bool readChart2Font();
00132 
00134         bool readChartLimit();
00135 
00137         bool readChartList();
00138 
00140         bool readChartUnknown();
00141 
00143 
00145         bool readWindowRecord();
00150         bool readUnknown1();
00151 
00152         shared_ptr<WKSContentListener> m_listener; 
00153 
00154         shared_ptr<WKS4ParserInternal::State> m_state;
00156         shared_ptr<WKS4Spreadsheet> m_spreadsheetParser;
00157 };
00158 
00159 #endif /* WPS4_H */
00160 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */