File indexing completed on 2024-05-19 16:08:00

0001 /* This file is part of the KDE project
0002    Copyright 2006-2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
0003    Copyright 2003 Ariya Hidayat <ariya@kde.org>
0004    Copyright 2002 Norbert Andres <nandres@web.de>
0005    Copyright 2001-2002 Laurent Montel <montel@kde.org>
0006    Copyright 2001 David Faure <faure@kde.org>
0007    Copyright 2000 Werner Trobin <trobin@kde.org>
0008    Copyright 1998-1999 Torben Weis <weis@kde.org>
0009 
0010    This library is free software; you can redistribute it and/or
0011    modify it under the terms of the GNU Library General Public
0012    License as published by the Free Software Foundation; either
0013    version 2 of the License, or (at your option) any later version.
0014 
0015    This library is distributed in the hope that it will be useful,
0016    but WITHOUT ANY WARRANTY; without even the implied warranty of
0017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0018    Library General Public License for more details.
0019 
0020    You should have received a copy of the GNU Library General Public License
0021    along with this library; see the file COPYING.LIB.  If not, write to
0022    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0023    Boston, MA 02110-1301, USA.
0024 */
0025 
0026 
0027 #ifndef CALLIGRA_SHEETS_AUTOFILL_COMMAND
0028 #define CALLIGRA_SHEETS_AUTOFILL_COMMAND
0029 
0030 #include "DataManipulators.h"
0031 
0032 #include <QList>
0033 #include <QRect>
0034 #include <QString>
0035 #include <QStringList>
0036 
0037 namespace Calligra
0038 {
0039 namespace Sheets
0040 {
0041 class AutoFillSequence;
0042 class Cell;
0043 
0044 /**
0045  * \ingroup Commands
0046  * \brief Auto-filling of a cell range.
0047  */
0048 class AutoFillCommand : public AbstractDataManipulator
0049 {
0050 public:
0051     /**
0052      * Constructor.
0053      */
0054     AutoFillCommand();
0055 
0056     /**
0057      * Destructor.
0058      */
0059     ~AutoFillCommand() override;
0060 
0061     void setSourceRange(const QRect& range);
0062     void setTargetRange(const QRect& range);
0063 
0064     /**
0065      * Executes the actual operation.
0066      */
0067     bool mainProcessing() override;
0068 
0069 public:
0070     static QStringList *other;
0071     static QStringList *month;
0072     static QStringList *day;
0073     static QStringList *shortMonth;
0074     static QStringList *shortDay;
0075 
0076 private:
0077     void fillSequence(const QList<Cell>& _srcList,
0078                       const QList<Cell>& _destList,
0079                       const AutoFillSequence& _seqList,
0080                       bool down = true);
0081     // dummy
0082     Value newValue(Element*, int, int, bool*, Format::Type*) override {
0083         return Value();
0084     }
0085 
0086 private:
0087     QRect m_sourceRange;
0088     QRect m_targetRange;
0089 };
0090 
0091 } // namespace Sheets
0092 } // namespace Calligra
0093 
0094 #endif // CALLIGRA_SHEETS_AUTOFILL_COMMAND