- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

WKS4Spreadsheet.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 WKS4_SPREADSHEET_H
23 #define WKS4_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 WKS4SpreadsheetInternal
36 {
37 class Cell;
38 class SpreadSheet;
39 struct State;
40 }
41
42 class WKS4Parser;
43
48 class WKS4Spreadsheet
49 {
50 public:
51 friend class WKS4Parser;
52
54 explicit WKS4Spreadsheet(WKS4Parser &parser);
56 ~WKS4Spreadsheet();
58 void setListener(WKSContentListenerPtr &listen)
59 {
60 m_listener = listen;
61 }
62
63 protected:
65 bool checkFilePosition(long pos);
67 int version() const;
69 bool hasLICSCharacters() const;
70
72 int getNumSpreadsheets() const;
74 void sendSpreadsheet(int sId);
75
77 void sendCellContent(WKS4SpreadsheetInternal::Cell const &cell);
78
80
82 bool readReportOpen();
84 bool readReportClose();
85
87 bool readFilterOpen();
89 bool readFilterClose();
90
91 //
92 // low level
93 //
95
97 bool readCell();
99 bool readCellFormulaResult();
101 bool readSheetSize();
103 bool readColumnSize();
105 bool readHiddenColumns();
106
108 bool readMsWorksDOSFieldProperty();
110 bool readMsWorksDOSCellProperty();
112 bool readMsWorksDOSCellExtraProperty();
114 bool readMsWorksDOSPageBreak();
115
117 bool readMsWorksColumnSize();
119 bool readMsWorksRowSize();
121 bool readMsWorksPageBreak();
123 bool readMsWorksStyle();
124
125 /* reads a cell */
126 bool readCell(Vec2i actPos, WKSContentListener::FormulaInstruction &instr);
127 /* reads a formula */
128 bool readFormula(long endPos, Vec2i const &pos,
129 std::vector<WKSContentListener::FormulaInstruction> &formula, std::string &error);
130
131 private:
132 WKS4Spreadsheet(WKS4Spreadsheet const &orig);
133 WKS4Spreadsheet &operator=(WKS4Spreadsheet const &orig);
135 libwps::DebugFile &ascii()
136 {
137 return m_asciiFile;
138 }
140 RVNGInputStreamPtr m_input;
141 shared_ptr<WKSContentListener> m_listener;
142 WKS4Parser &m_mainParser;
145 shared_ptr<WKS4SpreadsheetInternal::State> m_state;
147 libwps::DebugFile &m_asciiFile;
148 };
149
150 #endif /* WPS4_H */
151 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WKS4Spreadsheet::m_input
RVNGInputStreamPtr m_input
the input
Definition: WKS4Spreadsheet.h:140
WKS4Parser::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: WKS4.cpp:225
WKS4Spreadsheet::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition: WKS4Spreadsheet.h:58
WKS4Parser::m_listener
shared_ptr< WKSContentListener > m_listener
Definition: WKS4.h:152
WKS4SpreadsheetInternal::Cell
a cellule of a WKS4 spreadsheet
Definition: WKS4Spreadsheet.cpp:173
WKS4Spreadsheet::m_listener
shared_ptr< WKSContentListener > m_listener
Definition: WKS4Spreadsheet.h:141
WKS4Parser::hasLICSCharacters
bool hasLICSCharacters() const
returns the true if the file has LICS characters
Definition: WKS4.cpp:269
libwps::DebugFile
Definition: WPSDebug.h:196
WKS4Spreadsheet::m_asciiFile
libwps::DebugFile & m_asciiFile
the ascii file
Definition: WKS4Spreadsheet.h:147
WKS4SpreadsheetInternal
Definition: WKS4Spreadsheet.cpp:44
WKSContentListener.h
WKS4Parser
This class parses Microsoft Works spreadsheet or a database file.
Definition: WKS4.h:47
libwps_internal.h
WKS4Spreadsheet::ascii
libwps::DebugFile & ascii()
returns the debug file
Definition: WKS4Spreadsheet.h:135
WKS4Spreadsheet::m_state
shared_ptr< WKS4SpreadsheetInternal::State > m_state
the internal state
Definition: WKS4Spreadsheet.h:145
WKSContentListenerPtr
shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:113
WKS4Parser::WKS4Spreadsheet
friend class WKS4Spreadsheet
Definition: WKS4.h:50
WKS4Parser::version
int version() const
return the file version
Definition: WKS4.cpp:220
WKSParser::operator=
WKSParser & operator=(const WKSParser &)
RVNGInputStreamPtr
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
WKSParser::m_asciiFile
libwps::DebugFile m_asciiFile
the debug file
Definition: WKSParser.h:75
WKS4Spreadsheet
This class parses Microsoft Works spreadsheet file.
Definition: WKS4Spreadsheet.h:48
Vec2< int >
WKSContentListener::FormulaInstruction
small class use to define a formula instruction
Definition: WKSContentListener.h:54
WPSDebug.h