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

Generated on Sat Aug 13 2016 02:04:00 for libstaroffice by doxygen 1.8.11