xlsxchart.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // xlsxchart.h
  2. #ifndef QXLSX_CHART_H
  3. #define QXLSX_CHART_H
  4. #include <QtGlobal>
  5. #include <QSharedPointer>
  6. #include <QXmlStreamReader>
  7. #include <QXmlStreamWriter>
  8. #include "xlsxabstractooxmlfile.h"
  9. QT_BEGIN_NAMESPACE_XLSX
  10. class AbstractSheet;
  11. class Worksheet;
  12. class ChartPrivate;
  13. class CellRange;
  14. class DrawingAnchor;
  15. class Chart : public AbstractOOXmlFile
  16. {
  17. Q_DECLARE_PRIVATE(Chart)
  18. public:
  19. enum ChartType { // 16 type of chart (ECMA 376)
  20. CT_NoStatementChart = 0, // Zero is internally used for unknown types
  21. CT_AreaChart, CT_Area3DChart, CT_LineChart,
  22. CT_Line3DChart, CT_StockChart, CT_RadarChart,
  23. CT_ScatterChart, CT_PieChart, CT_Pie3DChart,
  24. CT_DoughnutChart, CT_BarChart, CT_Bar3DChart,
  25. CT_OfPieChart, CT_SurfaceChart, CT_Surface3DChart,
  26. CT_BubbleChart,
  27. };
  28. enum ChartAxisPos { None = (-1), Left = 0, Right, Top, Bottom };
  29. private:
  30. friend class AbstractSheet;
  31. friend class Worksheet;
  32. friend class Chartsheet;
  33. friend class DrawingAnchor;
  34. private:
  35. Chart(AbstractSheet *parent, CreateFlag flag);
  36. public:
  37. ~Chart();
  38. public:
  39. void addSeries(const CellRange &range, AbstractSheet *sheet = NULL, bool headerH = false, bool headerV = false, bool swapHeaders = false);
  40. void setChartType(ChartType type);
  41. void setChartStyle(int id);
  42. void setAxisTitle(Chart::ChartAxisPos pos, QString axisTitle);
  43. void setChartTitle(QString strchartTitle);
  44. void setChartLegend(Chart::ChartAxisPos legendPos, bool overlap = false);
  45. void setGridlinesEnable(bool majorGridlinesEnable = false, bool minorGridlinesEnable = false);
  46. public:
  47. bool loadFromXmlFile(QIODevice *device);
  48. void saveToXmlFile(QIODevice *device) const;
  49. };
  50. QT_END_NAMESPACE_XLSX
  51. #endif // QXLSX_CHART_H