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 
38 {
39 struct State;
40 }
41 
46 class MultiplanParser final : public WKSParser
47 {
48 public:
52  char const *password=nullptr);
54  ~MultiplanParser() override;
56  void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final;
58  bool checkHeader(WPSHeader *header, bool strict=false);
59 
60 protected:
62  bool checkFilePosition(long pos);
64  int version() const;
69 
71  std::shared_ptr<WKSContentListener> createListener(librevenge::RVNGSpreadsheetInterface *interface);
73  bool sendSpreadsheet();
75  bool sendCell(Vec2i const &cellPos, int pos);
76 
77  //
78  // low level
79  //
80 
82  bool readZones();
84  bool readColumnsWidth();
86  bool readZonesList();
88  bool readZonesListV2();
90  bool readCellDataPosition(WPSEntry const &entry);
92  bool readLink(int pos, WKSContentListener::FormulaInstruction &instruction);
94  bool readFilename(int pos, librevenge::RVNGString &filename);
96  bool readSharedData(int pos, int cellType, Vec2i const &cellPos, WKSContentListener::CellContent &content);
98  bool readName(int pos, WKSContentListener::FormulaInstruction &instruction);
100  bool readFunctionNamesList();
101 
103 
105  bool checkPassword(char const *password) const;
109  bool retrievePasswordKeys();
110 
112 
114  bool readZoneB();
115 
116 
117 protected:
119  bool readDouble(double &value);
121  bool readFormula(Vec2i const &cellPos, std::vector<WKSContentListener::FormulaInstruction> &formula, long endPos, std::string &extra);
123  bool readFormulaV2(Vec2i const &cellPos, std::vector<WKSContentListener::FormulaInstruction> &formula, long endPos, std::string &extra);
124 
125  std::shared_ptr<WKSContentListener> m_listener;
126  std::shared_ptr<MultiplanParserInternal::State> m_state;
128 };
129 
130 #endif /* WPS4_H */
131 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
bool retrievePasswordKeys()
try to guess a password supposing that the Zone0 content is default
Definition: Multiplan.cpp:2829
bool readZonesListV2()
read the spreadsheet zone list v2
Definition: Multiplan.cpp:685
bool readZoneB()
read an unknown zone
Definition: Multiplan.cpp:2283
int version() const
return the file version
Definition: Multiplan.cpp:226
MultiplanParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN, char const *password=nullptr)
constructor
Definition: Multiplan.cpp:214
bool sendCell(Vec2i const &cellPos, int pos)
try to send a cell
Definition: Multiplan.cpp:2352
bool readDouble(double &value)
try to read a double value
Definition: Multiplan.cpp:897
bool readFormulaV2(Vec2i const &cellPos, std::vector< WKSContentListener::FormulaInstruction > &formula, long endPos, std::string &extra)
try to read a formula V2
Definition: Multiplan.cpp:1405
std::shared_ptr< WKSContentListener > m_listener
Definition: Multiplan.h:125
RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input)
try to decode a stream, if successful, replace the stream&#39;input by the new one
Definition: Multiplan.cpp:2878
bool readFilename(int pos, librevenge::RVNGString &filename)
read a link filename
Definition: Multiplan.cpp:1990
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final
called by WPSDocument to parse the file
Definition: Multiplan.cpp:252
Type
enum Type
Definition: libwps_tools_win.h:46
bool readLink(int pos, WKSContentListener::FormulaInstruction &instruction)
read a link
Definition: Multiplan.cpp:1892
bool readColumnsWidth()
read the columns width
Definition: Multiplan.cpp:574
bool readZones()
finds the different zones (spreadsheet, chart, print, ...)
Definition: Multiplan.cpp:465
bool checkHeader(WPSHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: Multiplan.cpp:310
Definition: WPSHeader.h:31
bool readSharedData(int pos, int cellType, Vec2i const &cellPos, WKSContentListener::CellContent &content)
read a shared data
Definition: Multiplan.cpp:2138
Definition: libwps_tools_win.h:61
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
libwps_tools_win::Font::Type getDefaultFontType() const
returns the default font type, ie.
Definition: Multiplan.cpp:244
bool readName(int pos, WKSContentListener::FormulaInstruction &instruction)
reads a name and returns the cell&#39;s instruction
Definition: Multiplan.cpp:2035
std::shared_ptr< WKSContentListener > createListener(librevenge::RVNGSpreadsheetInterface *interface)
creates the main listener
Definition: Multiplan.cpp:297
small class use to define a sheet cell content
Definition: WKSContentListener.h:99
std::shared_ptr< MultiplanParserInternal::State > m_state
the listener (if set)
Definition: Multiplan.h:127
bool checkPassword(char const *password) const
check if the password corresponds to a ket
Definition: Multiplan.cpp:2745
Internal: namespace to define internal class of MultiplanParser.
Definition: Multiplan.cpp:50
This class parses Microsoft Multiplan DOS spreadsheet v1.
Definition: Multiplan.h:46
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:38
~MultiplanParser() override
destructor
Definition: Multiplan.cpp:222
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: Multiplan.cpp:231
small class use to define a formula instruction
Definition: WKSContentListener.h:57
bool readFunctionNamesList()
try to read the function names: v2
Definition: Multiplan.cpp:869
bool readZonesList()
read the spreadsheet zone list
Definition: Multiplan.cpp:603
bool readFormula(Vec2i const &cellPos, std::vector< WKSContentListener::FormulaInstruction > &formula, long endPos, std::string &extra)
try to read a formula
Definition: Multiplan.cpp:1039
std::shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:109
Definition: WKSParser.h:33
bool sendSpreadsheet()
try to send the main spreadsheet
Definition: Multiplan.cpp:2698
bool readCellDataPosition(WPSEntry const &entry)
read the cell data position
Definition: Multiplan.cpp:1847

Generated on Fri May 27 2022 03:07:00 for libwps by doxygen 1.8.14