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 
35 #include "WKSContentListener.h"
36 
37 namespace QuattroParserInternal
38 {
39 class SubDocument;
40 struct State;
41 }
42 
43 //class QuattroChart;
44 class QuattroGraph;
45 class QuattroSpreadsheet;
46 
51 class QuattroParser final : public WKSParser
52 {
54  //friend class QuattroChart;
55  friend class QuattroGraph;
56  friend class QuattroSpreadsheet;
57 public:
61  char const *password=nullptr);
63  ~QuattroParser() final;
65  void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final;
67  bool checkHeader(WPSHeader *header, bool strict=false);
68 
69 protected:
71  int version() const;
75  libwps_tools_win::Font::Type getDefaultFontType() const;
77  librevenge::RVNGString getFileName(int fId) const;
79  bool getField(int fId, librevenge::RVNGString &text,
80  WKSContentListener::FormulaInstruction &instr) const;
81 
82  //
83  // interface with QuattroSpreadsheet
84  //
85 
87  bool getColor(int id, WPSColor &color) const;
89  bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const;
90 
91  //
92  // interface with QuattroGraph
93  //
94 
96  bool sendGraphics(int sheetId, Vec2i const &cell) const;
97 
98  //
99  //
100  //
101 
103  std::shared_ptr<WKSContentListener> createListener(librevenge::RVNGSpreadsheetInterface *interface);
104 
106  void sendHeaderFooter(bool header);
107 
108  //
109  // low level
110  //
111 
113  bool checkHeader(std::shared_ptr<WPSStream> stream, bool strict);
115  bool readZones();
117  bool readOLEZones(std::shared_ptr<WPSStream> &stream);
119  bool readZone(std::shared_ptr<WPSStream> &stream);
120 
122 
124  bool readFieldName(std::shared_ptr<WPSStream> stream);
126  bool readCellPosition(std::shared_ptr<WPSStream> stream);
128  bool readFileName(std::shared_ptr<WPSStream> stream);
130  bool readFontDef(std::shared_ptr<WPSStream> stream);
132  bool readColorList(std::shared_ptr<WPSStream> stream);
134  bool readStyleName(std::shared_ptr<WPSStream> stream);
136  bool readHeaderFooter(std::shared_ptr<WPSStream> stream, bool header);
138  bool readCString(std::shared_ptr<WPSStream> stream, librevenge::RVNGString &string, long maxSize);
140  bool readPageSetup(std::shared_ptr<WPSStream> stream);
141 
143 
148  bool readRangeList(std::shared_ptr<WPSStream> stream);
149 
151  bool readZone341(std::shared_ptr<WPSStream> stream);
152 
154 
156  bool readOleLinkInfo(std::shared_ptr<WPSStream> stream, librevenge::RVNGString &link);
158  bool readOleBOlePart(std::shared_ptr<WPSStream> stream);
159 
161 
163  static RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input, std::vector<uint8_t> const &key);
164 
165  std::shared_ptr<WKSContentListener> m_listener;
166  std::shared_ptr<QuattroParserInternal::State> m_state;
169  // std::shared_ptr<QuattroChart> m_chartParser;
171  std::shared_ptr<QuattroGraph> m_graphParser;
174 };
175 
176 #endif /* WPS4_H */
177 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
bool sendGraphics(int sheetId, Vec2i const &cell) const
send the graphic corresponding to a cell
Definition: Quattro.cpp:271
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:1166
bool readZone(std::shared_ptr< WPSStream > &stream)
try to read a zone
Definition: Quattro.cpp:643
int version() const
return the file version
Definition: Quattro.cpp:235
bool readStyleName(std::shared_ptr< WPSStream > stream)
read a style name: zone d0
Definition: Quattro.cpp:1415
bool readColorList(std::shared_ptr< WPSStream > stream)
read a font: zone e8
Definition: Quattro.cpp:1378
bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const
returns the font corresponding to an id
Definition: Quattro.cpp:286
Definition: WPSOLEStream.h:33
std::shared_ptr< QuattroGraph > m_graphParser
the chart manager
Definition: Quattro.h:171
define the font properties
Definition: WPSFont.h:36
bool readFieldName(std::shared_ptr< WPSStream > stream)
read a list of field name + ...: zone b
Definition: Quattro.cpp:1187
bool readPageSetup(std::shared_ptr< WPSStream > stream)
read a page setup zone: fc
Definition: Quattro.cpp:1665
std::shared_ptr< QuattroSpreadsheet > m_spreadsheetParser
the spreadsheet manager
Definition: Quattro.h:173
bool getField(int fId, librevenge::RVNGString &text, WKSContentListener::FormulaInstruction &instr) const
returns the text and cell of a field instruction
Definition: Quattro.cpp:254
libwps_tools_win::Font::Type getDefaultFontType() const
returns the default font type, ie.
Definition: Quattro.cpp:240
Type
enum Type
Definition: libwps_tools_win.h:46
bool readHeaderFooter(std::shared_ptr< WPSStream > stream, bool header)
reads the header/footer: zone 25,26
Definition: Quattro.cpp:1480
bool readFontDef(std::shared_ptr< WPSStream > stream)
read a font: zone cf
Definition: Quattro.cpp:1313
~QuattroParser() final
destructor
Definition: Quattro.cpp:231
bool readOleBOlePart(std::shared_ptr< WPSStream > stream)
try to read the BOlePart sub stream: a zone which contains 5 long
Definition: Quattro.cpp:1801
bool readOLEZones(std::shared_ptr< WPSStream > &stream)
finds the different OLE zones: wb2
Definition: Quattro.cpp:508
bool readZones()
finds the different zones (spreadsheet, chart, print, ...)
Definition: Quattro.cpp:456
bool readOleLinkInfo(std::shared_ptr< WPSStream > stream, librevenge::RVNGString &link)
try to read the link info sub stream
Definition: Quattro.cpp:1770
QuattroParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN, char const *password=nullptr)
constructor
Definition: Quattro.cpp:220
Definition: WPSHeader.h:31
Definition: libwps_tools_win.h:61
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
This class parses Quattro Pro spreadsheet: .wq1 and wq2.
Definition: Quattro.h:51
This class parses Quattro Pro DOS spreadsheet file.
Definition: QuattroSpreadsheet.h:49
This class parses QuattroPro graph file.
Definition: QuattroGraph.h:52
the class to store a color
Definition: libwps_internal.h:280
bool readCellPosition(std::shared_ptr< WPSStream > stream)
read the cell&#39;s position: zone 96
Definition: Quattro.cpp:1630
Internal: the subdocument of a WPS4Parser.
Definition: Quattro.cpp:72
std::shared_ptr< WKSContentListener > m_listener
Definition: Quattro.h:165
bool checkHeader(WPSHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: Quattro.cpp:376
some Windows© classes and tools
Definition: libwps_tools_win.cpp:31
bool readZone341(std::shared_ptr< WPSStream > stream)
reads a big zone(chart?) which contains sub zones: 341
Definition: Quattro.cpp:1710
bool readFileName(std::shared_ptr< WPSStream > stream)
read a file name: zone 97
Definition: Quattro.cpp:1268
bool readRangeList(std::shared_ptr< WPSStream > stream)
reads some range spreadsheet zones
Definition: Quattro.cpp:1526
std::shared_ptr< QuattroParserInternal::State > m_state
the listener (if set)
Definition: Quattro.h:167
small structure use to store a stream and it debug file
Definition: WPSStream.h:29
bool getColor(int id, WPSColor &color) const
returns the color corresponding to an id
Definition: Quattro.cpp:281
static RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input, std::vector< uint8_t > const &key)
try to decode a stream, if successful, replace the stream&#39;input by the new one
Definition: Quattro.cpp:1825
std::shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:109
Definition: WKSParser.h:33
Definition: WKSContentListener.h:53
std::shared_ptr< WKSContentListener > createListener(librevenge::RVNGSpreadsheetInterface *interface)
creates the main listener
Definition: Quattro.cpp:348
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final
called by WPSDocument to parse the file
Definition: Quattro.cpp:300
Internal: namespace to define internal class of QuattroParser.
Definition: Quattro.cpp:58
void sendHeaderFooter(bool header)
send the header/footer
Definition: Quattro.cpp:1467
librevenge::RVNGString getFileName(int fId) const
returns the name of the fId file
Definition: Quattro.cpp:245

Generated on Thu May 3 2018 11:20:50 for libwps by doxygen 1.8.14