odsstream
odscolorscale.h
Go to the documentation of this file.
1 
8 /*******************************************************************************
9  * Copyright (c) 2013 Olivier Langella <Olivier.Langella@u-psud.fr>.
10  *
11  * This file is part of the libodsstream library.
12  *
13  * libodsstream is a library to read and write ODS documents as streams
14  * Copyright (C) 2013 Olivier Langella <Olivier.Langella@u-psud.fr>
15  *
16  * This program is free software: you can redistribute it and/or modify
17  * it under the terms of the GNU Lesser General Public License as published
18  *by the Free Software Foundation, either version 3 of the License, or (at your
19  *option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public License
27  * along with this program. If not, see <http://www.gnu.org/licenses/>.
28  *
29  * Contributors:
30  * Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
31  *implementation
32  ******************************************************************************/
33 
34 #ifndef ODSCOLORSCALE_H
35 #define ODSCOLORSCALE_H
36 
37 #include <QString>
38 #include <QColor>
39 #include <QXmlStreamWriter>
40 
41 class ContentXml;
42 
44 {
45  friend ContentXml;
46 
47  public:
48  OdsColorScale(const QString &cell_start_position,
49  const QString &cell_stop_position);
50  OdsColorScale(const OdsColorScale &other);
51  virtual ~OdsColorScale();
52 
57  void setCellRange(const QString &cell_start_position,
58  const QString &cell_stop_position);
59 
63  void setMinimumColor(const QColor &minimum_color);
64 
68  void setMaximumColor(const QColor &maximum_color);
69 
70  protected:
71  bool isInSheet(const QString &sheet_name);
72  void writeConditionalFormat(QXmlStreamWriter *p_writer);
73 
74  private:
75  std::tuple<QString, QString> parseCellRange(const QString &cell_position);
76 
77  private:
78  QString _sheet_name;
79  QString _cell_start_position;
80  QString _cell_stop_position;
81  // by default : temperature color scale
82  QColor _minimum_color = QColor("#0000ff");
83  QColor _maximum_color = QColor("#ff0000");
84  QColor _percentile_color = QColor("#ffffff");
85 };
86 
87 #endif // ODSCOLORSCALE_H
Definition: contentxml.h:35
Definition: odscolorscale.h:44
void setCellRange(const QString &cell_start_position, const QString &cell_stop_position)
set cell range to apply color scale
Definition: odscolorscale.cpp:183
void setMaximumColor(const QColor &maximum_color)
set maximum color of the color scale
Definition: odscolorscale.cpp:213
void setMinimumColor(const QColor &minimum_color)
set minimum color of the color scale
Definition: odscolorscale.cpp:208