Warning, file /office/calligra/filters/libodf2/chart/KoOdfChartWriter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * SPDX-FileCopyrightText: 2010 Sebastian Sauer <sebsauer@kdab.com> 0003 * SPDX-FileCopyrightText: 2010 Carlos Licea <carlos@kdab.com> 0004 * SPDX-FileCopyrightText: 2014-2015 Inge Wallin <inge@lysator.liu.se> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.1-or-later 0007 */ 0008 0009 #ifndef KOODFCHARTWRITER_H 0010 #define KOODFCHARTWRITER_H 0011 0012 #include <Charting.h> 0013 0014 #include "koodf2_export.h" 0015 0016 class KoStore; 0017 class KoXmlWriter; 0018 class KoGenStyles; 0019 class KoGenStyle; 0020 0021 0022 class KOODF2_EXPORT KoOdfChartWriter 0023 { 0024 public: 0025 explicit KoOdfChartWriter(KoChart::Chart* chart); 0026 virtual ~KoOdfChartWriter(); 0027 0028 KoChart::Chart* chart() const { return m_chart; } 0029 0030 void setSheetReplacement(bool val); 0031 0032 void set2003ColorPalette(QList< QColor > palette); 0033 QString markerType(KoChart::MarkerType type, int currentSeriesNumber); 0034 0035 bool m_drawLayer; 0036 QString m_href; 0037 QString m_cellRangeAddress; 0038 QString m_endCellAddress; 0039 QString m_notifyOnUpdateOfRanges; 0040 #if 0 0041 /// anchored to sheet 0042 QString m_sheetName; 0043 /// anchored to cell 0044 //unsigned long m_colL, m_rwT; 0045 #endif 0046 qreal m_x, m_y, m_width, m_height; //in pt 0047 qreal m_end_x, m_end_y; //in pt 0048 0049 // Saving of content 0050 bool saveIndex(KoXmlWriter* xmlWriter); 0051 virtual bool saveContent(KoStore* store, KoXmlWriter* manifestWriter); 0052 virtual bool saveSeries(KoGenStyles &styles, KoGenStyles &mainStyles, KoXmlWriter* bodyWriter, 0053 int maxExplode); 0054 0055 // helper functions 0056 qreal calculateFade(int index, int maxIndex); 0057 QColor shadeColor(const QColor& col, qreal factor); 0058 0059 protected: 0060 KoChart::Chart* m_chart; 0061 0062 QString normalizeCellRange(QString range); 0063 QString toPtString(int number); 0064 enum Orientation { 0065 vertical, 0066 horizontal 0067 }; 0068 float sprcToPt(int sprc, Orientation orientation); 0069 QColor tintColor(const QColor & color, qreal tintfactor); 0070 QString replaceSheet(const QString &originalString, const QString &replacementSheet); 0071 bool sheetReplacement; 0072 0073 // Style generation 0074 QString genChartAreaStyle(KoGenStyles& styles, KoGenStyles& mainStyles); 0075 virtual QString genChartAreaStyle(KoGenStyle& style, KoGenStyles& styles, 0076 KoGenStyles& mainStyles); 0077 QString genPlotAreaStyle(KoGenStyles& styles, KoGenStyles& mainStyles); 0078 virtual QString genPlotAreaStyle(KoGenStyle& style, KoGenStyles& styles, 0079 KoGenStyles& mainStyles); 0080 void addShapePropertyStyle(/*const*/ KoChart::Series* series, 0081 KoGenStyle& style, KoGenStyles& mainStyles); 0082 virtual void addDataThemeToStyle(KoGenStyle& style, 0083 int dataNumber, int maxNumData = 1, bool strokes = true); 0084 0085 QString generateGradientStyle(KoGenStyles& mainStyles, const KoChart::Gradient* grad); 0086 0087 // Color functions 0088 virtual QColor calculateColorFromGradientStop(const KoChart::Gradient::GradientStop& grad); 0089 virtual QColor labelFontColor() const; 0090 void writeInternalTable(KoXmlWriter* bodyWriter); 0091 0092 // MS Office related stuff 0093 QList<QColor> m_palette; 0094 // tells if a 2003 color palette has been set 0095 bool paletteIsSet; 0096 }; 0097 0098 #endif // KOODFCHARTWRITER_H