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 namespace QuattroParserInternal
36 {
37 class SubDocument;
38 struct State;
39 }
40 
41 //class QuattroChart;
42 class QuattroGraph;
43 class QuattroSpreadsheet;
44 
46 {
47 class CellReference;
48 }
53 class QuattroParser final : public WKSParser
54 {
56  //friend class QuattroChart;
57  friend class QuattroGraph;
58  friend class QuattroSpreadsheet;
59 public:
63  char const *password=nullptr);
65  ~QuattroParser() final;
67  void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final;
69  bool checkHeader(WPSHeader *header, bool strict=false);
70 
71 protected:
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  QuattroSpreadsheetInternal::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  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  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  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;
177  std::shared_ptr<QuattroParserInternal::State> m_state;
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: */
std::shared_ptr< QuattroSpreadsheetInternal::State > m_state
the internal state
Definition: QuattroSpreadsheet.h:167
Definition: WPSOLEStream.h:33
define the font properties
Definition: WPSFont.h:36
Type
enum Type
Definition: libwps_tools_win.h:46
small class use to store Quattro Pro cell reference
Definition: QuattroSpreadsheet.h:43
std::shared_ptr< WKSContentListener > m_listener
Definition: QuattroSpreadsheet.h:163
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
friend class QuattroParser
Definition: QuattroSpreadsheet.h:84
This class parses Quattro Pro spreadsheet: .wq1 and wq2.
Definition: Quattro.h:53
This class parses Quattro Pro spreadsheet file.
Definition: QuattroSpreadsheet.h:81
This class parses QuattroPro graph file.
Definition: QuattroGraph.h:55
the class to store a color
Definition: libwps_internal.h:280
Internal: the subdocument of a WPS4Parser.
Definition: Quattro.cpp:72
some Windows© classes and tools
Definition: libwps_tools_win.cpp:31
small structure use to store a stream and it debug file
Definition: WPSStream.h:29
int version() const
return the file version
Definition: QuattroSpreadsheet.cpp:557
std::shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:109
Definition: WKSParser.h:33
Definition: WKSContentListener.h:53
Internal: namespace to define internal class of QuattroParser.
Definition: Quattro.cpp:58
Definition: Quattro.h:45

Generated on Wed Apr 25 2018 18:46:55 for libwps by doxygen 1.8.13