libodsstream
Library for mass spectrometry
Loading...
Searching...
No Matches
odscolorscale.h
Go to the documentation of this file.
1/**
2 * \file odsstream/writer/options/odscolorscale.h
3 * \date 10/03/2018
4 * \author Olivier Langella
5 * \brief structure to apply a color scale in ODS sheets
6 */
7
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
41class 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
53 /** @brief set cell range to apply color scale
54 * @param cell_start_position cell position to start (Feuille1.C2)
55 * @param cell_stop_position cell position to stop (Feuille1.D4)
56 */
57 void setCellRange(const QString &cell_start_position,
58 const QString &cell_stop_position);
59
60 /** @brief set minimum color of the color scale
61 * @param minimum_color minimum color
62 */
63 void setMinimumColor(const QColor &minimum_color);
64
65 /** @brief set maximum color of the color scale
66 * @param maximum_color maximum color
67 */
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;
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
QColor _maximum_color
bool isInSheet(const QString &sheet_name)
std::tuple< QString, QString > parseCellRange(const QString &cell_position)
QString _sheet_name
void setCellRange(const QString &cell_start_position, const QString &cell_stop_position)
set cell range to apply color scale
QString _cell_stop_position
void setMaximumColor(const QColor &maximum_color)
set maximum color of the color scale
QString _cell_start_position
void writeConditionalFormat(QXmlStreamWriter *p_writer)
QColor _percentile_color
virtual ~OdsColorScale()
QColor _minimum_color
void setMinimumColor(const QColor &minimum_color)
set minimum color of the color scale