summaryrefslogtreecommitdiffstats
path: root/kchart/kchart_part.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kchart/kchart_part.h
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kchart/kchart_part.h')
-rw-r--r--kchart/kchart_part.h152
1 files changed, 152 insertions, 0 deletions
diff --git a/kchart/kchart_part.h b/kchart/kchart_part.h
new file mode 100644
index 00000000..79134b31
--- /dev/null
+++ b/kchart/kchart_part.h
@@ -0,0 +1,152 @@
+/**
+ * Kalle Dalheimer <kalle@kde.org>
+ */
+
+#ifndef KCHART_PART_H
+#define KCHART_PART_H
+
+
+#include <kconfig.h>
+
+#include <koChart.h>
+#include "kchart_params.h"
+#include "koffice_export.h"
+
+class KoXmlWriter;
+class KoGenStyles;
+namespace KChart
+{
+
+class KChartParams;
+
+
+class KCHART_EXPORT KChartPart : public KoChart::Part
+{
+ Q_OBJECT
+
+public:
+ KChartPart( QWidget *parentWidget = 0, const char *widgetName = 0,
+ QObject* parent = 0, const char* name = 0,
+ bool singleViewMode = false );
+ ~KChartPart();
+
+ // Methods inherited from KoDocument:
+
+ virtual bool initDoc(InitDocFlags flags, QWidget* parentWidget=0);
+
+ virtual void paintContent( QPainter& painter, const QRect& rect,
+ bool transparent = false,
+ double zoomX = 1.0, double zoomY = 1.0 );
+
+ // Methods unique to KChart, and available in the new interface
+ // (see ../interfaces/koChart.h.)
+
+ virtual void resizeData( int rows, int columns );
+ virtual void setCellData( int row, int column, const QVariant &);
+ virtual void analyzeHeaders( );
+ virtual void setCanChangeValue( bool b ) { m_bCanChangeValue = b; }
+
+ // ----------------------------------------------------------------
+
+ void analyzeHeaders( const KDChartTableData& data );
+ void doSetData( const KDChartTableData& data,
+ bool firstColHeader,
+ bool firstRowHeader );
+
+ bool showWizard( QString &dataArea );
+ void initLabelAndLegend();
+ void loadConfig(KConfig *conf);
+ void saveConfig(KConfig *conf);
+ void defaultConfig();
+
+ KChartParams::ChartType chartType() const { return (KChartParams::ChartType) params()->chartType(); }
+ KDChartTableData *data() { return &m_currentData; }
+ KChartParams *params() const { return m_params; }
+
+ QStringList &rowLabelTexts() { return m_rowLabels; }
+ QStringList &colLabelTexts() { return m_colLabels; }
+
+ // Save and load
+ virtual QDomDocument saveXML();
+ virtual bool loadXML( QIODevice *, const QDomDocument& doc );
+ virtual bool loadOasis( const QDomDocument& doc,
+ KoOasisStyles& oasisStyles,
+ const QDomDocument& settings,
+ KoStore *store );
+ virtual bool saveOasis( KoStore* store,
+ KoXmlWriter* manifestWriter );
+
+ bool canChangeValue() const { return m_bCanChangeValue; }
+
+ void initNullChart();
+
+ // Functions that generate templates (not used yet):
+ void generateBarChartTemplate();
+
+ virtual bool showEmbedInitDialog(QWidget* parent);
+
+public slots:
+ void slotModified();
+ virtual void initEmpty();
+
+signals:
+ void docChanged();
+
+protected:
+ virtual KoView* createViewInstance( QWidget* parent, const char* name );
+ bool loadOldXML( const QDomDocument& doc );
+ bool loadAuxiliary( const QDomDocument& doc );
+ bool loadData( const QDomDocument& doc, KDChartTableData& currentData );
+ bool loadOasisData( const QDomElement& tableElem );
+ void saveOasisData( KoXmlWriter* bodyWriter, KoGenStyles& mainStyles ) const;
+ void writeAutomaticStyles( KoXmlWriter& contentWriter, KoGenStyles& mainStyles ) const;
+
+private:
+ // Helper methods for painting.
+ int createDisplayData();
+ void createLabelsAndLegend( QStringList &longLabels,
+ QStringList &shortLabels );
+
+
+ QDomElement createElement(const QString &tagName,
+ const QFont &font,
+ QDomDocument &doc) const;
+ QFont toFont(QDomElement &element) const;
+
+ void setChartDefaults();
+
+private:
+ // The chart and its contents
+ KChartParams *m_params; // Everything about the chart
+ KDChartTableData m_currentData; // The data in the chart.
+ QStringList m_rowLabels;
+ QStringList m_colLabels;
+ //QString m_regionName;
+
+ // Other auxiliary values
+ bool m_bCanChangeValue;
+
+ // Graphics
+ QWidget *m_parentWidget;
+
+ // Used when displaying.
+ KDChartTableData m_displayData;
+
+ QPixmap m_bufferPixmap;
+};
+
+
+class WizardExt : public KoChart::WizardExtension
+{
+public:
+ WizardExt( KoChart::Part *part )
+ : KoChart::WizardExtension( part ) {};
+
+ virtual bool show( QString &dataArea ) {
+ return static_cast<KChartPart *>( part() )->showWizard( dataArea );
+ }
+};
+
+} //KChart namespace
+
+#endif