kchart
kchart_params.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KCHART_PARAMS_H
00022 #define KCHART_PARAMS_H
00023
00024
00025 class KoXmlWriter;
00026 class KoGenStyles;
00027 class KoOasisLoadingContext;
00028 class KoStore;
00029 class KDChartParams;
00030 class DCOPObject;
00031
00032
00033 #include "kdchart/KDChartParams.h"
00034
00035
00036 namespace KChart
00037 {
00038
00039 class KChartPart;
00040
00041 class KChartParams : public KDChartParams
00042 {
00043 public:
00044 typedef enum {
00045
00046 NoType = KDChartParams::NoType,
00047 Bar = KDChartParams::Bar,
00048 Line = KDChartParams::Line,
00049 Area = KDChartParams::Area,
00050 Pie = KDChartParams::Pie,
00051 HiLo = KDChartParams::HiLo,
00052 Ring = KDChartParams::Ring,
00053 Polar = KDChartParams::Polar,
00054 BoxWhisker = KDChartParams::BoxWhisker
00055
00056 } ChartType;
00057
00058
00059 typedef enum {
00060 DataRows = 0,
00061 DataColumns = 1
00062 } DataDirection;
00063
00064
00065 KChartParams( KChartPart *_part );
00066 ~KChartParams();
00067
00068 KChartPart * part() const { return m_part; }
00069
00070
00071
00072 ChartType chartType() const { return m_chartType; }
00073 void setChartType( ChartType _type ) {
00074 m_chartType = _type;
00075 KDChartParams::setChartType( (KDChartParams::ChartType) _type );
00076 }
00077
00078
00079 DataDirection dataDirection() const { return m_dataDirection; }
00080 void setDataDirection( DataDirection _dir ) {
00081 m_dataDirection = _dir;
00082 }
00083
00084 QString chartTypeToString( ChartType _type) const;
00085 ChartType stringToChartType( const QString& string );
00086
00087
00088 bool firstRowAsLabel() const { return m_firstRowAsLabel; }
00089 void setFirstRowAsLabel( bool _val );
00090 bool firstColAsLabel() const { return m_firstColAsLabel; }
00091 void setFirstColAsLabel( bool _val );
00092
00093
00094 QString dataArea() const { return m_dataArea; }
00095 void setDataArea( QString dataArea ) {
00096 m_dataArea = dataArea;
00097 }
00098
00099
00100
00101
00102
00103 public slots:
00104
00105 void setBarNumLines( int _numLines ) {
00106 m_barNumLines = _numLines;
00107 emit changed();
00108 }
00109
00110 int barNumLines() const {
00111 return m_barNumLines;
00112 }
00113
00114
00115
00116 public:
00117
00118 DCOPObject *dcopObject();
00119
00120 bool loadOasis( const QDomElement &chartElem,
00121 KoOasisLoadingContext &loadingContext,
00122 QString &errorMessage,
00123 KoStore *store );
00124 void saveOasis( KoXmlWriter* bodyWriter, KoGenStyles& mainStyles ) const;
00125
00126 private:
00127 bool loadOasisPlotarea( const QDomElement &plotareaElem,
00128 KoOasisLoadingContext &loadingContext,
00129 QString &errorMessage );
00130 bool loadOasisAxis( const QDomElement &axisElem,
00131 KoOasisLoadingContext &loadingContext,
00132 QString &errorMessage,
00133 KDChartAxisParams::AxisPos axisPos );
00134 void loadOasisFont( KoOasisLoadingContext& context, QFont& font, QColor& color );
00135
00136 void saveOasisPlotArea( KoXmlWriter* bodyWriter, KoGenStyles& mainStyles ) const;
00137 void saveOasisAxis( KoXmlWriter* bodyWriter, KoGenStyles& mainStyles,
00138 KDChartAxisParams::AxisPos axisPos,
00139 const char* axisName ) const;
00140 QString saveOasisFont( KoGenStyles& mainStyles, const QFont& font,
00141 const QColor& color ) const;
00142
00143 private:
00144 KChartPart *m_part;
00145
00146
00147 ChartType m_chartType;
00148
00149
00150 DataDirection m_dataDirection;
00151 bool m_firstRowAsLabel;
00152 bool m_firstColAsLabel;
00153
00154 QString m_dataArea;
00155
00156
00157 int m_barNumLines;
00158
00159 DCOPObject *m_dcop;
00160 };
00161
00162 }
00163
00164 #endif
|