QuattroDosChart.h Source File documentation

QuattroDosChart.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_CHART_H
23 #define QUATTRO_DOS_CHART_H
24
25 #include <ostream>
26 #include <map>
27 #include <vector>
28
29 #include <librevenge-stream/librevenge-stream.h>
30
31 #include "libwps_internal.h"
32
33 #include "WPSDebug.h"
34 #include "WKSContentListener.h"
35
36 namespace QuattroDosChartInternal
37 {
38 class Chart;
39 struct State;
40
41 }
42
43 class QuattroDosParser;
44
49 class QuattroDosChart
50 {
51 public:
52 friend class QuattroDosParser;
53 friend class QuattroDosChartInternal::Chart;
54
56 explicit QuattroDosChart(QuattroDosParser &parser);
58 ~QuattroDosChart();
60 void setListener(WKSContentListenerPtr &listen)
61 {
62 m_listener = listen;
63 }
65 bool readChartSetType();
67 bool readChartName();
69 bool readChart();
70
72 int getNumSpreadsheets() const;
74 void getChartPositionMap(int sheetId, std::map<Vec2i,Vec2i> &cellMap) const;
76 bool sendChart(int sheetId, Vec2i const &cell, Vec2f const &chartSize);
77 protected:
79 bool checkFilePosition(long pos);
81 int version() const;
82
84 bool sendText(WPSEntry const &entry);
85 private:
86 QuattroDosChart(QuattroDosChart const &orig) = delete;
87 QuattroDosChart &operator=(QuattroDosChart const &orig) = delete;
89 libwps::DebugFile &ascii()
90 {
91 return m_asciiFile;
92 }
94 RVNGInputStreamPtr m_input;
95 std::shared_ptr<WKSContentListener> m_listener;
96 QuattroDosParser &m_mainParser;
99 std::shared_ptr<QuattroDosChartInternal::State> m_state;
101 libwps::DebugFile &m_asciiFile;
102 };
103
104 #endif /* WPS4_H */
105 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
QuattroDosChart::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition: QuattroDosChart.h:95
WKSChart::Serie::S_Line
@ S_Line
Definition: WKSChart.h:162
QuattroDosChartInternal::Chart::m_ranges
Position m_ranges[2]
the chart range
Definition: QuattroDosChart.cpp:67
WPSColor::white
static WPSColor white()
return the white color
Definition: libwps_internal.h:311
QuattroDosChartInternal::State::m_eof
long m_eof
the last file position
Definition: QuattroDosChart.cpp:112
WKSChart::Axis::A_Logarithmic
@ A_Logarithmic
Definition: WKSChart.h:91
QuattroDosChartInternal::State::m_version
int m_version
the file version
Definition: QuattroDosChart.cpp:114
WKSChart::TextZone::m_font
WPSFont m_font
the zone format
Definition: WKSChart.h:278
QuattroDosChart::m_mainParser
QuattroDosParser & m_mainParser
the listener (if set)
Definition: QuattroDosChart.h:97
libwps::DebugStream::str
static std::string str()
Definition: WPSDebug.h:200
WKSChart::Serie::Type
Type
the series type
Definition: WKSChart.h:162
libwps::DebugFile::addPos
static void addPos(long)
Definition: WPSDebug.h:220
WPSBox2f
WPSBox2< float > WPSBox2f
WPSBox2 of float.
Definition: libwps_internal.h:890
WKSChart::Serie::P_Automatic
@ P_Automatic
Definition: WKSChart.h:166
WPSPosition::m_anchorTo
AnchorTo m_anchorTo
anchor position
Definition: WPSPosition.h:241
libwps_tools_win::Font::Type
Type
enum Type
Definition: libwps_tools_win.h:46
QuattroDosChartInternal::Chart::m_parser
QuattroDosChart & m_parser
the parser
Definition: QuattroDosChart.cpp:72
QuattroDosChart::sendText
bool sendText(WPSEntry const &entry)
try to send the text
Definition: QuattroDosChart.cpp:237
WPSGraphicStyle::Pattern::m_data
std::vector< unsigned char > m_data
the pattern data: a sequence of data: p[0..7,0],p[8..15,0]...p[0..7,1],p[8..15,1],...
Definition: WPSGraphicStyle.h:192
QuattroDosChart::m_state
std::shared_ptr< QuattroDosChartInternal::State > m_state
the internal state
Definition: QuattroDosChart.h:99
QuattroDosChart::readChartSetType
bool readChartSetType()
reads the chart type: b8(3d) or ca(bubble)
Definition: QuattroDosChart.cpp:264
WKSChart::TextZone::T_SubTitle
@ T_SubTitle
Definition: WKSChart.h:236
QuattroDosChartInternal::State::State
State()
constructor
Definition: QuattroDosChart.cpp:101
QuattroDosParser::getDefaultFontType
libwps_tools_win::Font::Type getDefaultFontType() const
returns the default font type, ie.
Definition: QuattroDos.cpp:241
QuattroDosChartInternal::Chart::Chart
Chart(QuattroDosChart &parser, RVNGInputStreamPtr const &input)
constructor
Definition: QuattroDosChart.cpp:56
WKSChart::TextZone::m_textEntryList
std::vector< WPSEntry > m_textEntryList
the text entry (or the list of text entry)
Definition: WKSChart.h:276
QuattroDosParser::getSheetName
librevenge::RVNGString getSheetName(int id) const
returns the name of the id's spreadsheet
Definition: QuattroDos.cpp:257
QuattroDosChart::operator=
QuattroDosChart & operator=(QuattroDosChart const &orig)=delete
QuattroDosChart::getNumSpreadsheets
int getNumSpreadsheets() const
returns the number of spreadsheet
Definition: QuattroDosChart.cpp:182
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
WPSPosition::m_anchorCellName
librevenge::RVNGString m_anchorCellName
the anchor cell name
Definition: WPSPosition.h:243
QuattroDosChartInternal::Chart::m_input
RVNGInputStreamPtr m_input
the input
Definition: QuattroDosChart.cpp:74
WPSFont
define the font properties
Definition: WPSFont.h:36
QuattroDosChart::readChart
bool readChart()
reads a structure which define a chart: 2d(default), 2e(name + value)
Definition: QuattroDosChart.cpp:325
WPSEntry::valid
bool valid(bool checkId=false) const
returns true if the zone length is positive
Definition: WPSEntry.h:89
WPSEntry
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:38
Vec2i
Vec2< int > Vec2i
Vec2 of int.
Definition: libwps_internal.h:702
WPSGraphicStyle::Pattern::m_dim
Vec2i m_dim
the dimension width x height
Definition: WPSGraphicStyle.h:187
QuattroDosChartInternal::Chart
the chart of a Quattro Pro Dos
Definition: QuattroDosChart.cpp:52
WPSListenerPtr
std::shared_ptr< WPSListener > WPSListenerPtr
shared pointer to WPSListener
Definition: libwps_internal.h:105
WPSGraphicStyle::Pattern::m_colors
WPSColor m_colors[2]
the two indexed colors
Definition: WPSGraphicStyle.h:190
QuattroDosChart::getChartPositionMap
void getChartPositionMap(int sheetId, std::map< Vec2i, Vec2i > &cellMap) const
returns the list of cell's begin to end corresponding to a chart
Definition: QuattroDosChart.cpp:196
Vec2f
Vec2< float > Vec2f
Vec2 of float.
Definition: libwps_internal.h:704
WKSChart::Serie::S_Area
@ S_Area
Definition: WKSChart.h:162
QuattroDosParser::version
int version() const
return the file version
Definition: QuattroDos.cpp:223
Vec2< int >
WKSChart
a class used to store a chart associated to a spreadsheet ....
Definition: WKSChart.h:45
WKSChart::Serie::S_Bar
@ S_Bar
Definition: WKSChart.h:162
WPS_DEBUG_MSG
#define WPS_DEBUG_MSG(M)
Definition: libwps_internal.h:134
QuattroDosChart::ascii
libwps::DebugFile & ascii()
returns the debug file
Definition: QuattroDosChart.h:89
WPSEntry::setBegin
void setBegin(long off)
sets the begin offset
Definition: WPSEntry.h:57
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
WKSContentListenerPtr
std::shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:114
QuattroDosChart::m_asciiFile
libwps::DebugFile & m_asciiFile
the ascii file
Definition: QuattroDosChart.h:101
WPSFont.h
WKSChart::Serie::S_Circle
@ S_Circle
Definition: WKSChart.h:162
QuattroDosChartInternal::State::getPattern
static bool getPattern(int id, WPSGraphicStyle::Pattern &pattern)
returns the pattern corresponding to a pattern id between 0 and 15
Definition: QuattroDosChart.cpp:122
WPSBorder::RightBit
@ RightBit
Definition: libwps_internal.h:401
WPSEntry.h
libwps::DebugFile::addNote
static void addNote(char const *)
Definition: WPSDebug.h:221
QuattroDosChart::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition: QuattroDosChart.h:60
WPSEntry::begin
long begin() const
returns the begin offset
Definition: WPSEntry.h:73
QuattroDosChartInternal
Definition: QuattroDosChart.cpp:46
QuattroDosChart::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: QuattroDosChart.cpp:170
WKSChart::Axis::A_Numeric
@ A_Numeric
Definition: WKSChart.h:91
QuattroDosParser::readFont
bool readFont(WPSFont &font, libwps_tools_win::Font::Type &type)
try to read a font
Definition: QuattroDos.cpp:938
libwps::readDouble8
bool readDouble8(RVNGInputStreamPtr &input, double &res, bool &isNaN)
read a double store with 8 bytes: mantisse 6.5 bytes, exponent 1.5 bytes
Definition: libwps_internal.cpp:173
QuattroDosChartInternal::State
the state of QuattroDosChart
Definition: QuattroDosChart.cpp:98
QuattroDosChart::sendChart
bool sendChart(int sheetId, Vec2i const &cell, Vec2f const &chartSize)
try to send the chart corresponding to sheetId and a position
Definition: QuattroDosChart.cpp:208
WKSChart::Serie::S_Scatter
@ S_Scatter
Definition: WKSChart.h:162
WPSEntry::length
long length() const
returns the length of the zone
Definition: WPSEntry.h:83
WKSChart::TextZone::T_Title
@ T_Title
Definition: WKSChart.h:236
libwps::DebugStream
Definition: WPSDebug.h:191
libwps::readU8
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:40
WKSChart::Serie::S_Bubble
@ S_Bubble
Definition: WKSChart.h:162
QuattroDosChartInternal::Chart::m_spreadsheetId
int m_spreadsheetId
the sheet id
Definition: QuattroDosChart.cpp:69
WPSPosition::Cell
@ Cell
Definition: WPSPosition.h:43
libwps_tools_win.h
QuattroDos.h
QuattroDosChart.h
WKSChart.h
WPSEntry::setEnd
void setEnd(long e)
sets the end offset
Definition: WPSEntry.h:67
QuattroDosParser
This class parses Quattro Pro spreadsheet: .wq1 and wq2.
Definition: QuattroDos.h:48
QuattroDosChart::readChartName
bool readChartName()
reads the chart name: b9
Definition: QuattroDosChart.cpp:293
libwps::readU16
uint16_t readU16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:64
WKSChart::Serie::P_None
@ P_None
Definition: WKSChart.h:166
libwps_tools_win::Language::name
std::string name(long id)
returns the name given Windows© id
Definition: libwps_tools_win.cpp:7332
WPSPosition.h
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
QuattroDosChartInternal::State::m_chartType
int m_chartType
the chart type
Definition: QuattroDosChart.cpp:116
QuattroDosChart::m_input
RVNGInputStreamPtr m_input
the input
Definition: QuattroDosChart.h:94
WPSPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: WPSPosition.h:39
WPSDebug.h
libwps::DebugFile::addDelimiter
static void addDelimiter(long, char)
Definition: WPSDebug.h:222
QuattroDosChart::version
int version() const
return the file version
Definition: QuattroDosChart.cpp:163
libwps::read16
int16_t read16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:71
libwps_internal.h
WKSContentListener.h
WPSGraphicStyle::Pattern
a basic pattern used in a WPSGraphicStyle:
Definition: WPSGraphicStyle.h:88
WPSColor
the class to store a color
Definition: libwps_internal.h:280
WKSChart::Position
a cell position
Definition: WKSChart.h:50
WPSBox2i
WPSBox2< int > WPSBox2i
WPSBox2 of int.
Definition: libwps_internal.h:888
QuattroDosChartInternal::State::m_idToChartMap
std::multimap< int, std::shared_ptr< Chart > > m_idToChartMap
map sheet id to chart
Definition: QuattroDosChart.cpp:118
WPSBox2< int >
QuattroDosChartInternal::Chart::sendContent
void sendContent(TextZone const &zone, WPSListenerPtr &listener) const final
send the zone content (called when the zone is of text type)
Definition: QuattroDosChart.cpp:77
QuattroDosChart::QuattroDosChart
QuattroDosChart(QuattroDosParser &parser)
constructor
Definition: QuattroDosChart.cpp:150
WKSChart::TextZone
a text zone a chart
Definition: WKSChart.h:233
libwps::DebugFile
Definition: WPSDebug.h:207
WKSChart::Serie::S_Stock
@ S_Stock
Definition: WKSChart.h:162
WKSChart::TextZone::C_Text
@ C_Text
Definition: WKSChart.h:238
QuattroDosParser::getColor
bool getColor(int id, WPSColor &color) const
returns the color corresponding to an id
Definition: QuattroDos.cpp:262
WPSColor::black
static WPSColor black()
return the back color
Definition: libwps_internal.h:306
QuattroDosChart::~QuattroDosChart
~QuattroDosChart()
destructor
Definition: QuattroDosChart.cpp:159
QuattroDosChart
This class parses Quattro Pro DOS chart file.
Definition: QuattroDosChart.h:49