comparison src/xlsx/xlsxconditionalformatting.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_XLSXCONDITIONALFORMATTING_H
26 #define QXLSX_XLSXCONDITIONALFORMATTING_H
27
28 #include "xlsxglobal.h"
29 #include "xlsxcellrange.h"
30 #include "xlsxcellreference.h"
31 #include <QSharedDataPointer>
32 #include <QString>
33 #include <QList>
34
35 class QXmlStreamReader;
36 class QXmlStreamWriter;
37 class QColor;
38 class ConditionalFormattingTest;
39
40 QT_BEGIN_NAMESPACE_XLSX
41
42 class Format;
43 class Worksheet;
44 class Styles;
45
46 class ConditionalFormattingPrivate;
47 class Q_XLSX_EXPORT ConditionalFormatting
48 {
49 public:
50 enum HighlightRuleType {
51 Highlight_LessThan,
52 Highlight_LessThanOrEqual,
53 Highlight_Equal,
54 Highlight_NotEqual,
55 Highlight_GreaterThanOrEqual,
56 Highlight_GreaterThan,
57 Highlight_Between,
58 Highlight_NotBetween,
59
60 Highlight_ContainsText,
61 Highlight_NotContainsText,
62 Highlight_BeginsWith,
63 Highlight_EndsWith,
64
65 Highlight_TimePeriod,
66
67 Highlight_Duplicate,
68 Highlight_Unique,
69 Highlight_Blanks,
70 Highlight_NoBlanks,
71 Highlight_Errors,
72 Highlight_NoErrors,
73
74 Highlight_Top,
75 Highlight_TopPercent,
76 Highlight_Bottom,
77 Highlight_BottomPercent,
78
79 Highlight_AboveAverage,
80 Highlight_AboveOrEqualAverage,
81 Highlight_AboveStdDev1,
82 Highlight_AboveStdDev2,
83 Highlight_AboveStdDev3,
84 Highlight_BelowAverage,
85 Highlight_BelowOrEqualAverage,
86 Highlight_BelowStdDev1,
87 Highlight_BelowStdDev2,
88 Highlight_BelowStdDev3,
89
90 Highlight_Expression
91 };
92
93 enum ValueObjectType
94 {
95 VOT_Formula,
96 VOT_Max,
97 VOT_Min,
98 VOT_Num,
99 VOT_Percent,
100 VOT_Percentile
101 };
102
103 ConditionalFormatting();
104 ConditionalFormatting(const ConditionalFormatting &other);
105 ~ConditionalFormatting();
106
107 bool addHighlightCellsRule(HighlightRuleType type, const Format &format, bool stopIfTrue=false);
108 bool addHighlightCellsRule(HighlightRuleType type, const QString &formula1, const Format &format, bool stopIfTrue=false);
109 bool addHighlightCellsRule(HighlightRuleType type, const QString &formula1, const QString &formula2, const Format &format, bool stopIfTrue=false);
110 bool addDataBarRule(const QColor &color, bool showData=true, bool stopIfTrue=false);
111 bool addDataBarRule(const QColor &color, ValueObjectType type1, const QString &val1, ValueObjectType type2, const QString &val2, bool showData=true, bool stopIfTrue=false);
112 bool add2ColorScaleRule(const QColor &minColor, const QColor &maxColor, bool stopIfTrue=false);
113 bool add3ColorScaleRule(const QColor &minColor, const QColor &midColor, const QColor &maxColor, bool stopIfTrue=false);
114
115 QList<CellRange> ranges() const;
116
117 void addCell(const CellReference &cell);
118 void addCell(int row, int col);
119 void addRange(int firstRow, int firstCol, int lastRow, int lastCol);
120 void addRange(const CellRange &range);
121
122 //needed by QSharedDataPointer!!
123 ConditionalFormatting &operator=(const ConditionalFormatting &other);
124
125 private:
126 friend class Worksheet;
127 friend class ::ConditionalFormattingTest;
128 bool saveToXml(QXmlStreamWriter &writer) const;
129 bool loadFromXml(QXmlStreamReader &reader, Styles *styles=0);
130 QSharedDataPointer<ConditionalFormattingPrivate> d;
131 };
132
133 QT_END_NAMESPACE_XLSX
134
135 #endif // QXLSX_XLSXCONDITIONALFORMATTING_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)