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_internal.h"
00029 #include "libwps_tools_win.h"
00030 
00031 #include "WKSParser.h"
00032 
00033 namespace WKS4ParserInternal
00034 {
00035 class SubDocument;
00036 struct State;
00037 }
00038 
00039 class WKS4Spreadsheet;
00040 
00045 class WKS4Parser : public WKSParser
00046 {
00047         friend class WKS4ParserInternal::SubDocument;
00048         friend class WKS4Spreadsheet;
00049 public:
00051         WKS4Parser(RVNGInputStreamPtr &input, WPSHeaderPtr &header);
00053         ~WKS4Parser();
00055         void parse(librevenge::RVNGSpreadsheetInterface *documentInterface);
00057         bool checkHeader(WPSHeader *header, bool strict=false);
00058 
00059 protected:
00061         bool checkFilePosition(long pos);
00063         int version() const;
00064 
00065         //
00066         // interface with WKS4Spreadsheet
00067         //
00068 
00070         bool getColor(int id, uint32_t &color) const;
00072         bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const;
00073 
00074 
00076         shared_ptr<WKSContentListener> createListener(librevenge::RVNGSpreadsheetInterface *interface);
00078         void sendHeaderFooter(bool header);
00079 
00080         //
00081         // low level
00082         //
00083 
00085         bool readZones();
00087         bool readZone();
00088 
00090 
00092         bool readFont();
00093 
00095         bool readPrnt();
00096 
00098         bool readPrn2();
00099 
00101         bool readHeaderFooter(bool header);
00102 
00104         bool readFieldName();
00105 
00107 
00109         bool readChartName();
00110 
00112         bool readChartDef();
00113 
00115         bool readChartFont();
00116 
00118         bool readChart2Font();
00119 
00121         bool readChartLimit();
00122 
00124         bool readChartList();
00125 
00127         bool readChartUnknown();
00128 
00130 
00132         bool readUnknown0();
00137         bool readUnknown1();
00138 
00139         shared_ptr<WKSContentListener> m_listener; 
00140 
00141         shared_ptr<WKS4ParserInternal::State> m_state;
00143         shared_ptr<WKS4Spreadsheet> m_spreadsheetParser;
00144 };
00145 
00146 #endif /* WPS4_H */
00147 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */