comparison src/xlsx/xlsxdatavalidation.h @ 1:93d3106bb9a4

Add qt xlsx library
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 22 Mar 2016 10:38:08 +0100
parents
children
comparison
equal deleted inserted replaced
0:49cd5cc0b072 1:93d3106bb9a4
1 /****************************************************************************
2 ** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me>
3 ** All right reserved.
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining
6 ** a copy of this software and associated documentation files (the
7 ** "Software"), to deal in the Software without restriction, including
8 ** without limitation the rights to use, copy, modify, merge, publish,
9 ** distribute, sublicense, and/or sell copies of the Software, and to
10 ** permit persons to whom the Software is furnished to do so, subject to
11 ** the following conditions:
12 **
13 ** The above copyright notice and this permission notice shall be
14 ** included in all copies or substantial portions of the Software.
15 **
16 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 ** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 ** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 ** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 ** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 **
24 ****************************************************************************/
25 #ifndef QXLSX_XLSXDATAVALIDATION_H
26 #define QXLSX_XLSXDATAVALIDATION_H
27
28 #include "xlsxglobal.h"
29 #include <QSharedDataPointer>
30 #include <QString>
31 #include <QList>
32
33 class QXmlStreamReader;
34 class QXmlStreamWriter;
35
36 QT_BEGIN_NAMESPACE_XLSX
37
38 class Worksheet;
39 class CellRange;
40 class CellReference;
41
42 class DataValidationPrivate;
43 class Q_XLSX_EXPORT DataValidation
44 {
45 public:
46 enum ValidationType
47 {
48 None,
49 Whole,
50 Decimal,
51 List,
52 Date,
53 Time,
54 TextLength,
55 Custom
56 };
57
58 enum ValidationOperator
59 {
60 Between,
61 NotBetween,
62 Equal,
63 NotEqual,
64 LessThan,
65 LessThanOrEqual,
66 GreaterThan,
67 GreaterThanOrEqual
68 };
69
70 enum ErrorStyle
71 {
72 Stop,
73 Warning,
74 Information
75 };
76
77 DataValidation();
78 DataValidation(ValidationType type, ValidationOperator op=Between, const QString &formula1=QString()
79 , const QString &formula2=QString(), bool allowBlank=false);
80 DataValidation(const DataValidation &other);
81 ~DataValidation();
82
83 ValidationType validationType() const;
84 ValidationOperator validationOperator() const;
85 ErrorStyle errorStyle() const;
86 QString formula1() const;
87 QString formula2() const;
88 bool allowBlank() const;
89 QString errorMessage() const;
90 QString errorMessageTitle() const;
91 QString promptMessage() const;
92 QString promptMessageTitle() const;
93 bool isPromptMessageVisible() const;
94 bool isErrorMessageVisible() const;
95 QList<CellRange> ranges() const;
96
97 void setValidationType(ValidationType type);
98 void setValidationOperator(ValidationOperator op);
99 void setErrorStyle(ErrorStyle es);
100 void setFormula1(const QString &formula);
101 void setFormula2(const QString &formula);
102 void setErrorMessage(const QString &error, const QString &title=QString());
103 void setPromptMessage(const QString &prompt, const QString &title=QString());
104 void setAllowBlank(bool enable);
105 void setPromptMessageVisible(bool visible);
106 void setErrorMessageVisible(bool visible);
107
108 void addCell(const CellReference &cell);
109 void addCell(int row, int col);
110 void addRange(int firstRow, int firstCol, int lastRow, int lastCol);
111 void addRange(const CellRange &range);
112
113 DataValidation &operator=(const DataValidation &other);
114
115 bool saveToXml(QXmlStreamWriter &writer) const;
116 static DataValidation loadFromXml(QXmlStreamReader &reader);
117 private:
118 QSharedDataPointer<DataValidationPrivate> d;
119 };
120
121 QT_END_NAMESPACE_XLSX
122
123 #endif // QXLSX_XLSXDATAVALIDATION_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)