00001 #ifndef SPREADSHEET_H
00002 #define SPREADSHEET_H
00003
00004 #include <qwidget.h>
00005 #include <qtable.h>
00006 #include "MainWin.h"
00007
00008 class Spreadsheet: public QWidget
00009 {
00010 Q_OBJECT
00011 public:
00012 Spreadsheet(QWidget *parent, class MainWin *mw, const char *name);
00013 QStringList Info();
00014 QTable *Table() { return table; }
00015 void save(QTextStream *t);
00016 void open(QTextStream *t, int version);
00017 QString columnTitle(int col);
00018 void setColumnTitle(int col, QString name);
00019 public slots:
00020 void plot2DSimple() { plot2D(P2D); }
00021 void plot2DPie() { plot2D(PPIE); }
00022 void plot2DPolar() { plot2D(PPOLAR); }
00023 void plotSurface() { plotMatrix(PSURFACE); }
00024 void plotQWT3D() { plotMatrix(PQWT3D); }
00025 void plot3DXYDY();
00026 void plot4DXYDXDY();
00027 void plot4DXYDYDY();
00028 void plot3DSimple() { plot3D(P3D); }
00029 void plot3DTernary() { plot3D(PTERNARY); }
00030
00031 void cutSelection();
00032 void copySelection();
00033 void pasteSelection();
00034 void clearSelection();
00035
00036 void fillRowNumber();
00037 void fillRandom(double max=1.0);
00038 void setCurrentColumn(int i);
00039
00040 void normSum();
00041 void normMax(double max=1.0);
00042 void transposeMatrix();
00043 void convertMatrixtoXYZ();
00044 void convertXYZtoMatrix();
00045 void exportData();
00046 void addColumn();
00047 void sortAscending();
00048 void sortDescending();
00049 void selectColumns(int left, int right=-1);
00050 void selectRows(int top, int bottom=-1);
00051 void deleteRows();
00052 void deleteColumns();
00053 void setValues(int srow=1, int erow=0, QString expr=0);
00054 void setProperties(QString label=0, int type=1, int format=1, int rows=100);
00056 private slots:
00057 void plot2D(PType type);
00058 void plot3D(PType type);
00059 void plotMatrix(PType type);
00060 private:
00061 int filledRows();
00062 int formatItem(int col);
00063 void sort();
00064 void qsort(int s, int e);
00065 void contextMenuEvent(QContextMenuEvent *);
00066 void resizeEvent(QResizeEvent *);
00067 void closeEvent(QCloseEvent *);
00068 class MainWin *mw;
00069 QTable *table;
00070 bool ascending;
00071 };
00072
00073 #endif //SPREADSHEET