LotusSpreadsheet.h Source File documentation

- 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 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
82 void sendCellContent(LotusSpreadsheetInternal::Cell const &cell,
83 LotusSpreadsheetInternal::Style const &style);
84
86
87 //
88 // low level
89 //
91
93 bool readSheetName();
94
96 bool readColumnDefinition();
98 bool readColumnSizes();
100 bool readRowFormats();
102 bool readRowFormat(LotusSpreadsheetInternal::Style &style, int &numCell, long endPos);
104 bool readRowSizes(long endPos);
105
107 bool readCell();
109 bool readCellName();
110
111 // data in formula
112
113 /* reads a cell */
114 bool readCell(int sId, bool isList, WKSContentListener::FormulaInstruction &instr);
115 /* reads a formula */
116 bool readFormula(long endPos, int sId, bool newFormula,
117 std::vector<WKSContentListener::FormulaInstruction> &formula, std::string &error);
118 private:
119 LotusSpreadsheet(LotusSpreadsheet const &orig);
120 LotusSpreadsheet &operator=(LotusSpreadsheet const &orig);
122 libwps::DebugFile &ascii()
123 {
124 return m_asciiFile;
125 }
127 RVNGInputStreamPtr m_input;
128 shared_ptr<WKSContentListener> m_listener;
129 LotusParser &m_mainParser;
132 shared_ptr<LotusStyleManager> m_styleManager;
134 shared_ptr<LotusSpreadsheetInternal::State> m_state;
136 libwps::DebugFile &m_asciiFile;
137 };
138
139 #endif /* LOTUS_SPREAD_SHEET_H */
140 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
LotusSpreadsheet::ascii
libwps::DebugFile & ascii()
returns the debug file
Definition: LotusSpreadsheet.h:122
LotusSpreadsheet::sendSpreadsheet
void sendSpreadsheet(int sheetId)
send the data
Definition: LotusSpreadsheet.cpp:1405
LotusSpreadsheet::m_listener
shared_ptr< WKSContentListener > m_listener
Definition: LotusSpreadsheet.h:128
libwps::DebugFile
Definition: WPSDebug.h:196
LotusSpreadsheet::m_mainParser
LotusParser & m_mainParser
the listener (if set)
Definition: LotusSpreadsheet.h:130
LotusSpreadsheet::LotusSpreadsheet
LotusSpreadsheet(LotusParser &parser)
constructor
Definition: LotusSpreadsheet.cpp:355
LotusSpreadsheet::~LotusSpreadsheet
~LotusSpreadsheet()
destructor
Definition: LotusSpreadsheet.cpp:362
LotusSpreadsheetInternal::Cell
a cellule of a Lotus spreadsheet
Definition: LotusSpreadsheet.cpp:119
LotusSpreadsheet::sendCellContent
void sendCellContent(LotusSpreadsheetInternal::Cell const &cell, LotusSpreadsheetInternal::Style const &style)
send the cell data
Definition: LotusSpreadsheet.cpp:1465
LotusSpreadsheet::version
int version() const
return the file version
Definition: LotusSpreadsheet.cpp:452
WKSContentListener.h
LotusSpreadsheetInternal::Style
a class used to store a style of a cell in LotusSpreadsheet
Definition: LotusSpreadsheet.cpp:52
LotusSpreadsheet::cleanState
void cleanState()
clean internal state
Definition: LotusSpreadsheet.cpp:366
LotusParser
This class parses a WK2..WK4 Lotus spreadsheet.
Definition: Lotus.h:47
LotusSpreadsheet::updateState
void updateState()
update internal state (must be called one time before sending data)
Definition: LotusSpreadsheet.cpp:371
LotusSpreadsheet::operator=
LotusSpreadsheet & operator=(LotusSpreadsheet const &orig)
LotusSpreadsheet::readRowSizes
bool readRowSizes(long endPos)
reads the row size ( in pt*32 )
Definition: LotusSpreadsheet.cpp:919
libwps_internal.h
LotusSpreadsheet::setLastSpreadsheetId
void setLastSpreadsheetId(int id)
set the last spreadsheet number ( default 0)
Definition: LotusSpreadsheet.cpp:442
WKSContentListenerPtr
shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:108
LotusSpreadsheet::readSheetName
bool readSheetName()
reads a sheet name
Definition: LotusSpreadsheet.cpp:975
LotusStyleManager
This class parses the Lotus style.
Definition: LotusStyleManager.h:45
LotusSpreadsheet::readCellName
bool readCellName()
reads a cell or list of cell name
Definition: LotusSpreadsheet.cpp:1034
RVNGInputStreamPtr
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:82
LotusSpreadsheet::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition: LotusSpreadsheet.h:64
LotusSpreadsheet::readFormula
bool readFormula(long endPos, int sId, bool newFormula, std::vector< WKSContentListener::FormulaInstruction > &formula, std::string &error)
Definition: LotusSpreadsheet.cpp:1642
LotusSpreadsheet::hasSomeSpreadsheetData
bool hasSomeSpreadsheetData() const
returns true if some spreadshet are defined
Definition: LotusSpreadsheet.cpp:471
LotusSpreadsheet::readRowFormat
bool readRowFormat(LotusSpreadsheetInternal::Style &style, int &numCell, long endPos)
reads a cell's row format
Definition: LotusSpreadsheet.cpp:737
LotusSpreadsheet
This class parses Microsoft Works spreadsheet file.
Definition: LotusSpreadsheet.h:50
LotusSpreadsheet::readColumnDefinition
bool readColumnDefinition()
reads the columns definitions
Definition: LotusSpreadsheet.cpp:487
LotusSpreadsheet::readRowFormats
bool readRowFormats()
reads the row formats
Definition: LotusSpreadsheet.cpp:617
LotusSpreadsheet::m_asciiFile
libwps::DebugFile & m_asciiFile
the ascii file
Definition: LotusSpreadsheet.h:136
LotusSpreadsheet::m_state
shared_ptr< LotusSpreadsheetInternal::State > m_state
the internal state
Definition: LotusSpreadsheet.h:134
LotusSpreadsheet::readCell
bool readCell()
reads a cell
Definition: LotusSpreadsheet.cpp:1112
LotusSpreadsheet::m_styleManager
shared_ptr< LotusStyleManager > m_styleManager
the style manager
Definition: LotusSpreadsheet.h:132
LotusSpreadsheet::m_input
RVNGInputStreamPtr m_input
the input
Definition: LotusSpreadsheet.h:127
LotusSpreadsheetInternal
Definition: LotusSpreadsheet.cpp:47
LotusSpreadsheet::readColumnSizes
bool readColumnSizes()
reads the column sizes ( in char )
Definition: LotusSpreadsheet.cpp:566
WKSContentListener::FormulaInstruction
small class use to define a formula instruction
Definition: WKSContentListener.h:54
WPSDebug.h
LotusSpreadsheet::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: LotusSpreadsheet.cpp:459