00001 #ifndef SPREADSHEET_H
00002 #define SPREADSHEET_H
00003
00004 #include <qwidget.h>
00005 #include <qtable.h>
00006 #include "MainWin.h"
00007 #include "widgettype.h"
00008
00009
00010
00011 #ifdef USE_NEW_TABLE
00012 #include <LTable.h>
00013 #endif
00014
00015 class Spreadsheet: public QWidget
00016 {
00017 Q_OBJECT
00018 public:
00019 Spreadsheet(QWidget *parent, class MainWin *mw, const char *name);
00020 WidgetType getWidgetType() { return widgettype; }
00021 QStringList Info();
00022 #ifdef USE_NEW_TABLE
00023 LTable *Table() { return table; }
00024 #else
00025 QTable *Table() { return table; }
00026 #endif
00027 void save(QTextStream *t);
00028 void open(QTextStream *t, int version);
00029 QString columnTitle(int col);
00030 void setColumnTitle(int col, QString name);
00031 bool eventFilter(QObject *object, QEvent *e);
00032 public slots:
00033 void Clear();
00034
00035 void plot2DSimple() { plot2D(P2D,FALSE); }
00036 void plot2DPie() { plot2D(PPIE,FALSE); }
00037 void plot2DPolar() { plot2D(PPOLAR,FALSE); }
00038 void plot2DLine() { plot2D(P2D,TRUE); }
00039 void plotSurface() { plotMatrix(PSURFACE); }
00040 void plotM3D() { plotMatrix(P3D); }
00041 void plotQWT3D() { plotMatrix(PQWT3D); }
00042 void plot3DXYDY();
00043 void plot4DXYDXDY();
00044 void plot4DXYDYDY();
00045 void plot3DSimple() { plot3D(P3D); }
00046 void plot3DTernary() { plot3D(PTERNARY); }
00047
00048 void addGraph2D(Graph2D *g);
00049 void addGraph3D(Graph3D *g);
00050 void addGraph4D(Graph4D *g);
00051 void addGraphM(GraphM *g);
00052
00053 void cutSelection();
00054 void copySelection();
00055 void pasteSelection();
00056 void clearSelection();
00057
00058 void fillRowNumber();
00059 void fillRandom(double max=1.0);
00060 void setCurrentColumn(int i);
00061
00062 void normSum();
00063 void normMax(double max=1.0);
00064 void transposeMatrix();
00065 void convertMatrixtoXYZ();
00066 void convertXYZtoMatrix();
00067 void exportData();
00068 void addColumn();
00069 void toggleMask();
00070 void maskSelection();
00071 void unMask();
00072 void sortAscending();
00073 void sortDescending();
00074 void selectColumns(int left, int right=-1);
00075 void selectRows(int top, int bottom=-1);
00076 void deleteRows();
00077 void deleteColumns();
00078 void setValues(int srow=1, int erow=0, QString expr=0);
00079 void setProperties(QString label=0, int type=1, int format=1, int rows=100);
00081 private slots:
00082 void plot2D(PType type,bool line);
00083 void plot3D(PType type);
00084 void plotMatrix(PType type);
00085 private:
00086 int filledRows(int col=1);
00087 int formatItem(int col);
00088 void sort();
00089 void qsort(int s, int e);
00090 void setDestination(int d) { destination=d; }
00091 void contextMenuEvent(QContextMenuEvent *);
00092 void resizeEvent(QResizeEvent *);
00093 void closeEvent(QCloseEvent *);
00094 Style *defaultStyle();
00095 Symbol *defaultSymbol();
00096 class MainWin *mw;
00097 WidgetType widgettype;
00098 #ifdef USE_NEW_TABLE
00099 LTable *table;
00100 #else
00101 QTable *table;
00102 #endif
00103 bool ascending;
00104 int destination;
00105 };
00106
00107 #endif //SPREADSHEET