KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
3.3KB

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