- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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
51 namespace STOFFChartInternal
52 {
53 class SubDocument;
54 }
56 class STOFFChart
57 {
58 friend class STOFFChartInternal::SubDocument;
59 public:
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
83 STOFFGraphicStyle m_style;
85 #endif
86 };
88 struct Legend {
90 Legend() : m_show(false), m_autoPosition(true), m_relativePosition(libstoff::RightBit), m_position(0,0), m_font()
91 {
92 }
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
110 STOFFGraphicStyle m_style;
112 #endif
113 };
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
135 STOFFGraphicStyle m_style;
137 #endif
138 };
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
169 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 }
196 void setDimension(STOFFVec2f const &dim)
197 {
198 m_dim=dim;
199 }
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 }
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
229 protected:
231 void sendTextZoneContent(TextZone::Type type, STOFFListenerPtr &listener);
232
233 protected:
235 librevenge::RVNGString m_sheetName;
237 STOFFVec2f m_dim;
239 Series::Type m_type;
241 bool m_dataStacked;
243 Axis m_axis[3];
245 Legend m_legend;
247 std::vector<Series> m_seriesList;
249 std::map<TextZone::Type, TextZone> m_textZoneMap;
250 private:
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:
STOFFChart::m_seriesList
std::vector< Series > m_seriesList
the list of series
Definition: STOFFChart.hxx:247
STOFFChart::Legend::m_position
STOFFVec2f m_position
the position in points
Definition: STOFFChart.hxx:106
STOFFChart::setDimension
void setDimension(STOFFVec2f const &dim)
return the chart dimension
Definition: STOFFChart.hxx:196
STOFFChart::TextZone::m_contentType
ContentType m_contentType
the content type
Definition: STOFFChart.hxx:159
STOFFFont.hxx
STOFFChart::getSeries
std::vector< Series > const & getSeries() const
return the list of series
Definition: STOFFChart.hxx:219
STOFFChart::Axis::m_type
Type m_type
the sequence type
Definition: STOFFChart.hxx:75
STOFFChart::m_legend
Legend m_legend
the legend
Definition: STOFFChart.hxx:245
libstoff::RightBit
Definition: libstaroffice_internal.hxx:170
STOFFChart::getLegend
Legend const & getLegend() const
return the legend
Definition: STOFFChart.hxx:211
STOFFChart::TextZone
a text zone a chart
Definition: STOFFChart.hxx:140
STOFFChart::Legend::m_font
STOFFFont m_font
the font
Definition: STOFFChart.hxx:108
STOFFBox2< int >
STOFFVec2< float >
STOFFChart::TextZone::m_cell
STOFFVec2i m_cell
the cell position ( for title and subtitle )
Definition: STOFFChart.hxx:163
STOFFSpreadsheetListenerPtr
shared_ptr< STOFFSpreadsheetListener > STOFFSpreadsheetListenerPtr
a smart pointer of STOFFSpreadsheetListener
Definition: libstaroffice_internal.hxx:490
STOFFChart::TextZone::ContentType
ContentType
the text content type
Definition: STOFFChart.hxx:144
STOFFChart::Axis
a axis in a chart
Definition: STOFFChart.hxx:61
STOFFChart::Legend
a legend in a chart
Definition: STOFFChart.hxx:88
STOFFChart::Series::m_type
Type m_type
the type
Definition: STOFFChart.hxx:131
operator<<
std::ostream & operator<<(std::ostream &o, STOFFColor const &c)
Definition: libstaroffice_internal.cxx:214
STOFFChart::Legend::Legend
Legend()
constructor
Definition: STOFFChart.hxx:90
STOFFListenerPtr
shared_ptr< STOFFListener > STOFFListenerPtr
a smart pointer of STOFFListener
Definition: libstaroffice_internal.hxx:484
STOFFChart::Axis::Type
Type
the axis content
Definition: STOFFChart.hxx:63
STOFFChart::Series::Type
Type
the series type
Definition: STOFFChart.hxx:117
STOFFChart::m_dataStacked
bool m_dataStacked
a flag to know if the data are stacked or not
Definition: STOFFChart.hxx:241
STOFFChart
a class used to store a chart associated to a spreadsheet ....
Definition: STOFFChart.hxx:56
STOFFEntry.hxx
STOFFChart::TextZone::m_textEntry
STOFFEntry m_textEntry
the text entry
Definition: STOFFChart.hxx:165
STOFFChart::TextZone::m_type
Type m_type
the zone type
Definition: STOFFChart.hxx:157
STOFFChartInternal::SubDocument
Internal: the subdocument of a STOFFChart.
Definition: STOFFChart.cxx:60
STOFFChart::m_dim
STOFFVec2f m_dim
the chart dimension in point
Definition: STOFFChart.hxx:237
STOFFChart::getDimension
STOFFVec2f const & getDimension() const
return the chart dimension
Definition: STOFFChart.hxx:191
libstoff
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition: libstaroffice_internal.cxx:50
STOFFChart::m_type
Series::Type m_type
the chart type (if no series)
Definition: STOFFChart.hxx:239
STOFFChart::TextZone::m_font
STOFFFont m_font
the zone format
Definition: STOFFChart.hxx:167
libstaroffice_internal.hxx
STOFFChart::Axis::m_showGrid
bool m_showGrid
show or not the grid
Definition: STOFFChart.hxx:77
STOFFChart::m_textZoneMap
std::map< TextZone::Type, TextZone > m_textZoneMap
a map text zone type to text zone
Definition: STOFFChart.hxx:249
STOFFChart::setDataType
void setDataType(Series::Type type, bool dataStacked)
sets the chart type
Definition: STOFFChart.hxx:184
STOFFFont
Class to store font.
Definition: STOFFFont.hxx:43
STOFFChart::Legend::m_show
bool m_show
show or not the legend
Definition: STOFFChart.hxx:100
STOFFChart::Legend::m_autoPosition
bool m_autoPosition
automatic position
Definition: STOFFChart.hxx:102
STOFFChart::m_sheetName
librevenge::RVNGString m_sheetName
the sheet name
Definition: STOFFChart.hxx:235
STOFFChart::Series
a series in a chart
Definition: STOFFChart.hxx:115
STOFFChart::TextZone::m_position
STOFFVec2f m_position
the position in the zone
Definition: STOFFChart.hxx:161
STOFFChart::Axis::m_labelRange
STOFFBox2i m_labelRange
the label range if defined
Definition: STOFFChart.hxx:81
STOFFEntry
basic class to store an entry in a file This contained :
Definition: STOFFEntry.hxx:46
STOFFVec2f
STOFFVec2< float > STOFFVec2f
STOFFVec2 of float.
Definition: libstaroffice_internal.hxx:758
STOFFChart::Legend::m_relativePosition
int m_relativePosition
the automatic position libstoff::LeftBit|...
Definition: STOFFChart.hxx:104
STOFFChart::TextZone::Type
Type
the text type
Definition: STOFFChart.hxx:142
STOFFGraphicStyle
Class to store a graphic style.
Definition: STOFFGraphicStyle.hxx:44
STOFFChartInternal
Internal: the structures of a STOFFChart.
Definition: STOFFChart.cxx:56
STOFFChart::Axis::m_showLabel
bool m_showLabel
show or not the label
Definition: STOFFChart.hxx:79
STOFFChart::Series::m_range
STOFFBox2i m_range
the data range
Definition: STOFFChart.hxx:133