Loading...
Searching...
No Matches
calcwriterinterface.h
Go to the documentation of this file.
/**
* \file odsstream/odsdochandlerinterface.h
* \date 10/03/2015
* \author Olivier Langella
* \brief interface to use as a wildcard to writer in either TSV, ODS
* TSVdirectory writers any kind of writer can be created in your program :
* OdsDocWriter, TsvDirectoryWriter, TsvOutputStream
* All of them implements this interface :
* it allows to use the same code to write in these different formats.
*/
/*******************************************************************************
* 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
******************************************************************************/
#pragma once
#include <QDate>
#include <QUrl>
#include "writer/options/odstablecellstyle.h"
#include "writer/options/odstablecellstyleref.h"
#include "writer/options/odscolorscale.h"
#include "writer/options/odstablesettings.h"
class CalcWriterInterface
{
public:
virtual ~CalcWriterInterface();
virtual void close() = 0;
/**
* \brief open a new sheet
*
* \param sheetName the sheet name
*/
virtual void writeSheet(const QString &sheetName) = 0;
/**
* \brief open a new line
*/
virtual void writeLine() = 0;
/**
* \brief write a text cell
* \param cell_text cell text
*/
virtual void writeCell(const char *cell_text) = 0;
/**
* \brief write a text cell
* \param cell_text cell text
*/
virtual void writeCell(const QString &cell_text) = 0;
/**
* \brief write an empty cell
*/
virtual void writeEmptyCell() = 0;
/**
* \brief write an unsigned integer in a cell
* \param number integer to write
*/
virtual void writeCell(std::size_t number) = 0;
/**
* \brief write an integer in a cell
* \param number integer to write
*/
virtual void writeCell(int number) = 0;
/**
* \brief write a float in a cell
* \param number float to write
*/
virtual void writeCell(float number) = 0;
/**
* \brief write a double in a cell
* \param number double to write
*/
virtual void writeCell(double number) = 0;
/**
* \brief write a double as a percentage
* \param number double to write must be a ratio (0.5 == 50%)
*/
virtual void writeCellPercentage(double value) = 0;
/**
* \brief write a boolean in a cell
* \param true_or_false boolean to write
*/
virtual void writeCell(bool true_or_false) = 0;
/**
* \brief write a date in a cell
* \param date date to write
*/
virtual void writeCell(const QDate &date) = 0;
/**
* \brief write a timestamp in a cell
* \param datetime timestamp to write
*/
virtual void writeCell(const QDateTime &datetime) = 0;
/**
* \brief write a text cell with an URL link
* \param url_link URL link
* \param text text to write
*/
virtual void writeCell(const QUrl &url_link, const QString &text) = 0;
/**
* build table cell style reference with a style definition
*
* \param style OdsTableCellStyle
* \return OdsTableCellStyleRef pointer on a style reference
*/
virtual OdsTableCellStyleRef
getTableCellStyleRef([[maybe_unused]] const OdsTableCellStyle &style);
/**
* set the cell table style. This is applied to in the stream to following
* cells. This ends by using an other style reference or by using
* setTableCellStyleRef function
*
* \param style_ref OdsTableCellStyleRef
*/
virtual void
setTableCellStyleRef([[maybe_unused]] OdsTableCellStyleRef style_ref);
/**
* clear cell style definition in the stream. the default style will be
* applied.
*
*/
void clearTableCellStyleRef();
/**
* \brief set annotation to write in the next cell
* \param annotation any comment on this cell
*/
virtual void setCellAnnotation(const QString &annotation) = 0;
/** \brief apply solor scale conditional format on a cell range
*
*/
virtual void
addColorScale([[maybe_unused]] const OdsColorScale &ods_color_scale);
/** @brief get the last written cell coordinate in ODS coordinate format
* get the coordinate of the last written cell or an empty string if the
* writer is not an OdsDocWriter
*
* @return QString with ODS cell coordinate of the form : "classeur.A5"
*/
virtual QString getOdsCellCoordinate();
/** @brief set ODS table settings of the current sheet (table)
*/
virtual void
setCurrentOdsTableSettings([[maybe_unused]] const OdsTableSettings &settings);
/**
* \brief write a cell for a given QVariant
* \param QVariant variable to write
*/
virtual void writeCellVariant(const QVariant &var);
};
CalcWriterInterface
Definition calcwriterinterface.h:49
CalcWriterInterface::writeEmptyCell
virtual void writeEmptyCell()=0
write an empty cell
CalcWriterInterface::writeCell
virtual void writeCell(const char *cell_text)=0
write a text cell
CalcWriterInterface::close
virtual void close()=0
CalcWriterInterface::writeCellVariant
virtual void writeCellVariant(const QVariant &var)
write a cell for a given QVariant
Definition calcwriterinterface.cpp:117
CalcWriterInterface::clearTableCellStyleRef
void clearTableCellStyleRef()
Definition calcwriterinterface.cpp:78
CalcWriterInterface::setCellAnnotation
virtual void setCellAnnotation(const QString &annotation)=0
set annotation to write in the next cell
CalcWriterInterface::writeCell
virtual void writeCell(bool true_or_false)=0
write a boolean in a cell
CalcWriterInterface::writeCell
virtual void writeCell(const QString &cell_text)=0
write a text cell
CalcWriterInterface::setTableCellStyleRef
virtual void setTableCellStyleRef(OdsTableCellStyleRef style_ref)
Definition calcwriterinterface.cpp:67
CalcWriterInterface::addColorScale
virtual void addColorScale(const OdsColorScale &ods_color_scale)
apply solor scale conditional format on a cell range
Definition calcwriterinterface.cpp:87
CalcWriterInterface::writeCell
virtual void writeCell(std::size_t number)=0
write an unsigned integer in a cell
CalcWriterInterface::getOdsCellCoordinate
virtual QString getOdsCellCoordinate()
get the last written cell coordinate in ODS coordinate format get the coordinate of the last written ...
Definition calcwriterinterface.cpp:99
CalcWriterInterface::writeCell
virtual void writeCell(float number)=0
write a float in a cell
CalcWriterInterface::writeCellPercentage
virtual void writeCellPercentage(double value)=0
write a double as a percentage
CalcWriterInterface::writeCell
virtual void writeCell(double number)=0
write a double in a cell
CalcWriterInterface::getTableCellStyleRef
virtual OdsTableCellStyleRef getTableCellStyleRef(const OdsTableCellStyle &style)
Definition calcwriterinterface.cpp:53
CalcWriterInterface::writeCell
virtual void writeCell(const QDate &date)=0
write a date in a cell
CalcWriterInterface::~CalcWriterInterface
virtual ~CalcWriterInterface()
Definition calcwriterinterface.cpp:41
CalcWriterInterface::writeCell
virtual void writeCell(const QDateTime &datetime)=0
write a timestamp in a cell
CalcWriterInterface::writeCell
virtual void writeCell(const QUrl &url_link, const QString &text)=0
write a text cell with an URL link
CalcWriterInterface::writeSheet
virtual void writeSheet(const QString &sheetName)=0
open a new sheet
CalcWriterInterface::setCurrentOdsTableSettings
virtual void setCurrentOdsTableSettings(const OdsTableSettings &settings)
set ODS table settings of the current sheet (table)
Definition calcwriterinterface.cpp:107
CalcWriterInterface::writeCell
virtual void writeCell(int number)=0
write an integer in a cell
CalcWriterInterface::writeLine
virtual void writeLine()=0
open a new line
OdsColorScale
Definition odscolorscale.h:44
OdsTableCellStyle
Definition odstablecellstyle.h:34
OdsTableSettings
Definition odstablesettings.h:43
odscolorscale.h
structure to apply a color scale in ODS sheets
odstablecellstyle.h
handler for ODS cell style
odstablecellstyleref.h
internal reference on handler for ODS cell style
OdsTableCellStyleRef
OdsTableCellStyleRefInternal * OdsTableCellStyleRef
Definition odstablecellstyleref.h:35
odstablesettings.h
store table settings