QuattroSpreadsheet.h Source File documentation

QuattroSpreadsheet.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_SPREADSHEET_H
23 #define QUATTRO_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 QuattroSpreadsheetInternal
37 {
38 class Cell;
39 class SpreadSheet;
40 struct State;
41 }
42
43 class QuattroParser;
44
49 class QuattroSpreadsheet
50 {
51 public:
52 friend class QuattroParser;
53
55 explicit QuattroSpreadsheet(QuattroParser &parser);
57 ~QuattroSpreadsheet();
59 void setListener(WKSContentListenerPtr &listen)
60 {
61 m_listener = listen;
62 }
64 void cleanState();
66 void updateState();
67
68 protected:
70 int version() const;
71
73 int getNumSpreadsheets() const;
75 librevenge::RVNGString getSheetName(int id) const;
77 void sendSpreadsheet(int sheetId, std::vector<Vec2i> const &listGraphicCells);
79 void sendCellContent(QuattroSpreadsheetInternal::Cell const &cell, int sheetId);
80
82 void addDLLIdName(int id, librevenge::RVNGString const &name, bool func1);
84 void addUserFormat(int id, librevenge::RVNGString const &name);
85
86 //
87 // low level
88 //
90
92 bool readCell(std::shared_ptr<WPSStream> stream);
94 bool readSheetSize(std::shared_ptr<WPSStream> stream);
96 bool readColumnSize(std::shared_ptr<WPSStream> stream);
98 bool readRowSize(std::shared_ptr<WPSStream> stream);
99
101 bool readBeginEndSheet(std::shared_ptr<WPSStream> stream, int &sheetId);
103 bool readSheetName(std::shared_ptr<WPSStream> stream);
105 bool readCellStyle(std::shared_ptr<WPSStream> stream);
106
108 bool readZone197(std::shared_ptr<WPSStream> stream);
109
110 /* reads a cell */
111 bool readCell(std::shared_ptr<WPSStream> stream, Vec2i actPos, WKSContentListener::FormulaInstruction &instr, int sheetId, librevenge::RVNGString const &fName);
112 /* reads a formula */
113 bool readFormula(std::shared_ptr<WPSStream> stream, long endPos, Vec2i const &pos, int sheetId,
114 std::vector<WKSContentListener::FormulaInstruction> &formula, std::string &error);
116 void updateCellWithUserFormat(QuattroSpreadsheetInternal::Cell &cell, librevenge::RVNGString const &format);
117 private:
118 QuattroSpreadsheet(QuattroSpreadsheet const &orig) = delete;
119 QuattroSpreadsheet &operator=(QuattroSpreadsheet const &orig) = delete;
120 std::shared_ptr<WKSContentListener> m_listener;
121 QuattroParser &m_mainParser;
124 std::shared_ptr<QuattroSpreadsheetInternal::State> m_state;
125 };
126
127 #endif /* WPS4_H */
128 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
QuattroSpreadsheet::updateCellWithUserFormat
void updateCellWithUserFormat(QuattroSpreadsheetInternal::Cell &cell, librevenge::RVNGString const &format)
try to update the cell&#39;s format using the user format
Definition: QuattroSpreadsheet.cpp:1805
QuattroSpreadsheet::m_state
std::shared_ptr< QuattroSpreadsheetInternal::State > m_state
the internal state
Definition: QuattroSpreadsheet.h:124
QuattroSpreadsheet::getSheetName
librevenge::RVNGString getSheetName(int id) const
returns the name of the id&#39;s spreadsheet
Definition: QuattroSpreadsheet.cpp:506
QuattroSpreadsheet::cleanState
void cleanState()
clean internal state
Definition: QuattroSpreadsheet.cpp:481
QuattroSpreadsheet::readFormula
bool readFormula(std::shared_ptr< WPSStream > stream, long endPos, Vec2i const &pos, int sheetId, std::vector< WKSContentListener::FormulaInstruction > &formula, std::string &error)
Definition: QuattroSpreadsheet.cpp:1337
QuattroSpreadsheet::readSheetName
bool readSheetName(std::shared_ptr< WPSStream > stream)
reads sheet name: zone cc
Definition: QuattroSpreadsheet.cpp:1148
QuattroSpreadsheet::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition: QuattroSpreadsheet.h:59
QuattroSpreadsheet::addDLLIdName
void addDLLIdName(int id, librevenge::RVNGString const &name, bool func1)
add a dll&#39;s correspondance between an id and a name
Definition: QuattroSpreadsheet.cpp:511
QuattroSpreadsheet::~QuattroSpreadsheet
~QuattroSpreadsheet()
destructor
Definition: QuattroSpreadsheet.cpp:477
QuattroSpreadsheet::operator=
QuattroSpreadsheet & operator=(QuattroSpreadsheet const &orig)=delete
WKSContentListener.h
QuattroSpreadsheet::m_mainParser
QuattroParser & m_mainParser
the listener (if set)
Definition: QuattroSpreadsheet.h:122
libwps_internal.h
QuattroSpreadsheet::readColumnSize
bool readColumnSize(std::shared_ptr< WPSStream > stream)
reads the column size ( in ??? )
Definition: QuattroSpreadsheet.cpp:997
libwps_tools_win::Language::name
std::string name(long id)
returns the name given Windows© id
Definition: libwps_tools_win.cpp:7297
QuattroSpreadsheet::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition: QuattroSpreadsheet.h:120
QuattroSpreadsheet::readZone197
bool readZone197(std::shared_ptr< WPSStream > stream)
reads a unknown sheet zone(one by sheet): zone 192
Definition: QuattroSpreadsheet.cpp:1190
QuattroSpreadsheet::sendSpreadsheet
void sendSpreadsheet(int sheetId, std::vector< Vec2i > const &listGraphicCells)
send the sId&#39;th spreadsheet
Definition: QuattroSpreadsheet.cpp:1717
QuattroParser
This class parses Quattro Pro spreadsheet: .wq1 and wq2.
Definition: Quattro.h:51
QuattroSpreadsheet::readCell
bool readCell(std::shared_ptr< WPSStream > stream)
reads a cell content data: zone 0xc-0x10 or 33
Definition: QuattroSpreadsheet.cpp:548
QuattroSpreadsheet
This class parses Quattro Pro DOS spreadsheet file.
Definition: QuattroSpreadsheet.h:49
QuattroSpreadsheet::sendCellContent
void sendCellContent(QuattroSpreadsheetInternal::Cell const &cell, int sheetId)
send the cell data
Definition: QuattroSpreadsheet.cpp:2030
QuattroSpreadsheet::readBeginEndSheet
bool readBeginEndSheet(std::shared_ptr< WPSStream > stream, int &sheetId)
read the begin/end of a sheet zone: zone ca and cb
Definition: QuattroSpreadsheet.cpp:1100
QuattroSpreadsheet::readCellStyle
bool readCellStyle(std::shared_ptr< WPSStream > stream)
reads a cell attribute: zone 0xce
Definition: QuattroSpreadsheet.cpp:722
QuattroSpreadsheet::readSheetSize
bool readSheetSize(std::shared_ptr< WPSStream > stream)
reads sheet size: zone 06
Definition: QuattroSpreadsheet.cpp:956
QuattroSpreadsheet::addUserFormat
void addUserFormat(int id, librevenge::RVNGString const &name)
add a user format&#39;s correspondance between an id and a name
Definition: QuattroSpreadsheet.cpp:527
QuattroSpreadsheet::readRowSize
bool readRowSize(std::shared_ptr< WPSStream > stream)
reads the row size: zone d6
Definition: QuattroSpreadsheet.cpp:1051
QuattroSpreadsheetInternal::Cell
a cellule of a Quattro spreadsheet
Definition: QuattroSpreadsheet.cpp:104
WKSContentListenerPtr
std::shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:114
Vec2< int >
QuattroSpreadsheet::QuattroSpreadsheet
QuattroSpreadsheet(QuattroParser &parser)
constructor
Definition: QuattroSpreadsheet.cpp:470
WKSContentListener::FormulaInstruction
small class use to define a formula instruction
Definition: WKSContentListener.h:57
QuattroSpreadsheet::version
int version() const
return the file version
Definition: QuattroSpreadsheet.cpp:490
QuattroSpreadsheet::updateState
void updateState()
update the state (need to be called before sending data)
Definition: QuattroSpreadsheet.cpp:486
WPSDebug.h
QuattroSpreadsheet::getNumSpreadsheets
int getNumSpreadsheets() const
returns the number of spreadsheet
Definition: QuattroSpreadsheet.cpp:497
QuattroSpreadsheetInternal
Definition: QuattroSpreadsheet.cpp:49