WKS4Chart.h Source File documentation

WKS4Chart.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_CHART_H
23 #define WKS4_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 WKS4ChartInternal
37 {
38 class Chart;
39 struct State;
40
41 }
42
43 class WKS4Parser;
44
49 class WKS4Chart
50 {
51 public:
52 friend class WKS4Parser;
53 friend class WKS4ChartInternal::Chart;
54
56 explicit WKS4Chart(WKS4Parser &parser);
58 ~WKS4Chart();
60 void setListener(WKSContentListenerPtr &listen)
61 {
62 m_listener = listen;
63 }
64
65 protected:
67 bool checkFilePosition(long pos);
69 int version() const;
70
72 void resetInput(RVNGInputStreamPtr const &input);
73
75 int getNumCharts() const;
77 void updateChart(WKS4ChartInternal::Chart &chart);
78
80 bool sendCharts();
82 bool sendText(WPSEntry const &entry);
83
85 bool readChart();
86
88 bool readChartAxis();
89
91 bool readChartSeries();
92
94 bool readChartSeriesStyles();
95
97 bool readChartSeriesColorMap();
99 bool readChartName();
100
102 bool readChartDim();
104 bool readChartFont();
106 bool readChart3D();
107
109 bool readChart2Font();
110
112 bool readChartLimit();
113
114 private:
115 WKS4Chart(WKS4Chart const &orig) = delete;
116 WKS4Chart &operator=(WKS4Chart const &orig) = delete;
118 libwps::DebugFile &ascii()
119 {
120 return m_asciiFile;
121 }
123 RVNGInputStreamPtr m_input;
124 std::shared_ptr<WKSContentListener> m_listener;
125 WKS4Parser &m_mainParser;
128 std::shared_ptr<WKS4ChartInternal::State> m_state;
130 libwps::DebugFile &m_asciiFile;
131 };
132
133 #endif /* WPS4_H */
134 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WKS4ChartInternal::State::m_idToColorMap
std::map< int, WPSColor > m_idToColorMap
a map id -> color
Definition: WKS4Chart.cpp:150
WKS4ChartInternal::Chart::m_fileType
int m_fileType
the chart type
Definition: WKS4Chart.cpp:78
WKSChart::Serie::S_Line
@ S_Line
Definition: WKSChart.h:162
WPSColor::white
static WPSColor white()
return the white color
Definition: libwps_internal.h:311
WPS_N_ELEMENTS
#define WPS_N_ELEMENTS(m)
Definition: libwps_internal.h:124
WKSChart::Axis::A_Logarithmic
@ A_Logarithmic
Definition: WKSChart.h:91
WKS4Chart::readChart
bool readChart()
reads a structure which define a chart: 2d(default), 2e(name + value)
Definition: WKS4Chart.cpp:435
WKS4Chart::m_state
std::shared_ptr< WKS4ChartInternal::State > m_state
the internal state
Definition: WKS4Chart.h:128
WKSChart::TextZone::m_font
WPSFont m_font
the zone format
Definition: WKSChart.h:278
WKS4Chart::WKS4Chart
WKS4Chart(WKS4Parser &parser)
constructor
Definition: WKS4Chart.cpp:223
WKS4ChartInternal::State::getColor
bool getColor(int id, WPSColor &color) const
returns a color corresponding to an id
Definition: WKS4Chart.cpp:155
libwps::DebugStream::str
static std::string str()
Definition: WPSDebug.h:200
WKSChart::Serie
a serie in a chart
Definition: WKSChart.h:159
WKSChart::Serie::Type
Type
the series type
Definition: WKSChart.h:162
WKS4Chart::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition: WKS4Chart.h:124
WKSChart::Serie::P_Diamond
@ P_Diamond
Definition: WKSChart.h:166
libwps::DebugFile::addPos
static void addPos(long)
Definition: WPSDebug.h:220
WKS4ChartInternal::Chart::Chart
Chart(WKS4Chart &parser, RVNGInputStreamPtr const &input)
constructor
Definition: WKS4Chart.cpp:55
WKSChart::Serie::P_Automatic
@ P_Automatic
Definition: WKSChart.h:166
WKS4Chart::version
int version() const
return the file version
Definition: WKS4Chart.cpp:252
WKS4ChartInternal::Chart::m_seriesData
SerieData m_seriesData[6]
the serie local data
Definition: WKS4Chart.cpp:102
WPSPosition::m_anchorTo
AnchorTo m_anchorTo
anchor position
Definition: WPSPosition.h:241
WKS4Chart.h
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
WKS4Chart::m_mainParser
WKS4Parser & m_mainParser
the listener (if set)
Definition: WKS4Chart.h:126
WKSChart::TextZone::T_SubTitle
@ T_SubTitle
Definition: WKSChart.h:236
WKS4Chart::readChart2Font
bool readChart2Font()
reads a structure which seems to define four chart font (only present in windows file): 84
Definition: WKS4Chart.cpp:900
WKS4ChartInternal::State::m_eof
long m_eof
the last file position
Definition: WKS4Chart.cpp:146
WKS4ChartInternal::Chart
the chart of a WKS4 Pro Dos
Definition: WKS4Chart.cpp:51
WKS4Chart::resetInput
void resetInput(RVNGInputStreamPtr const &input)
reset the main input
Definition: WKS4Chart.cpp:247
WKSChart::Serie::P_Plus
@ P_Plus
Definition: WKSChart.h:168
WKSChart::TextZone::m_textEntryList
std::vector< WPSEntry > m_textEntryList
the text entry (or the list of text entry)
Definition: WKSChart.h:276
WKS4Chart::getNumCharts
int getNumCharts() const
return the number of chart
Definition: WKS4Chart.cpp:236
WKS4ChartInternal::Chart::SerieData
small struct used to defined the serie data
Definition: WKS4Chart.cpp:87
WKSChart::m_dataStacked
bool m_dataStacked
a flag to know if the data are stacked or not
Definition: WKSChart.h:333
WKS4Chart::readChart3D
bool readChart3D()
reads a structure which stores zfront, zfar: 44
Definition: WKS4Chart.cpp:861
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
WKS4Chart::operator=
WKS4Chart & operator=(WKS4Chart const &orig)=delete
WKS4Chart::readChartAxis
bool readChartAxis()
reads the axis(or second yaxis) data: zone 0x14
Definition: WKS4Chart.cpp:971
WKS4Chart::readChartSeriesColorMap
bool readChartSeriesColorMap()
reads the chart's series color map: zone 0x31
Definition: WKS4Chart.cpp:1358
WKS4Parser::getDefaultFontType
libwps_tools_win::Font::Type getDefaultFontType() const
returns the default font type, ie.
Definition: WKS4.cpp:287
WPSEntry::valid
bool valid(bool checkId=false) const
returns true if the zone length is positive
Definition: WPSEntry.h:89
WKSChart::getAxis
Axis & getAxis(int coord)
return an axis (corresponding to a coord)
Definition: WKSChart.cpp:136
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
WKSChart::getSerie
Serie * getSerie(int id, bool create)
return a serie
Definition: WKSChart.cpp:156
WKS4Chart::sendText
bool sendText(WPSEntry const &entry)
try to send the text
Definition: WKS4Chart.cpp:415
WKS4ChartInternal::State::State
State()
constructor
Definition: WKS4Chart.cpp:134
WPSGraphicStyle::Pattern::m_dim
Vec2i m_dim
the dimension width x height
Definition: WPSGraphicStyle.h:187
WKS4ChartInternal::Chart::m_axisZoneFound
bool m_axisZoneFound
flag to know if we have found the axis zone
Definition: WKS4Chart.cpp:80
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
Vec2f
Vec2< float > Vec2f
Vec2 of float.
Definition: libwps_internal.h:704
WKSChart::Serie::P_Asterisk
@ P_Asterisk
Definition: WKSChart.h:168
WKS4ChartInternal::Chart::sendContent
void sendContent(TextZone const &zone, WPSListenerPtr &listener) const final
send the zone content (called when the zone is of text type)
Definition: WKS4Chart.cpp:110
WKSChart::Serie::PointType
PointType
the point type
Definition: WKSChart.h:164
WKS4.h
WKSChart::Serie::S_Area
@ S_Area
Definition: WKSChart.h:162
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
WKSChart::Serie::P_Square
@ P_Square
Definition: WKSChart.h:166
WPSEntry::setBegin
void setBegin(long off)
sets the begin offset
Definition: WPSEntry.h:57
WKS4Chart::~WKS4Chart
~WKS4Chart()
destructor
Definition: WKS4Chart.cpp:232
WKSContentListenerPtr
std::shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:114
WKS4Chart::readChartName
bool readChartName()
reads the chart name or title: 41
Definition: WKS4Chart.cpp:700
WKS4Chart::m_asciiFile
libwps::DebugFile & m_asciiFile
the ascii file
Definition: WKS4Chart.h:130
WKS4ChartInternal::State::getPattern
static bool getPattern(int id, WPSGraphicStyle::Pattern &pattern)
returns the pattern corresponding to a pattern id between 0 and 15
Definition: WKS4Chart.cpp:190
WPSFont.h
WKSChart::Serie::S_Circle
@ S_Circle
Definition: WKSChart.h:162
WKSChart::Serie::S_Radar
@ S_Radar
Definition: WKSChart.h:162
WPSBorder::RightBit
@ RightBit
Definition: libwps_internal.h:401
WPSEntry.h
libwps::DebugFile::addNote
static void addNote(char const *)
Definition: WPSDebug.h:221
WKS4ChartInternal::State::m_chartList
std::vector< std::shared_ptr< Chart > > m_chartList
list of chart
Definition: WKS4Chart.cpp:152
WPSEntry::begin
long begin() const
returns the begin offset
Definition: WPSEntry.h:73
WKS4Chart
This class parses Microsoft Works chart file.
Definition: WKS4Chart.h:49
WKS4Chart::readChartSeriesStyles
bool readChartSeriesStyles()
reads the series style: zone 0x16
Definition: WKS4Chart.cpp:1287
WKS4ChartInternal::Chart::SerieData::m_type
int m_type
the serie secondary type(used to swap line<->bar)
Definition: WKS4Chart.cpp:96
WKSChart::Axis::A_Numeric
@ A_Numeric
Definition: WKSChart.h:91
WKS4Parser::readCString
bool readCString(librevenge::RVNGString &string, long maxSize)
try to read a basic C string, knowing the maximum size
Definition: WKS4.cpp:1388
WKS4ChartInternal
Definition: WKS4Chart.cpp:46
WKS4Chart::readChartSeries
bool readChartSeries()
reads a list of series definition: zone 0x15
Definition: WKS4Chart.cpp:1224
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
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
WKS4Chart::sendCharts
bool sendCharts()
try to send the charts
Definition: WKS4Chart.cpp:384
WKS4ChartInternal::Chart::m_use2D
bool m_use2D
flag to know if we print line/surface data
Definition: WKS4Chart.cpp:82
WKSChart::TextZone::T_Title
@ T_Title
Definition: WKSChart.h:236
WKSChart::Serie::m_legendRange
Position m_legendRange
the legend range if defined
Definition: WKSChart.h:224
libwps::DebugStream
Definition: WPSDebug.h:191
libwps::readU8
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:40
WKS4ChartInternal::Chart::empty
bool empty() const
check if the chart has no serie
Definition: WKS4Chart.cpp:68
WKSChart::Axis::m_type
Type m_type
the sequence type
Definition: WKSChart.h:103
WKSChart::Serie::P_Horizontal_Bar
@ P_Horizontal_Bar
Definition: WKSChart.h:169
WKS4ChartInternal::Chart::m_seriesStylesZoneFound
bool m_seriesStylesZoneFound
flag to know if we have found the series zone
Definition: WKS4Chart.cpp:84
libwps_tools_win.h
WKS4Parser::getSheetName
librevenge::RVNGString getSheetName(int id) const
returns the name of the id's spreadsheet
Definition: WKS4.cpp:318
WKS4Chart::m_input
RVNGInputStreamPtr m_input
the input
Definition: WKS4Chart.h:123
WPSPosition::Page
@ Page
Definition: WPSPosition.h:43
WKSChart.h
WPSEntry::setEnd
void setEnd(long e)
sets the end offset
Definition: WPSEntry.h:67
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
WKS4Chart::ascii
libwps::DebugFile & ascii()
returns the debug file
Definition: WKS4Chart.h:118
WPSPosition.h
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
WKS4Chart::readChartLimit
bool readChartLimit()
reads end/begin of chart (only present in windows file): 80,81
Definition: WKS4Chart.cpp:948
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
WKS4Chart::updateChart
void updateChart(WKS4ChartInternal::Chart &chart)
update a chart, so that it can be send
Definition: WKS4Chart.cpp:271
WKS4ChartInternal::Chart::SerieData::m_ids
int m_ids[3]
the serie color
Definition: WKS4Chart.cpp:98
WKS4ChartInternal::Chart::SerieData::SerieData
SerieData()
constructor
Definition: WKS4Chart.cpp:90
libwps::read16
int16_t read16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:71
libwps_internal.h
WKSChart::m_type
Serie::Type m_type
the chart type (if no series)
Definition: WKSChart.h:331
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
WKS4Chart::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition: WKS4Chart.h:60
WKS4ChartInternal::State::m_version
int m_version
the file version
Definition: WKS4Chart.cpp:148
WKSChart::m_dataVertical
bool m_dataVertical
a flag to know if the data are vertical (for bar)
Definition: WKSChart.h:337
WKS4ChartInternal::Chart::m_input
RVNGInputStreamPtr m_input
the input
Definition: WKS4Chart.cpp:107
WKS4Parser::creator
libwps::WPSCreator creator() const
return the file creator
Definition: WKS4.cpp:261
WKSChart::TextZone
a text zone a chart
Definition: WKSChart.h:233
WKS4Parser::version
int version() const
return the file version
Definition: WKS4.cpp:256
WKS4Parser
This class parses Microsoft Works spreadsheet or a database file.
Definition: WKS4.h:48
libwps::DebugFile
Definition: WPSDebug.h:207
WKSChart::Serie::S_Stock
@ S_Stock
Definition: WKSChart.h:162
libwps::WPS_MSWORKS
@ WPS_MSWORKS
Definition: WPSDocument.h:48
WKSChart::TextZone::C_Text
@ C_Text
Definition: WKSChart.h:238
WKS4ChartInternal::Chart::m_parser
WKS4Chart & m_parser
the parser
Definition: WKS4Chart.cpp:105
WPSGraphicStyle::Pattern::getUniqueColor
bool getUniqueColor(WPSColor &col) const
check if the pattern has only one color; if so returns true...
Definition: WPSGraphicStyle.cpp:45
WKS4Chart::readChartDim
bool readChartDim()
reads a structure which seems to define some dimension (only present in windows file): 35
Definition: WKS4Chart.cpp:740
WKS4Chart::readChartFont
bool readChartFont()
reads a structure which seems to define two chart font (only present in windows file): 40
Definition: WKS4Chart.cpp:808
WKSChart::Serie::P_Circle
@ P_Circle
Definition: WKSChart.h:168
WKS4Chart::checkFilePosition
bool checkFilePosition(long pos)
return true if the pos is in the file, update the file size if need
Definition: WKS4Chart.cpp:259
WKS4ChartInternal::State
the state of WKS4Chart
Definition: WKS4Chart.cpp:131
WKSChart::Serie::m_type
Type m_type
the type
Definition: WKSChart.h:214