MWAWChart.hxx Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

MWAWChart.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33
34 /*
35 * Structure to store and construct a chart from an unstructured list
36 * of cell
37 *
38 */
39
40 #ifndef MWAW_CHART
41 # define MWAW_CHART
42
43 #include <iostream>
44 #include <vector>
45 #include <map>
46
47 #include "libmwaw_internal.hxx"
48
49 #include "MWAWEntry.hxx"
50 #include "MWAWFont.hxx"
51 #include "MWAWGraphicStyle.hxx"
52
53 namespace MWAWChartInternal
54 {
55 class SubDocument;
56 }
58 class MWAWChart
59 {
60 friend class MWAWChartInternal::SubDocument;
61 public:
63 struct Axis {
65 enum Type { A_None, A_Numeric, A_Logarithmic, A_Sequence, A_Sequence_Skip_Empty };
67 Axis();
69 ~Axis();
71 void addContentTo(std::string const &sheetName, int coord, librevenge::RVNGPropertyList &propList) const;
73 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
75 friend std::ostream &operator<<(std::ostream &o, Axis const &axis);
77 Type m_type;
79 bool m_showGrid;
81 bool m_showLabel;
83 Box2i m_labelRange;
85 MWAWGraphicStyle m_style;
86 };
88 struct Legend {
90 Legend() : m_show(false), m_autoPosition(true), m_relativePosition(libmwaw::RightBit), m_position(0,0), m_font(), m_style()
91 {
92 }
94 void addContentTo(librevenge::RVNGPropertyList &propList) const;
96 void addStyleTo(librevenge::RVNGPropertyList &propList, shared_ptr<MWAWFontConverter> fontConverter) const;
98 friend std::ostream &operator<<(std::ostream &o, Legend const &legend);
100 bool m_show;
102 bool m_autoPosition;
104 int m_relativePosition;
106 Vec2f m_position;
108 MWAWFont m_font;
110 MWAWGraphicStyle m_style;
111 };
113 struct Series {
115 enum Type { S_Area, S_Bar, S_Column, S_Line, S_Pie, S_Scatter, S_Stock };
117 Series();
119 virtual ~Series();
121 void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const;
123 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
125 static std::string getSeriesTypeName(Type type);
127 friend std::ostream &operator<<(std::ostream &o, Series const &series);
129 Type m_type;
131 Box2i m_range;
133 MWAWGraphicStyle m_style;
134 };
136 struct TextZone {
138 enum Type { T_Title, T_SubTitle, T_AxisX, T_AxisY, T_AxisZ };
140 enum ContentType { C_Cell, C_Text };
141
143 TextZone();
145 ~TextZone();
147 void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const;
149 void addStyleTo(librevenge::RVNGPropertyList &propList, shared_ptr<MWAWFontConverter> fontConverter) const;
151 friend std::ostream &operator<<(std::ostream &o, TextZone const &zone);
153 Type m_type;
155 ContentType m_contentType;
157 Vec2f m_position;
159 Vec2i m_cell;
161 MWAWEntry m_textEntry;
163 MWAWFont m_font;
165 MWAWGraphicStyle m_style;
166 };
167
169 MWAWChart(std::string const &sheetName, MWAWFontConverterPtr fontConverter, Vec2f const &dim=Vec2f());
171 virtual ~MWAWChart();
173 void sendChart(MWAWSpreadsheetListenerPtr &listener, librevenge::RVNGSpreadsheetInterface *interface);
175 virtual void sendContent(TextZone const &zone, MWAWListenerPtr &listener)=0;
176
178 void setDataType(Series::Type type, bool dataStacked)
179 {
180 m_type=type;
181 m_dataStacked=dataStacked;
182 }
183
185 Vec2f const &getDimension() const
186 {
187 return m_dim;
188 }
190 void setDimension(Vec2f const &dim)
191 {
192 m_dim=dim;
193 }
195 void add(int coord, Axis const &axis);
197 Axis const &getAxis(int coord) const;
198
200 void set(Legend const &legend)
201 {
202 m_legend=legend;
203 }
205 Legend const &getLegend() const
206 {
207 return m_legend;
208 }
209
211 void add(Series const &series);
213 std::vector<Series> const &getSeries() const
214 {
215 return m_seriesList;
216 }
217
219 void add(TextZone const &textZone);
221 bool getTextZone(TextZone::Type type, TextZone &textZone);
222
223 protected:
225 void sendTextZoneContent(TextZone::Type type, MWAWListenerPtr &listener);
226
227 protected:
229 std::string m_sheetName;
231 Vec2f m_dim;
233 Series::Type m_type;
235 bool m_dataStacked;
237 Axis m_axis[3];
239 Legend m_legend;
241 std::vector<Series> m_seriesList;
243 std::map<TextZone::Type, TextZone> m_textZoneMap;
245 MWAWFontConverterPtr m_fontConverter;
246 private:
247 MWAWChart(MWAWChart const &orig);
248 MWAWChart &operator=(MWAWChart const &orig);
249 };
250
251 #endif
252 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWChart::TextZone::operator<<
friend std::ostream & operator<<(std::ostream &o, TextZone const &zone)
operator<<
Definition: MWAWChart.cxx:615
MWAWListenerPtr
shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:431
MWAWChart::Legend
a legend in a chart
Definition: MWAWChart.hxx:88
MWAWChart::TextZone::m_textEntry
MWAWEntry m_textEntry
the text entry
Definition: MWAWChart.hxx:161
MWAWChart::Series::m_type
Type m_type
the type
Definition: MWAWChart.hxx:129
MWAWChart::TextZone::Type
Type
the text type
Definition: MWAWChart.hxx:138
MWAWChart::Series::Type
Type
the series type
Definition: MWAWChart.hxx:115
MWAWChart::TextZone::m_font
MWAWFont m_font
the zone format
Definition: MWAWChart.hxx:163
MWAWChart::TextZone::C_Text
Definition: MWAWChart.hxx:140
MWAWChartInternal::SubDocument
Internal: the subdocument of a MWAWChart.
Definition: MWAWChart.cxx:61
MWAWChartInternal
Internal: the structures of a MWAWChart.
Definition: MWAWChart.cxx:57
MWAWChart::TextZone::m_cell
Vec2i m_cell
the cell position ( for title and subtitle )
Definition: MWAWChart.hxx:159
MWAWChart::TextZone::ContentType
ContentType
the text content type
Definition: MWAWChart.hxx:140
MWAWChart::Series::S_Pie
Definition: MWAWChart.hxx:115
MWAWChart::TextZone::m_contentType
ContentType m_contentType
the content type
Definition: MWAWChart.hxx:155
MWAWEntry.hxx
libmwaw_internal.hxx
MWAWChart::Legend::m_autoPosition
bool m_autoPosition
automatic position
Definition: MWAWChart.hxx:102
MWAWChart::Series::~Series
virtual ~Series()
destructor
Definition: MWAWChart.cxx:475
MWAWChart::getAxis
Axis const & getAxis(int coord) const
return an axis (corresponding to a coord)
Definition: MWAWChart.cxx:137
Vec2f
Vec2< float > Vec2f
Vec2 of float.
Definition: libmwaw_internal.hxx:711
MWAWChart::m_legend
Legend m_legend
the legend
Definition: MWAWChart.hxx:239
MWAWChart::Axis::m_showGrid
bool m_showGrid
show or not the grid
Definition: MWAWChart.hxx:79
Box2< int >
MWAWChart::Series::getSeriesTypeName
static std::string getSeriesTypeName(Type type)
returns a string corresponding to a series type
Definition: MWAWChart.cxx:479
MWAWChart::m_sheetName
std::string m_sheetName
the sheet name
Definition: MWAWChart.hxx:229
MWAWChart::Series
a series in a chart
Definition: MWAWChart.hxx:113
MWAWChart::Axis::A_Sequence
Definition: MWAWChart.hxx:65
MWAWChart::TextZone::TextZone
TextZone()
constructor
Definition: MWAWChart.cxx:565
MWAWChart::Axis::Axis
Axis()
constructor
Definition: MWAWChart.cxx:331
MWAWChart::TextZone::addStyleTo
void addStyleTo(librevenge::RVNGPropertyList &propList, shared_ptr< MWAWFontConverter > fontConverter) const
add to the propList
Definition: MWAWChart.cxx:609
MWAWGraphicStyle
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
MWAWChart::TextZone::~TextZone
~TextZone()
destructor
Definition: MWAWChart.cxx:572
MWAWChart::Series::S_Bar
Definition: MWAWChart.hxx:115
MWAWChart::m_dim
Vec2f m_dim
the chart dimension in point
Definition: MWAWChart.hxx:231
MWAWChart::setDataType
void setDataType(Series::Type type, bool dataStacked)
sets the chart type
Definition: MWAWChart.hxx:178
MWAWChart::Axis::m_showLabel
bool m_showLabel
show or not the label
Definition: MWAWChart.hxx:81
libmwaw
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition: libmwaw_internal.cxx:47
MWAWChart::Series::m_style
MWAWGraphicStyle m_style
the graphic style
Definition: MWAWChart.hxx:133
MWAWChart::Axis::addStyleTo
void addStyleTo(librevenge::RVNGPropertyList &propList) const
add style to the propList
Definition: MWAWChart.cxx:369
MWAWChart::Series::S_Stock
Definition: MWAWChart.hxx:115
MWAWChart::Axis::A_Numeric
Definition: MWAWChart.hxx:65
MWAWChart::m_seriesList
std::vector< Series > m_seriesList
the list of series
Definition: MWAWChart.hxx:241
MWAWChart::Series::operator<<
friend std::ostream & operator<<(std::ostream &o, Series const &series)
operator<<
Definition: MWAWChart.cxx:528
MWAWChart::operator=
MWAWChart & operator=(MWAWChart const &orig)
MWAWChart::Axis::Type
Type
the axis content
Definition: MWAWChart.hxx:65
MWAWChart::getTextZone
bool getTextZone(TextZone::Type type, TextZone &textZone)
returns a textzone content(if set)
Definition: MWAWChart.cxx:152
MWAWChart::Axis::m_labelRange
Box2i m_labelRange
the label range if defined
Definition: MWAWChart.hxx:83
MWAWChart::Series::S_Line
Definition: MWAWChart.hxx:115
MWAWChart::Axis::A_None
Definition: MWAWChart.hxx:65
MWAWChart::Legend::Legend
Legend()
constructor
Definition: MWAWChart.hxx:90
MWAWChart::Axis::~Axis
~Axis()
destructor
Definition: MWAWChart.cxx:337
MWAWChart::Axis
a axis in a chart
Definition: MWAWChart.hxx:63
MWAWChart::Legend::addContentTo
void addContentTo(librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition: MWAWChart.cxx:413
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:44
MWAWChart::Legend::m_position
Vec2f m_position
the position in points
Definition: MWAWChart.hxx:106
MWAWChart::Legend::m_font
MWAWFont m_font
the font
Definition: MWAWChart.hxx:108
MWAWChart::Series::addContentTo
void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition: MWAWChart.cxx:502
MWAWChart::Series::S_Column
Definition: MWAWChart.hxx:115
MWAWChart::getDimension
Vec2f const & getDimension() const
return the chart dimension
Definition: MWAWChart.hxx:185
MWAWFont.hxx
MWAWChart::TextZone::T_SubTitle
Definition: MWAWChart.hxx:138
MWAWSpreadsheetListenerPtr
shared_ptr< MWAWSpreadsheetListener > MWAWSpreadsheetListenerPtr
a smart pointer of MWAWSpreadsheetListener
Definition: libmwaw_internal.hxx:441
MWAWChart::Series::S_Area
Definition: MWAWChart.hxx:115
MWAWChart::Axis::m_style
MWAWGraphicStyle m_style
the graphic style
Definition: MWAWChart.hxx:85
MWAWChart::sendChart
void sendChart(MWAWSpreadsheetListenerPtr &listener, librevenge::RVNGSpreadsheetInterface *interface)
send the chart to the listener
Definition: MWAWChart.cxx:174
MWAWChart::m_type
Series::Type m_type
the chart type (if no series)
Definition: MWAWChart.hxx:233
MWAWChart::Axis::addContentTo
void addContentTo(std::string const &sheetName, int coord, librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition: MWAWChart.cxx:341
MWAWChart::getLegend
Legend const & getLegend() const
return the legend
Definition: MWAWChart.hxx:205
MWAWChart::Axis::m_type
Type m_type
the sequence type
Definition: MWAWChart.hxx:77
MWAWChart::TextZone::T_Title
Definition: MWAWChart.hxx:138
MWAWChart::TextZone::T_AxisY
Definition: MWAWChart.hxx:138
MWAWChart::Series::m_range
Box2i m_range
the data range
Definition: MWAWChart.hxx:131
MWAWChart::sendTextZoneContent
void sendTextZoneContent(TextZone::Type type, MWAWListenerPtr &listener)
sends a textzone content
Definition: MWAWChart.cxx:160
MWAWChart::m_dataStacked
bool m_dataStacked
a flag to know if the data are stacked or not
Definition: MWAWChart.hxx:235
MWAWChart::Axis::operator<<
friend std::ostream & operator<<(std::ostream &o, Axis const &axis)
operator<<
Definition: MWAWChart.cxx:379
MWAWChart::getSeries
std::vector< Series > const & getSeries() const
return the list of series
Definition: MWAWChart.hxx:213
MWAWChart::TextZone::T_AxisZ
Definition: MWAWChart.hxx:138
MWAWChart::Series::Series
Series()
constructor
Definition: MWAWChart.cxx:469
MWAWChart::set
void set(Legend const &legend)
set the legend
Definition: MWAWChart.hxx:200
MWAWChart::TextZone::m_style
MWAWGraphicStyle m_style
the graphic style
Definition: MWAWChart.hxx:165
MWAWChart::m_textZoneMap
std::map< TextZone::Type, TextZone > m_textZoneMap
a map text zone type to text zone
Definition: MWAWChart.hxx:243
MWAWChart::sendContent
virtual void sendContent(TextZone const &zone, MWAWListenerPtr &listener)=0
send the zone content (called when the zone is of text type)
MWAWChart::m_axis
Axis m_axis[3]
the x,y,z axis
Definition: MWAWChart.hxx:237
MWAWChart::Legend::m_show
bool m_show
show or not the legend
Definition: MWAWChart.hxx:100
MWAWChart::setDimension
void setDimension(Vec2f const &dim)
return the chart dimension
Definition: MWAWChart.hxx:190
MWAWChart::add
void add(int coord, Axis const &axis)
adds an axis (corresponding to a coord)
Definition: MWAWChart.cxx:128
libmwaw::RightBit
Definition: libmwaw_internal.hxx:158
MWAWFontConverterPtr
shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition: libmwaw_internal.hxx:423
MWAWChart::MWAWChart
MWAWChart(std::string const &sheetName, MWAWFontConverterPtr fontConverter, Vec2f const &dim=Vec2f())
the constructor
Definition: MWAWChart.cxx:118
MWAWChart::~MWAWChart
virtual ~MWAWChart()
the destructor
Definition: MWAWChart.cxx:124
MWAWChart::Legend::operator<<
friend std::ostream & operator<<(std::ostream &o, Legend const &legend)
operator<<
Definition: MWAWChart.cxx:440
MWAWChart::TextZone::C_Cell
Definition: MWAWChart.hxx:140
MWAWChart::Legend::m_relativePosition
int m_relativePosition
the automatic position libmwaw::LeftBit|...
Definition: MWAWChart.hxx:104
MWAWChart::m_fontConverter
MWAWFontConverterPtr m_fontConverter
the font converter
Definition: MWAWChart.hxx:245
MWAWChart::TextZone::m_position
Vec2f m_position
the position in the zone
Definition: MWAWChart.hxx:157
MWAWChart::Series::S_Scatter
Definition: MWAWChart.hxx:115
MWAWChart::TextZone
a text zone a chart
Definition: MWAWChart.hxx:136
MWAWChart::Axis::A_Logarithmic
Definition: MWAWChart.hxx:65
MWAWChart::TextZone::m_type
Type m_type
the zone type
Definition: MWAWChart.hxx:153
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
MWAWChart::Legend::addStyleTo
void addStyleTo(librevenge::RVNGPropertyList &propList, shared_ptr< MWAWFontConverter > fontConverter) const
add style to the propList
Definition: MWAWChart.cxx:433
Vec2< float >
MWAWChart::TextZone::addContentTo
void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition: MWAWChart.cxx:576
MWAWChart::Series::addStyleTo
void addStyleTo(librevenge::RVNGPropertyList &propList) const
add style to the propList
Definition: MWAWChart.cxx:523
MWAWChart::Legend::m_style
MWAWGraphicStyle m_style
the graphic style
Definition: MWAWChart.hxx:110
MWAWChart
a class used to store a chart associated to a spreadsheet ....
Definition: MWAWChart.hxx:58
MWAWChart::TextZone::T_AxisX
Definition: MWAWChart.hxx:138
MWAWChart::Axis::A_Sequence_Skip_Empty
Definition: MWAWChart.hxx:65
MWAWGraphicStyle.hxx