kspread Library API Documentation

kspread_autofill.h

00001 /* This file is part of the KDE project
00002    
00003    Copyright 2003 Ariya Hidayat <ariya@kde.org>
00004    Copyright 2002 Norbert Andres <nandres@web.de>
00005    Copyright 2001-2002 Laurent Montel <montel@kde.org>
00006    Copyright 2001 David Faure <faure@kde.org>
00007    Copyright 2000 Werner Trobin <trobin@kde.org>
00008    Copyright 1998-1999 Torben Weis <weis@kde.org>
00009    
00010    This library is free software; you can redistribute it and/or
00011    modify it under the terms of the GNU Library General Public
00012    License as published by the Free Software Foundation; either
00013    version 2 of the License, or (at your option) any later version.
00014 
00015    This library is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018    Library General Public License for more details.
00019 
00020    You should have received a copy of the GNU Library General Public License
00021    along with this library; see the file COPYING.LIB.  If not, write to
00022    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023    Boston, MA 02111-1307, USA.
00024 */
00025 
00026 #ifndef __kspread_autofill_h__
00027 #define __kspread_autofill_h__
00028 
00029 class AutoFillDeltaSequence;
00030 class AutoFillSequenceItem;
00031 class AutoFillSequence;
00032 
00033 #include <qdatetime.h>
00034 #include <qmemarray.h>
00035 #include <qstring.h>
00036 #include <qptrlist.h>
00037 #include <qstringlist.h>
00038 
00039 class KSpreadCell;
00040 
00041 class AutoFillSequenceItem
00042 {
00043 public:
00044     enum Type { INTEGER, FLOAT, STRING, DAY, SHORTDAY,
00045       MONTH, SHORTMONTH, FORMULA, OTHER, DATE, TIME };
00046 
00047     AutoFillSequenceItem( int _i );
00048     AutoFillSequenceItem( double _d );
00049     AutoFillSequenceItem( const QString &_str );
00050 
00051     bool getDelta( AutoFillSequenceItem *_seq, double &delta );
00052 
00053     QString getSuccessor( int _no, double _delta );
00054     QString getPredecessor( int _no, double _delta );
00055 
00056     Type getType()const { return m_Type; }
00057     int getIValue()const { return m_IValue; }
00058     double getDValue()const { return m_DValue; }
00059     QString getString()const { return m_String; }
00060     int getIOtherEnd()const {return m_OtherEnd; }
00061     int getIOtherBegin()const {return m_OtherBegin; }
00062     static QStringList *other;
00063     static QStringList *month;
00064     static QStringList *day;
00065     static QStringList *shortMonth;
00066     static QStringList *shortDay;
00067 protected:
00068     int    m_IValue;
00069     double m_DValue;
00070     int    m_OtherBegin;
00071     int    m_OtherEnd;
00072 
00073     QString m_String;
00074 
00075     Type m_Type;
00076 };
00077 
00078 class AutoFillSequence
00079 {
00080 public:
00081     AutoFillSequence( KSpreadCell *_obj );
00082 
00083     int count()const { return sequence.count(); }
00084 
00085     AutoFillSequenceItem* getFirst() { return sequence.first(); }
00086     AutoFillSequenceItem* getNext() { return sequence.next(); }
00087 
00088     bool matches( AutoFillSequence* _seq, AutoFillDeltaSequence *_delta );
00089 
00090     void fillCell( KSpreadCell *src, KSpreadCell *dest, AutoFillDeltaSequence *delta, int _block, bool down = true );
00091 
00092 protected:
00093     QPtrList<AutoFillSequenceItem> sequence;
00094 };
00095 
00096 class AutoFillDeltaSequence
00097 {
00098 public:
00099     AutoFillDeltaSequence( AutoFillSequence *_first, AutoFillSequence *_next );
00100     ~AutoFillDeltaSequence();
00101 
00102     bool isOk()const { return m_ok; }
00103 
00104     bool equals( AutoFillDeltaSequence *_delta );
00105 
00106     QMemArray<double>* getSequence() { return m_sequence; }
00107 
00108     double getItemDelta( int _pos );
00109 
00110 protected:
00111     bool m_ok;
00112     QMemArray<double>* m_sequence;
00113 };
00114 
00115 #endif
KDE Logo
This file is part of the documentation for kspread Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:42:46 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003