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
36 *
37 */
38
39#ifndef MWAW_CHART
40# define MWAW_CHART
41
42#include <iostream>
43#include <vector>
44#include <map>
45
46#include "libmwaw_internal.hxx"
47
48#include "MWAWEntry.hxx"
49#include "MWAWFont.hxx"
50#include "MWAWGraphicStyle.hxx"
51
52namespace MWAWChartInternal
53{
54class SubDocument;
55}
58{
60public:
62 struct Axis {
66 Axis();
68 ~Axis();
70 void addContentTo(std::string const &sheetName, int coord, librevenge::RVNGPropertyList &propList) const;
72 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
74 friend std::ostream &operator<<(std::ostream &o, Axis const &axis);
85 };
87 struct Legend {
90 {
91 }
93 void addContentTo(librevenge::RVNGPropertyList &propList) const;
95 void addStyleTo(librevenge::RVNGPropertyList &propList, shared_ptr<MWAWFontConverter> fontConverter) const;
97 friend std::ostream &operator<<(std::ostream &o, Legend const &legend);
99 bool m_show;
110 };
112 struct Series {
116 Series();
118 virtual ~Series();
120 void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const;
122 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
124 static std::string getSeriesTypeName(Type type);
126 friend std::ostream &operator<<(std::ostream &o, Series const &series);
133 };
135 struct TextZone {
140
142 TextZone();
144 ~TextZone();
146 void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const;
148 void addStyleTo(librevenge::RVNGPropertyList &propList, shared_ptr<MWAWFontConverter> fontConverter) const;
150 friend std::ostream &operator<<(std::ostream &o, TextZone const &zone);
165 };
166
168 MWAWChart(std::string const &sheetName, MWAWFontConverterPtr fontConverter, MWAWVec2f const &dim=MWAWVec2f());
170 virtual ~MWAWChart();
172 void sendChart(MWAWSpreadsheetListenerPtr &listener, librevenge::RVNGSpreadsheetInterface *interface);
174 virtual void sendContent(TextZone const &zone, MWAWListenerPtr &listener)=0;
175
177 void setDataType(Series::Type type, bool dataStacked)
178 {
179 m_type=type;
180 m_dataStacked=dataStacked;
181 }
182
184 MWAWVec2f const &getDimension() const
185 {
186 return m_dim;
187 }
189 void setDimension(MWAWVec2f const &dim)
190 {
191 m_dim=dim;
192 }
194 void add(int coord, Axis const &axis);
196 Axis const &getAxis(int coord) const;
197
199 void set(Legend const &legend)
200 {
201 m_legend=legend;
202 }
204 Legend const &getLegend() const
205 {
206 return m_legend;
207 }
208
210 void add(Series const &series);
212 std::vector<Series> const &getSeries() const
213 {
214 return m_seriesList;
215 }
216
218 void add(TextZone const &textZone);
220 bool getTextZone(TextZone::Type type, TextZone &textZone);
221
222protected:
225
226protected:
228 std::string m_sheetName;
240 std::vector<Series> m_seriesList;
242 std::map<TextZone::Type, TextZone> m_textZoneMap;
245private:
246 explicit MWAWChart(MWAWChart const &orig);
248};
249
250#endif
251// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Internal: the subdocument of a MWAWChart.
Definition: MWAWChart.cxx:62
a class used to store a chart associated to a spreadsheet ....
Definition: MWAWChart.hxx:58
MWAWChart(std::string const &sheetName, MWAWFontConverterPtr fontConverter, MWAWVec2f const &dim=MWAWVec2f())
the constructor
Definition: MWAWChart.cxx:118
MWAWChart(MWAWChart const &orig)
Axis const & getAxis(int coord) const
return an axis (corresponding to a coord)
Definition: MWAWChart.cxx:137
void setDimension(MWAWVec2f const &dim)
return the chart dimension
Definition: MWAWChart.hxx:189
bool getTextZone(TextZone::Type type, TextZone &textZone)
returns a textzone content(if set)
Definition: MWAWChart.cxx:151
void sendTextZoneContent(TextZone::Type type, MWAWListenerPtr &listener)
sends a textzone content
Definition: MWAWChart.cxx:159
MWAWFontConverterPtr m_fontConverter
the font converter
Definition: MWAWChart.hxx:244
Series::Type m_type
the chart type (if no series)
Definition: MWAWChart.hxx:232
MWAWVec2f const & getDimension() const
return the chart dimension
Definition: MWAWChart.hxx:184
virtual ~MWAWChart()
the destructor
Definition: MWAWChart.cxx:124
Legend m_legend
the legend
Definition: MWAWChart.hxx:238
Legend const & getLegend() const
return the legend
Definition: MWAWChart.hxx:204
virtual void sendContent(TextZone const &zone, MWAWListenerPtr &listener)=0
send the zone content (called when the zone is of text type)
bool m_dataStacked
a flag to know if the data are stacked or not
Definition: MWAWChart.hxx:234
std::vector< Series > m_seriesList
the list of series
Definition: MWAWChart.hxx:240
void setDataType(Series::Type type, bool dataStacked)
sets the chart type
Definition: MWAWChart.hxx:177
std::map< TextZone::Type, TextZone > m_textZoneMap
a map text zone type to text zone
Definition: MWAWChart.hxx:242
void add(int coord, Axis const &axis)
adds an axis (corresponding to a coord)
Definition: MWAWChart.cxx:128
void sendChart(MWAWSpreadsheetListenerPtr &listener, librevenge::RVNGSpreadsheetInterface *interface)
send the chart to the listener
Definition: MWAWChart.cxx:173
std::vector< Series > const & getSeries() const
return the list of series
Definition: MWAWChart.hxx:212
void set(Legend const &legend)
set the legend
Definition: MWAWChart.hxx:199
Axis m_axis[4]
the x,y,z and a bad axis
Definition: MWAWChart.hxx:236
MWAWVec2f m_dim
the chart dimension in point
Definition: MWAWChart.hxx:230
std::string m_sheetName
the sheet name
Definition: MWAWChart.hxx:228
MWAWChart & operator=(MWAWChart const &orig)
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
Class to store font.
Definition: MWAWFont.hxx:44
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:48
shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:505
shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition: libmwaw_internal.hxx:495
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:785
shared_ptr< MWAWSpreadsheetListener > MWAWSpreadsheetListenerPtr
a smart pointer of MWAWSpreadsheetListener
Definition: libmwaw_internal.hxx:515
Internal: the structures of a MWAWChart.
Definition: MWAWChart.cxx:58
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition: libmwaw_internal.cxx:51
@ RightBit
Definition: libmwaw_internal.hxx:168
a axis in a chart
Definition: MWAWChart.hxx:62
MWAWGraphicStyle m_style
the graphic style
Definition: MWAWChart.hxx:84
Axis()
constructor
Definition: MWAWChart.cxx:330
MWAWBox2i m_labelRange
the label range if defined
Definition: MWAWChart.hxx:82
~Axis()
destructor
Definition: MWAWChart.cxx:336
Type
the axis content
Definition: MWAWChart.hxx:64
@ A_Sequence_Skip_Empty
Definition: MWAWChart.hxx:64
@ A_Sequence
Definition: MWAWChart.hxx:64
@ A_Logarithmic
Definition: MWAWChart.hxx:64
@ A_None
Definition: MWAWChart.hxx:64
@ A_Numeric
Definition: MWAWChart.hxx:64
Type m_type
the sequence type
Definition: MWAWChart.hxx:76
void addStyleTo(librevenge::RVNGPropertyList &propList) const
add style to the propList
Definition: MWAWChart.cxx:368
bool m_showGrid
show or not the grid
Definition: MWAWChart.hxx:78
friend std::ostream & operator<<(std::ostream &o, Axis const &axis)
operator<<
Definition: MWAWChart.cxx:378
void addContentTo(std::string const &sheetName, int coord, librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition: MWAWChart.cxx:340
bool m_showLabel
show or not the label
Definition: MWAWChart.hxx:80
a legend in a chart
Definition: MWAWChart.hxx:87
bool m_autoPosition
automatic position
Definition: MWAWChart.hxx:101
Legend()
constructor
Definition: MWAWChart.hxx:89
MWAWGraphicStyle m_style
the graphic style
Definition: MWAWChart.hxx:109
int m_relativePosition
the automatic position libmwaw::LeftBit|...
Definition: MWAWChart.hxx:103
MWAWVec2f m_position
the position in points
Definition: MWAWChart.hxx:105
friend std::ostream & operator<<(std::ostream &o, Legend const &legend)
operator<<
Definition: MWAWChart.cxx:441
bool m_show
show or not the legend
Definition: MWAWChart.hxx:99
MWAWFont m_font
the font
Definition: MWAWChart.hxx:107
void addContentTo(librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition: MWAWChart.cxx:414
void addStyleTo(librevenge::RVNGPropertyList &propList, shared_ptr< MWAWFontConverter > fontConverter) const
add style to the propList
Definition: MWAWChart.cxx:434
a series in a chart
Definition: MWAWChart.hxx:112
Series()
constructor
Definition: MWAWChart.cxx:470
void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition: MWAWChart.cxx:505
Type m_type
the type
Definition: MWAWChart.hxx:128
MWAWBox2i m_range
the data range
Definition: MWAWChart.hxx:130
virtual ~Series()
destructor
Definition: MWAWChart.cxx:476
Type
the series type
Definition: MWAWChart.hxx:114
@ S_Stock
Definition: MWAWChart.hxx:114
@ S_Area
Definition: MWAWChart.hxx:114
@ S_Bar
Definition: MWAWChart.hxx:114
@ S_Column
Definition: MWAWChart.hxx:114
@ S_Line
Definition: MWAWChart.hxx:114
@ S_Scatter
Definition: MWAWChart.hxx:114
@ S_Pie
Definition: MWAWChart.hxx:114
static std::string getSeriesTypeName(Type type)
returns a string corresponding to a series type
Definition: MWAWChart.cxx:480
friend std::ostream & operator<<(std::ostream &o, Series const &series)
operator<<
Definition: MWAWChart.cxx:531
void addStyleTo(librevenge::RVNGPropertyList &propList) const
add style to the propList
Definition: MWAWChart.cxx:526
MWAWGraphicStyle m_style
the graphic style
Definition: MWAWChart.hxx:132
a text zone a chart
Definition: MWAWChart.hxx:135
Type m_type
the zone type
Definition: MWAWChart.hxx:152
MWAWVec2i m_cell
the cell position ( for title and subtitle )
Definition: MWAWChart.hxx:158
~TextZone()
destructor
Definition: MWAWChart.cxx:577
MWAWGraphicStyle m_style
the graphic style
Definition: MWAWChart.hxx:164
Type
the text type
Definition: MWAWChart.hxx:137
@ T_Title
Definition: MWAWChart.hxx:137
@ T_AxisX
Definition: MWAWChart.hxx:137
@ T_SubTitle
Definition: MWAWChart.hxx:137
@ T_AxisY
Definition: MWAWChart.hxx:137
@ T_AxisZ
Definition: MWAWChart.hxx:137
MWAWEntry m_textEntry
the text entry
Definition: MWAWChart.hxx:160
void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition: MWAWChart.cxx:581
ContentType m_contentType
the content type
Definition: MWAWChart.hxx:154
TextZone()
constructor
Definition: MWAWChart.cxx:570
MWAWFont m_font
the zone format
Definition: MWAWChart.hxx:162
ContentType
the text content type
Definition: MWAWChart.hxx:139
@ C_Cell
Definition: MWAWChart.hxx:139
@ C_Text
Definition: MWAWChart.hxx:139
friend std::ostream & operator<<(std::ostream &o, TextZone const &zone)
operator<<
Definition: MWAWChart.cxx:622
void addStyleTo(librevenge::RVNGPropertyList &propList, shared_ptr< MWAWFontConverter > fontConverter) const
add to the propList
Definition: MWAWChart.cxx:616
MWAWVec2f m_position
the position in the zone
Definition: MWAWChart.hxx:156

Generated on Wed Jan 19 2022 22:23:15 for libmwaw by doxygen 1.9.3