QuattroDosSpreadsheet.h Source File documentation

QuattroDosSpreadsheet.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 QUATTRO_DOS_SPREADSHEET_H
23 #define QUATTRO_DOS_SPREADSHEET_H
24
25 #include <ostream>
26 #include <map>
27 #include <vector>
28
29 #include <librevenge-stream/librevenge-stream.h>
30
31 #include "libwps_internal.h"
32
33 #include "WPSDebug.h"
34 #include "WKSContentListener.h"
35
36 namespace QuattroDosSpreadsheetInternal
37 {
38 class Cell;
39 class SpreadSheet;
40 struct State;
41 }
42
43 class QuattroDosParser;
44
49 class QuattroDosSpreadsheet
50 {
51 public:
52 friend class QuattroDosParser;
53
55 explicit QuattroDosSpreadsheet(QuattroDosParser &parser);
57 ~QuattroDosSpreadsheet();
59 void setListener(WKSContentListenerPtr &listen)
60 {
61 m_listener = listen;
62 }
63
64 protected:
66 bool checkFilePosition(long pos);
68 int version() const;
70 bool hasLICSCharacters() const;
71
73 int getNumSpreadsheets() const;
75 librevenge::RVNGString getSheetName(int id) const;
77 void sendSpreadsheet(int sId, std::map<Vec2i,Vec2i> const &chartCellMap);
78
80 void sendCellContent(QuattroDosSpreadsheetInternal::Cell const &cell, int cellChartSheetId=-1, Vec2f const &chartSize=Vec2f());
81
83
85 bool readSpreadsheetOpen();
87 bool readSpreadsheetClose();
88
89 //
90 // low level
91 //
93
95 bool readCell();
97 bool readCellFormulaResult();
99 bool readSheetSize();
101 bool readSpreadsheetName();
103 bool readColumnSize();
105 bool readRowSize();
107 bool readHiddenColumns();
108
110 bool readCellProperty();
112 bool readCellStyle();
114 bool readUserStyle();
115
116 /* reads a cell */
117 bool readCell(Vec2i actPos, WKSContentListener::FormulaInstruction &instr, bool hasSheetId=false, int sheetId=0);
118 /* reads a formula */
119 bool readFormula(long endPos, Vec2i const &pos, int sheetId,
120 std::vector<WKSContentListener::FormulaInstruction> &formula, std::string &error);
121
122 private:
123 QuattroDosSpreadsheet(QuattroDosSpreadsheet const &orig) = delete;
124 QuattroDosSpreadsheet &operator=(QuattroDosSpreadsheet const &orig) = delete;
126 libwps::DebugFile &ascii()
127 {
128 return m_asciiFile;
129 }
131 RVNGInputStreamPtr m_input;
132 std::shared_ptr<WKSContentListener> m_listener;
133 QuattroDosParser &m_mainParser;
136 std::shared_ptr<QuattroDosSpreadsheetInternal::State> m_state;
138 libwps::DebugFile &m_asciiFile;
139 };
140
141 #endif /* WPS4_H */
142 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
QuattroDosSpreadsheet::readHiddenColumns
bool readHiddenColumns()
reads the list of hidden columns zone ( unused )
Definition: QuattroDosSpreadsheet.cpp:762
QuattroDosSpreadsheet::readSpreadsheetName
bool readSpreadsheetName()
reads a sheet name (zone 0xde), unused...
Definition: QuattroDosSpreadsheet.cpp:1628
Vec2f
Vec2< float > Vec2f
Vec2 of float.
Definition: libwps_internal.h:704
QuattroDosSpreadsheetInternal
Definition: QuattroDosSpreadsheet.cpp:45
QuattroDosParser
This class parses Quattro Pro spreadsheet: .wq1 and wq2.
Definition: QuattroDos.h:48
QuattroDosSpreadsheet::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition: QuattroDosSpreadsheet.h:132
libwps::DebugFile
Definition: WPSDebug.h:207
QuattroDosSpreadsheet::readCellStyle
bool readCellStyle()
reads a Quattro Pro cell styles (zone 0xd8)
Definition: QuattroDosSpreadsheet.cpp:803
QuattroDosSpreadsheet::getSheetName
librevenge::RVNGString getSheetName(int id) const
returns the name of the id&#39;s spreadsheet
Definition: QuattroDosSpreadsheet.cpp:631
QuattroDosSpreadsheet::sendCellContent
void sendCellContent(QuattroDosSpreadsheetInternal::Cell const &cell, int cellChartSheetId=-1, Vec2f const &chartSize=Vec2f())
send the cell data
Definition: QuattroDosSpreadsheet.cpp:2265
QuattroDosSpreadsheet::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: QuattroDosSpreadsheet.cpp:614
QuattroDosSpreadsheet::readCell
bool readCell()
reads a cell content data
Definition: QuattroDosSpreadsheet.cpp:1390
WKSContentListener.h
QuattroDosSpreadsheet::sendSpreadsheet
void sendSpreadsheet(int sId, std::map< Vec2i, Vec2i > const &chartCellMap)
send the sId&#39;th spreadsheet
Definition: QuattroDosSpreadsheet.cpp:2212
QuattroDosSpreadsheet::ascii
libwps::DebugFile & ascii()
returns the debug file
Definition: QuattroDosSpreadsheet.h:126
QuattroDosSpreadsheet::readUserStyle
bool readUserStyle()
reads a Quattro Pro style ( zone 0xc9)
Definition: QuattroDosSpreadsheet.cpp:1131
QuattroDosSpreadsheet::m_state
std::shared_ptr< QuattroDosSpreadsheetInternal::State > m_state
the internal state
Definition: QuattroDosSpreadsheet.h:136
libwps_internal.h
QuattroDosSpreadsheet::version
int version() const
return the file version
Definition: QuattroDosSpreadsheet.cpp:600
QuattroDosSpreadsheet::m_asciiFile
libwps::DebugFile & m_asciiFile
the ascii file
Definition: QuattroDosSpreadsheet.h:138
QuattroDosSpreadsheet::operator=
QuattroDosSpreadsheet & operator=(QuattroDosSpreadsheet const &orig)=delete
QuattroDosSpreadsheet::readSpreadsheetOpen
bool readSpreadsheetOpen()
reads a sheet header zone 0:dc (Quattro Pro wq2)
Definition: QuattroDosSpreadsheet.cpp:1656
QuattroDosSpreadsheet::m_input
RVNGInputStreamPtr m_input
the input
Definition: QuattroDosSpreadsheet.h:131
QuattroDosSpreadsheet
This class parses Quattro Pro DOS spreadsheet file.
Definition: QuattroDosSpreadsheet.h:49
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
QuattroDosSpreadsheet::readFormula
bool readFormula(long endPos, Vec2i const &pos, int sheetId, std::vector< WKSContentListener::FormulaInstruction > &formula, std::string &error)
Definition: QuattroDosSpreadsheet.cpp:1858
QuattroDosSpreadsheet::getNumSpreadsheets
int getNumSpreadsheets() const
returns the number of spreadsheet
Definition: QuattroDosSpreadsheet.cpp:626
QuattroDosSpreadsheet::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition: QuattroDosSpreadsheet.h:59
QuattroDosSpreadsheetInternal::Cell
a cellule of a Quattro spreadsheet
Definition: QuattroDosSpreadsheet.cpp:144
QuattroDosSpreadsheet::QuattroDosSpreadsheet
QuattroDosSpreadsheet(QuattroDosParser &parser)
constructor
Definition: QuattroDosSpreadsheet.cpp:587
QuattroDosSpreadsheet::readSpreadsheetClose
bool readSpreadsheetClose()
reads a sheet header zone 0:dd (Quattro Pro wq2)
Definition: QuattroDosSpreadsheet.cpp:1696
QuattroDosSpreadsheet::readRowSize
bool readRowSize()
reads the column size ( in points )
Definition: QuattroDosSpreadsheet.cpp:683
QuattroDosSpreadsheet::readColumnSize
bool readColumnSize()
reads the column size ( in ??? )
Definition: QuattroDosSpreadsheet.cpp:716
QuattroDosSpreadsheet::~QuattroDosSpreadsheet
~QuattroDosSpreadsheet()
destructor
Definition: QuattroDosSpreadsheet.cpp:596
QuattroDosSpreadsheet::readCellFormulaResult
bool readCellFormulaResult()
reads the result of a text formula
Definition: QuattroDosSpreadsheet.cpp:1587
WKSContentListenerPtr
std::shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:114
Vec2< float >
QuattroDosSpreadsheet::m_mainParser
QuattroDosParser & m_mainParser
the listener (if set)
Definition: QuattroDosSpreadsheet.h:134
WKSContentListener::FormulaInstruction
small class use to define a formula instruction
Definition: WKSContentListener.h:57
QuattroDosSpreadsheet::hasLICSCharacters
bool hasLICSCharacters() const
returns the true if the file has LICS characters
Definition: QuattroDosSpreadsheet.cpp:607
WPSDebug.h
QuattroDosSpreadsheet::readCellProperty
bool readCellProperty()
reads a Quattro Pro property (zone 0x9d)
Definition: QuattroDosSpreadsheet.cpp:991
QuattroDosSpreadsheet::readSheetSize
bool readSheetSize()
reads sheet size
Definition: QuattroDosSpreadsheet.cpp:642