kspread Library API Documentation

commands.h

00001 /* This file is part of the KDE project
00002    Copyright 2004 Ariya Hidayat <ariya@kde.org>
00003    Copyright 2004 Laurent Montel <montel@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef KSPREAD_COMMANDS
00022 #define KSPREAD_COMMANDS
00023 
00024 #include <koPageLayout.h>
00025 #include <koUnit.h>
00026 
00027 #include <kcommand.h>
00028 
00029 #include <qstring.h>
00030 #include <qptrstack.h>
00031 #include <qrect.h>
00032 #include <qptrlist.h>
00033 #include <qvaluelist.h>
00034 
00035 #include "kspread_sheet.h"
00036 
00037 class KSpreadCell;
00038 class KSpreadDoc;
00039 class KSpreadUndoAction;
00040 
00086 class UndoWrapperCommand : public KCommand
00087 {
00088 public:
00089   UndoWrapperCommand( KSpreadUndoAction* undoAction );
00090 
00091   virtual void execute();
00092   virtual void unexecute();
00093   virtual QString name() const;
00094 
00095 protected:
00096   KSpreadUndoAction* undoAction;
00097 };
00098 
00099 
00104 class MergeCellCommand : public KCommand
00105 {
00106 public:
00107   MergeCellCommand( KSpreadCell* cell, int colSpan, int rowSpan );
00108 
00109   virtual void execute();
00110   virtual void unexecute();
00111   virtual QString name() const;
00112 
00113 protected:
00114   KSpreadCell* cell;
00115   int colSpan;
00116   int rowSpan;
00117   int oldColSpan;
00118   int oldRowSpan;
00119   QString rangeName;
00120 };
00121 
00122 
00126 class DissociateCellCommand : public KCommand
00127 {
00128 public:
00129   DissociateCellCommand( KSpreadCell* cell );
00130 
00131   virtual void execute();
00132   virtual void unexecute();
00133   virtual QString name() const;
00134 
00135 protected:
00136   KSpreadCell* cell;
00137   int oldColSpan;
00138   int oldRowSpan;
00139 };
00140 
00141 
00148 class RenameSheetCommand : public KCommand
00149 {
00150 public:
00151   RenameSheetCommand( KSpreadSheet* sheet, const QString &name );
00152 
00153   virtual void execute();
00154   virtual void unexecute();
00155   virtual QString name() const;
00156 
00157 protected:
00158   KSpreadSheet* sheet;
00159   QString oldName;
00160   QString newName;
00161 };
00162 
00163 class HideSheetCommand : public KCommand
00164 {
00165 public:
00166   HideSheetCommand( KSpreadSheet* sheet );
00167 
00168   virtual void execute();
00169   virtual void unexecute();
00170   virtual QString name() const;
00171 
00172 protected:
00173   KSpreadDoc* doc;
00174   QString sheetName;
00175 };
00176 
00177 class ShowSheetCommand : public KCommand
00178 {
00179 public:
00180   ShowSheetCommand( KSpreadSheet* sheet );
00181 
00182   virtual void execute();
00183   virtual void unexecute();
00184   virtual QString name() const;
00185 
00186 protected:
00187   KSpreadDoc* doc;
00188   QString sheetName;
00189 };
00190 
00191 
00192 class AddSheetCommand : public KCommand
00193 {
00194 public:
00195   AddSheetCommand( KSpreadSheet* sheet );
00196 
00197   virtual void execute();
00198   virtual void unexecute();
00199   virtual QString name() const;
00200 
00201 protected:
00202     KSpreadSheet* sheet;
00203     KSpreadDoc* doc;
00204 };
00205 
00206 
00207 class RemoveSheetCommand : public KCommand
00208 {
00209 public:
00210   RemoveSheetCommand( KSpreadSheet* sheet );
00211 
00212   virtual void execute();
00213   virtual void unexecute();
00214   virtual QString name() const;
00215 
00216 protected:
00217     KSpreadSheet* sheet;
00218     KSpreadDoc* doc;
00219 };
00220 
00221 
00226 class SheetPropertiesCommand : public KCommand
00227 {
00228 public:
00229   SheetPropertiesCommand( KSpreadDoc* doc, KSpreadSheet* sheet );
00230   void setLayoutDirection( KSpreadSheet::LayoutDirection direction );
00231   void setAutoCalc( bool b );
00232   void setShowGrid( bool b );
00233   void setShowPageBorders( bool b );
00234   void setShowFormula( bool b );
00235   void setHideZero( bool b );
00236   void setShowFormulaIndicator( bool b );
00237   void setColumnAsNumber( bool b );
00238   void setLcMode( bool b );
00239   void setCapitalizeFirstLetter( bool b );
00240 
00241   virtual void execute();
00242   virtual void unexecute();
00243   virtual QString name() const;
00244 
00245 protected:
00246   KSpreadSheet* sheet;
00247   KSpreadDoc* doc;
00248   KSpreadSheet::LayoutDirection oldDirection, newDirection;
00249   bool oldAutoCalc, newAutoCalc;
00250   bool oldShowGrid, newShowGrid;
00251   bool oldShowPageBorders, newShowPageBorders;
00252   bool oldShowFormula, newShowFormula;
00253   bool oldHideZero, newHideZero;
00254   bool oldShowFormulaIndicator, newShowFormulaIndicator;
00255   bool oldColumnAsNumber, newColumnAsNumber;
00256   bool oldLcMode, newLcMode;
00257   bool oldCapitalizeFirstLetter, newCapitalizeFirstLetter;
00258 };
00259 
00260 
00261 class InsertColumnCommand : public KCommand
00262 {
00263 public:
00264   InsertColumnCommand( KSpreadSheet* s , unsigned int _column, unsigned int _nbCol );
00265 
00266   virtual void execute();
00267   virtual void unexecute();
00268   virtual QString name() const;
00269 
00270 protected:
00271     KSpreadDoc* doc;
00272     QString sheetName;
00273     unsigned int insertPosColumn;
00274     unsigned int nbColumnInserted;
00275 
00276 };
00277 
00278 
00279 class DefinePrintRangeCommand : public KCommand
00280 {
00281 public:
00282   DefinePrintRangeCommand( KSpreadSheet* sheet );
00283 
00284   virtual void execute();
00285   virtual void unexecute();
00286   virtual QString name() const;
00287 
00288 protected:
00289     KSpreadDoc* doc;
00290     QString sheetName;
00291     QRect printRangeRedo, printRange;
00292 };
00293 
00294 
00295 class PaperLayoutCommand : public KCommand
00296 {
00297 public:
00298   PaperLayoutCommand( KSpreadSheet* sheet );
00299 
00300   virtual void execute();
00301   virtual void unexecute();
00302   virtual QString name() const;
00303 
00304 protected:
00305     KSpreadDoc* doc;
00306     QString sheetName;
00307     KoPageLayout pl;
00308     KoPageLayout plRedo;
00309     KoHeadFoot hf;
00310     KoHeadFoot hfRedo;
00311     KoUnit::Unit unit;
00312     KoUnit::Unit unitRedo;
00313     bool printGrid;
00314     bool printGridRedo;
00315     bool printCommentIndicator;
00316     bool printCommentIndicatorRedo;
00317     bool printFormulaIndicator;
00318     bool printFormulaIndicatorRedo;
00319     QRect printRange;
00320     QRect printRangeRedo;
00321     QPair<int, int> printRepeatColumns;
00322     QPair<int, int> printRepeatColumnsRedo;
00323     QPair<int, int> printRepeatRows;
00324     QPair<int, int> printRepeatRowsRedo;
00325     double zoom;
00326     double zoomRedo;
00327     int pageLimitX;
00328     int pageLimitXRedo;
00329     int pageLimitY;
00330     int pageLimitYRedo;
00331 
00332 };
00333 
00334 class LinkCommand : public KCommand
00335 {
00336 public:
00337   LinkCommand( KSpreadCell* cell, const QString& text, const QString& link );
00338 
00339   virtual void execute();
00340   virtual void unexecute();
00341   virtual QString name() const;
00342 
00343 protected:
00344   KSpreadCell* cell;
00345   KSpreadDoc* doc;
00346   QString oldText;
00347   QString oldLink;
00348   QString newText;
00349   QString newLink;
00350 };
00351 
00352 
00353 #endif /* KSPREAD_COMMANDS */
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:44 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003