- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

LotusSpreadsheet.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwps
3 * Version: MPL 2.0 / LGPLv2.1+
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * Major Contributor(s):
10 * Copyright (C) 2006, 2007 Andrew Ziem
11 * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
12 * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
13 *
14 * For minor contributions see the git repository.
15 *
16 * Alternatively, the contents of this file may be used under the terms
17 * of the GNU Lesser General Public License Version 2.1 or later
18 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
19 * applicable instead of those above.
20 */
21
22 #ifndef LOTUS_SPREADSHEET_H
23 #define LOTUS_SPREADSHEET_H
24
25 #include <ostream>
26 #include <vector>
27
28 #include <librevenge-stream/librevenge-stream.h>
29
30 #include "libwps_internal.h"
31
32 #include "WPSDebug.h"
33 #include "WKSContentListener.h"
34
35 namespace LotusSpreadsheetInternal
36 {
37 class Cell;
38 class Spreadsheet;
39 struct Style;
40 struct State;
41 }
42
43 class LotusParser;
44 class LotusStyleManager;
45
50 class LotusSpreadsheet
51 {
52 public:
53 friend class LotusParser;
54
56 explicit LotusSpreadsheet(LotusParser &parser);
58 ~LotusSpreadsheet();
60 void cleanState();
62 void updateState();
64 void setListener(WKSContentListenerPtr &listen)
65 {
66 m_listener = listen;
67 }
69 void setLastSpreadsheetId(int id);
70 protected:
72 bool checkFilePosition(long pos);
74 int version() const;
76 bool hasSomeSpreadsheetData() const;
77
79 void sendSpreadsheet(int sheetId);
80
84 void sendRowContent(LotusSpreadsheetInternal::Spreadsheet const &sheet, int row);
86 void sendCellContent(LotusSpreadsheetInternal::Cell const &cell,
87 LotusSpreadsheetInternal::Style const &style, int numRepeated=1);
88
90
91 //
92 // low level
93 //
95
97 bool readSheetName();
98
100 bool readColumnDefinition();
102 bool readColumnSizes();
104 bool readRowFormats();
106 bool readRowFormat(LotusSpreadsheetInternal::Style &style, int &numCell, long endPos);
108 bool readRowSizes(long endPos);
109
111 bool readCell();
113 bool readCellName();
114
115 // data in formula
116
117 /* reads a cell */
118 bool readCell(int sId, bool isList, WKSContentListener::FormulaInstruction &instr);
119 /* reads a formula */
120 bool readFormula(long endPos, int sId, bool newFormula,
121 std::vector<WKSContentListener::FormulaInstruction> &formula, std::string &error);
122 private:
123 LotusSpreadsheet(LotusSpreadsheet const &orig);
124 LotusSpreadsheet &operator=(LotusSpreadsheet const &orig);
126 libwps::DebugFile &ascii()
127 {
128 return m_asciiFile;
129 }
131 RVNGInputStreamPtr m_input;
132 shared_ptr<WKSContentListener> m_listener;
133 LotusParser &m_mainParser;
136 shared_ptr<LotusStyleManager> m_styleManager;
138 shared_ptr<LotusSpreadsheetInternal::State> m_state;
140 libwps::DebugFile &m_asciiFile;
141 };
142
143 #endif /* LOTUS_SPREAD_SHEET_H */
144 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
LotusSpreadsheet::ascii
libwps::DebugFile & ascii()
returns the debug file
Definition: LotusSpreadsheet.h:126
LotusSpreadsheet::m_listener
shared_ptr< WKSContentListener > m_listener
Definition: LotusSpreadsheet.h:132
LotusParser::version
int version() const
return the file version
Definition: Lotus.cpp:183
libwps::DebugFile
Definition: WPSDebug.h:196
LotusSpreadsheetInternal::Cell
a cellule of a Lotus spreadsheet
Definition: LotusSpreadsheet.cpp:117
WKSContentListener.h
LotusSpreadsheetInternal::Style
a class used to store a style of a cell in LotusSpreadsheet
Definition: LotusSpreadsheet.cpp:52
LotusParser
This class parses a WK2..WK4 Lotus spreadsheet.
Definition: Lotus.h:47
libwps_internal.h
WKSContentListenerPtr
shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:113
LotusStyleManager
This class parses the Lotus style.
Definition: LotusStyleManager.h:45
LotusParser::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: Lotus.cpp:188
LotusSpreadsheetInternal::Spreadsheet
the spreadsheet of a LotusSpreadsheet
Definition: LotusSpreadsheet.cpp:178
WKSParser::operator=
WKSParser & operator=(const WKSParser &)
RVNGInputStreamPtr
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
LotusSpreadsheet::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition: LotusSpreadsheet.h:64
LotusSpreadsheet
This class parses Microsoft Works spreadsheet file.
Definition: LotusSpreadsheet.h:50
WKSParser::m_asciiFile
libwps::DebugFile m_asciiFile
the debug file
Definition: WKSParser.h:75
LotusSpreadsheet::m_asciiFile
libwps::DebugFile & m_asciiFile
the ascii file
Definition: LotusSpreadsheet.h:140
LotusSpreadsheet::m_state
shared_ptr< LotusSpreadsheetInternal::State > m_state
the internal state
Definition: LotusSpreadsheet.h:138
LotusSpreadsheet::m_styleManager
shared_ptr< LotusStyleManager > m_styleManager
the style manager
Definition: LotusSpreadsheet.h:136
LotusSpreadsheet::m_input
RVNGInputStreamPtr m_input
the input
Definition: LotusSpreadsheet.h:131
LotusSpreadsheetInternal
Definition: LotusSpreadsheet.cpp:47
WKSContentListener::FormulaInstruction
small class use to define a formula instruction
Definition: WKSContentListener.h:54
WPSDebug.h
LotusParser::m_listener
shared_ptr< WKSContentListener > m_listener
Definition: Lotus.h:125
LotusParser::LotusSpreadsheet
friend class LotusSpreadsheet
Definition: Lotus.h:51