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 STOFF_CHART
00040 # define STOFF_CHART
00041
00042 #include <iostream>
00043 #include <vector>
00044 #include <map>
00045
00046 #include "libstaroffice_internal.hxx"
00047
00048 #include "STOFFEntry.hxx"
00049 #include "STOFFFont.hxx"
00050
00051 namespace STOFFChartInternal
00052 {
00053 class SubDocument;
00054 }
00056 class STOFFChart
00057 {
00058 friend class STOFFChartInternal::SubDocument;
00059 public:
00061 struct Axis {
00063 enum Type { A_None, A_Numeric, A_Logarithmic, A_Sequence, A_Sequence_Skip_Empty };
00065 Axis();
00067 ~Axis();
00069 void addContentTo(librevenge::RVNGString const &sheetName, int coord, librevenge::RVNGPropertyList &propList) const;
00071 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
00073 friend std::ostream &operator<<(std::ostream &o, Axis const &axis);
00075 Type m_type;
00077 bool m_showGrid;
00079 bool m_showLabel;
00081 STOFFBox2i m_labelRange;
00082 #if 0
00083
00084 STOFFGraphicStyle m_style;
00085 #endif
00086 };
00088 struct Legend {
00090 Legend() : m_show(false), m_autoPosition(true), m_relativePosition(libstoff::RightBit), m_position(0,0), m_font()
00091 {
00092 }
00094 void addContentTo(librevenge::RVNGPropertyList &propList) const;
00096 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
00098 friend std::ostream &operator<<(std::ostream &o, Legend const &legend);
00100 bool m_show;
00102 bool m_autoPosition;
00104 int m_relativePosition;
00106 STOFFVec2f m_position;
00108 STOFFFont m_font;
00109 #if 0
00110
00111 STOFFGraphicStyle m_style;
00112 #endif
00113 };
00115 struct Series {
00117 enum Type { S_Area, S_Bar, S_Column, S_Line, S_Pie, S_Scatter, S_Stock };
00119 Series();
00121 virtual ~Series();
00123 void addContentTo(librevenge::RVNGString const &sheetName, librevenge::RVNGPropertyList &propList) const;
00125 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
00127 static librevenge::RVNGString getSeriesTypeName(Type type);
00129 friend std::ostream &operator<<(std::ostream &o, Series const &series);
00131 Type m_type;
00133 STOFFBox2i m_range;
00134 #if 0
00135
00136 STOFFGraphicStyle m_style;
00137 #endif
00138 };
00140 struct TextZone {
00142 enum Type { T_Title, T_SubTitle, T_AxisX, T_AxisY, T_AxisZ };
00144 enum ContentType { C_Cell, C_Text };
00145
00147 TextZone();
00149 ~TextZone();
00151 void addContentTo(librevenge::RVNGString const &sheetName, librevenge::RVNGPropertyList &propList) const;
00153 void addStyleTo(librevenge::RVNGPropertyList &propList) const;
00155 friend std::ostream &operator<<(std::ostream &o, TextZone const &zone);
00157 Type m_type;
00159 ContentType m_contentType;
00161 STOFFVec2f m_position;
00163 STOFFVec2i m_cell;
00165 STOFFEntry m_textEntry;
00167 STOFFFont m_font;
00168 #if 0
00169
00170 STOFFGraphicStyle m_style;
00171 #endif
00172 };
00173
00175 STOFFChart(librevenge::RVNGString const &sheetName, STOFFVec2f const &dim=STOFFVec2f());
00177 virtual ~STOFFChart();
00179 void sendChart(STOFFSpreadsheetListenerPtr &listener, librevenge::RVNGSpreadsheetInterface *interface);
00181 virtual void sendContent(TextZone const &zone, STOFFListenerPtr &listener)=0;
00182
00184 void setDataType(Series::Type type, bool dataStacked)
00185 {
00186 m_type=type;
00187 m_dataStacked=dataStacked;
00188 }
00189
00191 STOFFVec2f const &getDimension() const
00192 {
00193 return m_dim;
00194 }
00196 void setDimension(STOFFVec2f const &dim)
00197 {
00198 m_dim=dim;
00199 }
00201 void add(int coord, Axis const &axis);
00203 Axis const &getAxis(int coord) const;
00204
00206 void set(Legend const &legend)
00207 {
00208 m_legend=legend;
00209 }
00211 Legend const &getLegend() const
00212 {
00213 return m_legend;
00214 }
00215
00217 void add(Series const &series);
00219 std::vector<Series> const &getSeries() const
00220 {
00221 return m_seriesList;
00222 }
00223
00225 void add(TextZone const &textZone);
00227 bool getTextZone(TextZone::Type type, TextZone &textZone);
00228
00229 protected:
00231 void sendTextZoneContent(TextZone::Type type, STOFFListenerPtr &listener);
00232
00233 protected:
00235 librevenge::RVNGString m_sheetName;
00237 STOFFVec2f m_dim;
00239 Series::Type m_type;
00241 bool m_dataStacked;
00243 Axis m_axis[4];
00245 Legend m_legend;
00247 std::vector<Series> m_seriesList;
00249 std::map<TextZone::Type, TextZone> m_textZoneMap;
00250 private:
00251 STOFFChart(STOFFChart const &orig);
00252 STOFFChart &operator=(STOFFChart const &orig);
00253 };
00254
00255 #endif
00256