WKS4.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 WKS4_H
23 #define WKS4_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 WKS4ParserInternal
36 {
37 class SubDocument;
38 struct State;
39 }
40 
41 class WKS4Spreadsheet;
42 
47 class WKS4Parser : public WKSParser
48 {
50  friend class WKS4Spreadsheet;
51 public:
55  char const *password=0);
57  ~WKS4Parser();
59  void parse(librevenge::RVNGSpreadsheetInterface *documentInterface);
61  bool checkHeader(WPSHeader *header, bool strict=false);
62 
63 protected:
65  bool checkFilePosition(long pos);
67  int version() const;
71  libwps_tools_win::Font::Type getDefaultFontType() const;
73  bool hasLICSCharacters() const;
75  libwps::WPSCreator getCreator() const;
76 
77  //
78  // interface with WKS4Spreadsheet
79  //
80 
82  bool getColor(int id, WPSColor &color) const;
84  bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const;
85 
86 
88  shared_ptr<WKSContentListener> createListener(librevenge::RVNGSpreadsheetInterface *interface);
90  void sendHeaderFooter(bool header);
91 
92  //
93  // low level
94  //
95 
97  bool parseFormatStream();
99  void resetMainInput(RVNGInputStreamPtr newInput);
100 
102  bool readZones();
104  bool readZone();
106  bool readZoneQuattro();
107 
109 
111  bool readFont();
112 
114  bool readPrnt();
115 
117  bool readPrn2();
118 
120  bool readHeaderFooter(bool header);
121 
123  bool readFieldName();
124 
126 
128  bool readChartName();
129 
131  bool readChartDef();
132 
134  bool readChartFont();
135 
137  bool readChart2Font();
138 
140  bool readChartLimit();
141 
143  bool readChartList();
144 
146  bool readChartUnknown();
147 
149 
151  static RVNGInputStreamPtr decodeStream(RVNGInputStreamPtr input, long endPos, std::vector<uint8_t> const &key);
152 
154 
156  bool readWindowRecord();
161  bool readUnknown1();
162 
163  shared_ptr<WKSContentListener> m_listener;
164  shared_ptr<WKS4ParserInternal::State> m_state;
167  shared_ptr<WKS4Spreadsheet> m_spreadsheetParser;
168 };
169 
170 #endif /* WPS4_H */
171 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
Internal: namespace to define internal class of WKS4Parser.
Definition: WKS4.cpp:51
shared_ptr< WKSContentListener > m_listener
Definition: WKS4.h:163
bool hasLICSCharacters() const
returns the true if the file has LICS characters
Definition: WKS4Spreadsheet.cpp:508
Internal: the subdocument of a WPS4Parser.
Definition: WKS4.cpp:65
define the font properties
Definition: WPSFont.h:36
int version() const
return the file version
Definition: WKS4Spreadsheet.cpp:501
Type
enum Type
Definition: libwps_tools_win.h:46
This class parses Microsoft Works spreadsheet or a database file.
Definition: WKS4.h:47
shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:124
shared_ptr< WKS4SpreadsheetInternal::State > m_state
the internal state
Definition: WKS4Spreadsheet.h:147
Definition: WPSHeader.h:31
Definition: libwps_tools_win.h:61
shared_ptr< WKS4Spreadsheet > m_spreadsheetParser
the spreadsheet manager
Definition: WKS4.h:167
WPSCreator
Definition: WPSDocument.h:48
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:102
the class to store a color
Definition: libwps_internal.h:287
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: WKS4Spreadsheet.cpp:515
This class parses Microsoft Works spreadsheet file.
Definition: WKS4Spreadsheet.h:48
friend class WKS4Parser
Definition: WKS4Spreadsheet.h:51
Definition: WKSParser.h:33

Generated on Tue Oct 31 2017 04:26:19 for libwps by doxygen 1.8.13