LotusChart.h Source File documentation

LotusChart.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 LOTUS_CHART_H
23#define LOTUS_CHART_H
24
25#include <ostream>
26#include <string>
27#include <map>
28#include <vector>
29
30#include <librevenge-stream/librevenge-stream.h>
31
32#include "libwps_internal.h"
33
34#include "WPSDebug.h"
35#include "WKSChart.h"
36#include "WKSContentListener.h"
37
38#include "Lotus.h"
39
40namespace LotusChartInternal
41{
42class Chart;
43struct State;
44}
45
46class LotusStyleManager;
47class WPSGraphicStyle;
48
53 class LotusChart
54{
55public:
56 friend class LotusParser;
57 friend class LotusChartInternal::Chart;
58
60 explicit LotusChart(LotusParser &parser);
62 void cleanState();
64 void updateState();
66 ~LotusChart();
68 void setListener(WKSContentListenerPtr &listen)
69 {
70 m_listener = listen;
71 }
72
73protected:
75 int version() const;
76
78 int getNumCharts() const;
80 std::map<std::string,int> getNameToChartIdMap() const;
82 void updateChart(LotusChartInternal::Chart &chart, int id);
84 bool sendCharts();
86 bool sendChart(int cId, WPSPosition const &pos, WPSGraphicStyle const &style);
88 bool sendText(std::shared_ptr<WPSStream> stream, WPSEntry const &entry);
89
91 bool readChart(std::shared_ptr<WPSStream> stream);
93 bool readChartName(std::shared_ptr<WPSStream> stream);
94
95 // zone 1b
96
98 bool readMacHeader(std::shared_ptr<WPSStream> stream, long endPos, int &chartId);
100 bool readMacPlacement(std::shared_ptr<WPSStream> stream, long endPos);
102 bool readMacLegend(std::shared_ptr<WPSStream> stream, long endPos);
104 bool readMacPlotArea(std::shared_ptr<WPSStream> stream, long endPos);
106 bool readMacAxis(std::shared_ptr<WPSStream> stream, long endPos);
108 bool readMacSerie(std::shared_ptr<WPSStream> stream, long endPos);
110 bool readMacFloor(std::shared_ptr<WPSStream> stream, long endPos);
112 bool readMacPosition(std::shared_ptr<WPSStream> stream, long endPos);
113
115 bool readPlotArea(std::shared_ptr<WPSStream> stream, long endPos);
117 bool readSerie(std::shared_ptr<WPSStream> stream, long endPos);
119 bool readSerieName(std::shared_ptr<WPSStream> stream, long endPos);
121 static bool readSerieWidth(std::shared_ptr<WPSStream> stream, long endPos);
123 static bool readFontsStyle(std::shared_ptr<WPSStream> stream, long endPos);
125 bool readFramesStyle(std::shared_ptr<WPSStream> stream, long endPos);
126
128 bool convert(LotusParser::Link const &link, WKSChart::Position(&positions)[2]) const;
129private:
130 LotusChart(LotusChart const &orig) = delete;
131 LotusChart &operator=(LotusChart const &orig) = delete;
132 std::shared_ptr<WKSContentListener> m_listener;
134 LotusParser &m_mainParser;
136 std::shared_ptr<LotusStyleManager> m_styleManager;
138 std::shared_ptr<LotusChartInternal::State> m_state;
139};
140
141#endif /* WPS4_H */
142/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
Lotus.h
WKSChart.h
WKSContentListener.h
WPSDebug.h
LotusChartInternal::Chart
the chart of a Lotus Pro Dos
Definition: LotusChart.cpp:55
LotusChart
This class parses Microsoft Works chart file.
Definition: LotusChart.h:54
LotusChart::readChartName
bool readChartName(std::shared_ptr< WPSStream > stream)
reads the chart name or title: 12
Definition: LotusChart.cpp:639
LotusChart::readPlotArea
bool readPlotArea(std::shared_ptr< WPSStream > stream, long endPos)
reads a plot area style: 2a30 (unsure)
Definition: LotusChart.cpp:1576
LotusChart::cleanState
void cleanState()
clean internal state
Definition: LotusChart.cpp:180
LotusChart::readMacPlacement
bool readMacPlacement(std::shared_ptr< WPSStream > stream, long endPos)
reads a placement position(wk3mac): 2774
Definition: LotusChart.cpp:994
LotusChart::m_styleManager
std::shared_ptr< LotusStyleManager > m_styleManager
the style manager
Definition: LotusChart.h:136
LotusChart::readSerie
bool readSerie(std::shared_ptr< WPSStream > stream, long endPos)
reads a serie style: 2a31
Definition: LotusChart.cpp:1225
LotusChart::updateState
void updateState()
update internal state (must be called one time before sending data)
Definition: LotusChart.cpp:197
LotusChart::readMacHeader
bool readMacHeader(std::shared_ptr< WPSStream > stream, long endPos, int &chartId)
reads a chart data: 2710 (wk3mac)
Definition: LotusChart.cpp:736
LotusChart::getNumCharts
int getNumCharts() const
return the number of chart
Definition: LotusChart.cpp:235
LotusChart::convert
bool convert(LotusParser::Link const &link, WKSChart::Position(&positions)[2]) const
convert a link zone in a chart position(if possible)
Definition: LotusChart.cpp:1930
LotusChart::readSerieName
bool readSerieName(std::shared_ptr< WPSStream > stream, long endPos)
reads a serie name: 2a32 (serie 6-...)
Definition: LotusChart.cpp:1493
LotusChart::readSerieWidth
static bool readSerieWidth(std::shared_ptr< WPSStream > stream, long endPos)
reads a serie width style: 2a33
Definition: LotusChart.cpp:1541
LotusChart::sendText
bool sendText(std::shared_ptr< WPSStream > stream, WPSEntry const &entry)
try to send the text
Definition: LotusChart.cpp:2124
LotusChart::m_state
std::shared_ptr< LotusChartInternal::State > m_state
the internal state
Definition: LotusChart.h:138
LotusChart::readFontsStyle
static bool readFontsStyle(std::shared_ptr< WPSStream > stream, long endPos)
reads a list of font style: 2a34
Definition: LotusChart.cpp:1701
LotusChart::m_listener
std::shared_ptr< WKSContentListener > m_listener
Definition: LotusChart.h:132
LotusChart::sendChart
bool sendChart(int cId, WPSPosition const &pos, WPSGraphicStyle const &style)
try to send a chart
Definition: LotusChart.cpp:2169
LotusChart::readMacLegend
bool readMacLegend(std::shared_ptr< WPSStream > stream, long endPos)
reads a legend position(wk3mac): 277e
Definition: LotusChart.cpp:1097
LotusChart::readChart
bool readChart(std::shared_ptr< WPSStream > stream)
reads a structure which define a chart: 11
Definition: LotusChart.cpp:254
LotusChart::version
int version() const
return the file version
Definition: LotusChart.cpp:240
LotusChart::m_mainParser
LotusParser & m_mainParser
the listener (if set)
Definition: LotusChart.h:134
LotusChart::~LotusChart
~LotusChart()
destructor
Definition: LotusChart.cpp:176
LotusChart::setListener
void setListener(WKSContentListenerPtr &listen)
sets the listener
Definition: LotusChart.h:68
LotusChart::readFramesStyle
bool readFramesStyle(std::shared_ptr< WPSStream > stream, long endPos)
reads a some frame styles: 2a35
Definition: LotusChart.cpp:1743
LotusChart::getNameToChartIdMap
std::map< std::string, int > getNameToChartIdMap() const
returns a map chart name to chart id map
Definition: LotusChart.cpp:185
LotusChart::readMacFloor
bool readMacFloor(std::shared_ptr< WPSStream > stream, long endPos)
reads a 3D floor style(wk3mac): 2846
Definition: LotusChart.cpp:1047
LotusChart::readMacAxis
bool readMacAxis(std::shared_ptr< WPSStream > stream, long endPos)
reads an axis style(wk3mac): 27d8
Definition: LotusChart.cpp:780
LotusChart::readMacPlotArea
bool readMacPlotArea(std::shared_ptr< WPSStream > stream, long endPos)
reads a plot area position(wk3mac): 2788
Definition: LotusChart.cpp:1144
LotusChart::updateChart
void updateChart(LotusChartInternal::Chart &chart, int id)
update a chart, so that it can be send
Definition: LotusChart.cpp:1941
LotusChart::readMacSerie
bool readMacSerie(std::shared_ptr< WPSStream > stream, long endPos)
reads a serie style(wk3mac): 27e2
Definition: LotusChart.cpp:820
LotusChart::LotusChart
LotusChart(LotusChart const &orig)=delete
LotusChart::readMacPosition
bool readMacPosition(std::shared_ptr< WPSStream > stream, long endPos)
reads a manual position(wk3mac): 2904
Definition: LotusChart.cpp:1189
LotusChart::sendCharts
bool sendCharts()
try to send the charts(for Windows .wk3 file)
Definition: LotusChart.cpp:2139
LotusChart::operator=
LotusChart & operator=(LotusChart const &orig)=delete
LotusParser
This class parses a wk3,wk4,123 Lotus spreadsheet.
Definition: Lotus.h:73
LotusStyleManager
This class parses the Lotus style.
Definition: LotusStyleManager.h:48
WPSEntry
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:39
WPSGraphicStyle
a structure used to define a picture style
Definition: WPSGraphicStyle.h:38
WPSPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: WPSPosition.h:40
libwps_internal.h
WKSContentListenerPtr
std::shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:114
LotusChartInternal
Definition: LotusChart.cpp:50
LotusParser::Link
basic struct used to store link
Definition: Lotus.h:93
WKSChart::Position
a cell position
Definition: WKSChart.h:51