WKS4Format.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_FORMAT_H
23 #define WKS4_FORMAT_H
24 
25 #include <ostream>
26 #include <vector>
27 
28 #include <librevenge-stream/librevenge-stream.h>
29 
30 #include "libwps_internal.h"
31 
32 #include "WPSDebug.h"
33 #include "WKSContentListener.h"
34 
35 namespace WKS4FormatInternal
36 {
37 class Cell;
38 class Format;
39 struct State;
40 }
41 
42 class WKS4Parser;
43 
49 {
50 public:
51  friend class WKS4Parser;
52 
54  explicit WKS4Format(WKS4Parser &parser, RVNGInputStreamPtr const &input);
56  ~WKS4Format();
58  bool parse();
59 
60 protected:
62  bool checkFilePosition(long pos);
63 
64  //
65  // low level
66  //
69  bool checkHeader(bool strict=false);
71  bool readZones();
73  bool readZone();
74 
76  bool readFontName();
78  bool readFontSize();
80  bool readFontId();
81 
82 private:
83  WKS4Format(WKS4Format const &orig) = delete;
84  WKS4Format &operator=(WKS4Format const &orig) = delete;
87  {
88  return m_asciiFile;
89  }
95  std::shared_ptr<WKS4FormatInternal::State> m_state;
98 };
99 
100 #endif /* WPS4_H */
101 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WKS4Format::readFontId
bool readFontId()
reads a format font id zone: 0xb0
Definition: WKS4Format.cpp:455
WKS4Format::m_input
RVNGInputStreamPtr m_input
the input
Definition: WKS4Format.h:91
WKS4Format::m_asciiFile
libwps::DebugFile m_asciiFile
the ascii file
Definition: WKS4Format.h:97
libwps::DebugStream::str
static std::string str()
Definition: WPSDebug.h:200
libwps::DebugFile::open
static bool open(std::string const &)
Definition: WPSDebug.h:215
WKS4Format::readZones
bool readZones()
finds the different zones
Definition: WKS4Format.cpp:192
libwps::DebugFile::addPos
static void addPos(long)
Definition: WPSDebug.h:220
WKS4FormatInternal::State::State
State()
constructor
Definition: WKS4Format.cpp:67
WKS4FormatInternal::FontName::m_name
std::string m_name
the font name
Definition: WKS4Format.cpp:56
WKSSubDocument.h
libwps
Definition: libwps_internal.cpp:39
libwps::DebugFile::reset
static void reset()
Definition: WPSDebug.h:224
WKS4Format::operator=
WKS4Format & operator=(WKS4Format const &orig)=delete
WKS4Format::parse
bool parse()
try to parse an input
Definition: WKS4Format.cpp:108
WKS4Format::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: WKS4Format.cpp:94
WKS4Format::m_state
std::shared_ptr< WKS4FormatInternal::State > m_state
the internal state
Definition: WKS4Format.h:95
WKS4Format::readZone
bool readZone()
reads a zone
Definition: WKS4Format.cpp:228
WKS4FormatInternal::State
the state of WKS4Format
Definition: WKS4Format.cpp:65
WKS4FormatInternal
Internal: namespace to define internal class of WKS4Format.
Definition: WKS4Format.cpp:44
WKS4.h
WKS4Format::m_mainParser
WKS4Parser & m_mainParser
the main parser
Definition: WKS4Format.h:93
WPS_DEBUG_MSG
#define WPS_DEBUG_MSG(M)
Definition: libwps_internal.h:134
WKS4Format::WKS4Format
WKS4Format(WKS4Format const &orig)=delete
WKS4Format::readFontName
bool readFontName()
reads a format font name: zones 0xae
Definition: WKS4Format.cpp:395
WKS4Format::~WKS4Format
~WKS4Format()
destructor
Definition: WKS4Format.cpp:90
libwps::DebugFile::addNote
static void addNote(char const *)
Definition: WPSDebug.h:221
libwps::read8
int8_t read8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:59
WKS4Format::WKS4Format
WKS4Format(WKS4Parser &parser, RVNGInputStreamPtr const &input)
constructor
Definition: WKS4Format.cpp:82
WKS4FormatInternal::FontName
small struct used to defined a font name
Definition: WKS4Format.cpp:47
WKS4FormatInternal::State::m_idFontNameMap
std::map< int, FontName > m_idFontNameMap
a map id to font name style
Definition: WKS4Format.cpp:76
libwps::DebugStream
Definition: WPSDebug.h:192
libwps::readU8
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:40
WKS4Format.h
libwps_tools_win.h
WKS4Format::checkHeader
bool checkHeader(bool strict=false)
format zone ////////////////////////////// checks if the document header is correct (or not)
Definition: WKS4Format.cpp:141
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
WKS4Format
This class parses Lotus format file.
Definition: WKS4Format.h:49
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
WPSDebug.h
libwps::DebugFile::addDelimiter
static void addDelimiter(long, char)
Definition: WPSDebug.h:222
WKS4Format::readFontSize
bool readFontSize()
reads a format font sizes zones 0xaf and 0xb1
Definition: WKS4Format.cpp:503
WKS4FormatInternal::State::m_eof
long m_eof
the last file position
Definition: WKS4Format.cpp:74
libwps::read16
int16_t read16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:71
libwps_internal.h
WKSContentListener.h
WKS4Format::ascii
libwps::DebugFile & ascii()
returns the debug file
Definition: WKS4Format.h:86
WKS4Parser
This class parses Microsoft Works spreadsheet or a database file.
Definition: WKS4.h:49
WKS4FormatInternal::FontName::m_id
int m_id
the font id
Definition: WKS4Format.cpp:58
libwps::DebugFile
Definition: WPSDebug.h:208
WKS4FormatInternal::FontName::FontName
FontName()
constructor
Definition: WKS4Format.cpp:49
libwps::DebugFile::setStream
static void setStream(RVNGInputStreamPtr)
Definition: WPSDebug.h:212

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