SciDAVis  1.D4
columncommands.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : columncommands.h
3  Project : SciDAVis
4  Description : Commands to be called by Column to modify Column::Private
5  --------------------------------------------------------------------
6  Copyright : (C) 2007-2009 Tilman Benkert (thzs*gmx.net)
7  (replace * with @ in the email addresses)
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 
30 #ifndef COLUMNCOMMANDS_H
31 #define COLUMNCOMMANDS_H
32 
33 #include <QUndoCommand>
34 #include <QStringList>
35 #include "core/column/Column.h"
37 #include "lib/IntervalAttribute.h"
38 
40 // class ColumnSetModeCmd
43 class ColumnSetModeCmd : public QUndoCommand
44 {
45 public:
48  AbstractFilter *conversion_filter, QUndoCommand * parent = 0 );
51 
53  virtual void redo();
55  virtual void undo();
56 
57 private:
69  void * d_old_data;
71  void * d_new_data;
85  bool d_undone;
87  bool d_executed;
90 };
92 // end of class ColumnSetModeCmd
94 
95 
97 // class ColumnFullCopyCmd
100 class ColumnFullCopyCmd : public QUndoCommand
101 {
102 public:
104  ColumnFullCopyCmd(Column::Private * col, const AbstractColumn * src, QUndoCommand * parent = 0 );
107 
109  virtual void redo();
111  virtual void undo();
112 
113 private:
121 
127 
128 };
130 // end of class ColumnFullCopyCmd
132 
134 // class ColumnPartialCopyCmd
137 class ColumnPartialCopyCmd : public QUndoCommand
138 {
139 public:
141  ColumnPartialCopyCmd(Column::Private * col, const AbstractColumn * src, int src_start, int dest_start, int num_rows, QUndoCommand * parent = 0 );
144 
146  virtual void redo();
148  virtual void undo();
149 
150 private:
160 
167 
183 
184 
185 };
187 // end of class ColumnPartialCopyCmd
189 
190 
192 // class ColumnInsertEmptyRowsCmd
195 class ColumnInsertEmptyRowsCmd : public QUndoCommand
196 {
197 public:
199  ColumnInsertEmptyRowsCmd(Column::Private * col, int before, int count, QUndoCommand * parent = 0 );
202 
204  virtual void redo();
206  virtual void undo();
207 
208 private:
212  int d_before;
214  int d_count;
215 
216 };
218 // end of class ColumnInsertEmptyRowsCmd
220 
222 // class ColumnRemoveRowsCmd
225 class ColumnRemoveRowsCmd : public QUndoCommand
226 {
227 public:
229  ColumnRemoveRowsCmd(Column::Private * col, int first, int count, QUndoCommand * parent = 0 );
232 
234  virtual void redo();
236  virtual void undo();
237 
238 private:
242  int d_first;
244  int d_count;
252 
262 };
264 // end of class ColumnRemoveRowsCmd
266 
268 // class ColumnSetPlotDesignationCmd
271 class ColumnSetPlotDesignationCmd : public QUndoCommand
272 {
273 public:
275  ColumnSetPlotDesignationCmd(Column::Private * col, SciDAVis::PlotDesignation pd, QUndoCommand * parent = 0 );
278 
280  virtual void redo();
282  virtual void undo();
283 
284 private:
291 };
293 // end of class ColumnSetPlotDesignationCmd
295 
296 
298 // class ColumnClearCmd
301 class ColumnClearCmd : public QUndoCommand
302 {
303 public:
305  ColumnClearCmd(Column::Private * col, QUndoCommand * parent = 0 );
307  ~ColumnClearCmd();
308 
310  virtual void redo();
312  virtual void undo();
313 
314 private:
320  void * d_data;
322  void * d_empty_data;
326  bool d_undone;
327 
328 };
330 // end of class ColumnClearCmd
332 
333 
335 // class ColumnClearValidityCmd
338 class ColumnClearValidityCmd : public QUndoCommand
339 {
340 public:
342  ColumnClearValidityCmd(Column::Private * col, QUndoCommand * parent = 0 );
345 
347  virtual void redo();
349  virtual void undo();
350 
351 private:
357  bool d_copied;
358 
359 };
361 // end of class ColumnClearValidityCmd
363 
365 // class ColumnClearMasksCmd
368 class ColumnClearMasksCmd : public QUndoCommand
369 {
370 public:
372  ColumnClearMasksCmd(Column::Private * col, QUndoCommand * parent = 0 );
375 
377  virtual void redo();
379  virtual void undo();
380 
381 private:
387  bool d_copied;
388 
389 };
391 // end of class ColumnClearMasksCmd
393 
395 // class ColumnSetInvalidCmd
398 class ColumnSetInvalidCmd : public QUndoCommand
399 {
400 public:
402  ColumnSetInvalidCmd(Column::Private * col, Interval<int> interval, bool invalid, QUndoCommand * parent = 0 );
405 
407  virtual void redo();
409  virtual void undo();
410 
411 private:
417  bool d_invalid;
421  bool d_copied;
422 
423 };
425 // end of class ColumnSetInvalidCmd
427 
429 // class ColumnSetMaskedCmd
432 class ColumnSetMaskedCmd : public QUndoCommand
433 {
434 public:
436  ColumnSetMaskedCmd(Column::Private * col, Interval<int> interval, bool masked, QUndoCommand * parent = 0 );
439 
441  virtual void redo();
443  virtual void undo();
444 
445 private:
451  bool d_masked;
455  bool d_copied;
456 
457 };
459 // end of class ColumnSetMaskedCmd
461 
463 // class ColumnSetFormulaCmd
466 class ColumnSetFormulaCmd : public QUndoCommand
467 {
468 public:
470  ColumnSetFormulaCmd(Column::Private * col, Interval<int> interval, const QString& formula, QUndoCommand * parent = 0 );
473 
475  virtual void redo();
477  virtual void undo();
478 
479 private:
485  QString d_formula;
489  bool d_copied;
490 
491 };
493 // end of class ColumnSetFormulaCmd
495 
497 // class ColumnClearFormulasCmd
500 class ColumnClearFormulasCmd : public QUndoCommand
501 {
502 public:
504  ColumnClearFormulasCmd(Column::Private * col, QUndoCommand * parent = 0 );
507 
509  virtual void redo();
511  virtual void undo();
512 
513 private:
519  bool d_copied;
520 
521 };
523 // end of class ColumnClearFormulasCmd
525 
527 // class ColumnSetTextCmd
530 class ColumnSetTextCmd : public QUndoCommand
531 {
532 public:
534  ColumnSetTextCmd(Column::Private * col, int row, const QString& new_value, QUndoCommand * parent = 0 );
537 
539  virtual void redo();
541  virtual void undo();
542 
543 private:
547  int d_row;
549  QString d_new_value;
551  QString d_old_value;
556 
557 };
559 // end of class ColumnSetTextCmd
561 
563 // class ColumnSetValueCmd
566 class ColumnSetValueCmd : public QUndoCommand
567 {
568 public:
570  ColumnSetValueCmd(Column::Private * col, int row, double new_value, QUndoCommand * parent = 0 );
573 
575  virtual void redo();
577  virtual void undo();
578 
579 private:
583  int d_row;
585  double d_new_value;
587  double d_old_value;
592 
593 };
595 // end of class ColumnSetValueCmd
597 
599 // class ColumnSetDateTimeCmd
602 class ColumnSetDateTimeCmd : public QUndoCommand
603 {
604 public:
606  ColumnSetDateTimeCmd(Column::Private * col, int row, const QDateTime& new_value, QUndoCommand * parent = 0 );
609 
611  virtual void redo();
613  virtual void undo();
614 
615 private:
619  int d_row;
621  QDateTime d_new_value;
623  QDateTime d_old_value;
628 
629 };
631 // end of class ColumnSetDateTimeCmd
633 
635 // class ColumnReplaceTextsCmd
638 class ColumnReplaceTextsCmd : public QUndoCommand
639 {
640 public:
642  ColumnReplaceTextsCmd(Column::Private * col, int first, const QStringList& new_values, QUndoCommand * parent = 0 );
645 
647  virtual void redo();
649  virtual void undo();
650 
651 private:
655  int d_first;
657  QStringList d_new_values;
659  QStringList d_old_values;
661  bool d_copied;
666 
667 };
669 // end of class ColumnReplaceTextsCmd
671 
673 // class ColumnReplaceValuesCmd
676 class ColumnReplaceValuesCmd : public QUndoCommand
677 {
678 public:
680  ColumnReplaceValuesCmd(Column::Private * col, int first, const QVector<qreal>& new_values, QUndoCommand * parent = 0 );
683 
685  virtual void redo();
687  virtual void undo();
688 
689 private:
693  int d_first;
695  QVector<qreal> d_new_values;
697  QVector<qreal> d_old_values;
699  bool d_copied;
704 
705 };
707 // end of class ColumnReplaceValuesCmd
709 
711 // class ColumnReplaceDateTimesCmd
714 class ColumnReplaceDateTimesCmd : public QUndoCommand
715 {
716 public:
718  ColumnReplaceDateTimesCmd(Column::Private * col, int first, const QList<QDateTime>& new_values, QUndoCommand * parent = 0 );
721 
723  virtual void redo();
725  virtual void undo();
726 
727 private:
731  int d_first;
733  QList<QDateTime> d_new_values;
735  QList<QDateTime> d_old_values;
737  bool d_copied;
742 
743 };
745 // end of class ColumnReplaceDateTimesCmd
747 
748 
749 
750 
751 #endif