Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef MWAW_CHART
00040 # define MWAW_CHART
00041
00042 #include <iostream>
00043 #include <vector>
00044 #include <map>
00045
00046 #include "libmwaw_internal.hxx"
00047
00048 #include "MWAWEntry.hxx"
00049 #include "MWAWFont.hxx"
00050 #include "MWAWGraphicStyle.hxx"
00051
00052 namespace MWAWChartInternal
00053 {
00054 class SubDocument;
00055 }
00057 class MWAWChart
00058 {
00059 friend class MWAWChartInternal::SubDocument;
00060 public:
00062 struct Axis {
00064 enum Type { A_None, A_Numeric, A_Logarithmic, A_Sequence, A_Sequence_Skip_Empty };
00066 Axis();
00068 ~Axis();
00070 void addContentTo(std::string const &sheetName, int coord, librevenge::RVNGPropertyList &propList) const;
00072 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
00074 friend std::ostream &operator<<(std::ostream &o, Axis const &axis);
00076 Type m_type;
00078 bool m_showGrid;
00080 bool m_showLabel;
00082 MWAWBox2i m_labelRange;
00084 MWAWGraphicStyle m_style;
00085 };
00087 struct Legend {
00089 Legend() : m_show(false), m_autoPosition(true), m_relativePosition(libmwaw::RightBit), m_position(0,0), m_font(), m_style()
00090 {
00091 }
00093 void addContentTo(librevenge::RVNGPropertyList &propList) const;
00095 void addStyleTo(librevenge::RVNGPropertyList &propList, shared_ptr<MWAWFontConverter> fontConverter) const;
00097 friend std::ostream &operator<<(std::ostream &o, Legend const &legend);
00099 bool m_show;
00101 bool m_autoPosition;
00103 int m_relativePosition;
00105 MWAWVec2f m_position;
00107 MWAWFont m_font;
00109 MWAWGraphicStyle m_style;
00110 };
00112 struct Series {
00114 enum Type { S_Area, S_Bar, S_Column, S_Line, S_Pie, S_Scatter, S_Stock };
00116 Series();
00118 virtual ~Series();
00120 void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const;
00122 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
00124 static std::string getSeriesTypeName(Type type);
00126 friend std::ostream &operator<<(std::ostream &o, Series const &series);
00128 Type m_type;
00130 MWAWBox2i m_range;
00132 MWAWGraphicStyle m_style;
00133 };
00135 struct TextZone {
00137 enum Type { T_Title, T_SubTitle, T_AxisX, T_AxisY, T_AxisZ };
00139 enum ContentType { C_Cell, C_Text };
00140
00142 TextZone();
00144 ~TextZone();
00146 void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const;
00148 void addStyleTo(librevenge::RVNGPropertyList &propList, shared_ptr<MWAWFontConverter> fontConverter) const;
00150 friend std::ostream &operator<<(std::ostream &o, TextZone const &zone);
00152 Type m_type;
00154 ContentType m_contentType;
00156 MWAWVec2f m_position;
00158 MWAWVec2i m_cell;
00160 MWAWEntry m_textEntry;
00162 MWAWFont m_font;
00164 MWAWGraphicStyle m_style;
00165 };
00166
00168 MWAWChart(std::string const &sheetName, MWAWFontConverterPtr fontConverter, MWAWVec2f const &dim=MWAWVec2f());
00170 virtual ~MWAWChart();
00172 void sendChart(MWAWSpreadsheetListenerPtr &listener, librevenge::RVNGSpreadsheetInterface *interface);
00174 virtual void sendContent(TextZone const &zone, MWAWListenerPtr &listener)=0;
00175
00177 void setDataType(Series::Type type, bool dataStacked)
00178 {
00179 m_type=type;
00180 m_dataStacked=dataStacked;
00181 }
00182
00184 MWAWVec2f const &getDimension() const
00185 {
00186 return m_dim;
00187 }
00189 void setDimension(MWAWVec2f const &dim)
00190 {
00191 m_dim=dim;
00192 }
00194 void add(int coord, Axis const &axis);
00196 Axis const &getAxis(int coord) const;
00197
00199 void set(Legend const &legend)
00200 {
00201 m_legend=legend;
00202 }
00204 Legend const &getLegend() const
00205 {
00206 return m_legend;
00207 }
00208
00210 void add(Series const &series);
00212 std::vector<Series> const &getSeries() const
00213 {
00214 return m_seriesList;
00215 }
00216
00218 void add(TextZone const &textZone);
00220 bool getTextZone(TextZone::Type type, TextZone &textZone);
00221
00222 protected:
00224 void sendTextZoneContent(TextZone::Type type, MWAWListenerPtr &listener);
00225
00226 protected:
00228 std::string m_sheetName;
00230 MWAWVec2f m_dim;
00232 Series::Type m_type;
00234 bool m_dataStacked;
00236 Axis m_axis[3];
00238 Legend m_legend;
00240 std::vector<Series> m_seriesList;
00242 std::map<TextZone::Type, TextZone> m_textZoneMap;
00244 MWAWFontConverterPtr m_fontConverter;
00245 private:
00246 MWAWChart(MWAWChart const &orig);
00247 MWAWChart &operator=(MWAWChart const &orig);
00248 };
00249
00250 #endif
00251