Loading...
Searching...
No Matches
odscolorscale.h
Go to the documentation of this file.
/**
* \file odsstream/writer/options/odscolorscale.h
* \date 10/03/2018
* \author Olivier Langella
* \brief structure to apply a color scale in ODS sheets
*/
/*******************************************************************************
* Copyright (c) 2013 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of the libodsstream library.
*
* libodsstream is a library to read and write ODS documents as streams
* Copyright (C) 2013 Olivier Langella <Olivier.Langella@u-psud.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
*by the Free Software Foundation, either version 3 of the License, or (at your
*option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
*implementation
******************************************************************************/
#ifndef ODSCOLORSCALE_H
#define ODSCOLORSCALE_H
#include <QString>
#include <QColor>
#include <QXmlStreamWriter>
class ContentXml;
class OdsColorScale
{
friend ContentXml;
public:
OdsColorScale(const QString &cell_start_position,
const QString &cell_stop_position);
OdsColorScale(const OdsColorScale &other);
virtual ~OdsColorScale();
/** @brief set cell range to apply color scale
* @param cell_start_position cell position to start (Feuille1.C2)
* @param cell_stop_position cell position to stop (Feuille1.D4)
*/
void setCellRange(const QString &cell_start_position,
const QString &cell_stop_position);
/** @brief set minimum color of the color scale
* @param minimum_color minimum color
*/
void setMinimumColor(const QColor &minimum_color);
/** @brief set maximum color of the color scale
* @param maximum_color maximum color
*/
void setMaximumColor(const QColor &maximum_color);
protected:
bool isInSheet(const QString &sheet_name);
void writeConditionalFormat(QXmlStreamWriter *p_writer);
private:
std::tuple<QString, QString> parseCellRange(const QString &cell_position);
private:
QString _sheet_name;
QString _cell_start_position;
QString _cell_stop_position;
// by default : temperature color scale
QColor _minimum_color = QColor("#0000ff");
QColor _maximum_color = QColor("#ff0000");
QColor _percentile_color = QColor("#ffffff");
};
#endif // ODSCOLORSCALE_H
ContentXml
Definition contentxml.h:35
OdsColorScale::_maximum_color
QColor _maximum_color
Definition odscolorscale.h:83
OdsColorScale::isInSheet
bool isInSheet(const QString &sheet_name)
Definition odscolorscale.cpp:76
OdsColorScale::parseCellRange
std::tuple< QString, QString > parseCellRange(const QString &cell_position)
Definition odscolorscale.cpp:154
OdsColorScale::OdsColorScale
OdsColorScale(const QString &cell_start_position, const QString &cell_stop_position)
Definition odscolorscale.cpp:41
OdsColorScale::_sheet_name
QString _sheet_name
Definition odscolorscale.h:78
OdsColorScale::setCellRange
void setCellRange(const QString &cell_start_position, const QString &cell_stop_position)
set cell range to apply color scale
Definition odscolorscale.cpp:183
OdsColorScale::_cell_stop_position
QString _cell_stop_position
Definition odscolorscale.h:80
OdsColorScale::ContentXml
friend ContentXml
Definition odscolorscale.h:45
OdsColorScale::setMaximumColor
void setMaximumColor(const QColor &maximum_color)
set maximum color of the color scale
Definition odscolorscale.cpp:213
OdsColorScale::_cell_start_position
QString _cell_start_position
Definition odscolorscale.h:79
OdsColorScale::writeConditionalFormat
void writeConditionalFormat(QXmlStreamWriter *p_writer)
Definition odscolorscale.cpp:88
OdsColorScale::_percentile_color
QColor _percentile_color
Definition odscolorscale.h:84
OdsColorScale::~OdsColorScale
virtual ~OdsColorScale()
Definition odscolorscale.cpp:62
OdsColorScale::_minimum_color
QColor _minimum_color
Definition odscolorscale.h:82
OdsColorScale::setMinimumColor
void setMinimumColor(const QColor &minimum_color)
set minimum color of the color scale
Definition odscolorscale.cpp:208