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 
34 namespace LotusParserInternal
35 {
36 class SubDocument;
37 struct State;
38 }
39 
40 class LotusGraph;
41 class LotusSpreadsheet;
42 class LotusStyleManager;
43 class 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 {
69  friend class LotusGraph;
70  friend class LotusSpreadsheet;
71  friend class LotusStyleManager;
72 public:
77  ~LotusParser();
79  void parse(librevenge::RVNGSpreadsheetInterface *documentInterface);
81  bool checkHeader(WPSHeader *header, bool strict=false);
82 
83 protected:
85  int version() const;
86 
87  //
88  // interface
89  //
90 
92  bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const;
97 
98  //
99  // interface with LotusGraph
100  //
101 
103  bool hasGraphics(int sheetId) const;
105  void sendGraphics(int sheetId);
106 
107  //
108  // interface with LotusSpreadsheet
109  //
110 
112  bool getLeftTopPosition(Vec2i const &cell, int spreadsheet, Vec2f &pos) const;
113 
114  //
115  // interface with WPSOLE1Parser
116  //
117 
119  bool updateEmbeddedObject(int id, WPSEmbeddedObject &object) const;
120 
122  bool createZones();
124  bool createListener(librevenge::RVNGSpreadsheetInterface *interface);
125 
126  //
127  // low level
128  //
129 
131  bool parseFormatStream();
132 
134  bool checkHeader(shared_ptr<WPSStream> stream, bool mainStream, bool strict);
136  bool readZones(shared_ptr<WPSStream> stream);
138  bool readDataZone(shared_ptr<WPSStream> stream);
140  bool readZone(shared_ptr<WPSStream> stream);
142  bool readZone1(shared_ptr<WPSStream> stream);
144  bool readSheetZone(shared_ptr<WPSStream> stream);
146  bool readZone4(shared_ptr<WPSStream> stream);
148  bool readChartZone(shared_ptr<WPSStream> stream);
150  bool readRefZone(shared_ptr<WPSStream> stream);
152  bool readZone7(shared_ptr<WPSStream> stream);
154  bool readZone8(shared_ptr<WPSStream> stream);
156  bool readVersionZone(shared_ptr<WPSStream> stream);
158  bool readZoneV3(shared_ptr<WPSStream> stream);
160 
162  bool readMacFontName(shared_ptr<WPSStream> stream, long endPos);
164  bool readFMTStyleName(shared_ptr<WPSStream> stream);
166  bool readLinkZone(shared_ptr<WPSStream> stream);
168  bool readDocumentInfoMac(shared_ptr<WPSStream> stream, long endPos);
169 
171 
173  bool readChartDefinition(shared_ptr<WPSStream> stream);
175  bool readChartName(shared_ptr<WPSStream> stream);
176 
178 
179 
180  shared_ptr<WKSContentListener> m_listener;
181  shared_ptr<LotusParserInternal::State> m_state;
184  shared_ptr<LotusStyleManager> m_styleManager;
186  shared_ptr<LotusGraph> m_graphParser;
188  shared_ptr<LotusSpreadsheet> m_spreadsheetParser;
190  shared_ptr<WPSOLE1Parser> m_ole1Parser;
191 };
192 
193 #endif /* LOTUS_H */
194 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
bool updateEmbeddedObject(int id, WPSEmbeddedObject &object) const
try to retrieve the content of a graphic, knowing it local id
Definition: Lotus.cpp:316
bool readChartDefinition(shared_ptr< WPSStream > stream)
reads a chart definitions
Definition: Lotus.cpp:3134
bool readVersionZone(shared_ptr< WPSStream > stream)
reads a zone of type a: 123 files
Definition: Lotus.cpp:2755
bool checkHeader(WPSHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: Lotus.cpp:408
bool readZoneV3(shared_ptr< WPSStream > stream)
parse a wk123 zone
Definition: Lotus.cpp:1617
bool createListener(librevenge::RVNGSpreadsheetInterface *interface)
creates the main listener
Definition: Lotus.cpp:377
int version() const
return the file version
Definition: Lotus.cpp:275
bool readChartZone(shared_ptr< WPSStream > stream)
reads a zone of type 5: 123 files
Definition: Lotus.cpp:2308
~LotusParser()
destructor
Definition: Lotus.cpp:271
define the font properties
Definition: WPSFont.h:36
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface)
called by WPSDocument to parse the file
Definition: Lotus.cpp:331
Type
enum Type
Definition: libwps_tools_win.h:46
bool readSheetZone(shared_ptr< WPSStream > stream)
reads a zone of type 2: 123 files
Definition: Lotus.cpp:1825
bool readRefZone(shared_ptr< WPSStream > stream)
reads a zone of type 6: 123 files
Definition: Lotus.cpp:2408
bool readLinkZone(shared_ptr< WPSStream > stream)
reads a link
Definition: Lotus.cpp:2963
This class parses Microsoft Works graph file.
Definition: LotusGraph.h:54
This class parses a WK2..WK4 Lotus spreadsheet.
Definition: Lotus.h:66
a class used to parse a container which is used by Lotus123 (and also by RagTime).
Definition: WPSOLE1Parser.h:49
shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:110
shared_ptr< WPSOLE1Parser > m_ole1Parser
the ole1 parser
Definition: Lotus.h:190
bool readZone7(shared_ptr< WPSStream > stream)
reads a zone of type 7: 123 files
Definition: Lotus.cpp:2494
Internal: the subdocument of a LotusParser.
Definition: Lotus.cpp:69
void sendGraphics(int sheetId)
send the graphics corresponding to a sheetId
Definition: Lotus.cpp:306
Definition: WPSHeader.h:31
This class parses the Lotus style.
Definition: LotusStyleManager.h:47
Definition: libwps_tools_win.h:61
Internal: namespace to define internal class of LotusParser.
Definition: Lotus.cpp:55
bool readDataZone(shared_ptr< WPSStream > stream)
parse the different zones 1B
Definition: Lotus.cpp:1237
shared_ptr< LotusStyleManager > m_styleManager
the style manager
Definition: Lotus.h:184
bool readDocumentInfoMac(shared_ptr< WPSStream > stream, long endPos)
reads a mac document info zone: zone 1b, then 2af8
Definition: Lotus.cpp:3061
bool readZone4(shared_ptr< WPSStream > stream)
reads a zone of type 4: 123 files
Definition: Lotus.cpp:2124
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:88
bool readZone8(shared_ptr< WPSStream > stream)
reads a zone of type 8: 123 files
Definition: Lotus.cpp:2620
bool getLeftTopPosition(Vec2i const &cell, int spreadsheet, Vec2f &pos) const
returns the left top position of a cell
Definition: Lotus.cpp:311
This class parses Microsoft Works spreadsheet file.
Definition: LotusSpreadsheet.h:52
bool readZone(shared_ptr< WPSStream > stream)
reads a zone
Definition: Lotus.cpp:629
bool readZone1(shared_ptr< WPSStream > stream)
reads a zone of type 1: 123 files
Definition: Lotus.cpp:1641
bool hasGraphics(int sheetId) const
return true if the sheet sheetId has some graphic
Definition: Lotus.cpp:301
shared_ptr< LotusParserInternal::State > m_state
the listener (if set)
Definition: Lotus.h:182
bool readZones(shared_ptr< WPSStream > stream)
finds the different zones (spreadsheet, chart, print, ...)
Definition: Lotus.cpp:561
small class use to define a embedded object
Definition: libwps_internal.h:433
libwps_tools_win::Font::Type getDefaultFontType() const
returns the default font type, ie.
Definition: Lotus.cpp:283
LotusParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN)
constructor
Definition: Lotus.cpp:260
bool readChartName(shared_ptr< WPSStream > stream)
reads the chart name or title
Definition: Lotus.cpp:3201
bool createZones()
try to parse the different zones
Definition: Lotus.cpp:499
shared_ptr< WKSContentListener > m_listener
Definition: Lotus.h:180
Definition: WKSParser.h:33
bool readFMTStyleName(shared_ptr< WPSStream > stream)
reads a format style name: b6
Definition: Lotus.cpp:2916
shared_ptr< LotusGraph > m_graphParser
the graph manager
Definition: Lotus.h:186
shared_ptr< LotusSpreadsheet > m_spreadsheetParser
the spreadsheet manager
Definition: Lotus.h:188
bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const
returns the font corresponding to an id
Definition: Lotus.cpp:288
bool parseFormatStream()
check for the existence of a format stream, if it exists, parse it
Definition: Lotus.cpp:537
bool readMacFontName(shared_ptr< WPSStream > stream, long endPos)
reads a mac font name
Definition: Lotus.cpp:2793

Generated on Sun Jan 15 2017 11:54:07 for libwps by doxygen 1.8.8