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_SPREADSHEET_H 00023 #define WKS4_SPREADSHEET_H 00024 00025 #include <ostream> 00026 #include <vector> 00027 00028 #include <librevenge-stream/librevenge-stream.h> 00029 00030 #include "libwps_internal.h" 00031 00032 #include "WPSDebug.h" 00033 #include "WKSContentListener.h" 00034 00035 namespace WKS4SpreadsheetInternal 00036 { 00037 class Cell; 00038 class SpreadSheet; 00039 struct State; 00040 } 00041 00042 class WKS4Parser; 00043 00048 class WKS4Spreadsheet 00049 { 00050 public: 00051 friend class WKS4Parser; 00052 00054 WKS4Spreadsheet(WKS4Parser &parser); 00056 ~WKS4Spreadsheet(); 00058 void setListener(WKSContentListenerPtr &listen) 00059 { 00060 m_listener = listen; 00061 } 00062 00063 protected: 00065 bool checkFilePosition(long pos); 00067 int version() const; 00069 bool hasLICSCharacters() const; 00070 00072 int getNumSpreadsheets() const; 00074 void sendSpreadsheet(int sId); 00075 00077 void sendCellContent(WKS4SpreadsheetInternal::Cell const &cell); 00078 00080 00082 bool readReportOpen(); 00084 bool readReportClose(); 00085 00087 bool readFilterOpen(); 00089 bool readFilterClose(); 00090 00091 // 00092 // low level 00093 // 00095 00097 bool readCell(); 00099 bool readCellFormulaResult(); 00101 bool readSheetSize(); 00103 bool readColumnSize(); 00105 bool readHiddenColumns(); 00106 00108 bool readMsWorksDOSFieldProperty(); 00110 bool readMsWorksDOSCellProperty(); 00112 bool readMsWorksDOSCellExtraProperty(); 00114 bool readMsWorksDOSPageBreak(); 00115 00117 bool readMsWorksColumnSize(); 00119 bool readMsWorksRowSize(); 00121 bool readMsWorksPageBreak(); 00123 bool readMsWorksStyle(); 00124 00125 /* reads a cell */ 00126 bool readCell(Vec2i actPos, WKSContentListener::FormulaInstruction &instr); 00127 /* reads a formula */ 00128 bool readFormula(long endPos, Vec2i const &pos, 00129 std::vector<WKSContentListener::FormulaInstruction> &formula, std::string &error); 00130 00131 private: 00132 WKS4Spreadsheet(WKS4Spreadsheet const &orig); 00133 WKS4Spreadsheet &operator=(WKS4Spreadsheet const &orig); 00135 libwps::DebugFile &ascii() 00136 { 00137 return m_asciiFile; 00138 } 00140 RVNGInputStreamPtr m_input; 00141 shared_ptr<WKSContentListener> m_listener; 00142 00143 WKS4Parser &m_mainParser; 00145 shared_ptr<WKS4SpreadsheetInternal::State> m_state; 00147 libwps::DebugFile &m_asciiFile; 00148 }; 00149 00150 #endif /* WPS4_H */ 00151 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */