kspread

kspread_genvalidationstyle.h
1/* This file is part of the KDE project
2
3 Copyright 2004 Laurent Montel <montel@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21
22#ifndef KSPREAD_GENVALIDATIONSTYLE
23#define KSPREAD_GENVALIDATIONSTYLE
24
25#include <tqdict.h>
26#include <tqmap.h>
27
28class KoXmlWriter;
29
30namespace KSpread
31{
32class Validity;
33class GenValidationStyle;
34
35class GenValidationStyles
36{
37public:
38 GenValidationStyles();
39 ~GenValidationStyles();
40 TQString lookup( const GenValidationStyle& style );
41
42 typedef TQMap<GenValidationStyle, TQString> StyleMap;
43 void writeStyle( KoXmlWriter& writer );
44
45private:
46 TQString makeUniqueName( const TQString& base ) const;
47
49 StyleMap m_styles;
51 typedef TQMap<TQString, bool> NameMap;
52 NameMap m_names;
53
54};
55
56class GenValidationStyle
57{
58public:
59 explicit GenValidationStyle(Validity *_val=0) { initVal( _val ); }
60
61
62 bool operator<( const GenValidationStyle &other ) const {
63 if ( allowEmptyCell != other.allowEmptyCell ) return ( allowEmptyCell < other.allowEmptyCell );
64 if ( condition != other.condition ) return ( condition < other.condition );
65 if ( titleInfo != other.titleInfo ) return ( titleInfo < other.titleInfo );
66 if ( displayValidationInformation != other.displayValidationInformation ) return ( displayValidationInformation < other.displayValidationInformation );
67 if ( messageInfo != other.messageInfo ) return ( messageInfo < other.messageInfo );
68 if ( messageType != other.messageType ) return ( messageType < other.messageType );
69 if ( displayMessage != other.displayMessage ) return ( displayMessage < other.displayMessage );
70 if ( message != other.message ) return ( message < other.message );
71 if ( title != other.title ) return ( title < other.title );
72
73 return false;
74 }
75private:
76 TQString createValidationCondition( Validity* _val );
77 TQString createTextValidationCondition( Validity* _val );
78 TQString createTimeValidationCondition( Validity* _val );
79 TQString createDateValidationCondition( Validity* _val );
80 TQString createNumberValidationCondition( Validity* _val );
81 TQString createListValidationCondition( Validity* _val );
82
83 void initVal( Validity *_val );
84
85 TQString allowEmptyCell;
86 TQString condition;
87 TQString titleInfo;
88 TQString displayValidationInformation;
89 TQString messageInfo;
90 TQString messageType;
91 TQString displayMessage;
92 TQString message;
93 TQString title;
94 friend class GenValidationStyles;
95};
96
97} // namespace KSpread
98
99#endif
The KSpread namespace.
Definition commands.h:39