Eneboo - Documentación para desarrolladores
tools/aqods/AQOdsChart.h
Ir a la documentación de este archivo.
00001 /***************************************************************************
00002  AQOdsChart.h
00003  -------------------
00004  begin                : 13/12/2011
00005  copyright            : (C) 2003-2011 by InfoSiAL S.L.
00006  email                : mail@infosial.com
00007  ***************************************************************************/
00008 /***************************************************************************
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; version 2 of the License.               *
00012  ***************************************************************************/
00013 /***************************************************************************
00014  Este  programa es software libre. Puede redistribuirlo y/o modificarlo
00015  bajo  los  trminos  de  la  Licencia  Pblica General de GNU   en  su
00016  versin 2, publicada  por  la  Free  Software Foundation.
00017  ***************************************************************************/
00018 
00019 #ifndef AQODSCHART_H_
00020 #define AQODSCHART_H_
00021 
00022 #include "odf-gen/chart.h"
00023 
00024 #include "AQOdsCellAddress.h"
00025 #include "AQOdsColor.h"
00026 #include "AQOdsLength.h"
00027 
00028 class AQOdsSeries : public Series
00029 {
00030 public:
00031   AQOdsSeries(const AQOdsCellAddress &name,
00032               const AQOdsCellRange &domain,
00033               const AQOdsCellRange &values,
00034               const AQOdsColor &color)
00035     : Series(name, domain, values, color) {}
00036 };
00037 
00038 class AQOdsChart : public Chart
00039 {
00040 public:
00041   AQOdsChart(const QString &name,
00042              const AQOdsLength &width,
00043              const AQOdsLength &height)
00044     : Chart(name, width, height) {}
00045 
00046   void addRange(const AQOdsCellRange &range) {
00047     add_range(range);
00048   }
00049 
00050   void addSeries(const AQOdsSeries &series) {
00051     add_series(series);
00052   }
00053 
00054   void setTitle(const QString &title) {
00055     set_title(title);
00056   }
00057 
00058   void setSubtitle(const QString &subtitle) {
00059     set_subtitle(subtitle);
00060   }
00061 
00062   void setXAxisLabel(const QString &x_axis_label) {
00063     set_x_axis_label(x_axis_label);
00064   }
00065 
00066   void setYAxisLabel(const QString &y_axis_label) {
00067     set_y_axis_label(y_axis_label);
00068   }
00069 };
00070 
00071 MAP_ODS_TYPE(AQOdsChart, object);
00072 
00073 class AQOdsAutoChart : public AQOdsChart
00074 {
00075 public:
00076   AQOdsAutoChart(const QString &name,
00077                  const AQOdsLength &width,
00078                  const AQOdsLength &height,
00079                  const AQOdsSheet &sheet)
00080     : AQOdsChart(name, width, height) {
00081     ColorGenerator generator;
00082 
00083     add_range(CellRange(CellAddress(sheet.get_name(), 1, 1),
00084                         CellAddress(sheet.get_name(),
00085                                     sheet.get_columns(),
00086                                     sheet.get_rows())));
00087 
00088     for (unsigned int i = 2; i <= sheet.get_columns(); i++) {
00089       CellAddress name(sheet.get_name(), i, 1),
00090                   domain_start(sheet.get_name(), 1, 2),
00091                   domain_end(sheet.get_name(), 1, sheet.get_rows()),
00092                   values_start(sheet.get_name(), i, 2),
00093                   values_end(sheet.get_name(), i, sheet.get_rows());
00094       CellRange domain(domain_start, domain_end),
00095                 values(values_start, values_end);
00096       Color color(generator.next());
00097 
00098       add_series(Series(name, domain, values, color));
00099     }
00100   }
00101 };
00102 
00103 MAP_ODS_TYPE(AQOdsAutoChart, object);
00104 
00105 #endif /* AQODSCHART_H_ */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'