kspread

manipulator_data.h
1/* This file is part of the KDE project
2 Copyright (C) 2006 Tomas Mecir <mecirt@gmail.com>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20
21#ifndef KSPREAD_MANIPULATOR_DATA
22#define KSPREAD_MANIPULATOR_DATA
23
24#include "manipulator.h"
25#include "kspread_global.h"
26#include "kspread_value.h"
27
28namespace KSpread {
29
30
36struct ADMStorage {
37 Value val;
38 TQString text;
39 FormatType format;
40};
41
42class AbstractDataManipulator : public Manipulator {
43 public:
44 AbstractDataManipulator ();
45 virtual ~AbstractDataManipulator ();
46 virtual bool process (Element* element);
49 protected:
53 virtual Value newValue (Element *element, int col, int row,
54 bool *parse, FormatType *fmtType) = 0;
56 virtual bool preProcessing ();
57 TQMap<int, TQMap<int, ADMStorage> > oldData;
58};
59
60
66class DataManipulator : public AbstractDataManipulator {
67 public:
69 virtual ~DataManipulator ();
70 void setParsing (bool val) { m_parsing = val; };
73 void setValue (Value val) { data = val; };
76 void setFormat (FormatType fmtType) { m_format = fmtType; };
77 protected:
78 virtual Value newValue (Element *element, int col, int row, bool *,
79 FormatType *);
80
81 Value data;
82 FormatType m_format;
83 bool m_parsing : 1;
84};
85
86class ArrayFormulaManipulator : public AbstractDataManipulator {
87 public:
88 ArrayFormulaManipulator ();
89 virtual ~ArrayFormulaManipulator ();
90 void setText (const TQString text) { m_text = text; };
91 protected:
92 virtual Value newValue (Element *element, int col, int row, bool *,
93 FormatType *);
94 TQString cellRef, m_text;
95};
96
97
100class ProtectedCheck : public Region {
101 public:
103 virtual ~ProtectedCheck ();
104 void setSheet (Sheet *sheet) { m_sheet = sheet; };
105 bool check ();
106 protected:
107 Sheet *m_sheet;
108};
109
110
111} // namespace KSpread
112
113#endif // KSPREAD_MANIPULATOR_DATA
114
DataManipulator - allows setting values on one range.
void setFormat(FormatType fmtType)
If set, all cells shall be switched to this format.
void setValue(Value val)
set the values for the range.
class ProtectedCheck can be used to check, whether a particular range is protected or not
The one for all class for points and ranges.
Definition region.h:44
Provides a wrapper for cell value.
The KSpread namespace.
Definition commands.h:39
AbstractDataManipulator - provides storage of old cell data (for undo) and has an abstract method for...