kspread

manipulator_data.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2006 Tomas Mecir <mecirt@gmail.com>
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.
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 
00021 #ifndef KSPREAD_MANIPULATOR_DATA
00022 #define KSPREAD_MANIPULATOR_DATA
00023 
00024 #include "manipulator.h"
00025 #include "kspread_global.h"
00026 #include "kspread_value.h"
00027 
00028 namespace KSpread {
00029 
00030 
00036 struct ADMStorage {
00037   Value val;
00038   QString text;
00039   FormatType format;
00040 };
00041 
00042 class AbstractDataManipulator : public Manipulator {
00043   public:
00044     AbstractDataManipulator ();
00045     virtual ~AbstractDataManipulator ();
00046     virtual bool process (Element* element);
00049   protected:
00053     virtual Value newValue (Element *element, int col, int row,
00054       bool *parse, FormatType *fmtType) = 0;
00056     virtual bool preProcessing ();
00057     QMap<int, QMap<int, ADMStorage> > oldData;
00058 };
00059 
00060 
00066 class DataManipulator : public AbstractDataManipulator {
00067   public:
00068     DataManipulator ();
00069     virtual ~DataManipulator ();
00070     void setParsing (bool val) { m_parsing = val; };
00073     void setValue (Value val) { data = val; };
00076     void setFormat (FormatType fmtType) { m_format = fmtType; };
00077   protected:
00078     virtual Value newValue (Element *element, int col, int row, bool *,
00079         FormatType *);
00080     
00081     Value data;
00082     FormatType m_format;
00083     bool m_parsing : 1;
00084 };
00085 
00086 class ArrayFormulaManipulator : public AbstractDataManipulator {
00087   public:
00088     ArrayFormulaManipulator ();
00089     virtual ~ArrayFormulaManipulator ();
00090     void setText (const QString text) { m_text = text; };
00091   protected:
00092     virtual Value newValue (Element *element, int col, int row, bool *,
00093         FormatType *);
00094     QString cellRef, m_text;
00095 };
00096 
00097 
00100 class ProtectedCheck : public Region {
00101   public:
00102     ProtectedCheck ();
00103     virtual ~ProtectedCheck ();
00104     void setSheet (Sheet *sheet) { m_sheet = sheet; };
00105     bool check ();
00106   protected:
00107     Sheet *m_sheet;
00108 };
00109 
00110 
00111 } // namespace KSpread
00112 
00113 #endif  // KSPREAD_MANIPULATOR_DATA
00114 
KDE Home | KDE Accessibility Home | Description of Access Keys