Lotus.h Source File documentation

Lotus.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 LOTUS_H
23#define LOTUS_H
24
25#include <vector>
26
27#include <librevenge-stream/librevenge-stream.h>
28#include "libwps_internal.h"
29#include "libwps_tools_win.h"
30#include "WPSDebug.h"
31
32#include "WKSParser.h"
33
34namespace LotusParserInternal
35{
36class SubDocument;
37struct State;
38}
39
40class LotusGraph;
41class LotusSpreadsheet;
42class LotusStyleManager;
43class WPSOLE1Parser;
44
45/* .wk3: a spreadsheet is composed in two files
46 + a wk3 file which contains the spreadsheet data
47 + a fm3 file which contains the different formatings
48
49 .wk4: the file contains three parts:
50 + the wk3 previous file
51 + the fm3 file
52 + an unknown part, which may code the file structure,
53
54 Normally the wk3 and the fm3 are a sequence of small zones,
55 but picture seems to be appeared at random position inside the
56 fm3 part (and even inside some structure fm3 structures...)
57
58 search for .ole and OLE1
59
60 */
61
66 class LotusParser : public WKSParser
67{
68 friend class LotusParserInternal::SubDocument;
69 friend class LotusGraph;
70 friend class LotusSpreadsheet;
71 friend class LotusStyleManager;
72public:
74 LotusParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header,
75 libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN,
76 char const *password=0);
78 ~LotusParser();
80 void parse(librevenge::RVNGSpreadsheetInterface *documentInterface);
82 bool checkHeader(WPSHeader *header, bool strict=false);
83
84protected:
86 int version() const;
87
88 //
89 // interface
90 //
91
93 bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const;
97 libwps_tools_win::Font::Type getDefaultFontType() const;
98
99 //
100 // interface with LotusGraph
101 //
102
104 bool hasGraphics(int sheetId) const;
106 void sendGraphics(int sheetId);
107
108 //
109 // interface with LotusSpreadsheet
110 //
111
113 bool getLeftTopPosition(Vec2i const &cell, int spreadsheet, Vec2f &pos) const;
114
115 //
116 // interface with WPSOLE1Parser
117 //
118
120 bool updateEmbeddedObject(int id, WPSEmbeddedObject &object) const;
121
123 bool createZones();
125 bool createListener(librevenge::RVNGSpreadsheetInterface *interface);
126
127 //
128 // low level
129 //
130
132 bool parseFormatStream();
133
135 bool checkHeader(shared_ptr<WPSStream> stream, bool mainStream, bool strict);
137 bool readZones(shared_ptr<WPSStream> stream);
139 bool readDataZone(shared_ptr<WPSStream> stream);
141 bool readZone(shared_ptr<WPSStream> stream);
143 bool readZone1(shared_ptr<WPSStream> stream);
145 bool readSheetZone(shared_ptr<WPSStream> stream);
147 bool readZone4(shared_ptr<WPSStream> stream);
149 bool readChartZone(shared_ptr<WPSStream> stream);
151 bool readRefZone(shared_ptr<WPSStream> stream);
153 bool readZone7(shared_ptr<WPSStream> stream);
155 bool readZone8(shared_ptr<WPSStream> stream);
157 bool readVersionZone(shared_ptr<WPSStream> stream);
159 bool readZoneV3(shared_ptr<WPSStream> stream);
161
163 bool readMacFontName(shared_ptr<WPSStream> stream, long endPos);
165 bool readFMTStyleName(shared_ptr<WPSStream> stream);
167 bool readLinkZone(shared_ptr<WPSStream> stream);
169 bool readDocumentInfoMac(shared_ptr<WPSStream> stream, long endPos);
170
172
174 bool readChartDefinition(shared_ptr<WPSStream> stream);
176 bool readChartName(shared_ptr<WPSStream> stream);
177
179
181 static RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input, long endPos, std::vector<uint8_t> const &key);
183 static std::vector<uint8_t> retrievePasswordKeys(std::vector<uint8_t> const &fileKeys);
184
185 shared_ptr<WKSContentListener> m_listener;
187 shared_ptr<LotusParserInternal::State> m_state;
189 shared_ptr<LotusStyleManager> m_styleManager;
191 shared_ptr<LotusGraph> m_graphParser;
193 shared_ptr<LotusSpreadsheet> m_spreadsheetParser;
195 shared_ptr<WPSOLE1Parser> m_ole1Parser;
196};
197
198#endif /* LOTUS_H */
199/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WKSParser.h
WPSDebug.h
LotusGraph
This class parses Microsoft Works graph file.
Definition LotusGraph.h:55
LotusParserInternal::SubDocument
Internal: the subdocument of a LotusParser.
Definition Lotus.cpp:71
LotusParser::readZone7
bool readZone7(shared_ptr< WPSStream > stream)
reads a zone of type 7: 123 files
Definition Lotus.cpp:2581
LotusParser::LotusSpreadsheet
friend class LotusSpreadsheet
Definition Lotus.h:70
LotusParser::m_state
shared_ptr< LotusParserInternal::State > m_state
the listener (if set)
Definition Lotus.h:187
LotusParser::LotusParser
LotusParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN, char const *password=0)
constructor
Definition Lotus.cpp:268
LotusParser::readZone1
bool readZone1(shared_ptr< WPSStream > stream)
reads a zone of type 1: 123 files
Definition Lotus.cpp:1728
LotusParser::updateEmbeddedObject
bool updateEmbeddedObject(int id, WPSEmbeddedObject &object) const
try to retrieve the content of a graphic, knowing it local id
Definition Lotus.cpp:325
LotusParser::readChartDefinition
bool readChartDefinition(shared_ptr< WPSStream > stream)
reads a chart definitions
Definition Lotus.cpp:3228
LotusParser::getLeftTopPosition
bool getLeftTopPosition(Vec2i const &cell, int spreadsheet, Vec2f &pos) const
returns the left top position of a cell
Definition Lotus.cpp:320
LotusParser::m_ole1Parser
shared_ptr< WPSOLE1Parser > m_ole1Parser
the ole1 parser
Definition Lotus.h:195
LotusParser::m_styleManager
shared_ptr< LotusStyleManager > m_styleManager
the style manager
Definition Lotus.h:189
LotusParser::sendGraphics
void sendGraphics(int sheetId)
send the graphics corresponding to a sheetId
Definition Lotus.cpp:315
LotusParser::decodeStream
static RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input, long endPos, std::vector< uint8_t > const &key)
try to decode a stream, if successful, replace the stream'input by the new one
Definition Lotus.cpp:3344
LotusParser::retrievePasswordKeys
static std::vector< uint8_t > retrievePasswordKeys(std::vector< uint8_t > const &fileKeys)
try to guess a password knowing its file keys. Returns the keys if it founds a valid password
Definition Lotus.cpp:3406
LotusParser::checkHeader
bool checkHeader(WPSHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition Lotus.cpp:423
LotusParser::readLinkZone
bool readLinkZone(shared_ptr< WPSStream > stream)
reads a link
Definition Lotus.cpp:3057
LotusParser::parseFormatStream
bool parseFormatStream()
check for the existence of a format stream, if it exists, parse it
Definition Lotus.cpp:548
LotusParser::parse
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface)
called by WPSDocument to parse the file
Definition Lotus.cpp:340
LotusParser::readZones
bool readZones(shared_ptr< WPSStream > stream)
finds the different zones (spreadsheet, chart, print, ...)
Definition Lotus.cpp:572
LotusParser::createZones
bool createZones()
try to parse the different zones
Definition Lotus.cpp:510
LotusParser::~LotusParser
~LotusParser()
destructor
Definition Lotus.cpp:280
LotusParser::readVersionZone
bool readVersionZone(shared_ptr< WPSStream > stream)
reads a zone of type a: 123 files
Definition Lotus.cpp:2849
LotusParser::readChartZone
bool readChartZone(shared_ptr< WPSStream > stream)
reads a zone of type 5: 123 files
Definition Lotus.cpp:2395
LotusParser::getFont
bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const
returns the font corresponding to an id
Definition Lotus.cpp:297
LotusParser::readDocumentInfoMac
bool readDocumentInfoMac(shared_ptr< WPSStream > stream, long endPos)
reads a mac document info zone: zone 1b, then 2af8
Definition Lotus.cpp:3155
LotusParser::m_graphParser
shared_ptr< LotusGraph > m_graphParser
the graph manager
Definition Lotus.h:191
LotusParser::readSheetZone
bool readSheetZone(shared_ptr< WPSStream > stream)
reads a zone of type 2: 123 files
Definition Lotus.cpp:1912
LotusParser::getDefaultFontType
libwps_tools_win::Font::Type getDefaultFontType() const
returns the default font type, ie.
Definition Lotus.cpp:292
LotusParser::readMacFontName
bool readMacFontName(shared_ptr< WPSStream > stream, long endPos)
reads a mac font name
Definition Lotus.cpp:2887
LotusParser::m_spreadsheetParser
shared_ptr< LotusSpreadsheet > m_spreadsheetParser
the spreadsheet manager
Definition Lotus.h:193
LotusParser::readZone4
bool readZone4(shared_ptr< WPSStream > stream)
reads a zone of type 4: 123 files
Definition Lotus.cpp:2211
LotusParser::LotusGraph
friend class LotusGraph
Definition Lotus.h:69
LotusParser::m_listener
shared_ptr< WKSContentListener > m_listener
Definition Lotus.h:185
LotusParser::readZone
bool readZone(shared_ptr< WPSStream > stream)
reads a zone
Definition Lotus.cpp:644
LotusParser::version
int version() const
return the file version
Definition Lotus.cpp:284
LotusParser::readRefZone
bool readRefZone(shared_ptr< WPSStream > stream)
reads a zone of type 6: 123 files
Definition Lotus.cpp:2495
LotusParser::readZoneV3
bool readZoneV3(shared_ptr< WPSStream > stream)
parse a wk123 zone
Definition Lotus.cpp:1704
LotusParser::readDataZone
bool readDataZone(shared_ptr< WPSStream > stream)
parse the different zones 1B
Definition Lotus.cpp:1324
LotusParser::readFMTStyleName
bool readFMTStyleName(shared_ptr< WPSStream > stream)
reads a format style name: b6
Definition Lotus.cpp:3010
LotusParser::readZone8
bool readZone8(shared_ptr< WPSStream > stream)
reads a zone of type 8: 123 files
Definition Lotus.cpp:2707
LotusParser::readChartName
bool readChartName(shared_ptr< WPSStream > stream)
reads the chart name or title
Definition Lotus.cpp:3295
LotusParser::createListener
bool createListener(librevenge::RVNGSpreadsheetInterface *interface)
creates the main listener
Definition Lotus.cpp:392
LotusParser::hasGraphics
bool hasGraphics(int sheetId) const
return true if the sheet sheetId has some graphic
Definition Lotus.cpp:310
LotusParser::LotusStyleManager
friend class LotusStyleManager
Definition Lotus.h:71
LotusSpreadsheet
This class parses Microsoft Works spreadsheet file.
Definition LotusSpreadsheet.h:53
LotusStyleManager
This class parses the Lotus style.
Definition LotusStyleManager.h:48
WKSParser::WKSParser
WKSParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header)
Definition WKSParser.cpp:30
WPSFont
define the font properties
Definition WPSFont.h:37
WPSHeader
Definition WPSHeader.h:32
WPSOLE1Parser
a class used to parse a container which is used by Lotus123 (and also by RagTime).
Definition WPSOLE1Parser.h:50
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:61
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
Vec2f
Vec2< float > Vec2f
Vec2 of float.
Definition libwps_internal.h:721
WPSHeaderPtr
shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition libwps_internal.h:110
libwps_tools_win.h
LotusParserInternal
Internal: namespace to define internal class of LotusParser.
Definition Lotus.cpp:57
LotusParserInternal::State
the state of LotusParser
Definition Lotus.cpp:122
WPSEmbeddedObject
small class use to define a embedded object
Definition libwps_internal.h:439