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 
36 {
37 class SubDocument;
38 struct State;
39 }
40 
41 class QuattroDosChart;
43 
48 class QuattroDosParser final : public WKSParser
49 {
51  friend class QuattroDosChart;
52  friend class QuattroDosSpreadsheet;
53 public:
58  ~QuattroDosParser() final;
60  void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final;
62  bool checkHeader(WPSHeader *header, bool strict=false);
63 
64 protected:
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;
135  std::shared_ptr<QuattroDosParserInternal::State> m_state;
140  std::shared_ptr<QuattroDosChart> m_chartParser;
141 };
142 
143 #endif /* WPS4_H */
144 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
libwps_tools_win::Font::LICS
@ LICS
Definition: libwps_tools_win.h:54
QuattroDosParser::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition: QuattroDos.h:134
WPSFont::m_extra
std::string m_extra
public field use to add a message when the font is printed
Definition: WPSFont.h:94
QuattroDosParser::readZones
bool readZones()
finds the different zones (spreadsheet, chart, print, ...)
Definition: QuattroDos.cpp:434
libwps::DebugStream::str
static std::string str()
Definition: WPSDebug.h:200
libwps::DebugFile::open
static bool open(std::string const &)
Definition: WPSDebug.h:215
WPS_BOLD_BIT
#define WPS_BOLD_BIT
Definition: libwps_internal.h:506
libwps::DebugFile::addPos
static void addPos(long)
Definition: WPSDebug.h:220
QuattroDosParser::parse
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final
called by WPSDocument to parse the file
Definition: QuattroDos.cpp:288
WPSCell.h
libwps_tools_win::Font::Type
Type
enum Type
Definition: libwps_tools_win.h:46
WPSHeader::setKind
void setKind(libwps::WPSKind kind)
Definition: WPSHeader.h:64
QuattroDosParser::m_chartParser
std::shared_ptr< QuattroDosChart > m_chartParser
the chart manager
Definition: QuattroDos.h:140
QuattroDosParserInternal::Font::Font
Font(Font const &)=default
QuattroDosParser::readHeaderFooter
bool readHeaderFooter(bool header)
reads the header/footer
Definition: QuattroDos.cpp:1012
QuattroDosParserInternal::State::m_fontsList
std::vector< Font > m_fontsList
the fonts list
Definition: QuattroDos.cpp:174
WPS_UNDERLINE_BIT
#define WPS_UNDERLINE_BIT
Definition: libwps_internal.h:508
WKSSubDocument.h
libwps
Definition: libwps_internal.cpp:39
QuattroDosParser::getDefaultFontType
libwps_tools_win::Font::Type getDefaultFontType() const
returns the default font type, ie.
Definition: QuattroDos.cpp:239
QuattroDosParserInternal::SubDocument::SubDocument
SubDocument(RVNGInputStreamPtr const &input, QuattroDosParser &pars, bool header)
constructor for a text entry
Definition: QuattroDos.cpp:77
QuattroDosParser::getSheetName
librevenge::RVNGString getSheetName(int id) const
returns the name of the id's spreadsheet
Definition: QuattroDos.cpp:255
QuattroDosParser::checkHeader
bool checkHeader(WPSHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: QuattroDos.cpp:363
libwps::DebugFile::reset
static void reset()
Definition: WPSDebug.h:224
QuattroDosParserInternal::State::State
State(libwps_tools_win::Font::Type fontType)
constructor
Definition: QuattroDos.cpp:125
libwps_tools_win::Font::unicodeString
static librevenge::RVNGString unicodeString(const unsigned char *p, unsigned long size, Type type, bool skipUnknown=true)
converts a list of character in unicode
Definition: libwps_tools_win.cpp:7283
WPSPageSpan::ALL
@ ALL
Definition: WPSPageSpan.h:44
QuattroDosParser::m_state
std::shared_ptr< QuattroDosParserInternal::State > m_state
the listener (if set)
Definition: QuattroDos.h:136
WPSHeader.h
WPSFont
define the font properties
Definition: WPSFont.h:37
QuattroDosParser::readUnknown1
bool readUnknown1()
reads some unknown spreadsheet zones 0:18|0:19|0:20|0:27|0:2a
Definition: QuattroDos.cpp:1173
WPS_ITALICS_BIT
#define WPS_ITALICS_BIT
Definition: libwps_internal.h:502
QuattroDosParserInternal::Font::m_type
libwps_tools_win::Font::Type m_type
font encoding type
Definition: QuattroDos.cpp:65
WPSPageSpan::HEADER
@ HEADER
Definition: WPSPageSpan.h:43
WPSPageSpan::FOOTER
@ FOOTER
Definition: WPSPageSpan.h:43
WPSHeader::setMajorVersion
void setMajorVersion(int version)
Definition: WPSHeader.h:94
QuattroDosParserInternal::State::getDefaultFont
WPSFont getDefaultFont() const
returns a default font (Courier12) with file's version to define the default encoding *‍/
Definition: QuattroDos.cpp:154
QuattroDosParserInternal::Font::Font
Font(libwps_tools_win::Font::Type type)
constructor
Definition: QuattroDos.cpp:57
QuattroDosParserInternal::State::m_eof
long m_eof
the last file position
Definition: QuattroDos.cpp:166
WPSHeader::setCreator
void setCreator(libwps::WPSCreator creator)
Definition: WPSHeader.h:54
QuattroDosParserInternal::SubDocument
Internal: the subdocument of a WPS4Parser.
Definition: QuattroDos.cpp:74
QuattroDosParser::m_spreadsheetParser
std::shared_ptr< QuattroDosSpreadsheet > m_spreadsheetParser
the spreadsheet manager
Definition: QuattroDos.h:138
QuattroDosParser::createListener
std::shared_ptr< WKSContentListener > createListener(librevenge::RVNGSpreadsheetInterface *interface)
creates the main listener
Definition: QuattroDos.cpp:338
WPSPageSpan.h
QuattroDosParserInternal::SubDocument::m_header
bool m_header
a flag to known if we need to send the header or the footer
Definition: QuattroDos.cpp:95
QuattroDosParserInternal::SubDocument::~SubDocument
~SubDocument() final
destructor
Definition: QuattroDos.cpp:80
WPSHeader::setNeedEncoding
void setNeedEncoding(bool needEncoding)
Definition: WPSHeader.h:84
QuattroDosParserInternal::State::m_version
int m_version
the file version
Definition: QuattroDos.cpp:170
WKSParser::getInput
RVNGInputStreamPtr & getInput()
Definition: WKSParser.h:41
QuattroDosParser::readFileName
bool readFileName()
read a file name
Definition: QuattroDos.cpp:820
libwps::ParseException
Definition: libwps_internal.h:152
QuattroDosParser::version
int version() const
return the file version
Definition: QuattroDos.cpp:221
QuattroDosParserInternal::State::m_fontType
libwps_tools_win::Font::Type m_fontType
the user font type
Definition: QuattroDos.cpp:168
Vec2< int >
WPS_DEBUG_MSG
#define WPS_DEBUG_MSG(M)
Definition: libwps_internal.h:134
WPSFont::m_color
WPSColor m_color
the font color
Definition: WPSFont.h:89
WKSParser.h
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:865
WPSHeader
Definition: WPSHeader.h:32
libwps_tools_win::Font::UNKNOWN
@ UNKNOWN
Definition: libwps_tools_win.h:63
libwps::SubDocumentType
SubDocumentType
Definition: libwps_internal.h:248
QuattroDosParser::~QuattroDosParser
~QuattroDosParser() final
destructor
Definition: QuattroDos.cpp:217
QuattroDosParserInternal::Font
the font of a QuattroDosParser
Definition: QuattroDos.cpp:55
QuattroDosParser::sendHeaderFooter
void sendHeaderFooter(bool header)
send the header/footer
Definition: QuattroDos.cpp:979
WPSFont.h
QuattroDosParser::readWindowRecord
bool readWindowRecord()
reads windows record 0:7|0:9
Definition: QuattroDos.cpp:1124
WPSEntry.h
WPSFont::m_attributes
uint32_t m_attributes
the font attributes defined as a set of bits
Definition: WPSFont.h:85
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:247
libwps.h
libwps::DebugFile::addNote
static void addNote(char const *)
Definition: WPSDebug.h:221
QuattroDosParserInternal
Internal: namespace to define internal class of QuattroDosParser.
Definition: QuattroDos.cpp:52
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:265
libwps::WPS_SPREADSHEET
@ WPS_SPREADSHEET
Definition: WPSDocument.h:60
libwps::read8
int8_t read8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:59
WPSFont::m_size
double m_size
font size
Definition: WPSFont.h:83
WPSSubDocumentPtr
std::shared_ptr< WPSSubDocument > WPSSubDocumentPtr
shared pointer to WPSSubDocument
Definition: libwps_internal.h:111
QuattroDosSpreadsheet
This class parses Quattro Pro DOS spreadsheet file.
Definition: QuattroDosSpreadsheet.h:50
QuattroDosParser::readFont
bool readFont(WPSFont &font, libwps_tools_win::Font::Type &type)
try to read a font
Definition: QuattroDos.cpp:936
QuattroDosParserInternal::State::m_headerString
std::string m_headerString
the header string
Definition: QuattroDos.cpp:181
libwps_tools_win::Font::CP_437
@ CP_437
Definition: libwps_tools_win.h:46
QuattroDosParser::QuattroDosParser
QuattroDosParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN)
constructor
Definition: QuattroDos.cpp:207
libwps::WPS_QUATTRO_PRO
@ WPS_QUATTRO_PRO
Quattro Pro wq1,wq2, wb1,wb2,wb3, qpw spreadsheets and qpw spreadsheet.
Definition: WPSDocument.h:50
WPSHeaderPtr
std::shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:109
QuattroDosParser::readZone
bool readZone()
reads a zone
Definition: QuattroDos.cpp:471
WKSSubDocument
Basic class used to store a spreadsheet sub document.
Definition: WKSSubDocument.h:36
libwps::DebugStream
Definition: WPSDebug.h:192
libwps::readU8
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:40
QuattroDosParser::getFileName
librevenge::RVNGString getFileName(int fId) const
returns the name of the fId file
Definition: QuattroDos.cpp:278
QuattroDosParser::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: QuattroDos.cpp:226
QuattroDosParserInternal::SubDocument::operator==
bool operator==(std::shared_ptr< WPSSubDocument > const &doc) const final
operator==
Definition: QuattroDos.cpp:83
libwps_tools_win.h
QuattroDos.h
WPSPageSpan
Definition: WPSPageSpan.h:39
WPSPageSpan::setHeaderFooter
void setHeaderFooter(const HeaderFooterType type, const HeaderFooterOccurrence occurrence, WPSSubDocumentPtr &subDocument)
Definition: WPSPageSpan.cpp:111
QuattroDosChart.h
QuattroDosParser
This class parses Quattro Pro spreadsheet: .wq1 and wq2.
Definition: QuattroDos.h:49
QuattroDosParserInternal::Font::operator=
Font & operator=(Font const &)=default
QuattroDosParserInternal::State::m_footerString
std::string m_footerString
the footer string
Definition: QuattroDos.cpp:183
libwps::readU16
uint16_t readU16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:64
libwps_tools_win::Language::name
std::string name(long id)
returns the name given Windows id
Definition: libwps_tools_win.cpp:7332
QuattroDosParserInternal::State::m_hasLICSCharacters
bool m_hasLICSCharacters
flag to know if the character
Definition: QuattroDos.cpp:172
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
libwps::DebugFile::addDelimiter
static void addDelimiter(long, char)
Definition: WPSDebug.h:222
libwps_tools_win::Font::WIN3_WEUROPE
@ WIN3_WEUROPE
Definition: libwps_tools_win.h:52
libwps::read16
int16_t read16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:71
WKSParser::ascii
libwps::DebugFile & ascii()
a DebugFile used to write what we recognize when we parse the document
Definition: WKSParser.h:63
libwps_internal.h
WKSContentListener.h
WPSColor
the class to store a color
Definition: libwps_internal.h:281
WKSContentListener
Definition: WKSContentListener.h:54
librevenge
Definition: WPSOLEStream.h:34
libwps_tools_win
some Windows classes and tools
Definition: libwps_tools_win.cpp:32
QuattroDosParserInternal::State
the state of QuattroDosParser
Definition: QuattroDos.cpp:123
QuattroDosParser::getColor
bool getColor(int id, WPSColor &color) const
returns the color corresponding to an id
Definition: QuattroDos.cpp:260
QuattroDosParserInternal::State::m_pageSpan
WPSPageSpan m_pageSpan
the actual document size
Definition: QuattroDos.cpp:178
QuattroDosParserInternal::State::getDefaultFontType
libwps_tools_win::Font::Type getDefaultFontType() const
return the default font style
Definition: QuattroDos.cpp:142
QuattroDosParser::readUserFonts
bool readUserFonts()
reads the user fonts
Definition: QuattroDos.cpp:888
QuattroDosSpreadsheet.h
QuattroDosParserInternal::State::m_idToFileNameMap
std::map< int, librevenge::RVNGString > m_idToFileNameMap
map id to filename
Definition: QuattroDos.cpp:176
WPSFont::m_name
librevenge::RVNGString m_name
font name
Definition: WPSFont.h:81
QuattroDosChart
This class parses Quattro Pro DOS chart file.
Definition: QuattroDosChart.h:50
libwps::DebugFile::setStream
static void setStream(RVNGInputStreamPtr)
Definition: WPSDebug.h:212
QuattroDosParser::readFieldName
bool readFieldName()
read a list of field name + ...
Definition: QuattroDos.cpp:1064
WKSParser
Definition: WKSParser.h:34

Generated on Sat Aug 10 2024 18:41:17 for libwps by doxygen 1.8.20