kspread
kspread_autofill.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef __kspread_autofill_h__
00027 #define __kspread_autofill_h__
00028
00029 #include <qdatetime.h>
00030 #include <qmemarray.h>
00031 #include <qstring.h>
00032 #include <qptrlist.h>
00033 #include <qstringlist.h>
00034
00035 namespace KSpread
00036 {
00037 class AutoFillDeltaSequence;
00038 class AutoFillSequenceItem;
00039 class AutoFillSequence;
00040 class Cell;
00041
00042 class AutoFillSequenceItem
00043 {
00044 public:
00045 enum Type { INTEGER, FLOAT, STRING, DAY, SHORTDAY,
00046 MONTH, SHORTMONTH, FORMULA, OTHER, DATE, TIME };
00047
00048 AutoFillSequenceItem( int _i );
00049 AutoFillSequenceItem( double _d );
00050 AutoFillSequenceItem( const QString &_str );
00051
00052 bool getDelta( AutoFillSequenceItem *_seq, double &delta );
00053
00054 QString getSuccessor( int _no, double _delta );
00055 QString getPredecessor( int _no, double _delta );
00056
00057 Type getType()const { return m_Type; }
00058 int getIValue()const { return m_IValue; }
00059 double getDValue()const { return m_DValue; }
00060 QString getString()const { return m_String; }
00061 int getIOtherEnd()const {return m_OtherEnd; }
00062 int getIOtherBegin()const {return m_OtherBegin; }
00063 static QStringList *other;
00064 static QStringList *month;
00065 static QStringList *day;
00066 static QStringList *shortMonth;
00067 static QStringList *shortDay;
00068 protected:
00069 int m_IValue;
00070 double m_DValue;
00071 int m_OtherBegin;
00072 int m_OtherEnd;
00073
00074 QString m_String;
00075
00076 Type m_Type;
00077 };
00078
00079 class AutoFillSequence
00080 {
00081 public:
00082 AutoFillSequence( Cell *_obj );
00083
00084 int count()const { return sequence.count(); }
00085
00086 AutoFillSequenceItem* getFirst() { return sequence.first(); }
00087 AutoFillSequenceItem* getNext() { return sequence.next(); }
00088
00089 bool matches( AutoFillSequence* _seq, AutoFillDeltaSequence *_delta );
00090
00091 void fillCell( Cell *src, Cell *dest, AutoFillDeltaSequence *delta, int _block, bool down = true );
00092
00093 protected:
00094 QPtrList<AutoFillSequenceItem> sequence;
00095 };
00096
00097 class AutoFillDeltaSequence
00098 {
00099 public:
00100 AutoFillDeltaSequence( AutoFillSequence *_first, AutoFillSequence *_next );
00101 ~AutoFillDeltaSequence();
00102
00103 bool isOk()const { return m_ok; }
00104
00105 bool equals( AutoFillDeltaSequence *_delta );
00106
00107 QMemArray<double>* getSequence() { return m_sequence; }
00108
00109 double getItemDelta( int _pos );
00110
00111 protected:
00112 bool m_ok;
00113 QMemArray<double>* m_sequence;
00114 };
00115
00116 }
00117
00118 #endif
|