kspread

AbstractRegionCommand.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright 2005,2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KSPREAD_ABSTRACT_REGION_COMMAND
00021 #define KSPREAD_ABSTRACT_REGION_COMMAND
00022 
00023 #include <QUndoCommand>
00024 
00025 #include "Region.h"
00026 
00027 class KoCanvasBase;
00028 
00029 namespace KSpread
00030 {
00031 class Sheet;
00032 
00037 class KSPREAD_EXPORT AbstractRegionCommand : public Region, public QUndoCommand
00038 {
00039 public:
00043     AbstractRegionCommand(QUndoCommand* parent = 0);
00044 
00048     virtual ~AbstractRegionCommand();
00049 
00053     Sheet* sheet() const { return m_sheet; }
00054 
00058     void setSheet( Sheet* sheet ) { m_sheet = sheet; }
00059 
00066     virtual bool execute(KoCanvasBase* canvas = 0);
00067 
00071     virtual void redo();
00072 
00076     virtual void undo();
00077 
00083     virtual void setReverse( bool reverse ) { m_reverse = reverse; }
00084 
00089     void setRegisterUndo( bool registerUndo ) { m_register = registerUndo; }
00090 
00091 protected:
00096     virtual bool process( Element* ) { return true; }
00097 
00101     virtual bool preProcessing() { return true; }
00102 
00106     virtual bool mainProcessing();
00107 
00111     virtual bool postProcessing() { return true; }
00112 
00118     bool isApproved() const;
00119 
00120 protected:
00121     Sheet*  m_sheet;
00122     bool    m_reverse   : 1;
00123     bool    m_firstrun  : 1;
00124     bool    m_register  : 1;
00125     bool    m_success   : 1;
00126     bool    m_checkLock : 1;
00127 };
00128 
00129 } // namespace KSpread
00130 
00131 #endif // KSPREAD_ABSTRACT_REGION_COMMAND