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 <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
35namespace QuattroSpreadsheetInternal
36{
37class Cell;
38class SpreadSheet;
39struct State;
40}
41
42class QuattroParser;
43
48 class QuattroSpreadsheet
49{
50public:
51 friend class QuattroParser;
52
54 explicit QuattroSpreadsheet(QuattroParser &parser);
56 ~QuattroSpreadsheet();
58 void setListener(WKSContentListenerPtr &listen)
59 {
60 m_listener = listen;
61 }
62
63protected:
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(QuattroSpreadsheetInternal::Cell const &cell);
78
80
82 bool readSpreadsheetOpen();
84 bool readSpreadsheetClose();
85
86 //
87 // low level
88 //
90
92 bool readCell();
94 bool readCellFormulaResult();
96 bool readSheetSize();
98 bool readSpreadsheetName();
100 bool readColumnSize();
102 bool readRowSize();
104 bool readHiddenColumns();
105
107 bool readCellProperty();
109 bool readCellStyle();
111 bool readUserStyle();
112
113 /* reads a cell */
114 bool readCell(Vec2i actPos, WKSContentListener::FormulaInstruction &instr, bool hasSheetId=false, int sheetId=0);
115 /* reads a formula */
116 bool readFormula(long endPos, Vec2i const &pos, int sheetId,
117 std::vector<WKSContentListener::FormulaInstruction> &formula, std::string &error);
118
119private:
120 QuattroSpreadsheet(QuattroSpreadsheet const &orig);
121 QuattroSpreadsheet &operator=(QuattroSpreadsheet const &orig);
123 libwps::DebugFile &ascii()
124 {
125 return m_asciiFile;
126 }
127
128 RVNGInputStreamPtr m_input;
129 shared_ptr<WKSContentListener> m_listener;
131 QuattroParser &m_mainParser;
133 shared_ptr<QuattroSpreadsheetInternal::State> m_state;
135 libwps::DebugFile &m_asciiFile;
136};
137
138#endif /* WPS4_H */
139/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WKSContentListener.h
WPSDebug.h
QuattroParser
This class parses Quattro Pro spreadsheet: .wq1 and wq2.
Definition Quattro.h:48
QuattroSpreadsheetInternal::Cell
a cellule of a Quattro spreadsheet
Definition QuattroSpreadsheet.cpp:140
QuattroSpreadsheet::QuattroSpreadsheet
QuattroSpreadsheet(QuattroParser &parser)
constructor
Definition QuattroSpreadsheet.cpp:523
QuattroSpreadsheet::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition QuattroSpreadsheet.cpp:548
QuattroSpreadsheet::readSpreadsheetName
bool readSpreadsheetName()
reads a sheet name (zone 0xde), unused...
Definition QuattroSpreadsheet.cpp:1569
QuattroSpreadsheet::QuattroParser
friend class QuattroParser
Definition QuattroSpreadsheet.h:51
QuattroSpreadsheet::readColumnSize
bool readColumnSize()
reads the column size ( in ??? )
Definition QuattroSpreadsheet.cpp:642
QuattroSpreadsheet::readSpreadsheetClose
bool readSpreadsheetClose()
reads a sheet header zone 0:dd (Quattro Pro wq2)
Definition QuattroSpreadsheet.cpp:1645
QuattroSpreadsheet::readFormula
bool readFormula(long endPos, Vec2i const &pos, int sheetId, std::vector< WKSContentListener::FormulaInstruction > &formula, std::string &error)
Definition QuattroSpreadsheet.cpp:1803
QuattroSpreadsheet::hasLICSCharacters
bool hasLICSCharacters() const
returns the true if the file has LICS characters
Definition QuattroSpreadsheet.cpp:541
QuattroSpreadsheet::m_listener
shared_ptr< WKSContentListener > m_listener
Definition QuattroSpreadsheet.h:129
QuattroSpreadsheet::m_mainParser
QuattroParser & m_mainParser
the listener (if set)
Definition QuattroSpreadsheet.h:131
QuattroSpreadsheet::readSheetSize
bool readSheetSize()
reads sheet size
Definition QuattroSpreadsheet.cpp:571
QuattroSpreadsheet::ascii
libwps::DebugFile & ascii()
returns the debug file
Definition QuattroSpreadsheet.h:123
QuattroSpreadsheet::readHiddenColumns
bool readHiddenColumns()
reads the list of hidden columns zone ( unused )
Definition QuattroSpreadsheet.cpp:688
QuattroSpreadsheet::readRowSize
bool readRowSize()
reads the column size ( in points )
Definition QuattroSpreadsheet.cpp:609
QuattroSpreadsheet::~QuattroSpreadsheet
~QuattroSpreadsheet()
destructor
Definition QuattroSpreadsheet.cpp:530
QuattroSpreadsheet::sendSpreadsheet
void sendSpreadsheet(int sId)
send the sId'th spreadsheet
Definition QuattroSpreadsheet.cpp:2161
QuattroSpreadsheet::readCell
bool readCell()
reads a cell content data
Definition QuattroSpreadsheet.cpp:1316
QuattroSpreadsheet::m_asciiFile
libwps::DebugFile & m_asciiFile
the ascii file
Definition QuattroSpreadsheet.h:135
QuattroSpreadsheet::readUserStyle
bool readUserStyle()
reads a Quattro Pro style ( zone 0xc9)
Definition QuattroSpreadsheet.cpp:1045
QuattroSpreadsheet::getNumSpreadsheets
int getNumSpreadsheets() const
returns the number of spreadsheet
Definition QuattroSpreadsheet.cpp:560
QuattroSpreadsheet::m_state
shared_ptr< QuattroSpreadsheetInternal::State > m_state
the internal state
Definition QuattroSpreadsheet.h:133
QuattroSpreadsheet::sendCellContent
void sendCellContent(QuattroSpreadsheetInternal::Cell const &cell)
send the cell data
Definition QuattroSpreadsheet.cpp:2211
QuattroSpreadsheet::QuattroSpreadsheet
QuattroSpreadsheet(QuattroSpreadsheet const &orig)
QuattroSpreadsheet::m_input
RVNGInputStreamPtr m_input
the input
Definition QuattroSpreadsheet.h:128
QuattroSpreadsheet::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition QuattroSpreadsheet.h:58
QuattroSpreadsheet::readSpreadsheetOpen
bool readSpreadsheetOpen()
reads a sheet header zone 0:dc (Quattro Pro wq2)
Definition QuattroSpreadsheet.cpp:1605
QuattroSpreadsheet::version
int version() const
return the file version
Definition QuattroSpreadsheet.cpp:534
QuattroSpreadsheet::readCellStyle
bool readCellStyle()
reads a Quattro Pro cell styles (zone 0xd8)
Definition QuattroSpreadsheet.cpp:729
QuattroSpreadsheet::operator=
QuattroSpreadsheet & operator=(QuattroSpreadsheet const &orig)
QuattroSpreadsheet::readCellFormulaResult
bool readCellFormulaResult()
reads the result of a text formula
Definition QuattroSpreadsheet.cpp:1524
QuattroSpreadsheet::readCellProperty
bool readCellProperty()
reads a Quattro Pro property (zone 0x9d)
Definition QuattroSpreadsheet.cpp:905
libwps::DebugFile
Definition WPSDebug.h:197
libwps_internal.h
RVNGInputStreamPtr
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition libwps_internal.h:88
Vec2i
Vec2< int > Vec2i
Vec2 of int.
Definition libwps_internal.h:719
WKSContentListenerPtr
shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition libwps_internal.h:115
QuattroSpreadsheetInternal
Definition QuattroSpreadsheet.cpp:46
QuattroSpreadsheetInternal::State
the state of QuattroSpreadsheet
Definition QuattroSpreadsheet.cpp:441
WKSContentListener::FormulaInstruction
small class use to define a formula instruction
Definition WKSContentListener.h:57