kspread

kspread_autofill.h
1/* This file is part of the KDE project
2
3 Copyright 2003 Ariya Hidayat <ariya@kde.org>
4 Copyright 2002 Norbert Andres <nandres@web.de>
5 Copyright 2001-2002 Laurent Montel <montel@kde.org>
6 Copyright 2001 David Faure <faure@kde.org>
7 Copyright 2000 Werner Trobin <trobin@kde.org>
8 Copyright 1998-1999 Torben Weis <weis@kde.org>
9
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Library General Public
12 License as published by the Free Software Foundation; either
13 version 2 of the License, or (at your option) any later version.
14
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details.
19
20 You should have received a copy of the GNU Library General Public License
21 along with this library; see the file COPYING.LIB. If not, write to
22 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA.
24*/
25
26#ifndef __kspread_autofill_h__
27#define __kspread_autofill_h__
28
29#include <tqdatetime.h>
30#include <tqmemarray.h>
31#include <tqstring.h>
32#include <tqptrlist.h>
33#include <tqstringlist.h>
34
35namespace KSpread
36{
37class AutoFillDeltaSequence;
38class AutoFillSequenceItem;
39class AutoFillSequence;
40class Cell;
41
42class AutoFillSequenceItem
43{
44public:
45 enum Type { INTEGER, FLOAT, STRING, DAY, SHORTDAY,
46 MONTH, SHORTMONTH, FORMULA, OTHER, DATE, TIME };
47
48 AutoFillSequenceItem( int _i );
49 AutoFillSequenceItem( double _d );
50 AutoFillSequenceItem( const TQString &_str );
51
52 bool getDelta( AutoFillSequenceItem *_seq, double &delta );
53
54 TQString getSuccessor( int _no, double _delta );
55 TQString getPredecessor( int _no, double _delta );
56
57 Type getType()const { return m_Type; }
58 int getIValue()const { return m_IValue; }
59 double getDValue()const { return m_DValue; }
60 TQString getString()const { return m_String; }
61 int getIOtherEnd()const {return m_OtherEnd; }
62 int getIOtherBegin()const {return m_OtherBegin; }
63 static TQStringList *other;
64 static TQStringList *month;
65 static TQStringList *day;
66 static TQStringList *shortMonth;
67 static TQStringList *shortDay;
68protected:
69 int m_IValue;
70 double m_DValue;
71 int m_OtherBegin;
72 int m_OtherEnd;
73
74 TQString m_String;
75
76 Type m_Type;
77};
78
79class AutoFillSequence
80{
81public:
82 AutoFillSequence( Cell *_obj );
83
84 int count()const { return sequence.count(); }
85
86 AutoFillSequenceItem* getFirst() { return sequence.first(); }
87 AutoFillSequenceItem* getNext() { return sequence.next(); }
88
89 bool matches( AutoFillSequence* _seq, AutoFillDeltaSequence *_delta );
90
91 void fillCell( Cell *src, Cell *dest, AutoFillDeltaSequence *delta, int _block, bool down = true );
92
93protected:
94 TQPtrList<AutoFillSequenceItem> sequence;
95};
96
97class AutoFillDeltaSequence
98{
99public:
100 AutoFillDeltaSequence( AutoFillSequence *_first, AutoFillSequence *_next );
101 ~AutoFillDeltaSequence();
102
103 bool isOk()const { return m_ok; }
104
105 bool equals( AutoFillDeltaSequence *_delta );
106
107 TQMemArray<double>* getSequence() { return m_sequence; }
108
109 double getItemDelta( int _pos );
110
111protected:
112 bool m_ok;
113 TQMemArray<double>* m_sequence;
114};
115
116} // namespace KSpread
117
118#endif
Type
The type of the restriction.
The KSpread namespace.
Definition commands.h:39