WKS4Spreadsheet.h Source File documentation

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;
71 void resetInput(RVNGInputStreamPtr const &input);
72
74 int getNumSpreadsheets() const;
76 void sendSpreadsheet(int sId);
78 librevenge::RVNGString getSheetName(int id) const;
79
81 void sendCellContent(WKS4SpreadsheetInternal::Cell const &cell);
82
84
86 bool readReportOpen();
88 bool readReportClose();
89
91 bool readFilterOpen();
93 bool readFilterClose();
94
95 //
96 // low level
97 //
99
101 bool readCell();
103 bool readCellFormulaResult();
105 bool readSheetSize();
107 bool readColumnSize();
109 bool readHiddenColumns();
110
112 bool readMsWorksDOSFieldProperty();
114 bool readMsWorksDOSCellProperty();
116 bool readMsWorksDOSCellExtraProperty();
118 bool readMsWorksDOSPageBreak();
119
121 bool readMsWorksColumnSize();
123 bool readMsWorksRowSize();
125 bool readMsWorksPageBreak();
127 bool readMsWorksStyle();
128
129 /* reads a cell */
130 bool readCell(Vec2i actPos, WKSContentListener::FormulaInstruction &instr);
131 /* reads a formula */
132 bool readFormula(long endPos, Vec2i const &pos,
133 std::vector<WKSContentListener::FormulaInstruction> &formula, std::string &error);
134
135 private:
136 WKS4Spreadsheet(WKS4Spreadsheet const &orig) = delete;
137 WKS4Spreadsheet &operator=(WKS4Spreadsheet const &orig) = delete;
139 libwps::DebugFile &ascii()
140 {
141 return m_asciiFile;
142 }
144 RVNGInputStreamPtr m_input;
145 std::shared_ptr<WKSContentListener> m_listener;
146 WKS4Parser &m_mainParser;
149 std::shared_ptr<WKS4SpreadsheetInternal::State> m_state;
151 libwps::DebugFile &m_asciiFile;
152 };
153
154 #endif /* WPS4_SPREADSHEET_H */
155 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WKS4Spreadsheet::m_input
RVNGInputStreamPtr m_input
the input
Definition: WKS4Spreadsheet.h:144
WKS4Spreadsheet::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition: WKS4Spreadsheet.h:58
WKS4Spreadsheet::getNumSpreadsheets
int getNumSpreadsheets() const
returns the number of spreadsheet
Definition: WKS4Spreadsheet.cpp:549
WKS4SpreadsheetInternal::Cell
a cellule of a WKS4 spreadsheet
Definition: WKS4Spreadsheet.cpp:179
WKS4Spreadsheet::sendSpreadsheet
void sendSpreadsheet(int sId)
send the sId&#39;th spreadsheet
Definition: WKS4Spreadsheet.cpp:2347
WKS4Spreadsheet::hasLICSCharacters
bool hasLICSCharacters() const
returns the true if the file has LICS characters
Definition: WKS4Spreadsheet.cpp:530
WKS4Spreadsheet::readMsWorksPageBreak
bool readMsWorksPageBreak()
reads a page break
Definition: WKS4Spreadsheet.cpp:769
libwps::DebugFile
Definition: WPSDebug.h:207
WKS4Spreadsheet::m_asciiFile
libwps::DebugFile & m_asciiFile
the ascii file
Definition: WKS4Spreadsheet.h:151
WKS4Spreadsheet::version
int version() const
return the file version
Definition: WKS4Spreadsheet.cpp:523
WKS4Spreadsheet::m_state
std::shared_ptr< WKS4SpreadsheetInternal::State > m_state
the internal state
Definition: WKS4Spreadsheet.h:149
WKS4SpreadsheetInternal
Definition: WKS4Spreadsheet.cpp:45
WKSContentListener.h
WKS4Parser
This class parses Microsoft Works spreadsheet or a database file.
Definition: WKS4.h:48
WKS4Spreadsheet::readMsWorksDOSPageBreak
bool readMsWorksDOSPageBreak()
reads a page break (in a dos file)
Definition: WKS4Spreadsheet.cpp:1373
WKS4Spreadsheet::readMsWorksStyle
bool readMsWorksStyle()
reads a style
Definition: WKS4Spreadsheet.cpp:799
WKS4Spreadsheet::readHiddenColumns
bool readHiddenColumns()
reads the list of hidden columns zone ( unused )
Definition: WKS4Spreadsheet.cpp:649
WKS4Spreadsheet::readFormula
bool readFormula(long endPos, Vec2i const &pos, std::vector< WKSContentListener::FormulaInstruction > &formula, std::string &error)
Definition: WKS4Spreadsheet.cpp:1911
WKS4Spreadsheet::readMsWorksRowSize
bool readMsWorksRowSize()
reads the row size ( in ???)
Definition: WKS4Spreadsheet.cpp:732
WKS4Spreadsheet::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition: WKS4Spreadsheet.h:145
WKS4Spreadsheet::WKS4Spreadsheet
WKS4Spreadsheet(WKS4Parser &parser)
constructor
Definition: WKS4Spreadsheet.cpp:504
libwps_internal.h
WKS4Spreadsheet::readMsWorksColumnSize
bool readMsWorksColumnSize()
reads the column size ( in ???)
Definition: WKS4Spreadsheet.cpp:693
WKS4Spreadsheet::ascii
libwps::DebugFile & ascii()
returns the debug file
Definition: WKS4Spreadsheet.h:139
WKS4Spreadsheet::readFilterOpen
bool readFilterOpen()
reads the filter&#39;s header zone 10:54
Definition: WKS4Spreadsheet.cpp:2185
WKS4Spreadsheet::m_mainParser
WKS4Parser & m_mainParser
the listener (if set)
Definition: WKS4Spreadsheet.h:147
WKS4Spreadsheet::sendCellContent
void sendCellContent(WKS4SpreadsheetInternal::Cell const &cell)
send the cell data
Definition: WKS4Spreadsheet.cpp:2397
WKS4Spreadsheet::readReportOpen
bool readReportOpen()
reads the report&#39;s header zone 17:54
Definition: WKS4Spreadsheet.cpp:2245
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
WKS4Spreadsheet::readSheetSize
bool readSheetSize()
reads sheet size
Definition: WKS4Spreadsheet.cpp:565
WKS4Spreadsheet::readMsWorksDOSFieldProperty
bool readMsWorksDOSFieldProperty()
reads a field property
Definition: WKS4Spreadsheet.cpp:1212
WKS4Spreadsheet::readMsWorksDOSCellExtraProperty
bool readMsWorksDOSCellExtraProperty()
reads the actual cell addendum properties ( contains at least the color)
Definition: WKS4Spreadsheet.cpp:1299
WKS4Spreadsheet::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: WKS4Spreadsheet.cpp:537
WKS4Spreadsheet::readCell
bool readCell()
reads a cell content data
Definition: WKS4Spreadsheet.cpp:1406
WKS4Spreadsheet::getSheetName
librevenge::RVNGString getSheetName(int id) const
returns the name of the id&#39;s spreadsheet
Definition: WKS4Spreadsheet.cpp:554
WKS4Spreadsheet::readCellFormulaResult
bool readCellFormulaResult()
reads the result of a text formula
Definition: WKS4Spreadsheet.cpp:1746
WKS4Spreadsheet
This class parses Microsoft Works spreadsheet file.
Definition: WKS4Spreadsheet.h:48
WKSContentListenerPtr
std::shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:114
WKS4Spreadsheet::~WKS4Spreadsheet
~WKS4Spreadsheet()
destructor
Definition: WKS4Spreadsheet.cpp:514
WKS4Spreadsheet::readFilterClose
bool readFilterClose()
reads the filter&#39;s end zone 11:54
Definition: WKS4Spreadsheet.cpp:2211
WKS4Spreadsheet::operator=
WKS4Spreadsheet & operator=(WKS4Spreadsheet const &orig)=delete
Vec2< int >
WKSContentListener::FormulaInstruction
small class use to define a formula instruction
Definition: WKSContentListener.h:57
WPSDebug.h
WKS4Spreadsheet::resetInput
void resetInput(RVNGInputStreamPtr const &input)
reset the main input
Definition: WKS4Spreadsheet.cpp:518
WKS4Spreadsheet::readMsWorksDOSCellProperty
bool readMsWorksDOSCellProperty()
reads actualCell properties
Definition: WKS4Spreadsheet.cpp:1043
WKS4Spreadsheet::readColumnSize
bool readColumnSize()
reads the column size ( in ??? )
Definition: WKS4Spreadsheet.cpp:603
WKS4Spreadsheet::readReportClose
bool readReportClose()
reads the report&#39;s end zone 18:54
Definition: WKS4Spreadsheet.cpp:2313