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 
52 namespace MWAWChartInternal
53 {
54 class SubDocument;
55 }
57 class MWAWChart
58 {
60 public:
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);
78  bool m_showGrid;
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 
222 protected:
224  void sendTextZoneContent(TextZone::Type type, MWAWListenerPtr &listener);
225 
226 protected:
228  std::string m_sheetName;
240  std::vector<Series> m_seriesList;
242  std::map<TextZone::Type, TextZone> m_textZoneMap;
245 private:
246  explicit MWAWChart(MWAWChart const &orig);
247  MWAWChart &operator=(MWAWChart const &orig);
248 };
249 
250 #endif
251 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

Generated on Tue Mar 1 2016 23:42:50 for libmwaw by doxygen 1.8.4