STOFFChart.hxx Source File documentation

STOFFChart.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/* libstaroffice
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 STOFF_CHART
40# define STOFF_CHART
41
42#include <iostream>
43#include <vector>
44#include <map>
45
46#include "libstaroffice_internal.hxx"
47
48#include "STOFFEntry.hxx"
49#include "STOFFFont.hxx"
50
51namespace STOFFChartInternal
52{
53class SubDocument;
54}
56 class STOFFChart
57{
58 friend class STOFFChartInternal::SubDocument;
59public:
61 struct Axis {
63 enum Type { A_None, A_Numeric, A_Logarithmic, A_Sequence, A_Sequence_Skip_Empty };
65 Axis();
67 ~Axis();
69 void addContentTo(librevenge::RVNGString const &sheetName, int coord, librevenge::RVNGPropertyList &propList) const;
71 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
73 friend std::ostream &operator<<(std::ostream &o, Axis const &axis);
75 Type m_type;
77 bool m_showGrid;
79 bool m_showLabel;
81 STOFFBox2i m_labelRange;
82#if 0
84 STOFFGraphicStyle m_style;
85#endif
86 };
87
88 struct Legend {
90 Legend() : m_show(false), m_autoPosition(true), m_relativePosition(libstoff::RightBit), m_position(0,0), m_font()
91 {
92 }
93
94 void addContentTo(librevenge::RVNGPropertyList &propList) const;
96 void addStyleTo(librevenge::RVNGPropertyList &propList) 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 STOFFVec2f m_position;
108 STOFFFont m_font;
109#if 0
111 STOFFGraphicStyle m_style;
112#endif
113 };
114
115 struct Series {
117 enum Type { S_Area, S_Bar, S_Column, S_Line, S_Pie, S_Scatter, S_Stock };
119 Series();
121 virtual ~Series();
123 void addContentTo(librevenge::RVNGString const &sheetName, librevenge::RVNGPropertyList &propList) const;
125 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
127 static librevenge::RVNGString getSeriesTypeName(Type type);
129 friend std::ostream &operator<<(std::ostream &o, Series const &series);
131 Type m_type;
133 STOFFBox2i m_range;
134#if 0
136 STOFFGraphicStyle m_style;
137#endif
138 };
139
140 struct TextZone {
142 enum Type { T_Title, T_SubTitle, T_AxisX, T_AxisY, T_AxisZ };
144 enum ContentType { C_Cell, C_Text };
145
147 TextZone();
149 ~TextZone();
151 void addContentTo(librevenge::RVNGString const &sheetName, librevenge::RVNGPropertyList &propList) const;
153 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
155 friend std::ostream &operator<<(std::ostream &o, TextZone const &zone);
157 Type m_type;
159 ContentType m_contentType;
161 STOFFVec2f m_position;
163 STOFFVec2i m_cell;
165 STOFFEntry m_textEntry;
167 STOFFFont m_font;
168#if 0
170 STOFFGraphicStyle m_style;
171#endif
172 };
173
175 STOFFChart(librevenge::RVNGString const &sheetName, STOFFVec2f const &dim=STOFFVec2f());
177 virtual ~STOFFChart();
179 void sendChart(STOFFSpreadsheetListenerPtr &listener, librevenge::RVNGSpreadsheetInterface *interface);
181 virtual void sendContent(TextZone const &zone, STOFFListenerPtr &listener)=0;
182
184 void setDataType(Series::Type type, bool dataStacked)
185 {
186 m_type=type;
187 m_dataStacked=dataStacked;
188 }
189
191 STOFFVec2f const &getDimension() const
192 {
193 return m_dim;
194 }
195
196 void setDimension(STOFFVec2f const &dim)
197 {
198 m_dim=dim;
199 }
200
201 void add(int coord, Axis const &axis);
203 Axis const &getAxis(int coord) const;
204
206 void set(Legend const &legend)
207 {
208 m_legend=legend;
209 }
210
211 Legend const &getLegend() const
212 {
213 return m_legend;
214 }
215
217 void add(Series const &series);
219 std::vector<Series> const &getSeries() const
220 {
221 return m_seriesList;
222 }
223
225 void add(TextZone const &textZone);
227 bool getTextZone(TextZone::Type type, TextZone &textZone);
228
229protected:
231 void sendTextZoneContent(TextZone::Type type, STOFFListenerPtr &listener);
232
233protected:
235 librevenge::RVNGString m_sheetName;
237 STOFFVec2f m_dim;
239 Series::Type m_type;
241 bool m_dataStacked;
243 Axis m_axis[4];
245 Legend m_legend;
247 std::vector<Series> m_seriesList;
249 std::map<TextZone::Type, TextZone> m_textZoneMap;
250private:
251 STOFFChart(STOFFChart const &orig);
252 STOFFChart &operator=(STOFFChart const &orig);
253};
254
255#endif
256// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
STOFFEntry.hxx
STOFFFont.hxx
STOFFChartInternal::SubDocument
Internal: the subdocument of a STOFFChart.
Definition STOFFChart.cxx:61
STOFFChart::getTextZone
bool getTextZone(TextZone::Type type, TextZone &textZone)
returns a textzone content(if set)
Definition STOFFChart.cxx:150
STOFFChart::m_dataStacked
bool m_dataStacked
a flag to know if the data are stacked or not
Definition STOFFChart.hxx:241
STOFFChart::m_dim
STOFFVec2f m_dim
the chart dimension in point
Definition STOFFChart.hxx:237
STOFFChart::m_textZoneMap
std::map< TextZone::Type, TextZone > m_textZoneMap
a map text zone type to text zone
Definition STOFFChart.hxx:249
STOFFChart::m_seriesList
std::vector< Series > m_seriesList
the list of series
Definition STOFFChart.hxx:247
STOFFChart::~STOFFChart
virtual ~STOFFChart()
the destructor
Definition STOFFChart.cxx:123
STOFFChart::sendContent
virtual void sendContent(TextZone const &zone, STOFFListenerPtr &listener)=0
send the zone content (called when the zone is of text type)
STOFFChart::m_type
Series::Type m_type
the chart type (if no series)
Definition STOFFChart.hxx:239
STOFFChart::m_axis
Axis m_axis[4]
the x,y,z axis and a bad axis
Definition STOFFChart.hxx:243
STOFFChart::sendChart
void sendChart(STOFFSpreadsheetListenerPtr &listener, librevenge::RVNGSpreadsheetInterface *interface)
send the chart to the listener
Definition STOFFChart.cxx:172
STOFFChart::m_legend
Legend m_legend
the legend
Definition STOFFChart.hxx:245
STOFFChart::getLegend
Legend const & getLegend() const
return the legend
Definition STOFFChart.hxx:211
STOFFChart::setDimension
void setDimension(STOFFVec2f const &dim)
return the chart dimension
Definition STOFFChart.hxx:196
STOFFChart::sendTextZoneContent
void sendTextZoneContent(TextZone::Type type, STOFFListenerPtr &listener)
sends a textzone content
Definition STOFFChart.cxx:158
STOFFChart::getAxis
Axis const & getAxis(int coord) const
return an axis (corresponding to a coord)
Definition STOFFChart.cxx:136
STOFFChart::operator=
STOFFChart & operator=(STOFFChart const &orig)
STOFFChart::add
void add(int coord, Axis const &axis)
adds an axis (corresponding to a coord)
Definition STOFFChart.cxx:127
STOFFChart::setDataType
void setDataType(Series::Type type, bool dataStacked)
sets the chart type
Definition STOFFChart.hxx:184
STOFFChart::getSeries
std::vector< Series > const & getSeries() const
return the list of series
Definition STOFFChart.hxx:219
STOFFChart::getDimension
STOFFVec2f const & getDimension() const
return the chart dimension
Definition STOFFChart.hxx:191
STOFFChart::m_sheetName
librevenge::RVNGString m_sheetName
the sheet name
Definition STOFFChart.hxx:235
STOFFChart::STOFFChart
STOFFChart(librevenge::RVNGString const &sheetName, STOFFVec2f const &dim=STOFFVec2f())
the constructor
Definition STOFFChart.cxx:117
STOFFChart::set
void set(Legend const &legend)
set the legend
Definition STOFFChart.hxx:206
STOFFChart::STOFFChart
STOFFChart(STOFFChart const &orig)
STOFFEntry
basic class to store an entry in a file This contained :
Definition STOFFEntry.hxx:47
STOFFFont
Class to store font.
Definition STOFFFont.hxx:44
STOFFGraphicStyle
Class to store a graphic style.
Definition STOFFGraphicStyle.hxx:45
libstaroffice_internal.hxx
STOFFBox2i
STOFFBox2< int > STOFFBox2i
STOFFBox2 of int.
Definition libstaroffice_internal.hxx:1114
STOFFVec2i
STOFFVec2< int > STOFFVec2i
STOFFVec2 of int.
Definition libstaroffice_internal.hxx:748
STOFFListenerPtr
shared_ptr< STOFFListener > STOFFListenerPtr
a smart pointer of STOFFListener
Definition libstaroffice_internal.hxx:476
STOFFVec2f
STOFFVec2< float > STOFFVec2f
STOFFVec2 of float.
Definition libstaroffice_internal.hxx:752
STOFFSpreadsheetListenerPtr
shared_ptr< STOFFSpreadsheetListener > STOFFSpreadsheetListenerPtr
a smart pointer of STOFFSpreadsheetListener
Definition libstaroffice_internal.hxx:482
STOFFChartInternal
Internal: the structures of a STOFFChart.
Definition STOFFChart.cxx:57
libstoff
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition libstaroffice_internal.cxx:51
STOFFChart::Axis
a axis in a chart
Definition STOFFChart.hxx:61
STOFFChart::Axis::m_type
Type m_type
the sequence type
Definition STOFFChart.hxx:75
STOFFChart::Axis::Axis
Axis()
constructor
Definition STOFFChart.cxx:329
STOFFChart::Axis::addStyleTo
void addStyleTo(librevenge::RVNGPropertyList &propList) const
add style to the propList
Definition STOFFChart.cxx:366
STOFFChart::Axis::m_labelRange
STOFFBox2i m_labelRange
the label range if defined
Definition STOFFChart.hxx:81
STOFFChart::Axis::~Axis
~Axis()
destructor
Definition STOFFChart.cxx:334
STOFFChart::Axis::Type
Type
the axis content
Definition STOFFChart.hxx:63
STOFFChart::Axis::A_None
@ A_None
Definition STOFFChart.hxx:63
STOFFChart::Axis::A_Numeric
@ A_Numeric
Definition STOFFChart.hxx:63
STOFFChart::Axis::A_Sequence_Skip_Empty
@ A_Sequence_Skip_Empty
Definition STOFFChart.hxx:63
STOFFChart::Axis::A_Sequence
@ A_Sequence
Definition STOFFChart.hxx:63
STOFFChart::Axis::A_Logarithmic
@ A_Logarithmic
Definition STOFFChart.hxx:63
STOFFChart::Axis::addContentTo
void addContentTo(librevenge::RVNGString const &sheetName, int coord, librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition STOFFChart.cxx:338
STOFFChart::Axis::m_showGrid
bool m_showGrid
show or not the grid
Definition STOFFChart.hxx:77
STOFFChart::Axis::operator<<
friend std::ostream & operator<<(std::ostream &o, Axis const &axis)
operator<<
Definition STOFFChart.cxx:375
STOFFChart::Axis::m_showLabel
bool m_showLabel
show or not the label
Definition STOFFChart.hxx:79
STOFFChart::Legend
a legend in a chart
Definition STOFFChart.hxx:88
STOFFChart::Legend::m_relativePosition
int m_relativePosition
the automatic position libstoff::LeftBit|...
Definition STOFFChart.hxx:104
STOFFChart::Legend::Legend
Legend()
constructor
Definition STOFFChart.hxx:90
STOFFChart::Legend::m_show
bool m_show
show or not the legend
Definition STOFFChart.hxx:100
STOFFChart::Legend::operator<<
friend std::ostream & operator<<(std::ostream &o, Legend const &legend)
operator<<
Definition STOFFChart.cxx:434
STOFFChart::Legend::m_position
STOFFVec2f m_position
the position in points
Definition STOFFChart.hxx:106
STOFFChart::Legend::m_font
STOFFFont m_font
the font
Definition STOFFChart.hxx:108
STOFFChart::Legend::addContentTo
void addContentTo(librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition STOFFChart.cxx:408
STOFFChart::Legend::addStyleTo
void addStyleTo(librevenge::RVNGPropertyList &propList) const
add style to the propList
Definition STOFFChart.cxx:428
STOFFChart::Legend::m_autoPosition
bool m_autoPosition
automatic position
Definition STOFFChart.hxx:102
STOFFChart::Series
a series in a chart
Definition STOFFChart.hxx:115
STOFFChart::Series::m_range
STOFFBox2i m_range
the data range
Definition STOFFChart.hxx:133
STOFFChart::Series::Series
Series()
constructor
Definition STOFFChart.cxx:462
STOFFChart::Series::Type
Type
the series type
Definition STOFFChart.hxx:117
STOFFChart::Series::S_Scatter
@ S_Scatter
Definition STOFFChart.hxx:117
STOFFChart::Series::S_Pie
@ S_Pie
Definition STOFFChart.hxx:117
STOFFChart::Series::S_Line
@ S_Line
Definition STOFFChart.hxx:117
STOFFChart::Series::S_Column
@ S_Column
Definition STOFFChart.hxx:117
STOFFChart::Series::S_Bar
@ S_Bar
Definition STOFFChart.hxx:117
STOFFChart::Series::S_Stock
@ S_Stock
Definition STOFFChart.hxx:117
STOFFChart::Series::S_Area
@ S_Area
Definition STOFFChart.hxx:117
STOFFChart::Series::addContentTo
void addContentTo(librevenge::RVNGString const &sheetName, librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition STOFFChart.cxx:493
STOFFChart::Series::getSeriesTypeName
static librevenge::RVNGString getSeriesTypeName(Type type)
returns a string corresponding to a series type
Definition STOFFChart.cxx:470
STOFFChart::Series::~Series
virtual ~Series()
destructor
Definition STOFFChart.cxx:466
STOFFChart::Series::m_type
Type m_type
the type
Definition STOFFChart.hxx:131
STOFFChart::Series::operator<<
friend std::ostream & operator<<(std::ostream &o, Series const &series)
operator<<
Definition STOFFChart.cxx:518
STOFFChart::Series::addStyleTo
void addStyleTo(librevenge::RVNGPropertyList &propList) const
add style to the propList
Definition STOFFChart.cxx:514
STOFFChart::TextZone
a text zone a chart
Definition STOFFChart.hxx:140
STOFFChart::TextZone::operator<<
friend std::ostream & operator<<(std::ostream &o, TextZone const &zone)
operator<<
Definition STOFFChart.cxx:602
STOFFChart::TextZone::ContentType
ContentType
the text content type
Definition STOFFChart.hxx:144
STOFFChart::TextZone::C_Cell
@ C_Cell
Definition STOFFChart.hxx:144
STOFFChart::TextZone::C_Text
@ C_Text
Definition STOFFChart.hxx:144
STOFFChart::TextZone::addStyleTo
void addStyleTo(librevenge::RVNGPropertyList &propList) const
add to the propList
Definition STOFFChart.cxx:597
STOFFChart::TextZone::m_contentType
ContentType m_contentType
the content type
Definition STOFFChart.hxx:159
STOFFChart::TextZone::m_textEntry
STOFFEntry m_textEntry
the text entry
Definition STOFFChart.hxx:165
STOFFChart::TextZone::TextZone
TextZone()
constructor
Definition STOFFChart.cxx:554
STOFFChart::TextZone::m_position
STOFFVec2f m_position
the position in the zone
Definition STOFFChart.hxx:161
STOFFChart::TextZone::m_font
STOFFFont m_font
the zone format
Definition STOFFChart.hxx:167
STOFFChart::TextZone::~TextZone
~TextZone()
destructor
Definition STOFFChart.cxx:560
STOFFChart::TextZone::m_type
Type m_type
the zone type
Definition STOFFChart.hxx:157
STOFFChart::TextZone::m_cell
STOFFVec2i m_cell
the cell position ( for title and subtitle )
Definition STOFFChart.hxx:163
STOFFChart::TextZone::Type
Type
the text type
Definition STOFFChart.hxx:142
STOFFChart::TextZone::T_SubTitle
@ T_SubTitle
Definition STOFFChart.hxx:142
STOFFChart::TextZone::T_AxisZ
@ T_AxisZ
Definition STOFFChart.hxx:142
STOFFChart::TextZone::T_AxisX
@ T_AxisX
Definition STOFFChart.hxx:142
STOFFChart::TextZone::T_Title
@ T_Title
Definition STOFFChart.hxx:142
STOFFChart::TextZone::T_AxisY
@ T_AxisY
Definition STOFFChart.hxx:142
STOFFChart::TextZone::addContentTo
void addContentTo(librevenge::RVNGString const &sheetName, librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition STOFFChart.cxx:564