Quattro.h Source File documentation

Quattro.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_H
23#define QUATTRO_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 "WKSParser.h"
34
35namespace QuattroParserInternal
36{
37class SubDocument;
38struct State;
39}
40
41//class QuattroChart;
42class QuattroGraph;
43class QuattroSpreadsheet;
44
45 namespace QuattroFormulaInternal
46{
47class CellReference;
48}
53 class QuattroParser final : public WKSParser
54{
55 friend class QuattroParserInternal::SubDocument;
56 //friend class QuattroChart;
57 friend class QuattroGraph;
58 friend class QuattroSpreadsheet;
59public:
61 QuattroParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header,
62 libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN,
63 char const *password=nullptr);
65 ~QuattroParser() final;
67 void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final;
69 bool checkHeader(WPSHeader *header, bool strict=false);
70
71protected:
73 int version() const;
77 libwps_tools_win::Font::Type getDefaultFontType() const;
79 bool getExternalFileName(int fId, librevenge::RVNGString &fName) const;
81 bool getField(int fId, librevenge::RVNGString &text,
82 QuattroFormulaInternal::CellReference &ref,
83 librevenge::RVNGString const &fileName) const;
84
85 //
86 // interface with QuattroSpreadsheet
87 //
88
90 bool getColor(int id, WPSColor &color) const;
92 bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const;
94 Vec2f getCellPosition(int sheetId, Vec2i const &cell) const;
95
96 //
97 // interface with QuattroGraph
98 //
99
101 bool sendPageGraphics(int sheetId) const;
103 bool sendGraphics(int sheetId, Vec2i const &cell) const;
104
105 //
106 //
107 //
108
110 std::shared_ptr<WKSContentListener> createListener(librevenge::RVNGSpreadsheetInterface *interface);
111
113 void sendHeaderFooter(bool header);
114
115 //
116 // low level
117 //
118
120 bool checkHeader(std::shared_ptr<WPSStream> stream, bool strict);
122 bool readZones();
124 bool readOLEZones(std::shared_ptr<WPSStream> &stream);
126 bool readZone(std::shared_ptr<WPSStream> &stream);
127
129
131 bool readFieldName(std::shared_ptr<WPSStream> stream);
133 static bool readCellPosition(std::shared_ptr<WPSStream> stream);
135 bool readExternalData(std::shared_ptr<WPSStream> stream);
137 bool readFontDef(std::shared_ptr<WPSStream> stream);
139 bool readColorList(std::shared_ptr<WPSStream> stream);
141 bool readStyleName(std::shared_ptr<WPSStream> stream);
143 bool readHeaderFooter(std::shared_ptr<WPSStream> stream, bool header);
145 bool readPaneAttribute(std::shared_ptr<WPSStream> stream);
147 bool readOptimizer(std::shared_ptr<WPSStream> stream);
149 bool readQueryCommand(std::shared_ptr<WPSStream> stream);
151 static bool readSerieExtension(std::shared_ptr<WPSStream> stream);
153 bool readCString(std::shared_ptr<WPSStream> stream, librevenge::RVNGString &string, long maxSize);
154
156
158 bool readBlockList(std::shared_ptr<WPSStream> stream);
160 bool readZone341(std::shared_ptr<WPSStream> stream);
161
163
165 bool parseOLEStream(RVNGInputStreamPtr input, std::string const &avoid="");
167 bool readOleLinkInfo(std::shared_ptr<WPSStream> stream, librevenge::RVNGString &link);
169 static bool readOleBOlePart(std::shared_ptr<WPSStream> stream);
170
172
174 RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input, std::vector<uint8_t> const &key) const;
175
176 std::shared_ptr<WKSContentListener> m_listener;
178 std::shared_ptr<QuattroParserInternal::State> m_state;
179 // the chart manager
180 // std::shared_ptr<QuattroChart> m_chartParser;
182 std::shared_ptr<QuattroGraph> m_graphParser;
184 std::shared_ptr<QuattroSpreadsheet> m_spreadsheetParser;
185};
186
187#endif /* WPS4_H */
188/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WKSParser.h
QuattroFormulaInternal::CellReference
small class use to store Quattro Pro cell reference (.wb1-3 and qpw)
Definition: QuattroFormula.h:43
QuattroGraph
This class parses QuattroPro graph file.
Definition: QuattroGraph.h:56
QuattroParserInternal::SubDocument
Internal: the subdocument of a WPS4Parser.
Definition: Quattro.cpp:81
QuattroParser
This class parses Quattro Pro spreadsheet: .wb1, ..., .wb3.
Definition: Quattro.h:54
QuattroParser::readOleBOlePart
static bool readOleBOlePart(std::shared_ptr< WPSStream > stream)
try to read the BOlePart sub stream: a zone which contains 5 long
Definition: Quattro.cpp:2655
QuattroParser::sendPageGraphics
bool sendPageGraphics(int sheetId) const
send the page graphic corresponding to a sheet
Definition: Quattro.cpp:556
QuattroParser::getCellPosition
Vec2f getCellPosition(int sheetId, Vec2i const &cell) const
returns the beginning position of a cell
Definition: Quattro.cpp:571
QuattroParser::readOptimizer
bool readOptimizer(std::shared_ptr< WPSStream > stream)
read the first optimizer zone: 103
Definition: Quattro.cpp:2045
QuattroParser::version
int version() const
return the file version
Definition: Quattro.cpp:485
QuattroParser::readFontDef
bool readFontDef(std::shared_ptr< WPSStream > stream)
read a font: zone cf, fc and 110
Definition: Quattro.cpp:1848
QuattroParser::parseOLEStream
bool parseOLEStream(RVNGInputStreamPtr input, std::string const &avoid="")
try to parse the OLE stream(except the main stream)
Definition: Quattro.cpp:826
QuattroParser::readPaneAttribute
bool readPaneAttribute(std::shared_ptr< WPSStream > stream)
read the pane attribute: d1
Definition: Quattro.cpp:2379
QuattroParser::readCString
bool readCString(std::shared_ptr< WPSStream > stream, librevenge::RVNGString &string, long maxSize)
try to read a basic C string, knowing the maximum size
Definition: Quattro.cpp:1705
QuattroParser::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition: Quattro.h:176
QuattroParser::sendGraphics
bool sendGraphics(int sheetId, Vec2i const &cell) const
send the graphic corresponding to a cell
Definition: Quattro.cpp:561
QuattroParser::readExternalData
bool readExternalData(std::shared_ptr< WPSStream > stream)
read a external filename/name: zone 97,98
Definition: Quattro.cpp:1799
QuattroParser::readBlockList
bool readBlockList(std::shared_ptr< WPSStream > stream)
reads some cell reference list (potential followed by other data)
Definition: Quattro.cpp:2220
QuattroParser::m_state
std::shared_ptr< QuattroParserInternal::State > m_state
the listener (if set)
Definition: Quattro.h:178
QuattroParser::readCellPosition
static bool readCellPosition(std::shared_ptr< WPSStream > stream)
read the cell's position: zone 96
Definition: Quattro.cpp:2345
QuattroParser::createListener
std::shared_ptr< WKSContentListener > createListener(librevenge::RVNGSpreadsheetInterface *interface)
creates the main listener
Definition: Quattro.cpp:643
QuattroParser::readColorList
bool readColorList(std::shared_ptr< WPSStream > stream)
read a color lits: zone e8
Definition: Quattro.cpp:1911
QuattroParser::readStyleName
bool readStyleName(std::shared_ptr< WPSStream > stream)
read a style name: zone d0
Definition: Quattro.cpp:1947
QuattroParser::getFont
bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const
returns the font corresponding to an id
Definition: Quattro.cpp:581
QuattroParser::getColor
bool getColor(int id, WPSColor &color) const
returns the color corresponding to an id
Definition: Quattro.cpp:576
QuattroParser::readZone341
bool readZone341(std::shared_ptr< WPSStream > stream)
reads a big zone(chart?) which contains sub zones: 341
Definition: Quattro.cpp:2556
QuattroParser::readFieldName
bool readFieldName(std::shared_ptr< WPSStream > stream)
read a list of field name + ...: zone b
Definition: Quattro.cpp:1727
QuattroParser::readZone
bool readZone(std::shared_ptr< WPSStream > &stream)
try to read a zone
Definition: Quattro.cpp:974
QuattroParser::decodeStream
RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input, std::vector< uint8_t > const &key) const
try to decode a stream, if successful, replace the stream'input by the new one
Definition: Quattro.cpp:2679
QuattroParser::sendHeaderFooter
void sendHeaderFooter(bool header)
send the header/footer
Definition: Quattro.cpp:1993
QuattroParser::readZones
bool readZones()
finds the different zones (spreadsheet, chart, print, ...)
Definition: Quattro.cpp:766
QuattroParser::m_graphParser
std::shared_ptr< QuattroGraph > m_graphParser
the graph manager
Definition: Quattro.h:182
QuattroParser::checkHeader
bool checkHeader(WPSHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: Quattro.cpp:673
QuattroParser::readOLEZones
bool readOLEZones(std::shared_ptr< WPSStream > &stream)
finds the different OLE zones: wb2
Definition: Quattro.cpp:881
QuattroParser::readOleLinkInfo
bool readOleLinkInfo(std::shared_ptr< WPSStream > stream, librevenge::RVNGString &link)
try to read the link info sub stream
Definition: Quattro.cpp:2624
QuattroParser::getExternalFileName
bool getExternalFileName(int fId, librevenge::RVNGString &fName) const
returns the name of the fId file
Definition: Quattro.cpp:495
QuattroParser::m_spreadsheetParser
std::shared_ptr< QuattroSpreadsheet > m_spreadsheetParser
the spreadsheet manager
Definition: Quattro.h:184
QuattroParser::~QuattroParser
~QuattroParser() final
destructor
Definition: Quattro.cpp:481
QuattroParser::getDefaultFontType
libwps_tools_win::Font::Type getDefaultFontType() const
returns the default font type, ie.
Definition: Quattro.cpp:490
QuattroParser::parse
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final
called by WPSDocument to parse the file
Definition: Quattro.cpp:595
QuattroParser::readSerieExtension
static bool readSerieExtension(std::shared_ptr< WPSStream > stream)
read the serie extension zone: 2dc
Definition: Quattro.cpp:2486
QuattroParser::readQueryCommand
bool readQueryCommand(std::shared_ptr< WPSStream > stream)
read the table query command zone: 12f
Definition: Quattro.cpp:2166
QuattroParser::getField
bool getField(int fId, librevenge::RVNGString &text, QuattroFormulaInternal::CellReference &ref, librevenge::RVNGString const &fileName) const
returns the text and cell of a field instruction
Definition: Quattro.cpp:507
QuattroParser::readHeaderFooter
bool readHeaderFooter(std::shared_ptr< WPSStream > stream, bool header)
reads the header/footer: zone 25,26
Definition: Quattro.cpp:2006
QuattroSpreadsheet
This class parses Quattro Pro spreadsheet file.
Definition: QuattroSpreadsheet.h:52
Vec2< float >
WKSContentListener
Definition: WKSContentListener.h:54
WKSParser
Definition: WKSParser.h:34
WPSFont
define the font properties
Definition: WPSFont.h:37
WPSHeader
Definition: WPSHeader.h:32
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
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
libwps_tools_win.h
QuattroFormulaInternal
namespace to regroup data used to read QuattroPro .wb1-3, .qpw formula
Definition: Quattro.h:46
QuattroParserInternal
Internal: namespace to define internal class of QuattroParser.
Definition: Quattro.cpp:60
libwps_tools_win
some Windows© classes and tools
Definition: libwps_tools_win.cpp:32
WPSColor
the class to store a color
Definition: libwps_internal.h:281
WPSStream
small structure use to store a stream and it debug file
Definition: WPSStream.h:30