Multiplan.h Source File documentation

Multiplan.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 MULTIPLAN_H
23#define MULTIPLAN_H
24
25#include <vector>
26
27#include <librevenge-stream/librevenge-stream.h>
28#include "libwps/libwps.h"
29
30#include "libwps_internal.h"
31#include "libwps_tools_win.h"
32
33#include "WKSContentListener.h"
34
35#include "WKSParser.h"
36
37namespace libwps
38{
39
40namespace MultiplanParserInternal
41{
42struct State;
43}
44
49 class MultiplanParser final : public WKSParser
50{
51public:
53 MultiplanParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header,
54 libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN,
55 char const *password=nullptr);
57 ~MultiplanParser() override;
59 void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final;
61 bool checkHeader(WPSHeader *header, bool strict=false);
62
63protected:
65 bool checkFilePosition(long pos);
67 int version() const;
71 libwps_tools_win::Font::Type getDefaultFontType() const;
72
74 static std::shared_ptr<WKSContentListener> createListener(librevenge::RVNGSpreadsheetInterface *interface);
76 bool sendSpreadsheet();
78 bool sendCell(Vec2i const &cellPos, int pos);
79
80 //
81 // low level
82 //
83
85 bool readZones();
87 bool readColumnsWidth();
89 bool readZonesList();
91 bool readZonesListV2();
93 bool readCellDataPosition(WPSEntry const &entry);
95 bool readLink(int pos, WKSContentListener::FormulaInstruction &instruction);
97 bool readFilename(int pos, librevenge::RVNGString &filename);
99 bool readSharedData(int pos, int cellType, Vec2i const &cellPos, WKSContentListener::CellContent &content);
101 bool readName(int pos, WKSContentListener::FormulaInstruction &instruction);
103 bool readFunctionNamesList();
104
106
108 bool checkPassword(char const *password) const;
110 RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input);
112 bool retrievePasswordKeys();
113
115
117 bool readZoneB();
118
119
120protected:
122 bool readDouble(double &value);
124 bool readFormula(Vec2i const &cellPos, std::vector<WKSContentListener::FormulaInstruction> &formula, long endPos, std::string &extra);
126 bool readFormulaV2(Vec2i const &cellPos, std::vector<WKSContentListener::FormulaInstruction> &formula, long endPos, std::string &extra);
127
128 std::shared_ptr<WKSContentListener> m_listener;
130 std::shared_ptr<MultiplanParserInternal::State> m_state;
131};
132
133}
134
135#endif /* MULTIPLAN_H */
136/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WKSContentListener.h
WKSParser.h
WKSParser::WKSParser
WKSParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header)
Definition WKSParser.cpp:30
WPSEntry
basic class to store an entry in a file This contained :
Definition WPSEntry.h:39
WPSHeader
Definition WPSHeader.h:32
libwps::MultiplanParser::readDouble
bool readDouble(double &value)
try to read a double value
Definition Multiplan.cpp:904
libwps::MultiplanParser::readFormula
bool readFormula(Vec2i const &cellPos, std::vector< WKSContentListener::FormulaInstruction > &formula, long endPos, std::string &extra)
try to read a formula
Definition Multiplan.cpp:1046
libwps::MultiplanParser::readName
bool readName(int pos, WKSContentListener::FormulaInstruction &instruction)
reads a name and returns the cell's instruction
Definition Multiplan.cpp:1989
libwps::MultiplanParser::readZones
bool readZones()
finds the different zones (spreadsheet, chart, print, ...)
Definition Multiplan.cpp:472
libwps::MultiplanParser::checkHeader
bool checkHeader(WPSHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition Multiplan.cpp:317
libwps::MultiplanParser::readZoneB
bool readZoneB()
read an unknown zone
Definition Multiplan.cpp:2237
libwps::MultiplanParser::version
int version() const
return the file version
Definition Multiplan.cpp:233
libwps::MultiplanParser::readZonesListV2
bool readZonesListV2()
read the spreadsheet zone list v2
Definition Multiplan.cpp:692
libwps::MultiplanParser::getDefaultFontType
libwps_tools_win::Font::Type getDefaultFontType() const
returns the default font type, ie.
Definition Multiplan.cpp:251
libwps::MultiplanParser::~MultiplanParser
~MultiplanParser() override
destructor
Definition Multiplan.cpp:229
libwps::MultiplanParser::sendCell
bool sendCell(Vec2i const &cellPos, int pos)
try to send a cell
Definition Multiplan.cpp:2306
libwps::MultiplanParser::MultiplanParser
MultiplanParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN, char const *password=nullptr)
constructor
Definition Multiplan.cpp:221
libwps::MultiplanParser::retrievePasswordKeys
bool retrievePasswordKeys()
try to guess a password supposing that the Zone0 content is default
Definition Multiplan.cpp:2791
libwps::MultiplanParser::createListener
static std::shared_ptr< WKSContentListener > createListener(librevenge::RVNGSpreadsheetInterface *interface)
creates the main listener
Definition Multiplan.cpp:304
libwps::MultiplanParser::parse
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final
called by WPSDocument to parse the file
Definition Multiplan.cpp:259
libwps::MultiplanParser::readLink
bool readLink(int pos, WKSContentListener::FormulaInstruction &instruction)
read a link
Definition Multiplan.cpp:1872
libwps::MultiplanParser::m_state
std::shared_ptr< MultiplanParserInternal::State > m_state
the listener (if set)
Definition Multiplan.h:130
libwps::MultiplanParser::readCellDataPosition
bool readCellDataPosition(WPSEntry const &entry)
read the cell data position
Definition Multiplan.cpp:1827
libwps::MultiplanParser::sendSpreadsheet
bool sendSpreadsheet()
try to send the main spreadsheet
Definition Multiplan.cpp:2660
libwps::MultiplanParser::readZonesList
bool readZonesList()
read the spreadsheet zone list
Definition Multiplan.cpp:610
libwps::MultiplanParser::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition Multiplan.h:128
libwps::MultiplanParser::readSharedData
bool readSharedData(int pos, int cellType, Vec2i const &cellPos, WKSContentListener::CellContent &content)
read a shared data
Definition Multiplan.cpp:2092
libwps::MultiplanParser::readFilename
bool readFilename(int pos, librevenge::RVNGString &filename)
read a link filename
Definition Multiplan.cpp:1957
libwps::MultiplanParser::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition Multiplan.cpp:238
libwps::MultiplanParser::checkPassword
bool checkPassword(char const *password) const
check if the password corresponds to a ket
Definition Multiplan.cpp:2707
libwps::MultiplanParser::readFormulaV2
bool readFormulaV2(Vec2i const &cellPos, std::vector< WKSContentListener::FormulaInstruction > &formula, long endPos, std::string &extra)
try to read a formula V2
Definition Multiplan.cpp:1399
libwps::MultiplanParser::readFunctionNamesList
bool readFunctionNamesList()
try to read the function names: v2
Definition Multiplan.cpp:876
libwps::MultiplanParser::readColumnsWidth
bool readColumnsWidth()
read the columns width
Definition Multiplan.cpp:581
libwps::MultiplanParser::decodeStream
RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input)
try to decode a stream, if successful, replace the stream'input by the new one
Definition Multiplan.cpp:2840
libwps_tools_win::Font::Type
Type
enum Type
Definition libwps_tools_win.h:46
libwps_tools_win::Font::UNKNOWN
@ UNKNOWN
Definition libwps_tools_win.h:63
libwps.h
libwps_internal.h
WPSHeaderPtr
std::shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition libwps_internal.h:109
Vec2i
Vec2< int > Vec2i
Vec2 of int.
Definition libwps_internal.h:702
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition libwps_internal.h:87
libwps_tools_win.h
libwps::MultiplanParserInternal
Internal: namespace to define internal class of MultiplanParser.
Definition Multiplan.cpp:52
libwps
Definition libwps_internal.cpp:39
WKSContentListener::CellContent
small class use to define a sheet cell content
Definition WKSContentListener.h:100
WKSContentListener::FormulaInstruction
small class use to define a formula instruction
Definition WKSContentListener.h:58
libwps::MultiplanParserInternal::State
the state of MultiplanParser
Definition Multiplan.cpp:129