kspread

kspread_condition.h
1/* This file is part of the KDE project
2 Copyright 1998, 1999 Torben Weis <weis@kde.org>
3 Copyright 1999- 2006 The KSpread Team
4 www.koffice.org/kspread
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#ifndef __kspread_condition_h__
23#define __kspread_condition_h__
24
25#include <tqdom.h>
26#include <tqvaluelist.h>
27
28#include <koffice_export.h>
29
30#include "kspread_global.h"
31
32class TQColor;
33class TQFont;
34class TQString;
35class KoGenStyle;
36
37namespace KSpread
38{
39class Cell;
40class Style;
41
46class KSPREAD_EXPORT Conditional
47{
48public:
49 enum Type { None, Equal, Superior, Inferior, SuperiorEqual,
50 InferiorEqual, Between, Different, DifferentTo };
51
52 double val1;
53 double val2;
54 TQString * strVal1;
55 TQString * strVal2;
56 TQColor * colorcond;
57 TQFont * fontcond;
58 TQString * styleName;
59 Style * style;
60 Type cond;
61
64 Conditional( const Conditional& );
65 Conditional& operator=( const Conditional& );
66 bool operator==(const Conditional& other) const;
67 inline bool operator!=( const Conditional& other ) const { return !operator==( other ); }
68};
69
70
75{
76 public:
77
82 Conditions( const Cell * ownerCell );
83 virtual ~Conditions();
84
95 bool currentCondition( Conditional & condition );
96
100 TQValueList<Conditional> conditionList() const;
101
105 void setConditionList( const TQValueList<Conditional> & list );
106
111 TQDomElement saveConditions( TQDomDocument & doc ) const;
112
117 void loadConditions( const TQDomElement & element );
118
119 void loadOasisConditions( const TQDomElement & element );
120
121 void saveOasisConditions( KoGenStyle &currentCellStyle );
122
123
127 Style * matchedStyle() const { return m_matchedStyle; }
128
129 void checkMatches();
130
131 bool operator==( const Conditions& other ) const;
132 inline bool operator!=( const Conditions& other ) const { return !operator==( other ); }
133
134 private:
135 Conditions() {}
136
137 TQString saveOasisConditionValue(Conditional &cond);
138 void loadOasisConditionValue( const TQString &styleCondition, Conditional &newCondition );
139 void loadOasisValidationValue( const TQStringList &listVal, Conditional &newCondition );
140 void loadOasisCondition( TQString &valExpression, Conditional &newCondition );
141
142
143 const Cell * m_cell;
144 TQValueList<Conditional> m_condList;
145 Style * m_matchedStyle;
146};
147
148} // namespace KSpread
149
150#endif /*defined __kspread_condition_h__ */
For every cell in the spread sheet there is a Cell object.
Structure to indicate the condition we're testing on a cell and the special font and color that will ...
Manages a set of conditions for a cell.
TQValueList< Conditional > conditionList() const
Retrieve the current list of conditions we're checking.
bool currentCondition(Conditional &condition)
Use this function to see what conditions actually apply currently.
void setConditionList(const TQValueList< Conditional > &list)
Replace the current list of conditions with this new one.
Style * matchedStyle() const
returns the style that matches first (or NULL if no condition matches)
TQDomElement saveConditions(TQDomDocument &doc) const
Saves the conditions to a DOM tree structure.
void loadConditions(const TQDomElement &element)
Takes a parsed DOM element and recreates the conditions structure out of it.
The Style class represents a cell style.
The KSpread namespace.
Definition commands.h:39