QuattroDos.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_DOS_H
23#define QUATTRO_DOS_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 QuattroDosParserInternal
36{
37 class SubDocument;
38 struct State;
39}
40
41 class QuattroDosChart;
42 class QuattroDosSpreadsheet;
43
48 class QuattroDosParser final : public WKSParser
49{
50 friend class QuattroDosParserInternal::SubDocument;
51 friend class QuattroDosChart;
52 friend class QuattroDosSpreadsheet;
53 public:
55 QuattroDosParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header,
56 libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN);
58 ~QuattroDosParser() final;
60 void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final;
62 bool checkHeader(WPSHeader *header, bool strict=false);
63
64protected:
66 bool checkFilePosition(long pos);
68 int version() const;
72 libwps_tools_win::Font::Type getDefaultFontType() const;
74 librevenge::RVNGString getFileName(int fId) const;
75
76 //
77 // interface with QuattroDosSpreadsheet
78 //
79
81 bool getColor(int id, WPSColor &color) const;
83 bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const;
85 librevenge::RVNGString getSheetName(int id) const;
86
87 //
88 // interface with QuattroDosChart
89 //
90
92 bool sendChart(int sheetId, Vec2i const &cell, Vec2f const &chartSize);
93
95 std::shared_ptr<WKSContentListener> createListener(librevenge::RVNGSpreadsheetInterface *interface);
97 void sendHeaderFooter(bool header);
98
99 //
100 // low level
101 //
102
104 bool readZones();
106 bool readZone();
107
109
111 bool readUserFonts();
113 bool readFont(WPSFont &font, libwps_tools_win::Font::Type &type);
115 bool readHeaderFooter(bool header);
116
118 bool readFieldName();
120 bool readFileName();
121
123 bool readPString(librevenge::RVNGString &string, long maxSize);
125
127 bool readWindowRecord();
132 bool readUnknown1();
133
134 std::shared_ptr<WKSContentListener> m_listener;
136 std::shared_ptr<QuattroDosParserInternal::State> m_state;
138 std::shared_ptr<QuattroDosSpreadsheet> m_spreadsheetParser;
140 std::shared_ptr<QuattroDosChart> m_chartParser;
141};
142
143#endif /* WPS4_H */
144/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WKSParser.h
QuattroDosChart
This class parses Quattro Pro DOS chart file.
Definition QuattroDosChart.h:50
QuattroDosParserInternal::SubDocument
Internal: the subdocument of a WPS4Parser.
Definition QuattroDos.cpp:76
QuattroDosParser::m_state
std::shared_ptr< QuattroDosParserInternal::State > m_state
the listener (if set)
Definition QuattroDos.h:136
QuattroDosParser::readUserFonts
bool readUserFonts()
reads the user fonts
Definition QuattroDos.cpp:890
QuattroDosParser::readHeaderFooter
bool readHeaderFooter(bool header)
reads the header/footer
Definition QuattroDos.cpp:1014
QuattroDosParser::readFileName
bool readFileName()
read a file name
Definition QuattroDos.cpp:822
QuattroDosParser::QuattroDosSpreadsheet
friend class QuattroDosSpreadsheet
Definition QuattroDos.h:52
QuattroDosParser::getColor
bool getColor(int id, WPSColor &color) const
returns the color corresponding to an id
Definition QuattroDos.cpp:262
QuattroDosParser::readUnknown1
bool readUnknown1()
reads some unknown spreadsheet zones 0:18|0:19|0:20|0:27|0:2a
Definition QuattroDos.cpp:1175
QuattroDosParser::readZones
bool readZones()
finds the different zones (spreadsheet, chart, print, ...)
Definition QuattroDos.cpp:436
QuattroDosParser::createListener
std::shared_ptr< WKSContentListener > createListener(librevenge::RVNGSpreadsheetInterface *interface)
creates the main listener
Definition QuattroDos.cpp:340
QuattroDosParser::QuattroDosChart
friend class QuattroDosChart
Definition QuattroDos.h:51
QuattroDosParser::readFont
bool readFont(WPSFont &font, libwps_tools_win::Font::Type &type)
try to read a font
Definition QuattroDos.cpp:938
QuattroDosParser::sendChart
bool sendChart(int sheetId, Vec2i const &cell, Vec2f const &chartSize)
try to send the chart corresponding to sheetId and a position
Definition QuattroDos.cpp:249
QuattroDosParser::sendHeaderFooter
void sendHeaderFooter(bool header)
send the header/footer
Definition QuattroDos.cpp:981
QuattroDosParser::checkHeader
bool checkHeader(WPSHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition QuattroDos.cpp:365
QuattroDosParser::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition QuattroDos.h:134
QuattroDosParser::parse
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final
called by WPSDocument to parse the file
Definition QuattroDos.cpp:290
QuattroDosParser::getSheetName
librevenge::RVNGString getSheetName(int id) const
returns the name of the id's spreadsheet
Definition QuattroDos.cpp:257
QuattroDosParser::readZone
bool readZone()
reads a zone
Definition QuattroDos.cpp:473
QuattroDosParser::readWindowRecord
bool readWindowRecord()
reads windows record 0:7|0:9
Definition QuattroDos.cpp:1126
QuattroDosParser::getDefaultFontType
libwps_tools_win::Font::Type getDefaultFontType() const
returns the default font type, ie.
Definition QuattroDos.cpp:241
QuattroDosParser::~QuattroDosParser
~QuattroDosParser() final
destructor
Definition QuattroDos.cpp:219
QuattroDosParser::getFont
bool getFont(int id, WPSFont &font, libwps_tools_win::Font::Type &type) const
returns the font corresponding to an id
Definition QuattroDos.cpp:267
QuattroDosParser::readPString
bool readPString(librevenge::RVNGString &string, long maxSize)
try to read a basic pascal string, knowing the maximum size(excluding string size)
Definition QuattroDos.cpp:867
QuattroDosParser::getFileName
librevenge::RVNGString getFileName(int fId) const
returns the name of the fId file
Definition QuattroDos.cpp:280
QuattroDosParser::readFieldName
bool readFieldName()
read a list of field name + ...
Definition QuattroDos.cpp:1066
QuattroDosParser::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition QuattroDos.cpp:228
QuattroDosParser::m_chartParser
std::shared_ptr< QuattroDosChart > m_chartParser
the chart manager
Definition QuattroDos.h:140
QuattroDosParser::m_spreadsheetParser
std::shared_ptr< QuattroDosSpreadsheet > m_spreadsheetParser
the spreadsheet manager
Definition QuattroDos.h:138
QuattroDosParser::version
int version() const
return the file version
Definition QuattroDos.cpp:223
QuattroDosParser::QuattroDosParser
QuattroDosParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN)
constructor
Definition QuattroDos.cpp:209
QuattroDosSpreadsheet
This class parses Quattro Pro DOS spreadsheet file.
Definition QuattroDosSpreadsheet.h:50
WKSContentListener
Definition WKSContentListener.h:54
WKSParser::WKSParser
WKSParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header)
Definition WKSParser.cpp:30
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
Vec2i
Vec2< int > Vec2i
Vec2 of int.
Definition libwps_internal.h:702
Vec2f
Vec2< float > Vec2f
Vec2 of float.
Definition libwps_internal.h:704
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition libwps_internal.h:87
libwps_tools_win.h
QuattroDosParserInternal
Internal: namespace to define internal class of QuattroDosParser.
Definition QuattroDos.cpp:52
libwps_tools_win
some Windows© classes and tools
Definition libwps_tools_win.cpp:32
QuattroDosParserInternal::State
the state of QuattroDosParser
Definition QuattroDos.cpp:125
WPSColor
the class to store a color
Definition libwps_internal.h:281